/*
 * Chezalab
 * Palette: warm, natural, flat colour. No gradients or glows.
 *   paper  #FBF7F1  page background         ink    #1F1A17  text
 *   sand   #F3ECE2  alternate sections       muted  #685E56  secondary text (5.9:1 on paper)
 *   card   #FFFFFF  surfaces                 line   #E3D9CC  borders
 *   clay   #B54A24  primary / actions (5.2:1 with white)
 *   forest #2F6B4F  secondary / success (6.3:1 with white)
 *   ochre  #D9962B  highlights only, never body text
 */
:root {
  --paper: #fbf7f1;
  --sand: #f3ece2;
  --card: #ffffff;
  --line: #e3d9cc;
  --ink: #1f1a17;
  --muted: #685e56;
  --clay: #b54a24;
  --clay-dark: #963b1b;
  --clay-tint: #f6e4db;
  --forest: #2f6b4f;
  --forest-tint: #e2eee7;
  --ochre: #d9962b;
  --ochre-tint: #f8ecd5;
  --danger: #b3261e;
  --radius: 14px;
  --wrap: 1140px;
  --shadow: 0 1px 2px rgba(31, 26, 23, .06), 0 8px 24px -12px rgba(31, 26, 23, .18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--clay); text-underline-offset: 3px; }
a:hover { color: var(--clay-dark); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(2.6rem, 5.6vw, 4.3rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 750; max-width: 24ch; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, 760px); }
.wrap--wide { width: min(100% - 2.5rem, 1280px); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--clay); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; color: #fff; }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.eyebrow {
  font-family: var(--mono);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--forest);
  margin-bottom: 1rem;
}
.molten { color: var(--clay); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.fine { font-size: .85rem; color: var(--muted); margin: .75rem 0 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 700; font-size: 1rem;
  color: #fff;
  background: var(--clay);
  border: 1px solid var(--clay);
  border-radius: 999px;
  padding: .8rem 1.35rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--clay-dark); border-color: var(--clay-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--small { padding: .5rem 1rem; font-size: .9rem; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--sand); border-color: var(--muted); color: var(--ink); }
.btn--push { margin-left: auto; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--clay); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish--danger { color: var(--danger); }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 241, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__inner { display: flex; align-items: center; gap: 2rem; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: -0.02em; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand b { color: var(--clay); font-weight: 800; }
.nav nav { margin-left: auto; }
.nav__links { display: flex; gap: 1.6rem; list-style: none; margin: 0; padding: 0; }
.nav__links a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav__links a:hover { color: var(--ink); }
.nav__signin { color: var(--ink); text-decoration: none; font-size: .95rem; font-weight: 600; }
.nav__signin:hover { color: var(--clay); }

/* Hero */
.hero { padding: clamp(3.5rem, 8vw, 6rem) 0 4rem; }
.hero__grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 3.5rem; align-items: center; }
.hero__grid > * { min-width: 0; }

/* Signup */
.signup { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; max-width: 480px; }
.signup input {
  flex: 1 1 220px;
  font: inherit; color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .8rem 1.2rem;
}
.signup input::placeholder { color: #9a8f86; }
.signup input:focus { border-color: var(--forest); outline: none; box-shadow: 0 0 0 3px var(--forest-tint); }
.signup__msg { flex-basis: 100%; margin: .2rem 0 0 .4rem; font-size: .9rem; min-height: 1.4em; }
.signup__msg.is-ok { color: var(--forest); }
.signup__msg.is-err { color: var(--danger); }
.signup--center { margin-inline: auto; justify-content: center; }
.signed-in-cta { margin-top: 2rem; }
.signed-in-cta .fine { margin-top: .75rem; }

/* Demo window */
.demo { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.demo__bar { display: flex; align-items: center; gap: 6px; padding: .65rem .9rem; background: var(--sand); border-bottom: 1px solid var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.demo__title { margin-left: .6rem; font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.demo__prompt { font-family: var(--mono); font-size: .88rem; padding: .85rem 1rem; color: var(--ink); border-bottom: 1px solid var(--line); min-height: 3.1em; }
.demo__caret { color: var(--forest); margin-right: .5rem; }
.cursor { display: inline-block; width: .55em; height: 1.05em; vertical-align: -0.15em; background: var(--clay); margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#game { display: block; width: 100%; height: auto; aspect-ratio: 560 / 300; background: #f3e7d6; }
.demo__status { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--mono); font-size: .75rem; color: var(--muted); padding: .6rem 1rem; border-top: 1px solid var(--line); }
#status { color: var(--forest); }

/* Strip */
.strip { border-block: 1px solid var(--line); background: var(--sand); }
.strip__inner { display: grid; grid-template-columns: repeat(4, 1fr); }
.strip__inner > div { padding: 1.6rem 1rem; text-align: center; }
.strip__inner > div + div { border-left: 1px solid var(--line); }
.strip strong { display: block; font-size: 1.5rem; letter-spacing: -0.02em; color: var(--clay); }
.strip span { color: var(--muted); font-size: .9rem; }

/* Sections */
.section { padding: clamp(4rem, 9vw, 6.5rem) 0; }
.section--alt { background: var(--sand); border-block: 1px solid var(--line); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 2.6rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; }
.card p { color: var(--muted); margin: 0; }
.card__icon {
  display: grid; place-items: center;
  width: 42px; height: 42px; margin-bottom: 1rem;
  border-radius: 10px;
  background: var(--clay-tint);
  color: var(--clay); font-size: 1.2rem;
}
.cards .card:nth-child(3n+2) .card__icon { background: var(--forest-tint); color: var(--forest); }
.cards .card:nth-child(3n) .card__icon { background: var(--ochre-tint); color: #8a5a10; }
.card--plain { background: transparent; }

.steps { list-style: none; padding: 0; margin: 2.6rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.steps li { border-top: 2px solid var(--line); padding-top: 1.4rem; }
.steps li:first-child { border-top-color: var(--clay); }
.steps__n { display: block; font-family: var(--mono); color: var(--clay); margin-bottom: .6rem; }
.steps p { color: var(--muted); }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 1.1rem 0; }
details:first-of-type { margin-top: 2rem; border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 650; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--clay); font-weight: 400; font-size: 1.4rem; line-height: 1; transition: transform .2s ease; }
details[open] summary::after { transform: rotate(45deg); }
details p { color: var(--muted); margin: .8rem 0 0; }

/* CTA */
.cta { text-align: center; }
.cta h2 { margin-inline: auto; }
.cta p { color: var(--muted); }
.cta .btn[data-signed-in] { margin-top: 1rem; }

/* Footer */
.footer { background: var(--sand); border-top: 1px solid var(--line); padding: 3.5rem 0 2rem; font-size: .93rem; }
.footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.footer__about p { color: var(--muted); max-width: 32ch; margin-top: .8rem; }
.footer h2 { font-size: .78rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 .9rem; font-weight: 600; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.footer a { color: var(--ink); text-decoration: none; }
.footer a:hover { color: var(--clay); text-decoration: underline; }
.footer__bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); }
.footer__bottom a { color: var(--muted); }

/* Legal / content pages */
.doc { padding: 3.5rem 0 5rem; }
.doc h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.doc h2 { font-size: 1.35rem; max-width: none; margin-top: 2.2rem; }
.doc h3 { margin-top: 1.4rem; }
.doc p, .doc li { color: #3d3530; }
.doc ul { padding-left: 1.2rem; }
.doc li { margin-bottom: .35rem; }
.doc table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .93rem; }
.doc th, .doc td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { background: var(--sand); font-weight: 650; }
.doc .updated { color: var(--muted); font-size: .9rem; }
.doc .callout { background: var(--forest-tint); border: 1px solid #c3dccf; border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.doc .callout p { margin: 0; color: var(--ink); }

/* Forms on content pages */
.form { margin: 1.4rem 0 2rem; display: block; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form .fine { margin-top: .4rem; }
.form-done { margin: 1.4rem 0 2rem; border-color: #c3dccf; background: var(--forest-tint); }
.form-done:focus { outline: none; }
.check-row { display: flex; gap: .7rem; align-items: flex-start; margin: .4rem 0 1rem; color: var(--ink); }
.check-row input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--clay); flex: none; }
.turnstile { margin: .2rem 0 .8rem; }
/* Nothing to show until Turnstile actually needs the visitor; avoids layout shift. */
.turnstile:empty { display: none; }
.signup .turnstile { flex-basis: 100%; }
/* Honeypot: off-screen for people, present for bots. */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Account pages */
.page { min-height: 70vh; display: grid; place-items: center; padding: 3rem 0; }
.panel {
  width: min(100% - 2.5rem, 440px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2.2rem; box-shadow: var(--shadow);
}
.panel--wide { width: min(100% - 2.5rem, 640px); }
.panel h1 { font-size: 1.8rem; }
.panel h2 { font-size: 1.15rem; max-width: none; }
.panel p { color: var(--muted); }
.panel .hint { font-size: .9rem; }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 1.8rem 0; }
.panel .signup__msg { margin: .8rem 0 0; }
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .72rem .9rem;
}
.field textarea { resize: vertical; min-height: 6rem; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--forest); outline: none; box-shadow: 0 0 0 3px var(--forest-tint); }
.field span .muted { float: right; font-family: var(--mono); font-size: .75rem; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.badge {
  display: inline-block; font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .28rem .6rem; border-radius: 999px; background: var(--forest-tint); color: var(--forest);
}
.badge--muted { background: var(--sand); color: var(--muted); }

/* Dashboard */
.dash { background: var(--paper); }
.dash__who { margin-left: auto; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.dash__loading { text-align: center; padding: 4rem 0; }
.dash__layout { display: grid; grid-template-columns: 220px 1fr; gap: 2.5rem; padding: 2rem 0 4rem; align-items: start; }
.dash__side { position: sticky; top: 88px; }
.dash__side nav { display: flex; flex-direction: column; gap: .2rem; }
.dash__link {
  display: flex; justify-content: space-between; align-items: center;
  padding: .55rem .8rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .95rem;
}
.dash__link:hover { background: var(--sand); color: var(--ink); }
.dash__link.is-active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--clay), var(--shadow); }
.dash__link.is-soon { opacity: .6; cursor: default; }
.dash__link.is-soon:hover { background: none; color: var(--muted); }
.dash__link em { font-style: normal; font-family: var(--mono); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--forest); }
.dash__main h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
.dash__main h2 { font-size: 1.1rem; max-width: none; margin-bottom: .8rem; }
.dash__main section > .card + .card { margin-top: 1rem; }
.dash__sub { color: var(--muted); display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.dash__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.dash__head .dash__sub { max-width: 60ch; }
.dash__welcome {
  display: flex; flex-direction: column; gap: .2rem; margin-bottom: 1.6rem; padding: 1rem 1.2rem;
  border: 1px solid #c3dccf; background: var(--forest-tint); border-radius: var(--radius);
}
.dash__welcome span { color: #2b4a3b; }
.dash__grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.card h3 { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .15rem; }
.tile__label { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.tile strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.tile__hint { color: var(--muted); font-size: .85rem; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.checklist li { display: flex; align-items: center; gap: .7rem; }
.checklist a { color: var(--ink); }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; position: relative; background: var(--card); }
.checklist .is-done .check { border-color: var(--forest); background: var(--forest); }
.checklist .is-done .check::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checklist .is-done, .checklist .is-done a { color: var(--muted); text-decoration: line-through; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.recent a { color: var(--ink); font-weight: 600; }
.empty { color: var(--muted); }
.empty p { margin-bottom: .8rem; }
.project-form { margin-bottom: 1.4rem; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.projects .empty { grid-column: 1 / -1; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; }
.project { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; display: flex; flex-direction: column; gap: .4rem; }
.project__head { display: flex; justify-content: space-between; gap: .6rem; align-items: flex-start; }
.project__head h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
.project__meta { color: var(--muted); font-size: .85rem; margin: 0; }
.project__prompt { color: #3d3530; font-size: .93rem; margin: .3rem 0 0; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.project__actions { margin-top: auto; padding-top: .6rem; display: flex; justify-content: flex-end; }
.name-prompt { margin-top: 1.2rem; max-width: 520px; }
.name-prompt .field { margin-bottom: 0; }
.name-prompt .row input { flex: 1 1 200px; width: auto; }

/* Responsive */
@media (max-width: 960px) {
  .hero__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__about { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .dash__layout { grid-template-columns: 1fr; gap: 1rem; padding-top: 1rem; }
  .dash__side { position: static; }
  .dash__side nav { flex-direction: row; overflow-x: auto; gap: .3rem; padding-bottom: .3rem; }
  .dash__link { white-space: nowrap; }
  .dash__link.is-soon { display: none; }
  .dash__grid2, .tiles { grid-template-columns: 1fr; }
  .dash__who { display: none; }
}
@media (max-width: 720px) {
  .nav__inner { gap: 1rem; }
  .nav__links { display: none; }
  .nav nav { margin-left: auto; }
  .strip__inner { grid-template-columns: repeat(2, 1fr); }
  .strip__inner > div:nth-child(3) { border-left: 0; }
  .strip__inner > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .cards, .steps, .form__row { grid-template-columns: 1fr; }
  .demo__meta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
