/* ---------------------------------------------------------------------------
   KPIndicator checkout — the editorial research-report system, ported.

   Same three typefaces doing the same three jobs as the Next.js app
   (src/app/globals.css): Instrument Serif for display at 400 only, Archivo for
   UI and body, IBM Plex Mono for anything measured. Same colour discipline:
   primary is ink, so the pay button is near-black on warm paper; the amber
   signal is reserved for rules and eyebrow numerals and never fills a CTA.

   Tokens are the hex equivalents of the app's oklch values — this page loads no
   Tailwind, and hex keeps it renderable in older browsers. The oklch source is
   noted beside each one so the two files stay reconcilable.
--------------------------------------------------------------------------- */

:root {
  --paper: #fbfaf6;        /* oklch(0.9852 0.0055 90)  */
  --card: #fffefb;         /* oklch(0.9962 0.0032 90)  */
  --ink: #191511;          /* oklch(0.1985 0.011 62)   */
  --ink-button: #1e1813;   /* oklch(0.2135 0.013 62)   */
  --muted: #f3f1ec;        /* oklch(0.9575 0.0072 88)  */
  --muted-ink: #655f59;    /* oklch(0.4885 0.0125 68)  */
  --rule: #dddad4;         /* oklch(0.8885 0.0088 80)  */
  --signal: #e58c2e;       /* oklch(0.7185 0.1485 62)  */
  --signal-ink: #87400e;   /* oklch(0.4555 0.1125 50)  */
  --danger: #de2326;       /* oklch(0.5785 0.2185 27)  */
  --go: #b2efc1;           /* oklch(0.8985 0.0885 152) */
  --go-ink: #004016;       /* oklch(0.3185 0.0985 152) */
  --hold: #fcdab8;         /* oklch(0.9085 0.0585 68)  */
  --hold-ink: #673100;     /* oklch(0.3785 0.0985 58)  */
  --radius: 0.375rem;
  --grain-opacity: 0.038;

  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Instrument Serif", ui-serif, "Iowan Old Style", Georgia, Cambria, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain, identical to the marketing site. Behind content, never over it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

p, li { text-wrap: pretty; }
::selection { background: var(--signal); color: #17130f; }

/* -- Shared primitives ---------------------------------------------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted-ink);
  margin: 0;
}

.eyebrow em {
  font-style: normal;
  color: var(--signal-ink);
}

.display {
  font-family: var(--display);
  font-weight: 400;
  font-optical-sizing: auto;
  letter-spacing: -0.017em;
  line-height: 1.01;
  margin: 0;
}

.tnum { font-variant-numeric: tabular-nums; }

.measure { max-width: 52ch; }

a { color: inherit; }

.link {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 0.15s ease;
}

.link:hover { border-color: var(--ink); }

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

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.5rem clamp(1.25rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
}

.masthead__mark {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  text-decoration: none;
}

.masthead__mark span { color: var(--signal-ink); }

.masthead__meta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-ink);
}

/* -- Live-key warning ----------------------------------------------------- */

.livebar {
  background: var(--hold);
  color: var(--hold-ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.625rem clamp(1.25rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
}

/* -- The two-column sheet ------------------------------------------------- */

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 62rem) {
  .sheet {
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    min-height: calc(100vh - 5.5rem);
  }

  .docket {
    border-right: 1px solid var(--rule);
    border-bottom: 0;
    position: sticky;
    top: 0;
  }
}

.docket {
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
}

.payment {
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.5rem) 4rem;
}

/* -- Order docket --------------------------------------------------------- */

.docket__name {
  font-size: clamp(2.1rem, 1.4rem + 2.2vw, 3.1rem);
  margin-top: 1rem;
}

.docket__tagline {
  color: var(--muted-ink);
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
}

.docket__rule {
  border: 0;
  border-top: 1px solid var(--signal);
  margin: 1.75rem 0 1.25rem;
  width: 3.5rem;
}

.amount {
  font-family: var(--mono);
  font-size: clamp(2rem, 1.4rem + 1.9vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 0;
}

.amount__note {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-ink);
  margin: 0.625rem 0 0;
}

.spec {
  margin: 2rem 0 0;
  border-top: 1px solid var(--rule);
}

.spec__row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}

.spec__label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-ink);
  padding-top: 0.15rem;
}

.spec__value { margin: 0; }

.spec__value ul {
  margin: 0;
  padding-left: 1.05rem;
}

.spec__value li { margin: 0 0 0.3rem; }
.spec__value li:last-child { margin-bottom: 0; }

/* -- Payment column ------------------------------------------------------- */

.payment__heading {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.95rem);
  margin-top: 1rem;
}

.payment__heading em {
  font-style: italic;
  color: var(--signal-ink);
}

.form { margin-top: 2rem; max-width: 34rem; }

.field { margin-bottom: 1.1rem; }

.field__label {
  display: block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted-ink);
  margin-bottom: 0.4rem;
}

.field__label span { color: var(--signal-ink); }

.field input {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: #a49d94; }

.field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(229, 140, 46, 0.22);
}

.field--pair {
  display: grid;
  gap: 1.1rem;
}

@media (min-width: 34rem) {
  .field--pair { grid-template-columns: 1fr 1fr; }
}

.element-shell {
  margin: 1.75rem 0 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

/* Reserves height so mounting the Payment Element does not shift the page. */
#payment-element { min-height: 15rem; }

.element-loading {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-ink);
}

/* -- Button --------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink-button);
  border: 1px solid var(--ink-button);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.button:hover:not(:disabled) { background: #2f2822; }

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button--quiet {
  width: auto;
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}

.button--quiet:hover:not(:disabled) { background: var(--muted); }

.button__spinner {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid rgba(251, 250, 246, 0.35);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .button__spinner { animation-duration: 2s; }
}

/* -- Messages ------------------------------------------------------------- */

.notice {
  border: 1px solid var(--rule);
  border-left: 2px solid var(--signal);
  background: var(--card);
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.notice--error {
  border-left-color: var(--danger);
  color: #7d1614;
}

.notice[hidden] { display: none; }

.fineprint {
  margin: 1.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted-ink);
}

/* -- Outcome pages -------------------------------------------------------- */

.outcome {
  padding: clamp(2.5rem, 8vw, 5rem) clamp(1.25rem, 4vw, 3.5rem);
  max-width: 44rem;
}

.outcome__heading {
  font-size: clamp(2.2rem, 1.5rem + 2.4vw, 3.4rem);
  margin-top: 1rem;
}

.outcome__body {
  margin: 1.25rem 0 0;
  font-size: 1.0625rem;
  color: var(--muted-ink);
}

.outcome__receipt {
  margin: 2rem 0 0;
  border-top: 1px solid var(--rule);
}

.outcome__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.outcome__actions .button { width: auto; }

.stamp {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
}

.stamp--go { background: var(--go); color: var(--go-ink); }
.stamp--hold { background: var(--hold); color: var(--hold-ink); }
.stamp--stop { background: #ffcfce; color: #890514; }

/* -- Colophon ------------------------------------------------------------- */

.colophon {
  border-top: 1px solid var(--rule);
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-ink);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}
