/* ==========================================================================
   katicoach: основа. Шрифты, токены двух тем, базовые элементы.
   Правило формы: кнопки — пилюли, панели — 18px, карты — 6% ширины карты.
   ========================================================================== */

@font-face {
    font-family: "Cormorant Garamond";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/cormorant-garamond-cyrillic-wght-normal.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Cormorant Garamond";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/cormorant-garamond-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Cormorant Garamond";
    font-style: italic;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/cormorant-garamond-cyrillic-wght-italic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Cormorant Garamond";
    font-style: italic;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/cormorant-garamond-latin-wght-italic.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Onest";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/onest-cyrillic-wght-normal.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Onest";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/onest-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */

:root {
    --font-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
    --font-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-spring: cubic-bezier(.34, 1.36, .64, 1);
    --ease-inout: cubic-bezier(.65, 0, .35, 1);

    --radius-panel: 18px;
    --radius-input: 12px;
    --gutter: clamp(16px, 4vw, 48px);
    --maxw: 1240px;

    /* Рубашка карты одинакова в обеих темах: это предмет на столе. */
    --cardback-1: #2a2150;
    --cardback-2: #120e24;
    --cardback-line: #cdae6a;

    color-scheme: dark;
}

/* Тёмная тема «ночь» (по умолчанию) */
:root,
:root[data-theme="dark"] {
    --bg: #0e0d18;
    --bg-raised: #161429;
    --bg-sunken: #0a0913;
    --line: rgba(236, 231, 245, .12);
    --line-strong: rgba(236, 231, 245, .22);
    --text: #ece7f5;
    --text-2: #aba4c2;
    --text-3: #7d7696;
    --accent: #cdae6a;
    --accent-ink: #d9bd7e;
    --accent-soft: rgba(205, 174, 106, .14);
    --btn-bg: #cdae6a;
    --btn-text: #17122a;
    --btn-bg-hover: #dcc082;
    --logo-card: #1f1838;
    --fog-a: rgba(104, 82, 186, .34);
    --fog-b: rgba(48, 66, 150, .28);
    --fog-c: rgba(205, 174, 106, .07);
    --dust: 222, 200, 150;
    --shadow-card: 0 28px 50px -18px rgba(3, 2, 10, .75), 0 6px 14px -6px rgba(3, 2, 10, .6);
    --shadow-panel: 0 30px 80px -40px rgba(3, 2, 10, .9);
    --paper: #f3eee2;
    --paper-ink: #1c1730;
    color-scheme: dark;
}

/* Светлая тема «туман» */
:root[data-theme="light"] {
    --bg: #eceaf2;
    --bg-raised: #f7f6fb;
    --bg-sunken: #e2dfeb;
    --line: rgba(28, 23, 48, .12);
    --line-strong: rgba(28, 23, 48, .22);
    --text: #1c1730;
    --text-2: #544d6c;
    --text-3: #7a7392;
    --accent: #b8954a;
    --accent-ink: #77591b;
    --accent-soft: rgba(184, 149, 74, .16);
    --btn-bg: #241c40;
    --btn-text: #f4f1fa;
    --btn-bg-hover: #322858;
    --logo-card: #ffffff;
    --fog-a: rgba(255, 255, 255, .85);
    --fog-b: rgba(172, 156, 218, .38);
    --fog-c: rgba(205, 174, 106, .16);
    --dust: 84, 68, 140;
    --shadow-card: 0 26px 46px -20px rgba(44, 32, 92, .45), 0 6px 14px -8px rgba(44, 32, 92, .3);
    --shadow-panel: 0 30px 80px -44px rgba(44, 32, 92, .45);
    --paper: #fbf9f4;
    --paper-ink: #1c1730;
    color-scheme: light;
}

/* ---------- Сброс ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: clip;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100dvh;
    overflow-x: clip;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .5s var(--ease-out), color .5s var(--ease-out);
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; }

button { font: inherit; color: inherit; }

h1, h2, h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.06;
    letter-spacing: -.012em;
    text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.icon { width: 1.25em; height: 1.25em; flex: none; }

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* ---------- Атмосфера: медленный туман за всей страницей ---------- */

.atmo {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.atmo__fog {
    position: absolute;
    width: 75vmax;
    height: 75vmax;
    border-radius: 50%;
    opacity: .9;
    will-change: transform;
}

.atmo__fog--1 {
    top: -30vmax; left: -22vmax;
    background: radial-gradient(closest-side, var(--fog-a), transparent);
    animation: fog-drift-1 46s var(--ease-inout) infinite alternate;
}

.atmo__fog--2 {
    bottom: -38vmax; right: -26vmax;
    background: radial-gradient(closest-side, var(--fog-b), transparent);
    animation: fog-drift-2 58s var(--ease-inout) infinite alternate;
}

.atmo__fog--3 {
    top: 30%; left: 40%;
    width: 50vmax; height: 50vmax;
    background: radial-gradient(closest-side, var(--fog-c), transparent);
    animation: fog-drift-3 38s var(--ease-inout) infinite alternate;
}

@keyframes fog-drift-1 { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.12); } }
@keyframes fog-drift-2 { to { transform: translate3d(-16vmax, -8vmax, 0) scale(1.08); } }
@keyframes fog-drift-3 { to { transform: translate3d(-18vmax, 6vmax, 0) scale(.9); } }

body > *:not(.atmo) { position: relative; z-index: 1; }

/* Холст с пылинками (atmo.js) лежит под содержимым блока */
.dust {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* ---------- Кнопки ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6em;
    min-height: 52px;
    padding: 0 1.6em;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: .005em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .35s var(--ease-spring), background-color .3s var(--ease-out),
        border-color .3s var(--ease-out), color .3s var(--ease-out), box-shadow .4s var(--ease-out);
}

.btn:active { transform: scale(.97); }

.btn--primary {
    background: var(--btn-bg);
    color: var(--btn-text);
    box-shadow: 0 14px 30px -16px var(--accent);
}

.btn--primary:hover { background: var(--btn-bg-hover); transform: translateY(-2px); }
.btn--primary:active { transform: translateY(0) scale(.97); }

.btn--ghost {
    border-color: var(--line-strong);
    color: var(--text);
    background: transparent;
}

.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

.btn--sm { min-height: 42px; padding: 0 1.15em; font-size: .9375rem; }

.text-link {
    color: var(--text-2);
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: .25em;
    transition: color .25s, text-decoration-color .25s;
}

.text-link:hover { color: var(--accent-ink); text-decoration-color: var(--accent); }

/* ---------- Логотип ---------- */

.logo {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--text);
    text-decoration: none;
}

.logo__mark { width: 36px; height: 36px; overflow: visible; }

.logo__loop {
    stroke-dasharray: 60;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset .9s var(--ease-inout);
}

.logo:hover .logo__loop { animation: logo-redraw 1.1s var(--ease-inout); }

@keyframes logo-redraw {
    0% { stroke-dashoffset: 0; }
    45% { stroke-dashoffset: 60; }
    100% { stroke-dashoffset: 0; }
}

.logo__word { display: inline-flex; align-items: baseline; gap: .32em; line-height: 1; }

.logo__kati {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: -.01em;
}

.logo__coach {
    font-family: var(--font-body);
    font-size: .7rem;
    font-weight: 500;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--text-2);
}

/* ---------- Переключатель темы: карта-перевёртыш ---------- */

.theme-toggle {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    perspective: 240px;
    transition: border-color .3s var(--ease-out), transform .35s var(--ease-spring);
}

.theme-toggle:hover { border-color: var(--accent); transform: rotate(-6deg); }
.theme-toggle:active { transform: scale(.94); }

.theme-toggle__card {
    position: relative;
    width: 18px;
    height: 26px;
    transform-style: preserve-3d;
    transition: transform .7s var(--ease-spring);
}

:root[data-theme="dark"] .theme-toggle__card { transform: rotateY(180deg); }

.theme-toggle__face {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: 3px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.theme-toggle__face--light {
    background: var(--paper);
    border: 1px solid rgba(28, 23, 48, .25);
    color: #9a7a35;
}

.theme-toggle__face--dark {
    background: linear-gradient(160deg, var(--cardback-1), var(--cardback-2));
    border: 1px solid rgba(205, 174, 106, .55);
    color: var(--cardback-line);
    transform: rotateY(180deg);
}

.theme-toggle__icon { width: 13px; height: 13px; }

/* Плавная смена темы кругом от переключателя (View Transitions) */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

/* ---------- Появление при прокрутке ---------- */

.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
    transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out);
    transition-delay: calc(var(--d, 0) * 90ms);
}

.js [data-reveal].is-in {
    opacity: 1;
    transform: none;
}

/* ---------- Уменьшить движение ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }

    .js [data-reveal] { opacity: 1; transform: none; }
}
