/* =========================================================================
   KVITTO — site.css
   Everything that isn't a token. Consumes tokens.css exclusively.
   Structure: reset · base · layout · header · footer · buttons · forms ·
   receipts · mockup frames · sections/utilities · pricing · motion · responsive
   ========================================================================= */

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

/* ---- Base --------------------------------------------------------------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: var(--s-1) var(--s-2); z-index: 999;
  font-family: var(--mono); font-size: var(--fs-caption);
}
.skip-link:focus { left: var(--s-2); top: var(--s-2); }

/* ---- Layout primitives -------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.measure { max-width: var(--measure); }

/* ---- Typography helpers ------------------------------------------------- */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--graphite);
  margin-bottom: var(--s-3);
}
.caption {
  font-family: var(--mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--graphite);
  line-height: 1.4;
}
.headline {
  font-size: var(--fs-section);
  line-height: var(--lh-section);
  letter-spacing: var(--ls-tight);
  font-weight: var(--fw-medium);
  max-width: 15ch;
}
.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--ink);
  max-width: var(--measure);
  margin-top: var(--s-4);
}
.prose {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  max-width: var(--measure);
  margin-top: var(--s-3);
}
.prose + .prose { margin-top: var(--s-3); }
.ital { font-style: italic; font-weight: var(--fw-regular); }
.signal { color: var(--signal); }        /* one emphasised word per headline */

/* "Highlighter" — a soft pale-blue marker SWIPE across the lower part of a
   key word, like a stroke drawn over a printed brief. Sits under the word so
   it never collides with a tight-leading line above. Use SPARINGLY — one
   phrase per screen at most. box-decoration-break wraps it cleanly. */
.hl {
  background-image: linear-gradient(to top, var(--highlight) 40%, transparent 40%);
  padding: 0 0.08em;
  margin: 0 -0.04em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.tnum { font-variant-numeric: tabular-nums; }

/* Inline text links */
a.link {
  color: var(--signal);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--signal) 35%, transparent);
  transition: border-color var(--ui-dur) var(--ease);
}
a.link:hover { border-bottom-color: var(--signal); }

/* ---- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color var(--ui-dur) var(--ease),
              box-shadow var(--ui-dur) var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--hairline);
  box-shadow: 0 1px 0 rgba(0,0,0,0.01);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  min-height: 64px;
}
.wordmark {
  font-family: var(--display);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-mark);
  text-transform: uppercase;
  font-size: 16px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.nav-links {
  display: flex; align-items: center; gap: var(--s-4);
  list-style: none;
}
.nav-links a {
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
  text-decoration: none;
  color: var(--ink);
  transition: color var(--ui-dur) var(--ease);
}
.nav-links a:hover { color: var(--signal); }
.nav-links a[aria-current="page"] { color: var(--graphite); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display);
  font-size: var(--fs-button);
  font-weight: var(--fw-semi);
  line-height: 1;
  padding: 13px 20px;
  min-height: 44px;
  background: var(--signal);
  color: var(--signal-ink);
  border: 1px solid var(--signal);
  border-radius: var(--radius-cta);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--ui-dur) var(--ease);
}
.btn:hover { background: var(--signal-hover); border-color: var(--signal-hover); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-sm { padding: 9px 14px; min-height: 38px; font-size: var(--fs-nav); }

/* Consistent visible focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

/* ---- Panel — the "important box" surface --------------------------------
   A raised-paper card that lifts off the linen page like the receipts do.
   Used for the conversion moments (signup boxes) so the eye lands there. */
.panel {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-box);
  padding: clamp(22px, 3.6vw, 38px);
  box-shadow: 0 24px 50px -34px rgba(0, 0, 0, 0.30);
}

/* ---- Email form --------------------------------------------------------- */
.signup { max-width: var(--measure); margin-top: var(--s-5); }
/* When a signup sits in a panel, its top margin is absorbed by panel padding */
.signup.panel { padding-top: clamp(22px, 3.6vw, 38px); }
.form-row {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  align-items: flex-start;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-email { flex: 1 1 260px; }
.field-postcode { flex: 0 1 150px; }
.field label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--graphite);
}
.input {
  width: 100%;
  background: var(--paper);   /* linen — reads as a recessed well inside the raised panel */
  border: 1px solid var(--hairline);
  border-radius: var(--radius-box);
  padding: 12px 14px;
  min-height: 44px;
  font-family: var(--display);
  font-size: var(--fs-body);
  color: var(--ink);
  transition: border-color var(--ui-dur) var(--ease);
}
.input::placeholder { color: var(--graphite); opacity: 0.7; }
.input:focus { outline: none; border-color: var(--signal); }
.input:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.form-row .btn { align-self: stretch; }   /* match input height on desktop row */
.microcopy {
  margin-top: var(--s-2);
  font-size: 13.5px;
  color: var(--graphite);
  max-width: 52ch;
}
.microcopy a { color: var(--signal); }
/* quiet inline form states — text, not modals */
.form-status { margin-top: var(--s-2); font-size: 14px; min-height: 1.2em; }
.form-status[data-state="ok"]  { color: var(--ok); }
.form-status[data-state="err"] { color: var(--err); }

/* ---- Receipt cards (the signature element) ------------------------------ */
.receipts {
  display: flex;
  gap: var(--s-4);
  margin-top: var(--s-8);
}
.receipt {
  flex: 0 0 320px;
  background: var(--paper-raised);
  box-shadow: var(--shadow-receipt);
  border-radius: 2px;
  padding: var(--s-4) var(--s-3) var(--s-3);
  display: flex; flex-direction: column;
}
.receipt-voice {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--graphite);
  text-align: center;
  margin-bottom: var(--s-2);
}
.receipt-brand {
  font-family: var(--display);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-mark);
  text-transform: uppercase;
  font-size: 13px;
  text-align: center;
}
.receipt hr {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: var(--s-1) 0;
}
.receipt-body {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;   /* preserve the hand-set spacing, allow soft wrap */
  font-variant-numeric: tabular-nums;
  flex: 1;
}
.receipt-body b { font-weight: 400; color: var(--graphite); letter-spacing: 0.06em; }
.receipt-tear {
  border-top: 1.5px dashed var(--hairline);
  margin-top: var(--s-3);
  padding-top: var(--s-2);
  text-align: center;
}
.receipt-tear span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--graphite);
}
/* All receipts are light — real ones are never black. They lift off the
   cream page via the drop shadow, reading as a clean numbered series. */

.receipts-caption { margin-top: var(--s-4); }

/* ---- Mockup placeholder frames ------------------------------------------ */
.frame {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--paper-dim);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-box);
  display: grid; place-items: center;
  overflow: hidden;
  max-width: 460px;
}
/* When a real render arrives: add <img> as first child, it fills edge-to-edge
   with no layout shift. The caption below sits outside the frame. */
.frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame-caption {
  font-family: var(--mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--graphite);
  text-align: center;
  padding: var(--s-4);
}
.mockup-slot { margin-top: var(--section-y); }
.mockup-slot:first-of-type { margin-top: var(--s-8); }
.mockup-slot .caption { margin-top: var(--s-3); }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  margin-top: var(--section-y);
  padding-block: var(--s-8);
}
.site-footer .container {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5);
  align-items: baseline; justify-content: space-between;
}
.footer-mark {
  font-family: var(--mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--graphite);
  line-height: 1.8;
}
.footer-mark a { color: var(--graphite); text-decoration: none; }
.footer-mark a:hover { color: var(--signal); }
.footer-links { display: flex; gap: var(--s-4); }
.footer-links a {
  font-family: var(--mono);
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--graphite);
  text-decoration: none;
}
.footer-links a:hover { color: var(--signal); }

/* ---- Sections & rhythm -------------------------------------------------- */
.section { padding-block: var(--section-y); }
.section--band { background: var(--paper-dim); }
.section--tight { padding-block: clamp(56px, 9vh, 110px); }
.hairline { border: 0; border-top: 1px solid var(--hairline); }

/* Hero */
.hero { padding-top: clamp(56px, 10vh, 120px); padding-bottom: var(--section-y); }
.hero h1 {
  font-size: var(--fs-hero);
  line-height: var(--lh-hero);
  letter-spacing: var(--ls-tight);
  font-weight: var(--fw-medium);
  max-width: 16ch;
}
.hero .lead { margin-top: var(--s-5); }
.hero .btn { margin-top: var(--s-6); }

/* page intro (secondary pages) */
.page-intro h1 {
  font-size: var(--fs-hero);
  line-height: var(--lh-hero);
  letter-spacing: var(--ls-tight);
  font-weight: var(--fw-medium);
  max-width: 14ch;
}

/* ---- Pricing ladder ----------------------------------------------------- */
.price-frame { margin-bottom: var(--s-8); }
.tiers { display: flex; flex-direction: column; gap: 0; }
.tier {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-3) var(--s-5);
  align-items: baseline;
  padding-block: var(--s-6);
  border-top: 1px solid var(--hairline);
}
.tier:last-child { border-bottom: 1px solid var(--hairline); }
.tier-name {
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-tight);
  line-height: 1.05;
}
.tier-price {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  color: var(--signal);
}
.tier-price .cur { font-family: var(--mono); font-size: 0.5em; color: var(--graphite); letter-spacing: 0.08em; vertical-align: 0.25em; margin-right: 2px; }
.tier-desc { grid-column: 1 / -1; color: var(--graphite); max-width: 60ch; margin-top: calc(-1 * var(--s-2)); }
.tier-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase; color: var(--graphite);
}

/* Founder note block */
.founder {
  border-left: 2px solid var(--signal);
  padding-left: var(--s-4);
  max-width: 58ch;
}
.founder p { font-size: var(--fs-lead); line-height: 1.55; }
.founder p + p { margin-top: var(--s-3); }
.founder cite {
  display: block; margin-top: var(--s-3);
  font-family: var(--mono); font-size: var(--fs-caption);
  letter-spacing: var(--ls-caption); text-transform: uppercase;
  color: var(--graphite); font-style: normal;
}

/* Simple CTA link with arrow */
.cta-inline {
  display: inline-block; margin-top: var(--s-4);
  color: var(--signal); font-weight: var(--fw-medium); text-decoration: none;
}
.cta-inline:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- Motion ------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--reveal-dur) var(--ease),
              transform var(--reveal-dur) var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .site-header, .btn, .input, .nav-links a, a.link { transition: none !important; }
}

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

/* Receipts: horizontal scroll-snap strip on tablets, stacked on phones */
@media (max-width: 900px) {
  .receipts {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--s-2);
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    -webkit-overflow-scrolling: touch;
  }
  .receipt { scroll-snap-align: start; }
}
@media (max-width: 560px) {
  .receipts { flex-direction: column; overflow: visible; margin-inline: 0; padding-inline: 0; }
  .receipt { flex-basis: auto; width: 100%; max-width: 360px; }
}

/* Mobile nav: keep dead simple — links wrap under, CTA stays visible */
@media (max-width: 640px) {
  .nav { flex-wrap: wrap; gap: var(--s-2) var(--s-3); min-height: 0; padding-block: var(--s-2); }
  .nav-links { gap: var(--s-3); order: 3; width: 100%; }
  .nav-links li:last-child { margin-left: auto; } /* push CTA right on its row */
  .form-row .btn { flex: 1 1 100%; } /* full-width button, stacked */
  .field-email, .field-postcode { flex: 1 1 100%; }
  .tier { grid-template-columns: 1fr; }
  .tier-price { text-align: left; }
}

/* Print — let the paper aesthetic carry to actual paper, calmly */
@media print {
  .site-header, .site-footer, .signup, .btn { display: none; }
  body { background: #fff; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
