/* ordermytranscript.ca — design tokens & layout
   Palette + type per docs/transcript-front-door-spec.md §6 */

:root {
  --ink: #21304A;        /* deep ink navy — headings, footer */
  --paper: #FCFBF7;      /* warm paper white — background */
  --ledger: #2E5E4E;     /* archival ledger green — buttons, links */
  --ledger-dark: #24493D;
  --stamp: #B3402A;      /* date-stamp red — used ONCE (1-business-day promise) */
  --graphite: #3D4451;   /* body text */
  --rule: #D9D4C8;       /* hairline dividers, form borders */
  --tint: #F4F1E9;       /* section background tint */
  --card: #FFFFFF;
  --font-display: "Bitter", Georgia, serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Courier Prime", "Courier New", monospace;
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--graphite);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.9rem, 4.5vw + 0.8rem, 3rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 2.5vw + 0.7rem, 2rem); }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }
a { color: var(--ledger); text-underline-offset: 2px; }
a:hover { color: var(--ledger-dark); }
::selection { background: var(--ledger); color: var(--paper); }
:focus-visible { outline: 3px solid var(--ledger); outline-offset: 2px; border-radius: 4px; }
input, select, textarea, button { font: inherit; accent-color: var(--ledger); }
small { font-size: 0.875rem; }
.small { font-size: 0.875rem; color: #5A6170; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- Layout ---------- */
.wrap { max-width: 1020px; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 1.5rem); }
.prose { max-width: 66ch; }
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-tint { background: var(--tint); border-block: 1px solid var(--rule); }
.section-tint + .section-tint { border-top: 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.65rem; }
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.wordmark span { color: var(--ledger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--ledger); color: #fff;
  font-weight: 600; text-decoration: none; text-align: center;
  border: 0; border-radius: 8px; cursor: pointer;
  padding: 0.8rem 1.5rem;
  transition: background-color 120ms ease;
}
.btn:hover { background: var(--ledger-dark); color: #fff; }
.btn-large { font-size: 1.1rem; padding: 0.95rem 1.9rem; }
.btn-small { font-size: 0.9rem; padding: 0.5rem 0.95rem; white-space: nowrap; }
@media (max-width: 420px) {
  .header-inner .btn-small, .header-inner .btn-ghost { font-size: 0.85rem; padding: 0.45rem 0.7rem; }
  .wordmark { font-size: 1.02rem; }
}
.btn-ghost {
  display: inline-block;
  background: transparent; color: var(--ledger);
  font-weight: 600; border: 1.5px solid var(--ledger);
  border-radius: 8px; cursor: pointer; padding: 0.45rem 0.9rem;
}
.btn-ghost:hover { background: var(--ledger); color: #fff; }
.btn[disabled] { opacity: 0.6; cursor: wait; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2.5rem, 6vw, 4rem); }
.hero h1 { max-width: 18ch; }
.hero-sub { font-size: clamp(1.1rem, 1.5vw + 0.8rem, 1.3rem); max-width: 46ch; }
.hero-cta { margin: 1.6rem 0 2.2rem; }

.trust {
  list-style: none; margin: 0; padding: 1.1rem 0 0;
  border-top: 1px solid var(--rule);
  display: grid; gap: 0.7rem 2rem;
  font-size: 0.95rem;
}
@media (min-width: 620px) { .trust { grid-template-columns: 1fr 1fr; } }
.trust li { position: relative; padding-left: 1.6rem; }
.trust li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--ledger); font-weight: 700;
}
.stamp {
  display: inline-block;
  color: var(--stamp);
  border: 2px solid currentColor; border-radius: 6px;
  padding: 0 0.4em; margin-inline: 0.1em;
  font-weight: 700; text-transform: uppercase; font-size: 0.85em;
  letter-spacing: 0.03em;
  transform: rotate(-2deg);
  background: rgba(179, 64, 42, 0.05);
}

/* ---------- Steps ---------- */
.steps {
  list-style: none; counter-reset: step;
  margin: 0; padding: 0;
  display: grid; gap: 1.5rem;
}
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }
.steps li { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 1rem; }
.steps li::before {
  content: counter(step);
  font-family: var(--font-display); font-weight: 700; font-size: 1.9rem;
  color: var(--ledger); display: block; line-height: 1; margin-bottom: 0.4rem;
}
.steps h3 { margin-bottom: 0.25em; }
.steps p { margin: 0; font-size: 0.975rem; }

/* ---------- Estimator ---------- */
.est-grid { display: grid; gap: 2rem; margin-top: 1.5rem; }
@media (min-width: 920px) {
  .est-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 430px); align-items: start; }
  .est-result { position: sticky; top: 4.5rem; }
}
fieldset { border: 0; margin: 0 0 1.4rem; padding: 0; }
legend, .label {
  display: block; font-weight: 600; color: var(--ink);
  margin-bottom: 0.5rem; padding: 0; font-size: 1rem;
}
.choice-group { display: grid; gap: 0.5rem; }
.choice-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice {
  display: flex; align-items: flex-start; gap: 0.6rem;
  background: var(--card);
  border: 1.5px solid var(--rule); border-radius: 8px;
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.choice:hover { border-color: var(--ledger); }
.choice:has(input:checked) {
  border-color: var(--ledger);
  background: color-mix(in srgb, var(--ledger) 6%, #fff);
}
.choice:has(input:focus-visible) { outline: 3px solid var(--ledger); outline-offset: 2px; }
.choice input { margin-top: 0.25rem; flex: none; width: 1.05rem; height: 1.05rem; }
.choice span { display: block; }
.choice strong { display: block; font-weight: 600; color: var(--ink); }
.choice small { display: block; color: #5A6170; font-size: 0.85rem; line-height: 1.35; margin-top: 0.1rem; }
.sub-input { margin-top: 0.7rem; padding-left: 0.2rem; }
.sub-input label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 0.3rem; font-size: 0.95rem; }
.sub-input input[type="number"] { width: 7.5rem; }

/* The mock transcript page — the signature element */
.ts-page {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(33, 48, 74, 0.08), 0 10px 28px rgba(33, 48, 74, 0.07);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
  padding: 1.1rem 1.1rem 1.2rem 3.4rem;
  overflow: hidden;
}
.ts-page::before {  /* the double margin rule of a real transcript page */
  content: ""; position: absolute; top: 0; bottom: 0; left: 2.7rem; width: 4px;
  border-left: 1px solid #C9C2B2; border-right: 1px solid #C9C2B2;
}
.ts-head { text-align: center; margin-bottom: 0.9rem; padding-bottom: 0.7rem; border-bottom: 1px dashed var(--rule); }
.ts-doc-title {
  margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.95rem;
}
.ts-doc-sub { margin: 0.15rem 0 0; font-size: 0.72rem; color: #566070; }
.ts-lines {
  list-style: none; margin: 0; padding: 0;
  counter-reset: tsline;
  word-break: break-word;
}
.ts-lines li {
  counter-increment: tsline;
  position: relative;
  padding-left: 1ch; text-indent: -1ch;  /* soft hanging indent on stage-line wraps */
  min-height: 1.5em;
  margin-bottom: 0.15em;
}
.ts-lines li.ts-kv {
  display: grid; grid-template-columns: 12ch 1fr; column-gap: 1ch;
  padding-left: 0; text-indent: 0;
}
.ts-label { white-space: nowrap; }
.ts-lines li::before {
  content: counter(tsline);
  position: absolute; left: -2.6rem; top: 0; width: 1.6rem;
  text-align: right; text-indent: 0;
  color: #566070; font-size: 0.8em;
}
.ts-stage { color: #566070; }
.ts-cost { font-weight: 700; font-size: 1.02rem; }
@media (max-width: 480px) {
  .ts-page { padding-left: 2.8rem; padding-right: 0.9rem; font-size: 0.85rem; }
  .ts-page::before { left: 2.2rem; }
  .ts-lines li::before { left: -2.1rem; width: 1.3rem; }
}
.est-fineprint { margin-top: 0.9rem; }
.est-result .btn { margin-top: 0.3rem; }

@media (prefers-reduced-motion: no-preference) {
  .ts-page.just-updated { animation: ts-reveal 240ms ease-out; }
  @keyframes ts-reveal {
    from { opacity: 0.45; transform: translateY(3px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Rates table ---------- */
.rates {
  width: 100%; max-width: 640px;
  border-collapse: collapse;
  margin: 1.2rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
}
.rates caption {
  caption-side: top; text-align: left;
  font-size: 0.9rem; color: #5A6170; padding-bottom: 0.5rem;
}
.rates th, .rates td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--rule); }
.rates thead th { border-bottom: 2px solid var(--ink); font-weight: 600; color: var(--ink); }
.rates td { text-align: right; font-weight: 600; color: var(--ink); }
.rates tbody th { font-weight: 400; color: var(--graphite); }
.rates tbody th small { color: #5A6170; }
.rates thead th:not(:first-child) { text-align: right; }
.rates tfoot td { text-align: left; font-weight: 400; font-size: 0.9rem; color: #5A6170; border-bottom: 0; padding-top: 0.6rem; }

/* ---------- Form ---------- */
#order-form { max-width: 640px; margin-top: 1.6rem; }
.field { margin-bottom: 1.6rem; }
.field > label, .field .label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 0.4rem; }
.field label em, .field legend em { font-style: normal; font-weight: 400; color: #5A6170; font-size: 0.9em; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="number"], textarea {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--rule); border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--graphite);
  min-height: 44px;
}
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--ledger); outline-offset: 1px; border-color: var(--ledger); }
input:user-invalid, textarea:user-invalid { border-color: var(--stamp); }
textarea { resize: vertical; }
.hint { font-size: 0.875rem; color: #5A6170; margin: 0.35rem 0 0.5rem; }
.field .hint:first-of-type { margin-top: 0.35rem; }
fieldset .hint { margin-top: -0.2rem; }

.date-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.date-row input { flex: 1; max-width: 240px; }
.remove-date {
  background: transparent; border: 1.5px solid var(--rule); border-radius: 8px;
  color: #5A6170; cursor: pointer; padding: 0.45rem 0.7rem; line-height: 1;
  min-height: 44px;
}
.remove-date:hover { border-color: var(--stamp); color: var(--stamp); }

.note {
  background: color-mix(in srgb, var(--ledger) 7%, #fff);
  border: 1px solid color-mix(in srgb, var(--ledger) 30%, #fff);
  border-radius: 8px; padding: 0.8rem 1rem; margin-top: 0.7rem;
  font-size: 0.95rem;
}
.note p { margin: 0; }

.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.consent .choice { align-items: flex-start; }
.consent input { width: 1.15rem; height: 1.15rem; }
.consent span { font-size: 0.95rem; }

.form-estimate {
  border-top: 1px solid var(--rule);
  padding-top: 1.1rem; margin-top: 1.8rem;
  font-size: 1rem;
}
.form-estimate strong { color: var(--ink); font-size: 1.15em; }

.result-panel {
  margin-top: 1.6rem;
  background: var(--card);
  border: 1.5px solid var(--ledger);
  border-radius: 8px;
  padding: 1.2rem 1.3rem;
}
.result-panel h3 { margin-top: 0; }
.result-panel .badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #5A6170; border: 1.5px solid var(--rule);
  border-radius: 5px; padding: 0.1rem 0.5rem; margin-bottom: 0.6rem;
}
.result-panel .order-id { font-family: var(--font-mono); font-weight: 700; color: var(--ink); }

/* ---------- FAQ ---------- */
#faq details { max-width: 780px; border-top: 1px solid var(--rule); }
#faq details:last-of-type { border-bottom: 1px solid var(--rule); }
#faq summary {
  cursor: pointer; list-style: none;
  font-weight: 600; color: var(--ink);
  padding: 0.9rem 2rem 0.9rem 0;
  position: relative;
}
#faq summary::-webkit-details-marker { display: none; }
#faq summary::after {
  content: "+"; position: absolute; right: 0.2rem; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display); font-size: 1.3rem; color: var(--ledger);
}
#faq details[open] summary::after { content: "–"; }
#faq details p { padding: 0 0 1rem; margin: 0; max-width: 64ch; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: #C9D2E0;
  padding-block: 2.5rem 2rem; margin-top: 0;
  font-size: 0.95rem;
}
.wordmark-footer { font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 1.1rem; margin-bottom: 0.9rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-bottom: 1.2rem; }
.site-footer a { color: #E8ECF3; }
.site-footer a:hover { color: #fff; }
.site-footer .small { color: #9FACC2; max-width: 70ch; }

/* ---------- Legal pages ---------- */
.legal main { padding-block: 2.5rem 4rem; }
.legal h1 { font-size: clamp(1.7rem, 3.5vw + 0.6rem, 2.4rem); }
.legal .prose h2 { font-size: 1.25rem; margin-top: 2em; }
.legal .updated { color: #5A6170; font-size: 0.9rem; }
