/* «Сказка про меня» — shared styles: fonts, colours, type, buttons, forms, dialogs. */

@font-face { font-family: "Comfortaa"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/comfortaa-700.woff") format("woff"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/fonts/manrope-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: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/fonts/manrope-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: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/caveat-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: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/caveat-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 {
  color-scheme: light;

  --cream: #fff8ee;
  --paper: #fffdf8;
  --white: #ffffff;
  --ink: #3a2e2a;
  --ink-soft: #5e4e46;
  --line: #eadccb;
  --line-strong: #d9c5ad;

  --coral: #c8492f;
  --coral-hover: #ad3b23;
  --coral-soft: #fbe3da;
  --peach: #ffdcc6;
  --butter: #ffe8ad;
  --butter-ink: #7a5a00;
  --sage: #d3e7d6;
  --sage-ink: #35603f;
  --sky: #d8ebf7;
  --sky-ink: #285a7c;
  --lilac: #e8def6;
  --pink: #fad7d4;

  --ok-bg: #e2f1e4;
  --ok-ink: #2e5a37;
  --err-bg: #fde6e1;
  --err-ink: #8a2a17;

  --font-title: "Comfortaa", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --radius: 22px;
  --radius-s: 14px;
  --shadow: 0 12px 32px rgba(122, 78, 46, 0.12);
  --shadow-s: 0 4px 14px rgba(122, 78, 46, 0.10);
  --focus: 0 0 0 3px var(--white), 0 0 0 6px var(--sky-ink);
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 118.75%; /* 19px: comfortable for readers 45+ */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (min-width: 1100px) { html { font-size: 125%; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 700; line-height: 1.22; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.6vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--sky-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--coral-hover); }
strong { font-weight: 800; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 10px; }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.hand { font-family: var(--font-hand); font-weight: 700; font-size: 1.45em; line-height: 1.1; color: var(--coral); }
.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-header { position: relative; z-index: 5; padding: 18px 0; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-family: var(--font-title); font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.logo img { width: 48px; height: 48px; flex: none; }
.logo:hover { color: var(--ink); }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.header-nav a.link { padding: 10px 12px; color: var(--ink); font-weight: 700; text-decoration: none; border-radius: 12px; }
.header-nav a.link:hover { background: var(--white); }
@media (max-width: 720px) {
  .header-nav a.link { display: none; }
  .logo span { font-size: 1rem; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 3rem; padding: 0.55rem 1.5rem;
  border: 2px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 800; font-size: 1rem; line-height: 1.2; text-align: center; text-decoration: none;
  cursor: pointer; transition: background-color .15s, transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--coral); color: var(--white); box-shadow: 0 8px 20px rgba(200, 73, 47, .28); }
.btn-primary:hover { background: var(--coral-hover); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--sky-ink); padding-inline: 0.8rem; text-decoration: underline; text-underline-offset: 0.2em; font-weight: 700; }
.btn-ghost:hover { color: var(--coral-hover); }
.btn-danger { background: var(--white); color: var(--err-ink); border-color: #e7b3a7; }
.btn-danger:hover { background: var(--err-bg); color: var(--err-ink); }
.btn-big { min-height: 3.7rem; padding-inline: 2.1rem; font-size: 1.15rem; }
.btn-block { width: 100%; }
.btn .icon { width: 1.3em; height: 1.3em; flex: none; }

/* ---------- forms ---------- */
.field { margin-bottom: 1.15rem; }
.field > label, .field > .label { display: block; font-weight: 800; margin-bottom: 0.4rem; }
.field .opt { font-weight: 600; color: var(--ink-soft); }
.input, .textarea, .select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: 0.8rem 1rem; min-height: 3.1rem;
  background: var(--white); border: 2px solid var(--line-strong); border-radius: var(--radius-s);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--sky-ink); box-shadow: 0 0 0 3px var(--sky); }
.input[aria-invalid="true"] { border-color: var(--err-ink); }
.input::placeholder, .textarea::placeholder { color: #9a8a80; }
.hint { color: var(--ink-soft); font-size: 0.88rem; margin-top: 0.35rem; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 7.5rem; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 2.4rem; padding: 0 .9rem; font-size: .88rem; }

.alert { padding: 0.9rem 1.1rem; border-radius: var(--radius-s); margin-bottom: 1rem; font-weight: 600; }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-info { background: var(--sky); color: var(--sky-ink); }
.alert-warm { background: var(--butter); color: #5c4300; }

/* chips: one or several choices */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--ink);
  min-height: 2.8rem; padding: 0.45rem 1.1rem; border-radius: 999px;
  background: var(--white); border: 2px solid var(--line-strong); cursor: pointer;
}
.chip:hover { border-color: var(--ink-soft); }
.chip[aria-pressed="true"] { background: var(--sage); border-color: var(--sage-ink); color: var(--sage-ink); }
.chip[aria-pressed="true"]::before { content: "✓ "; }

/* ---------- cards ---------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 4vw, 36px); }
.card-soft { background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; }

/* ---------- dialog ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 28px; background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(58, 46, 42, .35); overflow: auto;
}
dialog.modal::backdrop { background: rgba(58, 46, 42, .5); backdrop-filter: blur(3px); }
.modal-body { padding: clamp(22px, 5vw, 38px); position: relative; }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink); font-size: 1.8rem; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: var(--cream); }
.modal-head { text-align: center; margin-bottom: 1.2rem; padding-inline: 30px; }
.modal-head img { width: 92px; height: 92px; margin: 0 auto 10px; }
.modal-head h2 { font-size: 1.55rem; margin-bottom: .3em; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--cream); padding: 6px; border-radius: 999px; margin-bottom: 1.3rem; }
.tab { font: inherit; font-weight: 800; font-size: .95rem; border: 0; border-radius: 999px; min-height: 2.9rem; background: transparent; color: var(--ink-soft); cursor: pointer; padding: .3rem .6rem; }
.tab[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: var(--shadow-s); }
.gift-note { display: flex; align-items: center; gap: 12px; background: var(--butter); border-radius: var(--radius-s); padding: .7rem 1rem; margin-bottom: 1.1rem; font-weight: 700; color: #5c4300; }
.gift-note img { width: 40px; height: 40px; flex: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); z-index: 50;
  max-width: calc(100vw - 32px); padding: 0.9rem 1.4rem; border-radius: 18px;
  background: var(--ink); color: var(--white); font-weight: 700; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- spinner ---------- */
.spinner { width: 1.2em; height: 1.2em; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -0.2em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.site-footer { padding: 40px 0 48px; color: var(--ink-soft); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
.site-footer a { color: var(--ink-soft); }
