/* ==========================================================================
   Valiton — valiton.org
   Design concept: after hours. Dark page, one warm lit source.
   ========================================================================== */

/* --- Fonts (self-hosted, subset to latin + typographic punctuation) ------ */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/assets/fonts/bricolage-grotesque.woff2') format('woff2');
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Instrument Sans';
  src: url('/assets/fonts/instrument-sans.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */

:root {
  --ink:       #0E1420;
  --ink-2:     #1B2333;
  --ink-3:     #2A3446;
  --amber:     #E8A33D;
  --amber-dim: #8A6224;
  --paper:     #F2F1ED;
  --mute:      #8B94A7;
  --white:     #FFFFFF;

  --display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 68ch;
  --gutter: 24px;
  --max: 1080px;
}

/* --- Reset --------------------------------------------------------------- */

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

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

body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

img, svg { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; }

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: var(--ink);
  padding: 10px 16px;
  font: 500 14px/1 var(--body);
  z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* --- Shared type --------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin-bottom: 20px;
}
.eyebrow::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--amber-dim);
  vertical-align: middle;
  margin-right: 10px;
}

/* --- Masthead ------------------------------------------------------------ */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(14, 20, 32, 0.88);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--ink-3);
}
.masthead .wrap {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--paper);
  text-decoration: none;
}
.wordmark span { color: var(--amber); }

.mast-cta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mute);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.18s ease;
}
.mast-cta strong { color: var(--paper); font-weight: 400; }
.mast-cta:hover { color: var(--amber); }
.mast-cta:hover strong { color: var(--amber); }

/* --- Hero ---------------------------------------------------------------- */

.hero { padding: 56px 0 88px; position: relative; }

/* the one lit source */
.hero::before {
  content: '';
  position: absolute;
  top: 18%;
  left: 50%;
  width: min(780px, 96vw);
  height: 420px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(232, 163, 61, 0.10), rgba(232, 163, 61, 0) 68%);
  pointer-events: none;
  z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }

.hero h1 {
  font-size: clamp(34px, 6.6vw, 66px);
  max-width: 15ch;
  margin-bottom: 22px;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--white);
}
.hero .lede {
  font-size: 18px;
  color: var(--mute);
  max-width: 56ch;
  margin-bottom: 36px;
}

/* Short laptop viewports: keep the demo panel in the first screen. */
@media (min-width: 1024px) and (max-height: 820px) {
  .hero { padding-top: 36px; }
  .hero h1 { font-size: 54px; margin-bottom: 18px; }
  .hero .lede { margin-bottom: 28px; }
  .log { min-height: 200px; }
}
.hero .lede strong { color: var(--paper); font-weight: 500; }

/* --- The chat panel (signature element) ---------------------------------- */

.panel {
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: 14px;
  max-width: 640px;
  overflow: hidden;
  box-shadow: 0 32px 70px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(232, 163, 61, 0.06);
}

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
}
.panel-bar .status { display: flex; align-items: center; gap: 9px; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(232, 163, 61, 0.9);
  flex: none;
}
.clock { color: var(--amber); font-variant-numeric: tabular-nums; }

.log {
  padding: 20px 16px 8px;
  min-height: 236px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
}

.msg { max-width: 88%; font-size: 15px; line-height: 1.55; }
.msg .who {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mute);
  margin-bottom: 6px;
}
.msg .bubble {
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--ink-3);
  color: var(--paper);
}
.msg.visitor { align-self: flex-end; text-align: right; }
.msg.visitor .bubble {
  border-bottom-right-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  text-align: left;
}
.msg.bot .bubble {
  border-bottom-left-radius: 3px;
  background: rgba(232, 163, 61, 0.06);
  border-color: rgba(232, 163, 61, 0.22);
}
.msg.bot .bubble a { color: var(--amber); text-underline-offset: 3px; }

.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--amber);
  vertical-align: -0.16em;
  margin-left: 2px;
  animation: blink 1.05s steps(1, end) infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.thinking { display: inline-flex; gap: 5px; align-items: center; padding: 4px 0; }
.thinking i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--mute);
  animation: pulse 1.25s ease-in-out infinite;
}
.thinking i:nth-child(2) { animation-delay: 0.16s; }
.thinking i:nth-child(3) { animation-delay: 0.32s; }
@keyframes pulse { 0%, 100% { opacity: 0.28; } 50% { opacity: 1; } }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 16px 14px;
}
.chips[hidden] { display: none; }
.chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  background: transparent;
  border: 1px solid var(--ink-3);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.chip:hover { color: var(--amber); border-color: var(--amber-dim); }

.ask {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--ink-3);
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.16);
}
.ask .prompt { font-family: var(--mono); font-size: 14px; color: var(--amber); flex: none; }
.ask input {
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--paper);
  font-family: var(--body);
  font-size: 15px;
  padding: 15px 0;
  caret-color: var(--amber);
}
.ask input::placeholder { color: var(--mute); opacity: 1; }
.ask input:focus { outline: none; }
.ask input:focus-visible { outline: none; }
.ask:focus-within { box-shadow: inset 0 2px 0 var(--amber); }
.ask button {
  flex: none;
  background: none;
  border: 0;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 10px 0;
  cursor: pointer;
  transition: color 0.18s ease;
}
.ask button:hover { color: var(--amber); }

.panel-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  margin-top: 14px;
  max-width: 640px;
}

/* --- Section frame ------------------------------------------------------- */

section.band {
  padding: 84px 0;
  border-top: 1px solid var(--ink-3);
}
section.band h2 {
  font-size: clamp(28px, 4.4vw, 48px);
  max-width: 20ch;
  margin-bottom: 40px;
  text-wrap: balance;
}

/* Problem — three beats */
.beats { display: grid; gap: 0; max-width: 760px; }
.beat {
  font-size: clamp(18px, 2.6vw, 24px);
  line-height: 1.4;
  font-weight: 400;
  padding: 26px 0;
  border-bottom: 1px solid var(--ink-3);
  color: var(--paper);
}
.beat:first-child { border-top: 1px solid var(--ink-3); }
.beat strong { color: var(--white); font-weight: 500; }

/* How it works — three steps */
.steps { display: grid; gap: 2px; counter-reset: step; }
.step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  padding: 26px 0;
  border-bottom: 1px solid var(--ink-3);
  align-items: start;
}
.step:first-child { border-top: 1px solid var(--ink-3); }
.step .n {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mute);
  padding-top: 5px;
}
.step h3 { font-size: 24px; margin-bottom: 8px; letter-spacing: -0.01em; }
.step p { color: var(--mute); max-width: 54ch; }

/* Trust */
.trust-lead {
  font-size: 18px;
  color: var(--mute);
  max-width: var(--measure);
  margin-bottom: 36px;
}
.trust-lead strong { color: var(--paper); font-weight: 500; }
.assurances {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  border-top: 1px solid var(--ink-3);
  padding-top: 26px;
}
.assurances li {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--paper);
  position: relative;
  padding-left: 16px;
}
.assurances li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--amber);
}

/* Price */
.price-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 28px; }
.price-num {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(64px, 13vw, 120px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.price-per { font-family: var(--mono); font-size: 16px; color: var(--mute); }

.price-facts { max-width: 58ch; margin-bottom: 40px; }
.price-facts li {
  padding: 16px 0;
  border-bottom: 1px solid var(--ink-3);
  font-size: 16px;
  color: var(--mute);
}
.price-facts li:first-child { border-top: 1px solid var(--ink-3); }
.price-facts strong {
  color: var(--paper);
  font-weight: 500;
  margin-right: 4px;
}

.cta {
  display: inline-block;
  font-family: var(--body);
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
  background: var(--amber);
  text-decoration: none;
  padding: 15px 26px;
  border-radius: 6px;
  transition: background 0.18s ease, transform 0.08s ease;
}
.cta:hover { background: #F2B455; }
.cta:active { transform: translateY(1px); }
.cta-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mute);
  margin-top: 16px;
}

/* Sourced statistics — the citation sits quietly under the claim. */
.source {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--mute);
  max-width: 62ch;
  margin-top: 22px;
}
.source a {
  color: var(--mute);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--amber-dim);
}
.source a:hover { color: var(--amber); }

/* About */
.about p {
  font-size: 18px;
  color: var(--mute);
  max-width: var(--measure);
  margin-bottom: 20px;
}
.about p strong { color: var(--paper); font-weight: 500; }
.about p:last-child { margin-bottom: 0; }
.about p.source { font-size: 12px; line-height: 1.6; }
.about p.about-sig {
  font-size: 16px;
  border-top: 1px solid var(--ink-3);
  padding-top: 22px;
  margin-top: 30px;
}

/* --- Footer -------------------------------------------------------------- */

footer.site {
  border-top: 1px solid var(--ink-3);
  padding: 56px 0 48px;
  font-size: 14px;
  color: var(--mute);
}
.foot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 64px;
  justify-content: space-between;
  margin-bottom: 40px;
}
.foot-block { max-width: 34ch; }
.foot-block h2 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin-bottom: 12px;
  text-transform: lowercase;
}
.foot-block address { font-style: normal; line-height: 1.7; }
.foot-block a { color: var(--paper); text-decoration: none; }
.foot-block a:hover { color: var(--amber); }
.foot-links { display: flex; flex-direction: column; gap: 8px; }
.foot-bottom {
  border-top: 1px solid var(--ink-3);
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 760px) {
  .hero { padding: 48px 0 64px; }
  .hero .lede { font-size: 17px; margin-bottom: 32px; }
  section.band { padding: 60px 0; }
  section.band h2 { margin-bottom: 28px; }
  .step { grid-template-columns: 40px 1fr; gap: 12px; }
  .step h3 { font-size: 20px; }
  .log { min-height: 210px; }
  .assurances { gap: 10px; flex-direction: column; }
  .foot-grid { gap: 28px; }
}

/* --- Reduced motion ------------------------------------------------------ */

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

/* ==========================================================================
   Legal pages — inverted for long-form reading
   ========================================================================== */

body.legal {
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
}

body.legal .masthead {
  background: rgba(242, 241, 237, 0.9);
  border-bottom: 1px solid rgba(14, 20, 32, 0.12);
}
body.legal .wordmark { color: var(--ink); }
body.legal .mast-cta { color: #5C6472; }
body.legal .mast-cta strong { color: var(--ink); }
body.legal .mast-cta:hover,
body.legal .mast-cta:hover strong { color: var(--amber-dim); }

body.legal .wrap { max-width: 920px; }

.legal-head {
  padding: 56px 0 32px;
  border-bottom: 1px solid rgba(14, 20, 32, 0.12);
}
.legal-head h1 {
  font-size: clamp(32px, 6vw, 48px);
  margin-bottom: 14px;
}
.legal-head .org { font-size: 17px; font-weight: 500; }
.legal-head .updated {
  font-family: var(--mono);
  font-size: 13px;
  color: #5C6472;
  margin-top: 10px;
}

.legal-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 40px 0 80px;
}

.toc { position: sticky; top: 84px; }
.toc > summary { display: none; }
.toc h2 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #5C6472;
  margin-bottom: 14px;
}
.toc ol { list-style: none; }
.toc li { margin-bottom: 2px; }
.toc a {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  color: #3A4354;
  text-decoration: none;
  padding: 5px 0 5px 14px;
  border-left: 1px solid rgba(14, 20, 32, 0.12);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toc a:hover { color: var(--ink); border-left-color: var(--amber-dim); }

/* ~68 characters per line — `ch` measures the width of "0", which runs
   narrow in this face, so the measure is set in em. */
.legal-body { max-width: 34em; }
.legal-body > section { padding-bottom: 8px; scroll-margin-top: 76px; }
.legal-body h2 {
  font-size: 24px;
  margin: 44px 0 16px;
  letter-spacing: -0.015em;
}
.legal-body > section:first-child h2 { margin-top: 0; }
.legal-body h3 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.4;
  margin: 26px 0 8px;
}
.legal-body p { margin-bottom: 16px; }
.legal-body ul { margin: 0 0 18px; }
.legal-body ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
}
.legal-body ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 5px;
  height: 1px;
  background: var(--amber-dim);
}
.legal-body strong { font-weight: 600; }
.legal-body a { color: var(--amber-dim); text-underline-offset: 3px; }
.legal-body hr {
  border: 0;
  border-top: 1px solid rgba(14, 20, 32, 0.12);
  margin: 40px 0 0;
}

.legal-body .summary-box {
  background: rgba(14, 20, 32, 0.04);
  border: 1px solid rgba(14, 20, 32, 0.1);
  border-radius: 10px;
  padding: 24px 26px;
  margin-bottom: 8px;
}
.legal-body .summary-box h2 { margin-top: 0; }
.legal-body .summary-box > :last-child { margin-bottom: 0; }

.legal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 15px;
}
.legal-body th, .legal-body td {
  text-align: left;
  vertical-align: top;
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid rgba(14, 20, 32, 0.12);
}
.legal-body th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #5C6472;
  border-bottom-color: rgba(14, 20, 32, 0.28);
}
.legal-body td:last-child, .legal-body th:last-child { padding-right: 0; }
.table-scroll { overflow-x: auto; }

.legal-body .caps {
  font-size: 15px;
  line-height: 1.6;
  color: #3A4354;
}

.legal-body address {
  font-style: normal;
  line-height: 1.7;
}

.legal-foot {
  border-top: 1px solid rgba(14, 20, 32, 0.12);
  padding: 28px 0 56px;
  font-family: var(--mono);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  justify-content: space-between;
  color: #5C6472;
}
.legal-foot a { color: var(--ink); text-decoration: none; }
.legal-foot a:hover { color: var(--amber-dim); }

@media (max-width: 860px) {
  .legal-layout { grid-template-columns: 1fr; gap: 8px; padding-top: 28px; }
  .toc {
    position: static;
    border: 1px solid rgba(14, 20, 32, 0.12);
    border-radius: 10px;
    padding: 0 16px;
    margin-bottom: 32px;
  }
  .toc > summary {
    display: block;
    list-style: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 13px;
    padding: 14px 0;
    color: #3A4354;
  }
  .toc > summary::-webkit-details-marker { display: none; }
  .toc > summary::after { content: ' +'; color: var(--amber-dim); }
  .toc[open] > summary::after { content: ' −'; }
  .toc h2 { display: none; }
  .toc ol { padding-bottom: 12px; }
  .legal-head { padding: 36px 0 24px; }
}

@media print {
  body.legal { background: #fff; color: #000; font-size: 11pt; }
  .masthead, .toc, .legal-foot { display: none; }
  .legal-layout { display: block; padding: 0; }
  .legal-body { max-width: none; }
  .legal-body a { color: #000; }
}
