/* ============================================================
   INDIVIDUATION — design system v2 "Carbon & Flame"
   Palette: #f15025 / #ffffff / #e6e8e6 / #ced0ce / #191919
   Themes: "night" (carbon) & "dawn" (paper)
   ============================================================ */

:root {
  --flame: #f15025;
  --white: #ffffff;
  --alabaster: #e6e8e6;
  --dust: #ced0ce;
  --carbon: #191919;

  --font-display: 'Space Grotesk', 'Noto Sans Georgian', 'Inter', sans-serif;
  --font-body: 'Inter', 'Noto Sans Georgian', -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 1160px;
}

/* ---- Night: carbon ---- */
[data-theme="night"] {
  --bg: var(--carbon);
  --bg-2: #1f1f1f;
  --surface: #202020;
  --surface-2: #272727;
  --text: var(--white);
  --text-soft: var(--dust);
  --muted: #8f918f;
  --accent: var(--flame);
  --accent-ink: var(--white);
  --accent-soft: rgba(241, 80, 37, 0.12);
  --line: rgba(230, 232, 230, 0.16);
  --frame: var(--alabaster);
  --img-filter: grayscale(0.3) contrast(1.08);
  color-scheme: dark;
}

/* ---- Dawn: paper ---- */
[data-theme="dawn"] {
  --bg: var(--white);
  --bg-2: var(--alabaster);
  --surface: var(--white);
  --surface-2: var(--alabaster);
  --text: var(--carbon);
  --text-soft: #3a3c3a;
  --muted: #6f716f;
  --accent: var(--flame);
  --accent-ink: var(--white);
  --accent-soft: rgba(241, 80, 37, 0.08);
  --line: var(--dust);
  --frame: var(--carbon);
  --img-filter: grayscale(0.2) contrast(1.04);
  color-scheme: light;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.45s var(--ease-out), color 0.45s var(--ease-out);
  overflow-x: hidden;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.45rem); letter-spacing: -0.01em; }
p { margin: 0 0 1em; color: var(--text-soft); }
em.accent { color: var(--accent); font-style: normal; }
img { max-width: 100%; display: block; filter: var(--img-filter); }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.1rem, 4vw, 2.5rem); }
section { padding: clamp(3.5rem, 8vw, 7rem) 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.72rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--text); margin-bottom: 1.2rem; font-weight: 600;
}
.eyebrow::before { content: ""; width: 10px; height: 10px; background: var(--accent); flex-shrink: 0; }

/* decorative orbs removed in v2 */
.orb, .scroll-cue { display: none; }

/* ---- Header / nav ---- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background 0.4s, box-shadow 0.4s;
}
.site-header.scrolled {
  background: var(--bg);
  box-shadow: 0 2px 0 var(--text);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem clamp(1.1rem, 4vw, 2.5rem);
  max-width: 1400px; margin: 0 auto;
}
.logo {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 0.55rem;
}
.logo svg { color: var(--accent); }
.nav-links { display: flex; gap: clamp(0.8rem, 2vw, 1.6rem); align-items: center; list-style: none; margin: 0; padding: 0; }

/* nav links: plain color shift, no underline */
.nav-links a:not(.btn) {
  color: var(--text-soft); text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.88rem; font-weight: 500; padding: 0.3rem 0.1rem;
  transition: color 0.2s;
}
.nav-links a:not(.btn):hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }

.nav-controls { display: flex; gap: 0.55rem; align-items: center; }

/* icon buttons (theme / lang): square, press effect */
.icon-btn {
  --size: 38px;
  width: var(--size); height: var(--size);
  display: grid; place-items: center;
  border: 2px solid var(--text);
  background: var(--bg); color: var(--text); cursor: pointer;
  font-family: var(--font-display); font-size: 0.7rem; font-weight: 700;
  box-shadow: 3px 3px 0 var(--accent);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out), background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--accent); }

/* burger */
.burger { display: none; }

/* ---- Buttons: hard-shadow press ---- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.7rem;
  border: 2px solid var(--text);
  color: var(--text); background: var(--bg);
  font-family: var(--font-display); font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--accent);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out), background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 5px 5px 0 var(--text); }
.btn:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--text); }
.btn.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 5px 5px 0 var(--text); }
.btn.solid:hover { background: var(--text); border-color: var(--text); color: var(--bg); box-shadow: 5px 5px 0 var(--accent); }
.btn svg { transition: transform 0.25s var(--ease-out); }
.btn:hover svg { transform: translateX(4px); }

/* ---- Hero ---- */
.hero {
  min-height: 100svh; display: flex; align-items: center;
  position: relative; padding-top: 5rem;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero-img-wrap {
  position: relative;
  border: 2px solid var(--frame);
  box-shadow: 12px 12px 0 var(--accent);
  overflow: hidden; aspect-ratio: 3/4;
}
.hero-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 .line { display: block; overflow: hidden; }
.hero h1 .line span { display: block; transform: translateY(110%); animation: rise 0.9s var(--ease-out) forwards; }
.hero h1 .line:nth-child(2) span { animation-delay: 0.1s; }
.hero h1 .line:nth-child(3) span { animation-delay: 0.2s; }
@keyframes rise { to { transform: translateY(0); } }
.hero .lede { font-size: 1.12rem; max-width: 34rem; }

/* ---- Cards ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.4rem; }
.card {
  position: relative; background: var(--surface); border: 1.5px solid var(--line);
  padding: 1.8rem;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s, background 0.45s;
}
.card:hover {
  transform: translate(-4px, -4px);
  border-color: var(--text);
  box-shadow: 6px 6px 0 var(--accent);
}
.card .glyph {
  width: 50px; height: 50px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  margin-bottom: 1.1rem;
}
.card.img-card { padding: 0; }
.card.img-card .thumb { aspect-ratio: 16/10; overflow: hidden; border-bottom: 1.5px solid var(--line); }
.card.img-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-out); }
.card.img-card:hover .thumb img { transform: scale(1.04); }
.card.img-card .body { padding: 1.5rem 1.8rem 1.8rem; }

/* ---- Symbol dictionary ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.8rem 0 2.2rem; align-items: center; }
.chip {
  padding: 0.5rem 1.1rem; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text-soft);
  font-family: var(--font-display); font-weight: 500;
  font-size: 0.8rem; cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.search-input {
  flex: 1 1 220px; min-width: 200px;
  padding: 0.7rem 1.1rem; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 4px 4px 0 var(--accent-soft); }

.symbol-card h3 { margin-bottom: 0.3rem; }
.symbol-card .cat-tag {
  font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent);
  padding: 0.22rem 0.7rem; display: inline-block; margin-bottom: 0.9rem;
  font-family: var(--font-display); font-weight: 600;
}
.symbol-card .ask {
  margin-top: 1rem; padding-top: 1rem; border-top: 1.5px dashed var(--line);
  font-size: 0.88rem; color: var(--muted); font-style: italic;
}

/* ---- Timeline (history page) ---- */
.timeline { position: relative; padding-left: 2.4rem; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px;
  background: var(--line);
}
.t-item { position: relative; margin-bottom: 3.2rem; }
.t-item::before {
  content: ""; position: absolute; left: -2.42rem; top: 8px; width: 13px; height: 13px;
  background: var(--bg); border: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: background 0.2s;
}
.t-item:hover::before { background: var(--accent); }
.t-item .t-era {
  font-family: var(--font-display);
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}

/* ---- Game ---- */
.game-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; margin-top: 1.6rem; }
.game-tile {
  aspect-ratio: 4/3; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text);
  display: grid; place-items: center; text-align: center; padding: 0.8rem;
  font-family: var(--font-body); font-size: 0.88rem; cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.15s, background 0.15s, box-shadow 0.15s, opacity 0.4s;
}
.game-tile:hover { border-color: var(--text); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--accent); }
.game-tile.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 4px 4px 0 var(--accent); }
.game-tile.matched { opacity: 0.2; pointer-events: none; transform: scale(0.96); box-shadow: none; }
.game-tile.wrong { animation: shake 0.45s; border-color: var(--accent); background: var(--accent-soft); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
.game-hud { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 1.5rem; }
.game-stat { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; }
.game-stat small { display: block; font-weight: 600; font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }

/* ---- Forms ---- */
.form-grid { display: grid; gap: 1.3rem; }
.field { position: relative; }
.field input, .field textarea, .field select {
  width: 100%; padding: 1.05rem 1.2rem;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font-family: var(--font-body); font-size: 0.95rem; resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 4px 4px 0 var(--accent-soft);
}
.field label {
  position: absolute; left: 1.1rem; top: 1.02rem; padding: 0 0.35rem;
  color: var(--muted); font-size: 0.92rem; pointer-events: none;
  transition: all 0.25s var(--ease-out); background: transparent;
}
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label {
  top: -0.55rem; font-size: 0.72rem; color: var(--accent); background: var(--bg);
}
.field input::placeholder, .field textarea::placeholder { color: transparent; }
.field .err { color: var(--accent); font-size: 0.78rem; margin-top: 0.35rem; display: none; }
.field.invalid input, .field.invalid textarea { border-color: var(--accent); }
.field.invalid .err { display: block; }
.form-success { display: none; text-align: center; padding: 3rem 1rem; animation: fadeUp 0.7s var(--ease-out); }
.form-success.show { display: block; }

/* ---- Reveal animations ---- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal.visible { opacity: 1; transform: none; }
.reveal-l { opacity: 0; transform: translateX(-36px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal-r { opacity: 0; transform: translateX(36px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal-l.visible, .reveal-r.visible { opacity: 1; transform: none; }
.stagger > * { opacity: 0; transform: translateY(22px); transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
.stagger.visible > * { opacity: 1; transform: none; }
.stagger.visible > *:nth-child(1) { transition-delay: 0.04s; } .stagger.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger.visible > *:nth-child(3) { transition-delay: 0.16s; } .stagger.visible > *:nth-child(4) { transition-delay: 0.22s; }
.stagger.visible > *:nth-child(5) { transition-delay: 0.28s; } .stagger.visible > *:nth-child(6) { transition-delay: 0.34s; }
.stagger.visible > *:nth-child(7) { transition-delay: 0.4s; } .stagger.visible > *:nth-child(8) { transition-delay: 0.46s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ---- Page hero (inner pages) ---- */
.page-hero { padding: clamp(8rem, 16vh, 11rem) 0 clamp(2.5rem, 6vw, 4rem); position: relative; }
.page-hero p.lede { font-size: 1.1rem; max-width: 42rem; }

/* two-col split */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.split .img-blob {
  border: 2px solid var(--frame);
  box-shadow: 12px 12px 0 var(--accent);
  overflow: hidden; aspect-ratio: 4/5;
  border-radius: 0 !important;
}
.split .img-blob img { width: 100%; height: 100%; object-fit: cover; }

/* numbered steps */
.step { display: grid; grid-template-columns: 64px 1fr; gap: 1.4rem; margin-bottom: 2.4rem; }
.step .num {
  font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; color: var(--accent);
  line-height: 1;
}

/* quote block */
.quote {
  border-left: 5px solid var(--accent); padding: 0.6rem 0 0.6rem 1.6rem;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  color: var(--text); margin: 2.5rem 0;
}
.quote cite { display: block; font-family: var(--font-body); font-style: normal; font-size: 0.82rem; color: var(--muted); margin-top: 0.7rem; letter-spacing: 0.1em; }

/* ---- Common-dream detail page ---- */
.dream-link { text-decoration: none; color: inherit; display: block; }
.dream-link .body p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.read-more {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
  margin-top: 0.6rem;
}
.read-more svg { transition: transform 0.25s var(--ease-out); }
.dream-link:hover .read-more svg { transform: translateX(4px); }
.back-link {
  font-family: var(--font-display); font-weight: 600; font-size: 0.85rem;
  color: var(--text-soft); text-decoration: none; transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }
.detail-block { margin-bottom: 2.8rem; }
.detail-block h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); display: flex; align-items: center; gap: 0.7rem; }
.detail-block h2::before { content: ""; width: 12px; height: 12px; background: var(--accent); flex-shrink: 0; }
.detail-nav { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 3.5rem; padding-top: 2rem; border-top: 2px solid var(--line); }
.detail-nav .chip { text-decoration: none; }

/* ---- Footer ---- */
.site-footer { border-top: 2px solid var(--text); padding: 3rem 0 2rem; margin-top: 3rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; align-items: flex-start; }
.site-footer a { color: var(--text-soft); text-decoration: none; transition: color 0.2s; }
.site-footer a:hover { color: var(--accent); }
.footer-note { font-size: 0.8rem; color: var(--muted); margin-top: 2.2rem; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .hero-grid, .split { grid-template-columns: 1fr; }
  .hero-img-wrap { max-width: 420px; margin: 0 auto; order: -1; aspect-ratio: 4/3; }
  .nav-links {
    position: fixed; inset: 0; background: var(--bg);
    flex-direction: column; justify-content: center; gap: 1.8rem;
    transform: translateY(-102%); transition: transform 0.45s var(--ease-out); z-index: 90;
  }
  .nav-links.open { transform: none; }
  .nav-links a:not(.btn) { font-size: 1.3rem; }
  .burger {
    display: grid; place-items: center; z-index: 95;
    width: 40px; height: 40px; border: none; background: none; cursor: pointer; color: var(--text);
  }
  .burger span { display: block; width: 22px; height: 2px; background: currentColor; position: relative; transition: 0.3s; }
  .burger span::before, .burger span::after {
    content: ""; position: absolute; left: 0; width: 22px; height: 2px; background: currentColor; transition: 0.3s;
  }
  .burger span::before { top: -7px; } .burger span::after { top: 7px; }
  .burger.open span { background: transparent; }
  .burger.open span::before { top: 0; transform: rotate(45deg); }
  .burger.open span::after { top: 0; transform: rotate(-45deg); }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  html { scroll-behavior: auto; }
  .reveal, .reveal-l, .reveal-r, .stagger > * { opacity: 1; transform: none; }
}

/* focus visibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
