/* ==========================================================================
   KrukHaus — landing
   Темна тема з теплими акцентами. Без зовнішніх ресурсів.
   ========================================================================== */

/* ---------- Шрифти (локальні, SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/literata-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: "Literata";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/literata-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: "Literata";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/literata-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: "Literata";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/literata-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: "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: "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;
}

/* ---------- Токени ---------- */
:root {
  --bg: #12100e;
  --bg-raised: #1b1815;
  --line: rgba(243, 234, 223, 0.12);
  --line-strong: rgba(243, 234, 223, 0.22);
  --text: #f3eadf;
  --text-muted: #b3a798;
  --accent: #e8a25c;
  --accent-soft: #f4be7e;
  --accent-ink: #1a120a;

  --font-display: "Literata", "Iowan Old Style", Georgia, serif;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --maxw: 72rem;
  --radius: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
}

/* ---------- База ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    radial-gradient(60rem 40rem at 78% 18%, rgba(232, 162, 92, 0.10), transparent 60%),
    radial-gradient(40rem 30rem at 10% 100%, rgba(232, 162, 92, 0.05), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, p { margin: 0; }

a { color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 100;
  padding: .75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

main { flex: 1; }
main:focus { outline: none; }

/* ---------- Header ---------- */
.site-header {
  padding-block: clamp(1rem, 2.5vw, 1.75rem);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  min-height: 44px;
}

.brand-mark { width: 36px; height: 36px; }

.brand-word {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 560;
  letter-spacing: -0.01em;
}
.brand-accent { color: var(--accent); }

/* Перемикач мови */
.lang-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(27, 24, 21, .6);
}
.lang-switch[hidden] { display: none; }

.lang-btn {
  appearance: none;
  border: 0;
  margin: 0;
  min-width: 52px;
  min-height: 36px;
  padding: .3rem .9rem;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font: 700 .8125rem/1 var(--font-ui);
  letter-spacing: .08em;
  cursor: pointer;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(2rem, 6vw, 5rem) clamp(3rem, 8vw, 6rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}

.eyebrow,
.section-label {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--accent-soft);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: currentColor;
  opacity: .7;
}

.hero-title {
  margin-top: 1.25rem;
  overflow-wrap: break-word;
  font-family: var(--font-display);
  font-size: min(clamp(3rem, 1.6rem + 6.4vw, 7.5rem), 18vw);
  font-weight: 480;
  line-height: .95;
  letter-spacing: -0.035em;
}
.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.hero-slogan {
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.85rem);
  line-height: 1.3;
  font-weight: 420;
}

.hero-lead {
  margin-top: 1rem;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: clamp(1.0625rem, 1rem + .25vw, 1.1875rem);
}

.hero-actions {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.btn-enter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 56px;
  padding: .9rem 1.6rem .9rem 1.9rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  font-size: 1.0625rem;
  letter-spacing: .01em;
  text-decoration: none;
  box-shadow: 0 0 0 0 rgba(232, 162, 92, 0), 0 10px 30px -10px rgba(232, 162, 92, .55);
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease);
}
.btn-enter:hover {
  background: var(--accent-soft);
  box-shadow: 0 0 0 6px rgba(232, 162, 92, .14), 0 14px 40px -10px rgba(232, 162, 92, .7);
  transform: translateY(-1px);
}
.btn-enter:active { transform: translateY(0); }
.btn-enter:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: var(--radius);
}
.btn-arrow { transition: transform .3s var(--ease); }
.btn-enter:hover .btn-arrow { transform: translateX(4px); }

.hero-hint {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--text-muted);
  font-size: .9375rem;
}
.hero-hint::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Ілюстрація */
.hero-art {
  justify-self: center;
  width: 100%;
  max-width: 30rem;
}
.scene { width: 100%; height: auto; overflow: visible; }

.house-line {
  stroke: var(--line-strong);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.ground {
  stroke: var(--line);
  stroke-width: 1;
  stroke-linecap: round;
}
.stars circle { fill: var(--text); opacity: .55; }

.halo { transform-origin: 240px 330px; }
.window, .halo, .spill { transform-box: view-box; }

/* ---------- Concept ---------- */
.concept {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--line);
}

.section-label span[aria-hidden] {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.concept-title {
  margin-top: 1rem;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 20ch;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3.4rem);
  font-weight: 460;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.concept-text {
  margin-top: 1.5rem;
  max-width: 44rem;
  color: var(--text-muted);
  font-size: clamp(1.0625rem, .95rem + .45vw, 1.25rem);
  line-height: 1.7;
}

.principles {
  list-style: none;
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.principle {
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--bg-raised);
  transition: background-color .4s var(--ease);
}
.principle:hover { background: #211d19; }

.principle-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.principle h3 {
  margin-top: 1.25rem;
  overflow-wrap: break-word;
  hyphens: auto;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 520;
  letter-spacing: -0.01em;
}
.principle p {
  margin-top: .5rem;
  overflow-wrap: break-word;
  hyphens: auto;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 1.75rem max(1.75rem, env(safe-area-inset-bottom));
  color: var(--text-muted);
  font-size: .9375rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 2rem;
}
.footer-copy { color: var(--text); }

/* ---------- Адаптивність ---------- */
@media (max-width: 52rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art {
    order: -1;
    max-width: 17rem;
    justify-self: start;
    margin-bottom: -.5rem;
  }
  .principles { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 26rem) {
  .brand-word { font-size: 1.15rem; }
  .btn-enter { width: 100%; justify-content: center; text-align: center; }
}

/* Вузькі смартфони 320–360 px: три мови + логотип в один рядок */
@media (max-width: 23rem) {
  .brand { gap: .5rem; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-word { font-size: 1.05rem; }
  .lang-switch { padding: 3px; }
  .lang-btn { min-width: 40px; min-height: 36px; padding: .3rem .55rem; letter-spacing: .04em; }
}

/* ---------- Анімація ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    animation: reveal .9s var(--ease) forwards;
  }
  .reveal:nth-child(1) { animation-delay: .05s; }
  .reveal:nth-child(2) { animation-delay: .15s; }
  .reveal:nth-child(3) { animation-delay: .3s; }
  .reveal:nth-child(4) { animation-delay: .42s; }
  .reveal:nth-child(5) { animation-delay: .55s; }

  .hero-art { animation: art-in 1.4s var(--ease) .2s both; }

  .window { animation: breathe 6s ease-in-out 1.5s infinite; }
  .halo { animation: halo 6s ease-in-out 1.5s infinite; }

  .stars circle { animation: twinkle 5s ease-in-out infinite; }
  .stars circle:nth-child(2n) { animation-duration: 7s; animation-delay: 1.2s; }
  .stars circle:nth-child(3n) { animation-duration: 9s; animation-delay: 2.4s; }

  @keyframes reveal {
    to { opacity: 1; transform: none; }
  }
  @keyframes art-in {
    from { opacity: 0; transform: translateY(18px) scale(.98); }
    to { opacity: 1; transform: none; }
  }
  @keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: .86; }
  }
  @keyframes halo {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .7; transform: scale(.96); }
  }
  @keyframes twinkle {
    0%, 100% { opacity: .55; }
    50% { opacity: .15; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Режим підвищеного контрасту ---------- */
@media (forced-colors: active) {
  .btn-enter, .lang-btn[aria-pressed="true"] { border: 2px solid ButtonText; }
}
