/*
 * KvarnPay merchant docs — the widget's design language stretched to a
 * document. Tokens and faces are lifted from `apps/widget/src/style.css`; the
 * paths here are relative so the page opens correctly from `file://` as well as
 * from a web root. No build step, no framework, and — like the widget — no
 * third-party request of any kind.
 */

/* Only the weights this page sets are shipped: TT Firs Neue 600 for display,
   Inter 400/600/700 for text. The widget's other faces stay in the widget. */
@font-face {
  font-family: 'TT Firs Neue';
  src: url('fonts/TTFirsNeue-600.v1.woff2') format('woff2');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-400.v1.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-600.v1.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-700.v1.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/*
 * The widget's tokens verbatim, plus the few a document needs that a 480px card
 * never did: a measure, a page gutter and a monospace stack. Light-only by the
 * same decision — the brand has no dark counterparts.
 */
:root {
  color-scheme: light;

  --ink: #001811;
  --muted: #3f5551;
  --subtle: #5a6e6a;

  --surface: #fff;
  --tint: #f4f7f6;
  --seg-track: #eef3f1;
  --line: rgb(0 24 17 / 7%);
  --dash: rgb(0 24 17 / 11%);

  --teal: #002f36;
  --teal-700: #004853;
  --mint: #90ffbc;
  --mint-tint: #e9fbf1;

  --positive: #108570;
  --ring: var(--positive);
  --error: #c91b1b;

  --radius-card: 15px;
  --radius-panel: 12px;
  --radius-control: 13px;

  --shadow-card:
    0 1px 3px rgb(0 24 17 / 6%), 0 10px 30px -22px rgb(0 47 54 / 22%);

  --font-display: 'TT Firs Neue', Inter, system-ui, sans-serif;
  --font-text: Inter, system-ui, -apple-system, sans-serif;
  --font-mono:
    ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono',
    monospace;

  /*
   * Two widths, not one. `--measure` is the column the masthead and the section
   * hairlines span; `--block` is the narrower one prose, code and asides sit in,
   * so a line of body text stays inside the ~75 characters an eye tracks
   * comfortably. Tables are the exception and take the full column — a data grid
   * wants its own space. The gutter shrinks with the viewport.
   */
  --measure: 46rem;
  --block: 37rem;
  --gutter: 2rem;

  font-family: var(--font-text);
  color: var(--ink);
  line-height: 1.5;
}

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

html {
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background: var(--surface);
  font-size: 16px;
  line-height: 1.65;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

a {
  color: var(--positive);
  text-underline-offset: 2px;
}

/* --- Page frame --------------------------------------------------------- */

.page {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}

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

.masthead {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
}

.masthead img,
.notfound img {
  display: block;
  height: 26px;
  margin-bottom: 2.25rem;
}

.masthead h1 {
  max-width: 22ch;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2.2vw, 2.9rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

/* The one line under the title: what this page is, at a glance. */
.masthead .lede {
  max-width: 46ch;
  margin: 1rem 0 0;
  font-size: 1.0625rem;
  color: var(--muted);
}

/* --- Sections ----------------------------------------------------------- */

/*
 * Sections separate by air and a hairline, never by a box. Same rule the widget
 * follows: borders are spent on the card and on real controls, and everything
 * else is told apart by weight, tint and space.
 */
section {
  padding-top: 3.25rem;
}

section + section {
  margin-top: 3.25rem;
  border-top: 1px solid var(--line);
}

h2 {
  max-width: 24ch;
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h3 {
  margin: 2.5rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/*
 * A counted label above the heading, borrowed from the widget's step indicator:
 * the smallest type on the page, and reserved for text nobody has to read.
 */
.eyebrow {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
}

p {
  max-width: var(--block);
  margin: 0 0 1.1rem;
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 600;
}

/* --- Lists -------------------------------------------------------------- */

ul,
ol {
  max-width: var(--block);
  margin: 0 0 1.1rem;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.5rem;
}

li:last-child {
  margin-bottom: 0;
}

li::marker {
  color: var(--subtle);
}

ol.steps {
  counter-reset: step;
  margin: 0;
  padding: 0;
  list-style: none;
}

ol.steps > li {
  position: relative;
  margin-bottom: 1.1rem;
  padding-left: 2.5rem;
  counter-increment: step;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  top: 0.15rem;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--seg-track);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--teal);
}

/* A terse rules list: the claim, then what it must be. */
dl.checklist {
  max-width: var(--block);
  margin: 0;
}

dl.checklist dt {
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

dl.checklist dt:first-child {
  margin-top: 0;
}

dl.checklist dd {
  margin: 0.1rem 0 0;
  color: var(--muted);
}

/* --- Code --------------------------------------------------------------- */

code {
  padding: 0.1em 0.34em;
  border-radius: 5px;
  background: var(--seg-track);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--ink);
}

/*
 * A recessed panel, like the widget's amount field: the tint says "this is a
 * block of machine text" without spending another border on it. It scrolls
 * sideways rather than wrapping, because a wrapped code line reads as two.
 */
pre {
  max-width: var(--block);
  margin: 0 0 1.1rem;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  border-radius: var(--radius-panel);
  background: var(--tint);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  tab-size: 2;
}

pre code {
  padding: 0;
  border-radius: 0;
  background: none;
  font-size: inherit;
}

figure {
  max-width: var(--block);
  margin: 0 0 1.1rem;
}

figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--subtle);
}

/* --- Tables ------------------------------------------------------------- */

/*
 * The tint panel again, this time holding the table so a wide one scrolls
 * inside its own edge instead of pushing the page sideways.
 */
.table {
  margin: 0 0 1.1rem;
  overflow-x: auto;
  border-radius: var(--radius-panel);
  background: var(--tint);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.7rem 1.25rem;
  text-align: left;
  vertical-align: top;
}

thead th {
  padding-top: 0.9rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
  white-space: nowrap;
}

tbody tr {
  border-top: 1px solid var(--line);
}

tbody th {
  font-weight: 600;
}

/*
 * Two shapes of table, and they want opposite things from the first column. A
 * term list (claims, environments) has a short row header that must never wrap
 * away from its own row; a symptom/cause table has a sentence there, so it wraps
 * and takes a declared share of the width — without that share the browser hands
 * the long first column everything and squeezes the second into a ribbon.
 */
.table--terms tbody th {
  white-space: nowrap;
}

.table--split tbody th {
  width: 45%;
}

tbody td {
  color: var(--muted);
}

/* Claim names and values are machine text; the first column carries them. */
tbody th code,
tbody td code {
  background: none;
  padding: 0;
}

/* --- Careful aside ------------------------------------------------------ */

/*
 * The house note for a trap, matching the internal docs' blockquote: a wash of
 * the brand's own green and one accent edge — loud enough to stop a skimming
 * reader, quiet enough not to compete with the section it interrupts.
 */
.careful {
  max-width: var(--block);
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--positive);
  border-radius: 0 var(--radius-panel) var(--radius-panel) 0;
  background: var(--mint-tint);
  font-size: 0.9375rem;
}

.careful p {
  max-width: none;
  margin: 0;
}

.careful p + p {
  margin-top: 0.65rem;
}

.careful strong {
  font-weight: 700;
  color: var(--teal);
}

/* --- Diagram ------------------------------------------------------------ */

/*
 * The card shadow, spent once on the whole page: the diagram is the only thing
 * here that is an object rather than text.
 */
.diagram {
  max-width: 27rem;
  margin: 1.75rem 0 1.25rem;
}

.diagram-frame {
  padding: 1.25rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Footer ------------------------------------------------------------- */

.foot {
  margin-top: 4rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.foot .powered {
  display: flex;
  gap: 7px;
  align-items: baseline;
  margin: 0 0 0.9rem;
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
}

.foot .powered img {
  height: 14px;
  opacity: 0.95;
  /* Optically seats the wordmark on the micro-label's baseline. */
  transform: translateY(2px);
}

.foot p {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  color: var(--subtle);
}

/* An unfilled value, marked as one so nobody ships it by accident. */
.placeholder {
  padding: 0.05em 0.35em;
  border: 1px dashed var(--dash);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--muted);
}

/* --- Not found ---------------------------------------------------------- */

.notfound {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 3rem var(--gutter);
}

.notfound h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.notfound p {
  margin: 0 0 1.75rem;
  color: var(--muted);
}

/* The widget's primary button, at document scale. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 1.4rem;
  border-radius: var(--radius-control);
  background: var(--teal);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--surface);
  text-decoration: none;
}

.btn:hover {
  background: var(--teal-700);
}

/* --- Narrow viewports --------------------------------------------------- */

@media (max-width: 40rem) {
  :root {
    --gutter: 1.25rem;
  }

  body {
    font-size: 15.5px;
  }

  .masthead {
    padding: 2.5rem 0 2rem;
  }

  .masthead img {
    margin-bottom: 1.75rem;
  }

  section {
    padding-top: 2.5rem;
  }

  section + section {
    margin-top: 2.5rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  th,
  td {
    padding: 0.65rem 1rem;
  }

  pre {
    padding: 1rem;
  }

  /*
   * The symptom/cause table stacks on a phone. Held as two columns it becomes
   * two thin towers of one-word lines; as label-then-answer blocks it reads
   * like the rest of the page and costs no sideways scroll. Only this table —
   * the term tables are already a short key beside a short value.
   */
  .table--split thead {
    display: none;
  }

  .table--split table,
  .table--split tbody,
  .table--split tr {
    display: block;
  }

  /* Matching the declared 45% share above needs `tbody` here too, or that
     narrower selector keeps the symptom column at 45% of a phone. */
  .table--split tbody th,
  .table--split tbody td {
    display: block;
    width: auto;
  }

  .table--split tr {
    padding: 0.5rem 0;
  }

  .table--split th {
    padding-bottom: 0.15rem;
  }

  .table--split td {
    padding-top: 0;
  }
}
