/**
 * Base Styles — Reset, Typography, Fonts
 * 
 * @package Biolocus
 * @version 1.0.0
 */

/* ===== FONT FACE — ONEST (Variable Font) ===== */
@font-face {
    font-family: 'Onest';
    src: url('../fonts/onest/Onest-VariableFont_wght.woff2') format('woff2-variations'),
         url('../fonts/onest/Onest-VariableFont_wght.woff2') format('woff2');
    font-weight: 300 800; /* Диапазон весов */
    font-style: normal;
    font-display: swap;
}

/* ===== CSS RESET ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-regular);
    line-height: var(--line-height-normal);
    color: var(--text-dark);
    background-color: var(--body-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Body lock для модалок */
body.modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0);
}

/* ===== ТИПОГРАФИКА ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-extrabold);
    line-height: var(--line-height-tight);
    color: var(--text-dark);
}

h1 {
    font-size: var(--font-size-5xl);
}

h2 {
    font-size: var(--font-size-3xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

h5 {
    font-size: var(--font-size-base);
}

h6 {
    font-size: var(--font-size-sm);
}

p {
    margin-bottom: 1em;
}

p:last-child {
    margin-bottom: 0;
}

/* ===== ССЫЛКИ ===== */
a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ===== ИЗОБРАЖЕНИЯ ===== */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

/* ===== ФОРМЫ ===== */
button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    margin: 0;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
    -webkit-appearance: button;
    cursor: pointer;
}

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
}

input,
textarea,
select {
    width: 100%;
}

textarea {
    resize: vertical;
}

/* Убираем стандартные стрелки у number input */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* ===== СПИСКИ ===== */
ul,
ol {
    list-style: none;
}

/* ===== ТАБЛИЦЫ ===== */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* ===== ПРОЧЕЕ ===== */
hr {
    border: 0;
    border-top: 1px solid var(--card-border);
    margin: var(--spacing-lg) 0;
}

strong,
b {
    font-weight: var(--font-bold);
}

em {
    font-style: normal;
    color: var(--primary);
}

small {
    font-size: var(--font-size-xs);
}

/* ===== ВЫДЕЛЕНИЕ ТЕКСТА ===== */
::selection {
    background-color: var(--primary);
    color: var(--text-inverse);
}

::-moz-selection {
    background-color: var(--primary);
    color: var(--text-inverse);
}

/* ===== СКРОЛЛБАР ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--section-alt);
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) var(--section-alt);
}

/* ===== PLACEHOLDER ===== */
::placeholder {
    color: var(--text-light);
    opacity: 1;
}

/* ===== FOCUS VISIBLE ===== */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== SCREEN READER ONLY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ===== SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--text-inverse);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    z-index: var(--z-top);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--spacing-md);
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-sale { color: var(--sale); }
.text-muted { color: var(--text-light); }

.font-light { font-weight: var(--font-light); }
.font-regular { font-weight: var(--font-regular); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.overflow-hidden { overflow: hidden; }

/* ===== PRINT STYLES ===== */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}