/* ---------- Tokens ---------- */
:root {
  --lagoon: #0d2a2f;
  --lagoon-2: #143a40;
  --water: #3fa7a0;
  --stone: #e6e0d2;
  --brass: #d4a94f;
  --muted: #6f8a8c;

  --font-display: "Bodoni Moda", "Didot", Georgia, serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --nav-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
  margin: 0;
  background: var(--lagoon);
  color: var(--stone);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* faint city-block grid */
  background-image:
    linear-gradient(rgba(230, 224, 210, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 224, 210, .035) 1px, transparent 1px);
  background-size: 72px 72px;
}

a { color: inherit; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .95em; }

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

/* ---------- Progress bar ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brass);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 60;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
  z-index: 50;
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.nav.scrolled {
  background: rgba(13, 42, 47, .92);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(230, 224, 210, .08);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  text-decoration: none;
  letter-spacing: .02em;
}

.nav-links { display: flex; gap: .25rem; }
.nav-links a {
  position: relative;
  padding: .5rem .9rem;
  text-decoration: none;
  font-weight: 500;
  color: rgba(230, 224, 210, .75);
  transition: color .2s;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: .9rem; right: .9rem; bottom: .2rem;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav-links a:hover { color: var(--stone); }
.nav-links a.active { color: var(--stone); }
.nav-links a.active::after { transform: scaleX(1); }

.menu-btn {
  display: none;
  width: 44px; height: 44px;
  background: none; border: 0; cursor: pointer;
  position: relative;
}
.menu-btn span {
  position: absolute;
  left: 11px; right: 11px;
  height: 2px;
  background: var(--stone);
  transition: transform .3s var(--ease), top .3s var(--ease);
}
.menu-btn span:nth-child(1) { top: 17px; }
.menu-btn span:nth-child(2) { top: 25px; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { top: 21px; transform: rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1.5rem;
  border-radius: 6px;
  font: 600 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .2s var(--ease), background .2s, color .2s, border-color .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { background: var(--brass); color: var(--lagoon); }
.btn.primary:hover { background: #ffc653; transform: translateY(-2px); }
.btn.ghost { border-color: rgba(230, 224, 210, .35); color: var(--stone); }
.btn.ghost:hover { border-color: var(--stone); transform: translateY(-2px); }
.btn.small { padding: .6rem 1rem; font-size: .95rem; margin-top: 1.25rem; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding: calc(var(--nav-h) + 2rem) max(clamp(1.25rem, 5vw, 4rem), calc((100vw - 1280px) / 2)) 6rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.4rem, 9vw, 7rem);
  line-height: .95;
  margin: 0 0 1.5rem;
  letter-spacing: .01em;
}
.hero h1 .word { display: inline-block; white-space: nowrap; margin-right: .25em; }
.hero h1 .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(-.5em) scale(1.35);
  animation: stamp .55s var(--ease) forwards;
  animation-delay: calc(var(--i) * 55ms + 150ms);
}
@keyframes stamp {
  60% { opacity: 1; transform: translateY(.04em) scale(.98); }
  100% { opacity: 1; transform: none; }
}

.lede {
  max-width: 34rem;
  font-size: 1.2rem;
  color: rgba(230, 224, 210, .82);
  margin: 0 0 2rem;
  opacity: 0;
  animation: rise .7s var(--ease) 900ms forwards;
}
.cta-row {
  display: flex; flex-wrap: wrap; gap: .85rem;
  opacity: 0;
  animation: rise .7s var(--ease) 1050ms forwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Chat demo ---------- */
.chat {
  background: var(--lagoon-2);
  border: 1px solid rgba(230, 224, 210, .12);
  border-radius: 14px;
  display: flex; flex-direction: column;
  min-height: 420px;
  position: relative; z-index: 1;
}
.chat-bar {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1.1rem;
  font-size: .9rem; color: rgba(230, 224, 210, .65);
  border-bottom: 1px solid rgba(230, 224, 210, .1);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--water); box-shadow: 0 0 0 0 rgba(63,167,160,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(63,167,160,0); } 100% { box-shadow: 0 0 0 0 rgba(63,167,160,0); } }
.chat-log { flex: 1; padding: 1.1rem; display: flex; flex-direction: column; gap: .8rem; overflow-y: auto; max-height: 340px; }
.empty { margin: auto; color: rgba(230, 224, 210, .55); text-align: center; }
.msg { max-width: 88%; padding: .7rem 1rem; border-radius: 14px; animation: rise .35s var(--ease); white-space: pre-line; }
.msg.user { align-self: flex-end; background: var(--brass); color: var(--lagoon); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: rgba(230, 224, 210, .08); border-bottom-left-radius: 4px; }
.typing { display: inline-flex; gap: 4px; padding: .3rem 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--stone); opacity: .4; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: 1; transform: translateY(-3px); } }
.prompts { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.1rem 1.2rem; border-top: 1px solid rgba(230, 224, 210, .1); }
.prompts button {
  font: 500 .92rem var(--font-body); color: var(--stone); background: transparent; cursor: pointer;
  border: 1.5px solid rgba(230, 224, 210, .3); border-radius: 999px; padding: .5rem .95rem;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.prompts button:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); transform: translateY(-2px); }
.prompts button:disabled { opacity: .5; cursor: default; }

/* waves */
.hero { position: relative; overflow: hidden; }
.waves { position: absolute; left: 0; bottom: 0; width: 200%; height: 90px; pointer-events: none; }
.waves path { fill: rgba(63, 167, 160, .12); }
.waves .w2 { fill: rgba(63, 167, 160, .2); }
.waves .w1 { animation: drift 16s linear infinite; }
.waves .w2 { animation: drift 10s linear infinite reverse; }
@keyframes drift { to { transform: translateX(-360px); } }
.hero > * { position: relative; }
.hero > .waves { position: absolute; }

/* ---------- Sections ---------- */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 5vw, 4rem);
}
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
  margin: 0 0 1rem;
  position: relative;
  padding-bottom: .9rem;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 96px; height: 6px;
  background: repeating-linear-gradient(-45deg, var(--brass) 0 10px, var(--lagoon) 10px 20px);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .8s var(--ease) .2s;
}
.section-title.in::after { transform: scaleX(1); }
.section-sub { max-width: 34rem; color: rgba(230, 224, 210, .75); margin: 0 0 2rem; }

/* Scroll reveal for headings, file card and values */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Features ---------- */
.features {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2.5rem;
  margin-top: 2.5rem;
}

.tabs { position: relative; display: flex; flex-direction: column; }
.tabs button {
  text-align: left;
  background: none; border: 0; cursor: pointer;
  color: rgba(230, 224, 210, .6);
  font: 500 1.1rem/1.2 var(--font-body);
  padding: 1rem 1.25rem;
  transition: color .25s, background .25s;
}
.tabs button:hover { color: var(--stone); background: rgba(230, 224, 210, .04); }
.tabs button[aria-selected="true"] { color: var(--stone); }

.indicator {
  position: absolute;
  left: 0; top: 0;
  width: 4px; height: 0;
  background: var(--brass);
  transform: translate(var(--ix, 0), var(--iy, 0));
  transition: transform .4s var(--ease), height .4s var(--ease), width .4s var(--ease);
}

.panels {
  background: var(--lagoon-2);
  border: 1px solid rgba(230, 224, 210, .1);
  border-radius: 14px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  min-height: 320px;
}
.panel { animation: swap .5s var(--ease); }
.panel[hidden] { display: none; }
@keyframes swap {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}
.panel h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  margin: 0 0 .75rem;
}
.panel p { margin: 0 0 1.25rem; max-width: 36rem; color: rgba(230, 224, 210, .85); }
.panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.panel li { padding-left: 1.5rem; position: relative; }
.panel li::before {
  content: "";
  position: absolute; left: 0; top: .55em;
  width: 10px; height: 10px;
  background: var(--brass);
  transform: rotate(45deg);
}

/* ---------- Download ---------- */
.file {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  background: var(--lagoon-2);
  border: 1px solid rgba(230, 224, 210, .1);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.file-icon {
  width: 56px; height: 64px;
  display: grid; place-items: end center;
  padding-bottom: 8px;
  background: var(--muted);
  color: var(--stone);
  font: 700 .8rem var(--font-body);
  border-radius: 6px 16px 6px 6px;
}
.file-meta { display: grid; flex: 1 1 200px; }
.file-meta span { color: rgba(230, 224, 210, .65); font-size: .95rem; }

.kv { margin: 0; display: grid; gap: .75rem; }
.kv-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.25rem;
  border-left: 4px solid var(--muted);
  background: rgba(230, 224, 210, .04);
  border-radius: 0 8px 8px 0;
}
.kv dt { color: rgba(230, 224, 210, .6); font-weight: 500; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.copy {
  font: 600 .9rem var(--font-body);
  padding: .5rem .9rem;
  border-radius: 6px;
  background: transparent;
  color: var(--stone);
  border: 2px solid rgba(230, 224, 210, .3);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.copy:hover { border-color: var(--stone); }
.copy.done { background: var(--water); border-color: var(--water); color: var(--lagoon); }

/* ---------- Footer & toast ---------- */
.footer {
  display: flex; justify-content: space-between; gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 5vw, 4rem) 3rem;
  border-top: 1px solid rgba(230, 224, 210, .1);
  color: rgba(230, 224, 210, .65);
}
.footer p { margin: 0; font-family: var(--font-display); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--stone); }

.toast {
  position: fixed;
  left: 50%; bottom: 1.5rem;
  transform: translate(-50%, 140%);
  background: var(--stone);
  color: var(--lagoon);
  font-weight: 600;
  padding: .8rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  transition: transform .4s var(--ease);
  z-index: 70;
  max-width: calc(100vw - 2rem);
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .features { grid-template-columns: 1fr; gap: 1.25rem; }
  .tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; padding: .9rem 1rem; }
  .indicator { height: 4px; width: 0; top: auto; bottom: 0; }
}

@media (max-width: 720px) {
  .menu-btn { display: block; }
  .nav-links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    background: rgba(13, 42, 47, .98);
    padding: .5rem clamp(1.25rem, 5vw, 4rem) 1.25rem;
    border-bottom: 1px solid rgba(230, 224, 210, .1);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform .4s var(--ease), opacity .3s, visibility .4s;
  }
  .nav-links.open { transform: none; opacity: 1; visibility: visible; }
  .nav-links a { padding: .9rem 0; font-size: 1.1rem; }
  .nav-links a::after { left: 0; right: auto; width: 40px; }
  .kv-row { grid-template-columns: 1fr auto; }
  .kv dt { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}


/* ---------- Code gate ---------- */
.file-icon { position: relative; transition: background .4s var(--ease); }
.file-icon::before {
  content: ""; position: absolute; top: 9px; left: 50%; width: 14px; height: 11px;
  transform: translateX(-50%); border: 3px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0;
  transition: transform .4s var(--ease);
}
.file[data-state="locked"] .file-icon { background: #3b5558; }
.file[data-state="open"] .file-icon { background: var(--water); color: var(--lagoon); }
.file[data-state="open"] .file-icon::before { transform: translate(-50%, -4px) rotate(-28deg); transform-origin: right bottom; }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.gate { margin-top: 1.5rem; max-width: 560px; transition: opacity .4s var(--ease), transform .4s var(--ease); }
.gate.done { opacity: 0; transform: translateY(-8px); pointer-events: none; height: 0; margin: 0; overflow: hidden; }
.gate label { display: block; font-weight: 600; margin-bottom: .5rem; }
.gate-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.gate-row input {
  flex: 1 1 220px; min-width: 0;
  font: 500 1rem ui-monospace, Menlo, Consolas, monospace; color: var(--stone);
  background: rgba(230, 224, 210, .06);
  border: 2px solid rgba(230, 224, 210, .25); border-radius: 6px; padding: .8rem 1rem;
  transition: border-color .2s;
}
.gate-row input:focus { outline: none; border-color: var(--brass); }
.gate.bad .gate-row input { border-color: #e0654f; animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.gate-msg { min-height: 1.5em; margin: .6rem 0 0; color: #f0917f; font-size: .95rem; }
.kv { margin-top: 1.5rem; }
.kv:not([hidden]) .kv-row { animation: rise .5s var(--ease) backwards; }
.kv:not([hidden]) .kv-row:nth-child(2) { animation-delay: .1s; }
