/* ============================================================
   K HERITAGE — Demo stylesheet
   Palette: deep ocean navy, abyss, parchment cream, antique gold
   ============================================================ */

:root {
  --abyss: #04101f;
  --deep: #082035;
  --navy: #0b3a5e;
  --navy-soft: #11567f;
  --foam: #cfe6ea;
  --gold: #d7b269;
  --gold-bright: #efce8b;
  --gold-deep: #b8923f;
  --cream: #f4ecd8;
  --parchment: #f6efdd;
  --ink: #2a2419;
  --text: #e9f1f4;
  --text-dim: #9fb6c4;
  --line: rgba(215, 178, 105, 0.22);

  --serif: "Cormorant Garamond", Georgia, serif;
  --logo: "Marcellus", serif;
  --sans: "Inter", system-ui, sans-serif;

  --maxw: 1160px;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);

  /* themeable semantic tokens (dark = default) */
  --heading: #f4ecd8;
  --surface: rgba(11, 58, 94, 0.30);
  --surface-hover: rgba(11, 58, 94, 0.45);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --input-bg: rgba(5, 18, 33, 0.6);
  --modal-bg: linear-gradient(170deg, #0c2c47, #061726);
  --nav-bg: rgba(5, 18, 33, 0.86);
  --ocean-grad:
    radial-gradient(1200px 700px at 50% -10%, #103a5a 0%, transparent 60%),
    linear-gradient(180deg, #0a2a45 0%, #082035 35%, #051726 70%, #03101d 100%);
  --ship: var(--gold);
  --ship-op: 0.20;
  --stars-op: 0.5;
}

/* ---------------- Light theme ---------------- */
html[data-theme="light"] {
  --abyss: #e9f1f1;
  --text: #26333b;
  --text-dim: #5e7480;
  --heading: #0b3a5e;
  --line: rgba(11, 58, 94, 0.16);
  --surface: rgba(255, 255, 255, 0.62);
  --surface-hover: rgba(255, 255, 255, 0.9);
  --chip-bg: rgba(11, 58, 94, 0.06);
  --input-bg: rgba(255, 255, 255, 0.72);
  --modal-bg: linear-gradient(170deg, #ffffff, #f2ecdd);
  --nav-bg: rgba(245, 241, 230, 0.92);
  --ocean-grad:
    radial-gradient(1200px 700px at 50% -10%, #dcebf0 0%, transparent 55%),
    linear-gradient(180deg, #eaf2f1 0%, #dde9ea 45%, #e9efe7 100%);
  --ship: #0b3a5e;
  --ship-op: 0.16;
  --stars-op: 0;
  --shadow: 0 24px 50px rgba(11, 40, 70, 0.16);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--abyss);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.1; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--gold-bright); }
.gold { color: var(--gold); }

/* ============================================================
   Animated ocean background
   ============================================================ */
.ocean-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--ocean-grad);
  transition: background .6s ease;
}
.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.6), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 40% 60%, rgba(215,178,105,.5), transparent),
    radial-gradient(1.5px 1.5px at 85% 50%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 10% 80%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 60% 75%, rgba(215,178,105,.4), transparent);
  opacity: var(--stars-op);
  animation: twinkle 8s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: .7; } }

.wave {
  position: absolute; left: -10%; right: -10%; height: 46vh; bottom: -6vh;
  background-repeat: repeat-x;
  background-size: 1200px 100%;
  opacity: .5;
}
.wave-1 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' viewBox='0 0 1200 200'%3E%3Cpath d='M0 80 C 200 20 400 140 600 80 C 800 20 1000 140 1200 80 L1200 200 L0 200 Z' fill='%230b3a5e'/%3E%3C/svg%3E");
  animation: drift 22s linear infinite;
  opacity: .55; height: 40vh; bottom: -4vh;
}
.wave-2 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' viewBox='0 0 1200 200'%3E%3Cpath d='M0 100 C 250 40 450 160 700 100 C 900 50 1050 150 1200 100 L1200 200 L0 200 Z' fill='%23082035'/%3E%3C/svg%3E");
  animation: drift 16s linear infinite reverse;
  opacity: .7; height: 34vh;
}
.wave-3 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' viewBox='0 0 1200 200'%3E%3Cpath d='M0 120 C 200 70 500 170 700 120 C 950 60 1050 150 1200 120 L1200 200 L0 200 Z' fill='%23051726'/%3E%3C/svg%3E");
  animation: drift 28s linear infinite;
  opacity: .9; height: 26vh; bottom: -2vh;
}
@keyframes drift { from { background-position-x: 0; } to { background-position-x: 1200px; } }

.caustics {
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 30% 20%, rgba(120,180,200,.06), transparent),
    radial-gradient(500px 240px at 75% 30%, rgba(215,178,105,.05), transparent);
  mix-blend-mode: screen;
}

/* lighter waves for light theme */
html[data-theme="light"] .wave-1 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' viewBox='0 0 1200 200'%3E%3Cpath d='M0 80 C 200 20 400 140 600 80 C 800 20 1000 140 1200 80 L1200 200 L0 200 Z' fill='%23bcd9e1'/%3E%3C/svg%3E");
  opacity: .5;
}
html[data-theme="light"] .wave-2 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' viewBox='0 0 1200 200'%3E%3Cpath d='M0 100 C 250 40 450 160 700 100 C 900 50 1050 150 1200 100 L1200 200 L0 200 Z' fill='%23a6cbd6'/%3E%3C/svg%3E");
  opacity: .55;
}
html[data-theme="light"] .wave-3 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' viewBox='0 0 1200 200'%3E%3Cpath d='M0 120 C 200 70 500 170 700 120 C 950 60 1050 150 1200 120 L1200 200 L0 200 Z' fill='%238fbac9'/%3E%3C/svg%3E");
  opacity: .65;
}

/* drifting ship in a bottle */
.ship {
  position: absolute; left: 0; color: var(--ship);
  opacity: 0; will-change: transform, opacity; pointer-events: none;
  animation: sail var(--dur, 90s) linear infinite;
}
.ship-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 8px rgba(0,0,0,.18)); }
.ship-1 { top: 26%; width: 118px; --dur: 82s; animation-delay: -14s; }
.ship-2 { top: 58%; width: 168px; --dur: 124s; animation-delay: -70s; }
@keyframes sail {
  0%   { transform: translateX(-16vw) translateY(0) rotate(-1.5deg); opacity: 0; }
  10%  { opacity: var(--ship-op); }
  50%  { transform: translateX(45vw) translateY(-14px) rotate(1.5deg); }
  90%  { opacity: var(--ship-op); }
  100% { transform: translateX(112vw) translateY(0) rotate(-1.5deg); opacity: 0; }
}

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(4, 16, 31, 0);
  transition: background .4s ease, padding .4s ease, box-shadow .4s ease;
}
.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
  padding-top: 10px; padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 44px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.brand-name { font-family: var(--logo); font-size: 1.2rem; letter-spacing: .14em; color: var(--heading); }
.nav-links { display: flex; gap: 28px; margin-left: auto; }
.nav-links a {
  font-size: .82rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim); transition: color .25s; position: relative;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px; width: 0; height: 1px;
  background: var(--gold); transition: width .3s ease;
}
.nav-links a:hover { color: var(--heading); }
.nav-links a:hover::after { width: 100%; }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.lang-toggle {
  background: none; border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .75rem;
  letter-spacing: .1em; transition: border-color .25s, color .25s;
}
.lang-toggle:hover { border-color: var(--gold); }
.lang-toggle .active { color: var(--gold); }
.lang-sep { margin: 0 4px; opacity: .5; }
.icon-toggle {
  background: none; border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; width: 34px; height: 34px; padding: 0; cursor: pointer;
  font-size: 1rem; line-height: 1; display: grid; place-items: center;
  transition: border-color .25s, color .25s, transform .4s ease;
}
.icon-toggle:hover { border-color: var(--gold); color: var(--gold); transform: rotate(20deg); }
.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; }
.nav-burger span { width: 24px; height: 2px; background: var(--heading); border-radius: 2px; transition: .3s; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  font-family: var(--sans); font-weight: 500; font-size: .85rem;
  letter-spacing: .05em; border-radius: 999px; cursor: pointer;
  padding: 11px 22px; border: 1px solid transparent; transition: all .25s ease;
  white-space: nowrap;
}
.btn-lg { padding: 15px 32px; font-size: .95rem; }
.btn-gold {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: #2a1f06; box-shadow: 0 8px 26px rgba(215,178,105,.28);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(215,178,105,.42); }
.btn-ghost { background: var(--chip-bg); color: var(--heading); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); background: rgba(215,178,105,.08); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  min-height: 100vh; position: relative;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 20px 80px;
}
.hero-inner { max-width: 880px; animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: none; } }
.hero-logo { width: 168px; margin-bottom: 18px; filter: drop-shadow(0 8px 28px rgba(0,0,0,.5)); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
.hero-kicker {
  text-transform: uppercase; letter-spacing: .34em; font-size: .76rem;
  color: var(--gold); margin-bottom: 22px;
}
.hero-title { font-size: clamp(2.6rem, 7vw, 5.2rem); font-weight: 500; }
.hero-title .gold { font-style: italic; }
.hero-sub {
  max-width: 640px; margin: 26px auto 0; color: var(--text-dim);
  font-size: clamp(1rem, 1.6vw, 1.18rem); font-family: var(--serif);
  font-size: 1.32rem; line-height: 1.5;
}
.hero-cta { display: flex; gap: 16px; justify-content: center; margin-top: 38px; flex-wrap: wrap; }
.hero-pillars {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  margin-top: 64px; flex-wrap: wrap;
}
.pillar { display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--serif); font-size: 1.3rem; color: var(--heading); }
.pillar-num { font-family: var(--sans); font-size: .7rem; letter-spacing: .2em; color: var(--gold); }
.pillar-line { width: 56px; height: 1px; background: var(--line); }
.hero-scroll { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); width: 24px; height: 40px; border: 1px solid var(--line); border-radius: 14px; }
.hero-scroll span { position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; background: var(--gold); border-radius: 2px; transform: translateX(-50%); animation: scrolldot 1.8s ease-in-out infinite; }
@keyframes scrolldot { 0% { opacity: 0; top: 8px; } 40% { opacity: 1; } 80% { opacity: 0; top: 22px; } 100% { opacity: 0; } }
.float-bottle { position: absolute; font-size: 2.4rem; opacity: .5; filter: drop-shadow(0 6px 12px rgba(0,0,0,.5)); }
.fb-1 { left: 8%; top: 36%; animation: bob 7s ease-in-out infinite; }
.fb-2 { right: 9%; top: 58%; animation: bob 9s ease-in-out infinite reverse; }

/* ============================================================
   Sections (shared)
   ============================================================ */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(70px, 11vw, 130px) clamp(18px, 4vw, 40px); position: relative; }
.section-head { text-align: center; max-width: 760px; margin: 0 auto 60px; }
.eyebrow { text-transform: uppercase; letter-spacing: .3em; font-size: .74rem; color: var(--gold); margin-bottom: 16px; }
.section-title { font-size: clamp(2rem, 4.4vw, 3.3rem); }
.section-lead { margin-top: 20px; color: var(--text-dim); font-family: var(--serif); font-size: 1.28rem; line-height: 1.55; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
/* fail-safe: if JS/observer never runs, content stays visible */
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .bottle-card, .hero-inner { opacity: 1 !important; }
}

/* ============================================================
   Manifesto
   ============================================================ */
.threats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.threat {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 28px; position: relative; overflow: hidden;
}
.threat-num { font-family: var(--serif); font-style: italic; font-size: 3rem; color: var(--gold); opacity: .55; }
.threat h3 { font-size: 1.5rem; margin: 8px 0 12px; }
.threat p { color: var(--text-dim); font-size: .98rem; }
.threat cite { display: block; margin-top: 16px; font-style: italic; font-family: var(--serif); color: var(--gold); font-size: 1.05rem; }

.mission { text-align: center; margin: 72px auto; max-width: 880px; }
.mission-text { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2.1rem); line-height: 1.4; color: var(--heading); }

.pillars-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.pcard {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 30px;
  background: var(--surface); transition: transform .3s, border-color .3s, background .3s;
}
.pcard:hover { transform: translateY(-6px); border-color: var(--gold); background: var(--surface-hover); }
.pcard-num { font-family: var(--sans); letter-spacing: .2em; font-size: .8rem; color: var(--gold); }
.pcard h3 { font-size: 1.7rem; margin: 10px 0 14px; }
.pcard p { color: var(--text-dim); }

/* ============================================================
   Ocean / bottles
   ============================================================ */
.ocean-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 40px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  background: var(--chip-bg); border: 1px solid var(--line); color: var(--text-dim);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font-size: .82rem; transition: all .25s;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip .type-ico { width: 16px; height: 16px; flex-shrink: 0; }
.chip:hover { color: var(--heading); border-color: var(--gold); }
.chip.active { background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #2a1f06; border-color: transparent; }

.bottle-sea {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px;
}
.sea-empty { text-align: center; color: var(--text-dim); font-family: var(--serif); font-size: 1.3rem; padding: 40px; }

.bottle-card {
  position: relative; border-radius: var(--radius); padding: 26px 24px 22px;
  border: 1px solid var(--line); cursor: pointer; overflow: hidden;
  background: var(--surface);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .3s, box-shadow .3s;
  animation: floatUp .7s ease both;
}
@keyframes floatUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.bottle-card:hover { transform: translateY(-8px); border-color: var(--gold); box-shadow: var(--shadow); }
.bottle-card::before {
  content: ""; position: absolute; inset: 0; opacity: .07; pointer-events: none;
  background: radial-gradient(circle at 80% 0%, var(--gold) 0%, transparent 45%);
}
.bc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bc-type { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; font-weight: 600; }
.type-request { background: rgba(99,179,237,.16); color: #9ad0f5; }
.type-offer { background: rgba(215,178,105,.16); color: var(--gold-bright); }
.type-quest { background: rgba(167,139,250,.16); color: #c7b6ff; }
.bc-emoji { display: inline-flex; color: var(--gold); }
.bc-emoji .type-ico { width: 22px; height: 22px; }
.bc-title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.2; margin-bottom: 10px; color: var(--heading); }
.bc-excerpt { color: var(--text-dim); font-size: .94rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--text-dim); }
.bc-author { display: flex; align-items: center; gap: 8px; }
.bc-avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--navy-soft), var(--gold-deep)); display: grid; place-items: center; font-size: .72rem; color: #f6efdd; font-weight: 600; }
.bc-replies { color: var(--gold); }
.bc-new { position: absolute; top: 14px; right: 14px; background: var(--gold); color: #2a1f06; font-size: .62rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .1em; }

/* ============================================================
   Scribe
   ============================================================ */
.scribe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.field-label { display: block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
textarea, input[type="text"], select {
  width: 100%; background: var(--input-bg); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-family: var(--sans); font-size: .96rem; padding: 14px 16px; resize: vertical;
  transition: border-color .25s;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--gold); }
textarea::placeholder, input::placeholder { color: #5e7686; }
.scribe-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.scribe-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.scribe-hint { margin-top: 14px; font-size: .82rem; color: var(--text-dim); }

.parchment {
  min-height: 420px; border-radius: 14px; padding: 34px 32px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.03), rgba(120,80,20,.06)),
    radial-gradient(120% 120% at 0% 0%, #fbf5e4, #efe2c2);
  color: var(--ink); box-shadow: var(--shadow), inset 0 0 60px rgba(150,110,40,.18);
  border: 1px solid #d8c391; position: relative;
  font-family: var(--serif);
}
.parchment.empty { display: grid; place-items: center; text-align: center; }
@keyframes ficheIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.parchment.show { animation: ficheIn .6s ease both; }
.parchment-placeholder { color: #9a8554; font-style: italic; font-size: 1.2rem; max-width: 280px; }
.parchment h3 { color: #5a3d18; font-size: 1.9rem; text-align: center; }
.parchment .pq { text-align: center; font-style: italic; color: #7a5b2a; margin: 6px 0 22px; font-size: 1.1rem; }
.fiche-row { margin-bottom: 18px; }
.fiche-row h4 {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-deep); margin: 0 0 5px; border-bottom: 1px solid rgba(150,110,40,.25); padding-bottom: 4px;
}
.fiche-row p, .fiche-row li { font-size: 1.12rem; color: var(--ink); line-height: 1.45; }
.fiche-row ul { margin: 4px 0 0; padding-left: 20px; }
.fiche-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.fiche-tag { background: rgba(150,110,40,.14); color: #6a4d1c; border: 1px solid rgba(150,110,40,.3); padding: 3px 12px; border-radius: 999px; font-family: var(--sans); font-size: .76rem; }
.fiche-pillars { display: flex; gap: 8px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.fiche-pillar { font-family: var(--sans); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #6a4d1c; border: 1px solid rgba(150,110,40,.4); border-radius: 999px; padding: 5px 14px; }
.fiche-seal { text-align: center; margin-top: 22px; font-family: var(--logo); letter-spacing: .2em; color: var(--gold-deep); font-size: .8rem; }
.scribe-typing { display: inline-block; }
.fiche-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; }
.fiche-btn { font-family: var(--sans); font-size: .8rem; padding: 8px 16px; border-radius: 999px; border: 1px solid rgba(150,110,40,.4); background: rgba(150,110,40,.08); color: #6a4d1c; cursor: pointer; transition: all .25s; }
.fiche-btn:hover { background: rgba(150,110,40,.18); }

.thinking { display: flex; gap: 6px; align-items: center; justify-content: center; }
.thinking span { width: 9px; height: 9px; border-radius: 50%; background: var(--gold-deep); animation: think 1.2s ease-in-out infinite; }
.thinking span:nth-child(2) { animation-delay: .2s; }
.thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes think { 0%,100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }

/* ============================================================
   Foundation / steps / stats
   ============================================================ */
.steps { display: flex; align-items: stretch; justify-content: center; gap: 8px; flex-wrap: wrap; }
.step { flex: 1; min-width: 200px; max-width: 250px; text-align: center; padding: 30px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.step-n { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold); font-family: var(--serif); font-size: 1.3rem; margin-bottom: 16px; }
.step h3 { font-size: 1.4rem; margin-bottom: 8px; }
.step p { color: var(--text-dim); font-size: .92rem; }
.step-arrow { align-self: center; color: var(--gold); font-size: 1.6rem; opacity: .6; }

.principles { display: flex; justify-content: center; align-items: center; gap: clamp(14px, 3vw, 34px); margin: 78px 0; flex-wrap: wrap; }
.principle { font-family: var(--serif); font-style: italic; font-size: clamp(1.1rem, 2.1vw, 1.55rem); color: var(--heading); letter-spacing: .01em; }
.principle-dot { color: var(--gold); opacity: .55; font-size: .7rem; transform: translateY(-2px); }

.founder { text-align: center; max-width: 760px; margin: 0 auto; }
.founder-quote { font-family: var(--serif); font-style: italic; font-size: clamp(1.5rem, 3.4vw, 2.3rem); color: var(--heading); line-height: 1.35; }
.founder-name { margin-top: 24px; letter-spacing: .08em; color: var(--gold); }
.founder-name span { color: var(--text-dim); }

/* ============================================================
   Footer
   ============================================================ */
.footer { text-align: center; padding: 70px 20px 50px; border-top: 1px solid var(--line); margin-top: 40px; }
.footer-logo { width: 110px; opacity: .85; margin-bottom: 14px; }
.footer-tag { font-family: var(--serif); letter-spacing: .2em; color: var(--gold); text-transform: uppercase; font-size: .9rem; }
.footer-fine { color: var(--text-dim); font-size: .8rem; margin-top: 16px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(2,10,20,.78); backdrop-filter: blur(8px); padding: 20px;
  animation: fade .3s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; width: min(640px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--modal-bg); border: 1px solid var(--line);
  border-radius: 20px; padding: 40px clamp(24px, 4vw, 44px); box-shadow: var(--shadow);
  animation: rise .4s cubic-bezier(.2,.7,.2,1) both;
}
.modal-close { position: absolute; top: 16px; right: 20px; background: none; border: none; color: var(--text-dim); font-size: 2rem; line-height: 1; cursor: pointer; transition: color .2s; }
.modal-close:hover { color: var(--gold); }
.modal-body h3 { font-size: 1.9rem; margin-bottom: 6px; }
.modal-eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .74rem; color: var(--gold); margin-bottom: 14px; display: inline-flex; align-items: center; gap: 7px; }
.modal-eyebrow .type-ico { width: 16px; height: 16px; }
.match-item small .type-ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }

/* form */
.form-group { margin-bottom: 18px; }
.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-opt { border: 1px solid var(--line); border-radius: 12px; padding: 14px 10px; text-align: center; cursor: pointer; transition: all .25s; font-size: .82rem; }
.type-opt .to-emoji { display: flex; justify-content: center; margin-bottom: 8px; color: var(--gold); }
.type-opt .to-emoji .type-ico { width: 26px; height: 26px; }
.type-opt:hover { border-color: var(--gold); }
.type-opt.sel { border-color: var(--gold); background: rgba(215,178,105,.12); }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }

/* read view */
.read-message { font-family: var(--serif); font-size: 1.22rem; line-height: 1.55; color: var(--heading); white-space: pre-wrap; margin: 18px 0; padding: 20px 22px; background: var(--input-bg); border-left: 3px solid var(--gold); border-radius: 0 12px 12px 0; }
.read-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-dim); font-size: .86rem; margin-bottom: 8px; }
.read-meta b { color: var(--heading); font-weight: 500; }
.match-box { margin-top: 24px; padding: 20px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(215,178,105,.05); }
.match-box h4 { font-family: var(--sans); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.match-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.match-item:last-child { border-bottom: none; }
.match-score { font-family: var(--serif); color: var(--gold); font-size: 1.2rem; min-width: 44px; }
.match-item small { color: var(--text-dim); display: block; }
.replies-list { margin-top: 22px; }
.reply { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.reply .bc-avatar { flex-shrink: 0; }
.reply-body p { font-size: .96rem; }
.reply-body small { color: var(--text-dim); }

/* toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep)); color: #2a1f06;
  padding: 14px 26px; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 200;
  box-shadow: 0 12px 30px rgba(0,0,0,.4); opacity: 0; transition: all .4s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Settings popover
   ============================================================ */
.ai-settings { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--input-bg); }
.ai-settings.hidden { display: none; }
.ai-settings label { font-size: .78rem; color: var(--text-dim); display: block; margin-bottom: 6px; }
.ai-settings input { margin-bottom: 12px; }
.ai-settings .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .threats, .pillars-grid, .scribe-grid { grid-template-columns: 1fr; }
  .step-arrow { transform: rotate(90deg); }
}
@media (max-width: 760px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--nav-bg); backdrop-filter: blur(14px); padding: 10px 0; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 14px 28px; }
  .nav-burger { display: flex; margin-left: 12px; }
  .nav-actions { display: flex; gap: 12px; margin-left: auto; }
  .nav-actions .btn-gold { display: none; }
  .hero-pillars { gap: 12px; }
  .pillar-line { width: 30px; }
}
