/* Elsewhen ☾ — тема сайта. Все цвета — здесь, переменными.
   Тема выбирается по местному времени посетителя (скрипт в <head> ставит data-theme):
   06:00–17:59 — day, 18:00–05:59 — night. В кабинете есть ещё переключатель «солнце/луна».
   Шаги Tab Audit идут «через день»: data-scene на .scene-sky (morning … night, evenings). */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-soft.woff2") format("woff2-variations"), url("/fonts/fraunces-soft.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito.woff2") format("woff2-variations"), url("/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  /* бренд — одинаков в обеих темах */
  --coral: #F2765D;
  --coral-hi: #F7907A;
  --coral-lo: #E0603A;
  --on-coral: #1A1428;
  --glow: rgba(242, 118, 93, .45);
  --cream: #F6F1E9;
  --navy: #121A33;
  --navy-2: #1E2A4F;
  --deep: #1B2340;

  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --soft: "SOFT" 100;

  --radius: 22px;
  --radius-sm: 14px;
  --gutter: 20px;
  --maxw: 560px;
  --t-scene: 600ms;
  --t-quick: 180ms;
}

/* ── Ночь (18:00–05:59) ── */
:root,
[data-theme="night"] {
  color-scheme: dark;
  --bg-1: #121A33;
  --bg-2: #1E2A4F;
  --sky: #121A33;
  --page-bg: linear-gradient(180deg, #121A33 0%, #1E2A4F 100%);
  --ink: #F6F1E9;
  --ink-soft: #DDE3EE;
  --muted: #B9C2D6;
  --accent-ink: #F4846D;
  --quote: #FFD8CC;
  --card: rgba(255, 255, 255, .07);
  --card-solid: #26315A;
  --card-line: rgba(255, 255, 255, .12);
  --field: rgba(255, 255, 255, .06);
  --field-line: rgba(255, 255, 255, .28);
  --pill-line: #5A6A9C;
  --pill-ink: #E3E8F3;
  --pill-sel-bg: #F6F1E9;
  --pill-sel-ink: #121A33;
  --pill-sel-line: #F6F1E9;
  --moon-lit: #F6F1E9;
  --moon-dark: #2B3866;
  --moon-line: #4A5A8C;
  --moon-glow: rgba(246, 241, 233, .35);
  --tab-fill: rgba(242, 118, 93, .22);
  --tab-line: rgba(242, 118, 93, .62);
  --tab-glow: rgba(242, 118, 93, .38);
  --star: rgba(255, 255, 255, .75);
  --stars-opacity: 1;
  --banner-bg: #F6F1E9;
  --banner-ink: #121A33;
  --shadow: 0 14px 36px rgba(3, 6, 20, .45);
  --focus: #FFD8CC;
}

/* ── День (06:00–17:59) ── */
[data-theme="day"] {
  color-scheme: light;
  --bg-1: #F6F1E9;
  --bg-2: #FFF8EE;
  --sky: #CFE3F2;
  --page-bg: linear-gradient(180deg, #CFE3F2 0px, #E7EDEE 220px, #F6F1E9 460px, #FFF8EE 100%);
  --ink: #1B2340;
  --ink-soft: #2C3556;
  --muted: #4A5571;
  --accent-ink: #A63A23;
  --quote: #7A3424;
  --card: rgba(255, 255, 255, .74);
  --card-solid: #FFFFFF;
  --card-line: rgba(27, 35, 64, .10);
  --field: #FFFFFF;
  --field-line: rgba(27, 35, 64, .30);
  --pill-line: rgba(27, 35, 64, .32);
  --pill-ink: #1B2340;
  --pill-sel-bg: #1B2340;
  --pill-sel-ink: #F6F1E9;
  --pill-sel-line: #1B2340;
  --moon-lit: #FFFCF4;
  --moon-dark: #7E8CB0;
  --moon-line: rgba(27, 35, 64, .45);
  --moon-glow: rgba(242, 190, 120, .45);
  --tab-fill: rgba(242, 118, 93, .16);
  --tab-line: rgba(224, 96, 58, .55);
  --tab-glow: rgba(242, 118, 93, .30);
  --star: rgba(255, 255, 255, 0);
  --stars-opacity: 0;
  --banner-bg: #1B2340;
  --banner-ink: #F6F1E9;
  --shadow: 0 14px 34px rgba(27, 35, 64, .14);
  --focus: #A63A23;
}

/* ── Сцены теста: день от рассвета до ночи ── */
.scene { --s-ink: var(--deep); --s-muted: #3F4A68; --s-accent: #8C2E1A; --s-card: rgba(255,255,255,.78); --s-card-line: rgba(27,35,64,.10);
  --s-pill-line: rgba(27,35,64,.30); --s-pill-ink: #1B2340; --s-sel-bg: #1B2340; --s-sel-ink: #F6F1E9;
  --s-moon-lit: #FFFDF8; --s-moon-dark: rgba(27,35,64,.16); --s-moon-line: rgba(27,35,64,.40); }
.scene[data-scene="evening"] { --s-card: rgba(255,250,246,.86); --s-accent: #5A1E2A; --s-muted: #2E3550; }
.scene[data-scene="night"],
.scene[data-scene="evenings"] { --s-ink: #F6F1E9; --s-muted: #B9C2D6; --s-accent: #F4846D; --s-card: rgba(255,255,255,.07); --s-card-line: rgba(255,255,255,.13);
  --s-pill-line: #5A6A9C; --s-pill-ink: #E3E8F3; --s-sel-bg: #F6F1E9; --s-sel-ink: #121A33;
  --s-moon-lit: #F6F1E9; --s-moon-dark: #2B3866; --s-moon-line: #4A5A8C; }

.sky-layer { position: fixed; inset: 0; z-index: -1; opacity: 0; transition: opacity var(--t-scene) ease; pointer-events: none; }
.sky-layer.on { opacity: 1; }
.sky-layer[data-sky="morning"]  { background: linear-gradient(180deg, #F9C9AE 0%, #FBDCC5 30%, #E6EEF4 70%, #D6E7F3 100%); }
.sky-layer[data-sky="pauses"]   { background: linear-gradient(180deg, #A9D3F0 0%, #CBE4F5 40%, #EEF5F8 100%); }
.sky-layer[data-sky="people"]   { background: linear-gradient(180deg, #F6D49A 0%, #F9E3BD 40%, #FCF1DE 100%); }
.sky-layer[data-sky="evening"]  { background: linear-gradient(180deg, #F2967A 0%, #E57B6E 28%, #B0607F 62%, #5E4A8E 100%); }
.sky-layer[data-sky="night"],
.sky-layer[data-sky="evenings"] { background: linear-gradient(180deg, #121A33 0%, #1E2A4F 100%); }
.sky-layer[data-sky="night"]::after,
.sky-layer[data-sky="evenings"]::after { content: ""; position: absolute; inset: 0; background-image: var(--stars-img); opacity: .9; }

/* редкие звёзды */
:root {
  --stars-img:
    radial-gradient(1.3px 1.3px at 9% 7%, rgba(255,255,255,.85) 50%, transparent 52%),
    radial-gradient(1px 1px at 23% 15%, rgba(255,255,255,.7) 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 41% 5%, rgba(255,255,255,.75) 50%, transparent 52%),
    radial-gradient(1px 1px at 63% 11%, rgba(255,255,255,.6) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 78% 4%, rgba(255,255,255,.8) 50%, transparent 52%),
    radial-gradient(1px 1px at 91% 17%, rgba(255,255,255,.55) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 15% 31%, rgba(255,255,255,.5) 50%, transparent 52%),
    radial-gradient(1px 1px at 86% 36%, rgba(255,255,255,.5) 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 54% 26%, rgba(255,255,255,.45) 50%, transparent 52%),
    radial-gradient(1px 1px at 33% 47%, rgba(255,255,255,.35) 50%, transparent 52%),
    radial-gradient(1px 1px at 72% 58%, rgba(255,255,255,.3) 50%, transparent 52%);
}

/* ── База ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--page-bg);
  background-color: var(--bg-1);
  color: var(--ink);
  font: 400 17px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[data-theme="night"] body::before,
:root:not([data-theme]) body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: var(--stars-img); opacity: var(--stars-opacity);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
[tabindex="-1"]:focus { outline: 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; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--cream); color: var(--navy); padding: 10px 16px; border-radius: 999px; font-weight: 800; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

h1, h2, h3, .head { font-family: var(--font-head); font-variation-settings: var(--soft); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 40px; line-height: 1.04; }
h2 { font-size: 27px; line-height: 1.12; }
h3 { font-size: 21px; line-height: 1.2; }
p { margin: 0 0 12px; }
.lead { font-size: 18px; line-height: 1.5; color: var(--ink-soft); }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.45; }
.quote { font-family: var(--font-head); font-variation-settings: var(--soft); font-weight: 400; font-size: 20px; line-height: 1.38; color: var(--quote); }
.label { font: 800 12.5px/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 10px; }

/* бренд «elsewhen ☾» — луна рисуется SVG, чтобы везде одинаково */
.brand { display: inline-flex; align-items: center; gap: 6px; font: 600 15px/1 var(--font-head); font-variation-settings: var(--soft); letter-spacing: .04em; color: var(--ink); text-decoration: none; opacity: .92; }
.brand svg { width: 13px; height: 13px; }

/* ── Кнопки-«таблетки» ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 28px; width: 100%;
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none; text-align: center;
  background: linear-gradient(180deg, var(--coral-hi) 0%, var(--coral) 55%, var(--coral-lo) 100%);
  color: var(--on-coral); font: 800 18px/1.1 var(--font-body); letter-spacing: .01em;
  box-shadow: 0 8px 24px var(--glow), inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(150, 50, 25, .18);
  transition: transform var(--t-quick) ease, box-shadow var(--t-quick) ease, filter var(--t-quick) ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.04); box-shadow: 0 10px 30px var(--glow), inset 0 2px 0 rgba(255,255,255,.4), inset 0 -3px 0 rgba(150,50,25,.18); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn[aria-disabled="true"] { filter: grayscale(.55) brightness(.9); opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-soft {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: var(--card); border: 1.5px solid var(--card-line); color: var(--ink);
  font: 700 16px/1.1 var(--font-body);
  transition: background var(--t-quick) ease, transform var(--t-quick) ease;
}
.btn-soft:active { transform: translateY(1px); }
.btn-link { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 14px; background: none; border: 0; cursor: pointer;
  color: var(--ink-soft); font: 700 16px/1.2 var(--font-body); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ── Карточки ── */
.card { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 20px; margin: 0 0 14px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.card > :last-child { margin-bottom: 0; }

/* ── Луны ── */
.moon { display: block; overflow: visible; }
.moon .m-dark { fill: var(--moon-dark); stroke: var(--moon-line); stroke-width: 1.2; }
.moon .m-lit { fill: var(--moon-lit); }
.moon.glow .m-lit { filter: drop-shadow(0 0 6px var(--moon-glow)); }

/* ── Плавающие «вкладки» ── */
.tabs-float { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tabs-float i { position: absolute; width: 28px; height: 17px; border-radius: 6px; background: var(--tab-fill); border: 1px solid var(--tab-line);
  box-shadow: 0 0 12px var(--tab-glow); animation: drift 7s ease-in-out infinite alternate; }
.tabs-float i:nth-child(2n) { animation-duration: 9s; width: 22px; height: 14px; }
.tabs-float i:nth-child(3n) { animation-duration: 11s; animation-delay: -3s; opacity: .7; }
@keyframes drift { from { transform: translate3d(0, 0, 0) rotate(var(--r, -6deg)); } to { transform: translate3d(4px, -9px, 0) rotate(calc(var(--r, -6deg) * -1)); } }

/* ── Плашка «открой в браузере» (только внутри Instagram) ── */
.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--banner-bg); color: var(--banner-ink); border-radius: 18px; padding: 14px 14px 14px 18px;
  font: 700 15px/1.4 var(--font-body); box-shadow: var(--shadow); margin: 12px 0; }
.banner p { margin: 0; flex: 1; }
.banner button { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
[hidden] { display: none !important; }

/* ── Поля формы ── */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font: 800 14px/1.3 var(--font-body); margin: 0 0 6px; }
.input, .select {
  width: 100%; min-height: 54px; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--field-line); background: var(--field); color: var(--ink);
  font: 600 17px/1.3 var(--font-body); -webkit-appearance: none; appearance: none;
}
.select { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
[data-theme="night"] .select option { color: #121A33; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; font-size: 15.5px; line-height: 1.45; }
.check input { flex: none; width: 26px; height: 26px; margin: 0; border-radius: 8px; border: 2px solid var(--field-line); background: var(--field);
  -webkit-appearance: none; appearance: none; display: grid; place-content: center; cursor: pointer; transition: background var(--t-quick) ease; }
.check input::after { content: ""; width: 12px; height: 7px; border: 3px solid var(--on-coral); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--t-quick) ease; }
.check input:checked { background: var(--coral); border-color: var(--coral); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.error { color: var(--accent-ink); font-weight: 800; font-size: 15px; margin: 8px 0 0; }

/* ── Подвал ── */
.site-footer { padding: 26px var(--gutter) 34px; text-align: center; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer .sep { opacity: .6; padding: 0 4px; }

/* ── Меньше движения ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .tabs-float i { animation: none !important; }
}

@media (min-width: 900px) {
  h1 { font-size: 46px; }
  body { font-size: 18px; }
}
