/*
 * Shared layout and components for the three sites (spec: design/concepts-1129/SPEC.md on branch design/concepts-1129).
 * Each site's brand.css sets the tokens below and adds its own touches. No inline styles anywhere: CSP is style-src 'self'.
 */
:root {
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font-body);
  --font-num: var(--font-body);
  --h-weight: 700;
  --ink: #16181d;
  --muted: #4a5160;
  --line: #d9dce1;
  --input-line: #767c86; /* 4.4:1 on white: visible field borders */
  --bg: #ffffff;
  --panel: #f4f6f9;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-hover: #1e40af;
  --accent-soft: #eef3ff;
  --link: var(--accent);
  --focus: #b45309;
  --error: #b42318;
  --radius: 12px;
  --card-radius: 18px;
  --btn-radius: 12px;
  --header-bg: #ffffff;
  --header-ink: var(--ink);
  --header-muted: var(--muted);
  --hero-bg: #ffffff;
  --hero-ink: var(--ink);
  --hero-muted: var(--muted);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 12px 32px -12px rgba(0, 0, 0, 0.2);
  --gutter: max(5vw, 16px);
}

* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overflow-x: clip;
}
/* Scripts with no self-hosted font: system fonts, a little more line height. */
:lang(th) body, :lang(hi) body { line-height: 1.7; }
:lang(ja), :lang(ko), :lang(zh-CN) { line-break: strict; word-break: normal; }
p, h1, h2, h3, h4, li, td, th, dt, dd, label, legend, summary, caption, .btn { overflow-wrap: break-word; }
/* Long compounds: hyphenate where the language needs it (lang is set per page). */
:lang(de) body, :lang(nl) body { hyphens: auto; }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.wrap.narrow { max-width: calc(860px + 2 * var(--gutter)); }
.sec { padding-top: clamp(48px, 7vw, 96px); padding-bottom: clamp(48px, 7vw, 96px); }

.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; }
h1 { font-size: clamp(32px, 5.2vw, 58px); line-height: 1.06; letter-spacing: -0.02em; font-weight: var(--h-weight); }
h2 { font-size: clamp(26px, 3.6vw, 40px); line-height: 1.12; letter-spacing: -0.015em; font-weight: var(--h-weight); margin: 0 0 14px; }
h3 { font-size: 20px; line-height: 1.25; margin: 0 0 8px; }
:lang(th) h1, :lang(hi) h1, :lang(th) h2, :lang(hi) h2 { line-height: 1.3; letter-spacing: 0; }
:lang(ja) h1, :lang(ko) h1, :lang(zh-CN) h1 { line-height: 1.25; letter-spacing: 0; }
p { margin: 0 0 12px; }
.lead { font-size: clamp(17px, 1.6vw, 19px); color: var(--hero-muted); margin: 18px 0 0; max-width: 36em; }
.intro { color: var(--muted); font-size: 17px; max-width: 44em; margin: 0 0 28px; }
.small { font-size: 14px; color: var(--muted); }
.kicker { font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; margin: 0 0 14px; color: var(--accent); }
:lang(ja) .kicker, :lang(ko) .kicker, :lang(zh-CN) .kicker, :lang(th) .kicker, :lang(hi) .kicker { text-transform: none; letter-spacing: 0.02em; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
header.top { background: var(--header-bg); color: var(--header-ink); border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; gap: 10px 20px; min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--header-ink); font-family: var(--font-head); font-weight: 700; margin-right: auto; flex: none; }
.brand svg { flex: none; }
header.top nav { display: flex; align-items: center; gap: 6px 20px; font-size: 15px; }
header.top nav a { color: var(--header-muted); text-decoration: none; font-weight: 500; }
header.top nav a:hover { color: var(--header-ink); text-decoration: underline; }
.langlink { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; }
.btn.hdr { min-height: 40px; padding: 8px 14px; font-size: 14px; flex: 0 1 auto; }
@media (max-width: 699px) {
  header.top .navlink { display: none; }
  .langlink span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  header.top .wrap { gap: 8px 12px; }
  .wordmark { font-size: 16px; }
}
@media (max-width: 389px) {
  .btn.hdr { padding: 6px 10px; font-size: 13px; max-width: 46vw; line-height: 1.2; }
  .brand { gap: 7px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px;
  font: inherit; font-weight: 600; font-size: 16px; line-height: 1.25; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: var(--btn-radius) !important; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--input-line); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.big { font-size: 17px; padding: 14px 28px; }
.linkbtn { background: none; border: 0; color: var(--link); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 6px; min-height: 36px; }

/* The hidden attribute always wins, even over classes that set display (e.g. .row { display: flex }). */
[hidden] { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }

/* ---------- hero ---------- */
.hero { background: var(--hero-bg); color: var(--hero-ink); padding: clamp(28px, 5vw, 64px) 0 clamp(48px, 6vw, 88px); }
.hero-grid { display: grid; gap: clamp(28px, 4vw, 56px); align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); } }
.hero h1.h1-long { font-size: clamp(30px, 3.7vw, 46px); line-height: 1.1; }
.hero h1.h1-xlong { font-size: clamp(27px, 3vw, 38px); line-height: 1.15; }
.hero-text > :last-child { margin-bottom: 0; }
.pricebar { margin: 24px 0 0; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 0; }
.vs { margin: 24px 0 0; font-size: 15px; max-width: 36em; }
/* Phones: headline, buttons (a primary CTA before any scrolling), lead, price strip, product shot, "Why not ChatGPT?". */
@media (max-width: 899px) {
  .hero-grid { gap: 18px; }
  .hero-grid > .hero-text { display: contents; }
  .hero-grid .kicker { order: 0; margin: 0; }
  .hero-grid h1 { order: 1; }
  .hero-grid .ctas { order: 2; margin: 0; }
  .hero-grid .lead { order: 3; margin: 0; }
  .hero-grid .pricebar { order: 4; margin: 0; }
  .hero-grid > .shot, .hero-grid > .tool, .hero-grid > .rep { order: 5; margin-top: 6px; }
  .hero-grid .vs { order: 6; margin: 0; }
}
@media (max-width: 479px) { .ctas .btn { flex: 1 1 100%; } }

/* ---------- grids and cards ---------- */
.two, .three { display: grid; gap: 20px; }
@media (min-width: 760px) {
  .two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
ol.three, ul.incl, ol.covers { list-style: none; margin: 0; padding: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--card-radius); padding: 20px; margin: 16px 0; }
.card > h2:first-child { margin-top: 0; }
.card.accent { background: var(--accent-soft); border-color: var(--accent); }

.pcard { display: flex; flex-direction: column; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--card-radius); padding: 28px; }
.pcard h3 { margin: 0; }
.pcard p { margin: 0; }
.amt { font-family: var(--font-head); font-size: clamp(34px, 4.2vw, 48px); line-height: 1.05; font-weight: var(--h-weight); letter-spacing: -0.02em; }
.amt .fig { white-space: nowrap; }
.pcard .pc-cta { margin-top: auto; padding-top: 8px; }
.pcard .pc-cta .btn { width: 100%; }
.pcard .row.pc-cta { margin: auto 0 0; }
ul.dots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.dots li { position: relative; padding-left: 20px; }
ul.dots li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
ul.ticks { padding-left: 1.2em; }
ul.ticks li { margin: 4px 0; }
.price { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; }

/* ---------- forms ---------- */
.tool { background: #fff; border: 1px solid var(--line); border-radius: var(--card-radius); padding: clamp(18px, 3vw, 28px); box-shadow: var(--card-shadow); }
.field { margin: 0 0 14px; }
label, legend { display: block; font-weight: 600; margin: 0 0 5px; font-size: 15px; }
input[type="text"], input[type="email"], input[type="number"], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--input-line);
  border-radius: calc(var(--btn-radius) - 2px);
  padding: 10px 12px;
  min-height: 46px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.checks { display: grid; gap: 8px; grid-template-columns: 1fr; }
.checks label { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 44px; margin: 0; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: calc(var(--btn-radius) - 2px); cursor: pointer; }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checks input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
@media (min-width: 600px) {
  .checks { grid-template-columns: 1fr 1fr; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: end; }
}
.hint { margin: 5px 0 0; }
.field-error { color: var(--error); font-weight: 600; margin: 4px 0 0; }
input[aria-invalid="true"] { border-color: var(--error); }
.status { margin: 10px 0 0; font-weight: 600; min-height: 1.5em; }
form.done .field, form.done [type="submit"] { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.interests .checks { grid-template-columns: 1fr; }
.interests .checks label { align-items: flex-start; }
.interests .checks input { margin-top: 2px; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; margin-top: 24px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 18px; background: #fff; }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 16px 0; font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.35; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; color: var(--accent); font-size: 22px; line-height: 1; font-family: var(--font-num); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* ---------- sections shared by all sites ---------- */
.ladder { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 28px 0; background: var(--panel); }
.ladder p { margin: 0; }
.ladder p + p { margin-top: 6px; }
.ladder a { font-weight: 700; }
.eu { border-left: 4px solid var(--accent); padding: 4px 0 4px 16px; margin: 32px 0; }
.eu h2 { font-size: 22px; margin: 0 0 8px; }
.final-sec { padding: 0 0 clamp(40px, 6vw, 72px); }
.final { display: grid; gap: 20px; align-items: center; padding: clamp(28px, 5vw, 56px); border-radius: calc(var(--card-radius) + 4px); background: var(--ink); color: #fff; }
.final h2 { color: inherit; margin: 0 0 8px; }
.final p { margin: 0; opacity: 0.88; }
@media (min-width: 800px) { .final { grid-template-columns: minmax(0, 1fr) auto; } }
.nightschool { margin: 16px 0 0; font-weight: 600; }
.more-link { margin: 18px 0 0; font-weight: 600; }

/* ---------- tables, reports ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num { text-align: right; white-space: nowrap; }
caption { text-align: left; padding: 0 0 6px; }
.report { background: #fff; border: 1px solid var(--line); border-radius: var(--card-radius); padding: clamp(18px, 3vw, 32px); margin: 32px 0 0; }
.report h2 { font-size: clamp(22px, 2.6vw, 28px); }
.report h3 { margin-top: 18px; }
.report h4 { margin: 22px 0 6px; font-size: 16px; }
.sample-banner { background: #fff7e0; border: 2px dashed #8a6d00; padding: 8px 12px; border-radius: 8px; }
.totals { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 16px 0; }
@media (min-width: 480px) { .totals { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .report .totals { grid-template-columns: repeat(3, 1fr); } }
.total { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.total .k { display: block; font-size: 13px; color: var(--muted); }
.total .v { display: block; font-size: 22px; font-weight: 600; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
ol.incl { padding-left: 1.4em; }
.tiers { display: grid; gap: 20px; }
.honest { color: var(--muted); font-size: 15px; margin: 24px 0 0; max-width: 52em; }

/* ---------- policy document (generator result) ---------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--card-radius); padding: clamp(18px, 3vw, 32px); box-shadow: var(--card-shadow); }
.doc h2 { margin-top: 0; font-size: clamp(24px, 3vw, 32px); }
.doc h3 { margin-top: 20px; font-size: 18px; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 4px 0; }
.doc .intro { color: var(--muted); margin: 2px 0; font-size: 16px; }
.doc .note { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 10px; font-size: 14px; color: var(--muted); }
.doc .credit { border-top: 0; margin-top: 4px; padding-top: 0; font-size: 13px; }

/* ---------- seat check (spend) ---------- */
.seat-row { border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin: 0 0 12px; background: #fff; }
.seat-row .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.seat-row .head strong { font-size: 14px; }
.seat-row .grid4 { display: grid; gap: 0 12px; grid-template-columns: 1fr; align-items: end; } /* labels wrap to 2 lines in some locales; keep the input boxes on one line */
.seat-row .grid4 .field:first-child { grid-column: 1 / -1; }
.seat-row .price-pair { display: flex; flex-wrap: wrap; gap: 6px; }
.seat-row .price-pair input { flex: 1 1 6em; min-width: 6em; }
.seat-row select.period { flex: 0 0 auto; width: auto; }
.row-note p { margin: 4px 0 0; }
.row-note .hint { color: var(--error); font-weight: 600; }
.row-note .hint .linkbtn { padding: 0 4px; min-height: 0; }
.warn { color: var(--error); font-weight: 600; }
.overlap { margin: 8px 0; padding-left: 20px; font-weight: 600; }
.result-h { font-size: 20px; font-weight: 700; margin: 16px 0 0; }
.audit-cta { font-weight: 600; margin: 12px 0 8px; }
#summary-form { margin-top: 10px; }
table.ranked td.next-cut, table.ranked td.next-logins { font-weight: 600; }
table.ranked td.next-logins { color: var(--error); }
table.ranked th[scope="row"] { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  table.ranked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.ranked tr { display: block; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 10px; padding: 6px 0; }
  table.ranked th, table.ranked td { display: block; border: 0; padding: 4px 10px; text-align: left; white-space: normal; }
  table.ranked td::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* ---------- footer ---------- */
footer.bottom { border-top: 1px solid var(--line); background: var(--panel); padding: 24px 0 32px; font-size: 14px; color: var(--muted); }
footer.bottom p { margin: 6px 0; }
footer.bottom a { color: inherit; }
.langs-h { font-size: 14px; margin: 16px 0 6px; font-family: var(--font-body); }
.langs ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.langs a { display: inline-block; padding: 6px 0; }
/* Language names in their own script use the system font, so "Tiếng Việt" does not pull in a Vietnamese font subset on every page. */
.langs a[lang]:not(:lang(en)) { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.langs a[aria-current] { font-weight: 700; color: var(--ink); text-decoration: none; }

/* ---------- privacy, thanks, sample pages ---------- */
.prose { padding-top: clamp(28px, 5vw, 56px); padding-bottom: clamp(40px, 6vw, 72px); max-width: calc(820px + 2 * var(--gutter)); }
.prose h1 { font-size: clamp(30px, 4.4vw, 46px); margin-bottom: 8px; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; }
.prose .lead { color: var(--muted); }
.page-sample .hero .lead, .page-privacy .lead { max-width: 40em; }
.page-sample main > .wrap { padding-bottom: clamp(40px, 6vw, 72px); }
.cta { margin: 18px 0 0; }
dl.frame { margin: 10px 0; }
dl.frame dt { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; margin: 14px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
dl.frame dt span { font-family: var(--font-body); font-weight: 400; font-size: 0.92rem; color: var(--muted); }
dl.frame dd { margin: 6px 0 6px 0; padding-left: 14px; border-left: 2px solid var(--line); }

/* A/B variants: shared/track.js sets <html data-variant>. No JS or no storage -> A. */
html:not([data-variant="B"]) [data-ab="B"] { display: none !important; }
html[data-variant="B"] [data-ab="A"] { display: none !important; }

@media print {
  header.top, footer.bottom, .no-print, .skip { display: none !important; }
  .doc { border: 0; padding: 0; box-shadow: none; }
  body { font-size: 11pt; }
}
