/* ============================================================
   Optimal — menu profitability for restaurants
   Design system: "the menu as a financial document"
   ============================================================ */

:root {
  --ivory: #FBF7F1;
  --panel: #F4EEE4;
  --dark: #1C1917;
  --ink: #1C1917;
  --body: #6B6259;
  --muted: #8A7F73;
  --hairline: #E6DFD4;
  /* Quadrant colours — functional only, never decorative.
     The four brand hexes below are used for figures, dots and leaders. */
  --star: #128A55;
  --plowhorse: #B07B1E;
  --puzzle: #3C6E9F;
  --dog: #C4553D;
  /* Chip fills: contrast-checked variants of the quadrant colours.
     White 11px bold text on the raw hexes measures below WCAG 4.5:1
     (e.g. plowhorse 3.68:1, star 4.38:1, dog 4.46:1), so chips use
     these darkened fills which all pass 4.5:1 with white text. */
  --star-chip: #11824F;
  --plowhorse-chip: #96690F;
  --puzzle-chip: #3C6E9F;
  --dog-chip: #B04B35;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Inter", "Public Sans", -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 28px; }
.measure { max-width: 66ch; }

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.017em;
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 { font-size: 44px; }
h2 { font-size: 34px; }
h3 { font-size: 20px; letter-spacing: -0.01em; }
h4 { font-size: 16px; }
p { margin: 0 0 1em; }
strong { color: var(--ink); font-weight: 600; }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--star); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--dark);
  color: var(--ivory);
  padding: 10px 18px;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 12px; top: 12px; color: var(--ivory); }

/* ---------- labels / mono tags ---------- */
.tag, .kicker {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker { display: block; margin-bottom: 14px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums lining-nums; }

/* ---------- header ---------- */
.site-head {
  border-bottom: 1px solid var(--hairline);
  background: var(--ivory);
}
.head-in {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-top: 18px;
  padding-bottom: 18px;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 10px;
  vertical-align: 2px;
}
.site-nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--body);
  text-decoration: none;
  font-size: 15px;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.btn {
  display: inline-block;
  font-weight: 600;
  font-size: 15px;
  padding: 11px 22px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
}
.btn:hover { background: var(--ink); color: var(--ivory); }
.btn-cta {
  background: var(--star);
  border-color: var(--star);
  color: #fff;
  white-space: nowrap;
}
.btn-cta:hover { background: #0E7A49; border-color: #0E7A49; color: #fff; }
.btn-dark {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--ivory);
}
.btn-dark:hover { background: #000; color: #fff; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  padding: 72px 0 64px;
  align-items: start;
}
.hero-copy p { font-size: 17px; }
.hero-cta { margin-top: 26px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero-note { font-size: 14px; color: var(--muted); margin-top: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 30px 32px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 12px;
  margin-bottom: 8px;
}
.panel-title { font-weight: 700; color: var(--ink); font-size: 15px; }
.panel-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* ---------- the menu row (signature) ---------- */
.menu-list { margin: 0; }
.mrow {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
}
.mrow-name { color: var(--ink); font-size: 16px; white-space: nowrap; }
.mrow-leader {
  flex: 1 1 auto;
  border-bottom: 1px dotted var(--muted);
  min-width: 24px;
  transform: translateY(-4px);
}
.mrow-units {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}
.mrow-cm { font-weight: 600; font-size: 16px; white-space: nowrap; }
.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  border-radius: 4px;
  padding: 3px 8px 2px;
  white-space: nowrap;
}
.q-star { color: var(--star); }
.q-plowhorse { color: var(--plowhorse); }
.q-puzzle { color: var(--puzzle); }
.q-dog { color: var(--dog); }
.chip-star { background: var(--star-chip); }
.chip-plowhorse { background: var(--plowhorse-chip); }
.chip-puzzle { background: var(--puzzle-chip); }
.chip-dog { background: var(--dog-chip); }
.pos-figure { color: var(--star); font-weight: 600; }
.neg-figure { color: var(--dog); font-weight: 600; }

/* reveal animation: rows top-to-bottom, 70ms stagger, margin + chip last */
.js .menu-list[data-reveal] .mrow { opacity: 0; transform: translateY(10px); }
.js .menu-list[data-reveal] .mrow.in {
  opacity: 1;
  transform: none;
  transition: opacity 400ms var(--ease), transform 400ms var(--ease);
}
.js .menu-list[data-reveal] .mrow .mrow-cm,
.js .menu-list[data-reveal] .mrow .chip { opacity: 0; }
.js .menu-list[data-reveal] .mrow.in .mrow-cm,
.js .menu-list[data-reveal] .mrow.in .chip {
  opacity: 1;
  transition: opacity 300ms var(--ease) 160ms;
}

/* ---------- the one move band ---------- */
.one-move {
  background: var(--dark);
  color: var(--ivory);
  padding: 56px 0;
  margin: 64px 0;
}
.one-move .tag { color: #A79C90; }
.one-move-in {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.one-move-text { font-size: 22px; font-weight: 600; color: var(--ivory); max-width: 30ch; letter-spacing: -0.01em; margin: 0; }
.one-move-figure {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.017em;
  color: #35B87E;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}
.one-move-sub { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #A79C90; display: block; margin-top: 6px; }

/* ---------- sections / rules ---------- */
.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--hairline); }
.rule { border: 0; border-top: 1px solid var(--hairline); margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }

.step { border-top: 2px solid var(--ink); padding-top: 18px; }
.step-num { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--muted); display: block; margin-bottom: 10px; }
.step h3 { margin-bottom: 8px; }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.stat-num { font-size: 34px; font-weight: 700; letter-spacing: -0.017em; color: var(--ink); display: block; }
.stat-label { font-size: 14px; color: var(--body); }

/* POS strip */
.pos-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--body);
  align-items: baseline;
}

/* ---------- the matrix ---------- */
.matrix-wrap { margin: 24px 0 8px; }
.matrix { width: 100%; height: auto; display: block; }
.mx-axis { stroke: var(--muted); stroke-width: 1; }
.mx-mid { stroke: var(--hairline); stroke-width: 1; stroke-dasharray: 4 4; }
.mx-axis-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; fill: var(--muted); text-transform: uppercase; }
.mx-corner { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.mx-pt { stroke: var(--ivory); stroke-width: 1.5; }
.mx-lbl { font-family: var(--mono); font-size: 10.5px; fill: var(--body); }
.js .matrix[data-settle] .mx-pt, .js .matrix[data-settle] .mx-lbl {
  opacity: 0;
  transform: translateY(26px);
}
.js .matrix[data-settle].settled .mx-pt, .js .matrix[data-settle].settled .mx-lbl {
  opacity: 1;
  transform: none;
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}

/* ---------- tables ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 24px 0;
}
table.data caption {
  text-align: left;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
}
table.data th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--ink);
  padding: 8px 10px 8px 0;
}
table.data td {
  border-bottom: 1px solid var(--hairline);
  padding: 9px 10px 9px 0;
  color: var(--body);
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
table.data td.dish { color: var(--ink); }
table.data tr:hover td { background: var(--panel); }

/* ---------- forms ---------- */
.form-block { background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px; padding: 40px; }
.rform, .nform { max-width: 640px; }
.field { margin-bottom: 20px; }
.field label, .field legend {
  display: block;
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 6px;
}
.field .hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="file"],
.field select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 10px 12px;
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--star);
  outline-offset: 1px;
  border-color: var(--star);
}
.field fieldset { border: 0; margin: 0; padding: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.radio-row label { font-weight: 400; color: var(--body); display: flex; align-items: center; gap: 7px; margin: 0; }
.check-row { display: flex; gap: 10px; align-items: flex-start; }
.check-row input { margin-top: 5px; flex: 0 0 auto; }
.check-row label { font-weight: 400; color: var(--body); font-size: 14px; margin: 0; }

/* honeypot: hidden by CSS positioning, never display:none */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* notices */
.notice {
  border-radius: 8px;
  padding: 16px 20px;
  margin: 0 0 24px;
  font-size: 15px;
}
.notice-ok { background: #E9F4EE; border: 1px solid #BFE0CE; color: #175C3C; }
.notice-err { background: #F9ECE8; border: 1px solid #EBC9BF; color: #7C3A2A; }

/* email typo chip */
.typo-chip {
  display: none;
  margin-top: 8px;
  font-size: 13px;
  background: #FDF6E8;
  border: 1px solid #EAD9B0;
  color: #6B5312;
  border-radius: 6px;
  padding: 8px 12px;
}
.typo-chip.show { display: block; }
.typo-chip button {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0 0 0 6px;
  cursor: pointer;
  text-decoration: underline;
}

.field-error { border-color: var(--dog) !important; }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--hairline);
  background: var(--panel);
  padding: 56px 0 40px;
  margin-top: 64px;
}
.foot-grid { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 48px; }
.foot-nav a { display: block; color: var(--body); text-decoration: none; padding: 3px 0; font-size: 15px; }
.foot-nav a:hover { color: var(--ink); }
.foot-base {
  border-top: 1px solid var(--hairline);
  margin-top: 40px;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.nform { max-width: none; }
.nform .field { margin-bottom: 14px; }

/* ---------- result / confirm pages ---------- */
.result-box { background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px; padding: 36px 40px; margin: 40px 0; }
.kv { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--hairline); font-size: 15px; }
.kv b { color: var(--ink); font-weight: 600; min-width: 180px; }

/* spacing utilities (CSP-safe, no inline styles) */
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mt28 { margin-top: 28px; }
.small { font-size: 15px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 48px 0; }
  .grid-2, .grid-3, .stats, .foot-grid { grid-template-columns: 1fr; }
  h1 { font-size: 34px; }
  .head-in { flex-wrap: wrap; gap: 14px; }
  .site-nav { margin-left: 0; order: 3; width: 100%; }
  .form-block { padding: 28px 22px; }
}

/* ---------- reduced motion: everything at final state ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .menu-list[data-reveal] .mrow,
  .js .menu-list[data-reveal] .mrow .mrow-cm,
  .js .menu-list[data-reveal] .mrow .chip,
  .js .matrix[data-settle] .mx-pt,
  .js .matrix[data-settle] .mx-lbl {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
