/*
  Meridian: fintech landing page (Screenery template 01)
  World: Swiss International Style posters. Paper, ink, one signal red. No gradients, shadows or radii.
  Structure: tokens, base, the visible grid, header, hero poster, position table, method, security, quote, closing form, footer,
  then "Components" (select, notice, confirmation dialog, browser surfaces), motion and breakpoints.
  Signature: --p (0 to 1, driven by scroll) narrows the headline's width axis and stands the red band up.
*/

/* ---------- Tokens ---------- */
@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  --paper: #f4f1ea;
  --ink: #111111;
  --red: #e10600;
  --on-red: #ffffff;          /* small text on red only: paper on red is 4.4:1, white is 5:1 */
  --ink-2: #4a4843;           /* secondary text on paper, 8.3:1 */
  --paper-2: #c2beb5;         /* secondary text on ink, 10:1 */
  --line: #11111126;          /* grid hairline on paper */
  --line-inv: #f4f1ea2e;      /* grid hairline on ink */

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;
  --s-9: 112px;

  --margin: clamp(16px, 2.78vw, 40px);     /* page margin, outside the grid */
  --pad: clamp(10px, 1.1vw, 16px);         /* inset of content from a hairline */
  --section: clamp(72px, 10vw, 152px);     /* vertical rhythm between sections */
  --top-h: 64px;

  --radius: 0;
  --rule: 1px;

  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --p: 0;
}

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--top-h);
  scrollbar-color: var(--ink) var(--paper);
  accent-color: var(--red);
  caret-color: var(--red);
}

body {
  position: relative;      /* the hairline overlay spans the whole document */
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-stretch: 100%;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--red); color: var(--on-red); }

/* Page scrollbar: an ink bar in a paper gutter, square like everything else */
html::-webkit-scrollbar { width: 12px; height: 12px; }
html::-webkit-scrollbar-track { background: var(--paper); border-left: var(--rule) solid var(--line); }
html::-webkit-scrollbar-thumb { background: var(--ink); border: 3px solid var(--paper); border-radius: 0; }
html::-webkit-scrollbar-thumb:hover { background: var(--red); }
html:has(dialog[open]) { overflow: hidden; }

h1, h2, h3, p, dl, dd, ol, figure, blockquote, fieldset { margin: 0; padding: 0; }
ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
address { font-style: normal; }
img, svg { display: block; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

button, input { font: inherit; color: inherit; border-radius: var(--radius); }
button { cursor: pointer; }

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

h2 {
  font-size: clamp(2.125rem, 4.3vw, 3.875rem);
  font-weight: 700;
  font-stretch: 82%;
  line-height: 0.98;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.skip {
  position: absolute;
  left: var(--margin);
  top: -100px;
  z-index: 50;
  padding: var(--s-3) var(--s-4);
  background: var(--ink);
  color: var(--paper);
}
.skip:focus { top: var(--s-2); }

/* ---------- The grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  margin-inline: var(--margin);
}
.grid > * { padding-inline: var(--pad); min-width: 0; }

.lines {
  position: absolute;
  inset: 0 var(--margin);
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr)) 0;
  pointer-events: none;
}
.lines i {
  border-left: var(--rule) solid var(--line);
  transform-origin: 50% 0;
}
.lines--inv i { border-left-color: var(--line-inv); }

main, .foot { position: relative; z-index: 1; }

/* Shared controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: 52px;
  padding: 0 var(--s-5);
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.9688rem;
  font-weight: 600;
  font-stretch: 106%;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn svg, .link svg, .nav__cta svg { flex: none; transition: translate 0.35s var(--ease); }
.btn:not([disabled]):hover { background: var(--red); color: var(--on-red); }
.btn:not([disabled]):hover svg, .nav__cta:hover svg { translate: 4px 0; }
.btn:not([disabled]):active, .nav__cta:active { background: var(--ink); color: var(--paper); }
.btn--wide { width: 100%; }
.btn[disabled] { background: var(--ink-2); cursor: progress; }

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  font-size: 0.9688rem;
  font-weight: 600;
  font-stretch: 106%;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.link:hover { text-decoration-thickness: 2px; }
.link:hover svg { translate: 0 3px; }
.link--btn { padding: 0; border: 0; background: none; }
.link--btn:hover { text-decoration-thickness: 2px; }

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
}
.top::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--rule);
  background: var(--ink);
  transform-origin: 0 50%;
}
.top__grid { min-height: var(--top-h); align-items: stretch; }

.brand {
  grid-column: 1 / 4;
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-size: 1.125rem;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark { flex: none; }

.menu-btn { display: none; }

.nav {
  grid-column: 4 / 13;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: var(--s-6);
  padding-inline: 0;
  font-size: 0.9375rem;
  font-weight: 500;
}
.nav a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  position: relative;
}
.nav a:not(.nav__cta) {
  padding-inline: var(--s-3);            /* room for the focus ring; the margin keeps the text on its mark */
  margin-inline: calc(var(--s-3) * -1);
}
.nav a:not(.nav__cta)::after {
  content: "";
  position: absolute;
  left: var(--s-3);
  right: var(--s-3);
  bottom: -1px;
  height: 3px;
  background: var(--red);
  scale: 0 1;
  transform-origin: 0 50%;
  transition: scale 0.35s var(--ease);
  z-index: 1;
}
.nav a:not(.nav__cta):hover::after,
.nav a[aria-current="true"]::after { scale: 1 1; }

.nav__cta {
  justify-content: space-between;
  gap: var(--s-4);
  padding-inline: var(--s-5);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-stretch: 106%;
  white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.nav__cta:hover { background: var(--red); color: var(--on-red); }
.nav a:focus-visible { outline-offset: -8px; }
.nav__cta:focus-visible { outline-color: var(--paper); }

/* On wide screens every nav item starts on a hairline */
@media (min-width: 1180px) {
  .nav {
    grid-column: 6 / 13;
    display: grid;
    grid-template-columns: subgrid;
    gap: 0;
  }
  .nav a:not(.nav__cta) { justify-self: start; margin-left: calc(var(--pad) - var(--s-3)); }
  .nav__cta { grid-column: 5 / -1; padding-inline: var(--pad); }
}

/* ---------- Hero ---------- */
.hero {
  grid-template-rows: 1fr auto;
  min-height: min(calc(100svh - var(--top-h)), 100vw);   /* portrait tablets: the poster stops at a square */
}

.hero__meta {
  grid-column: 1;
  grid-row: 1 / 3;
  padding: var(--s-5) 0;
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  writing-mode: vertical-rl;
  rotate: 180deg;
  font-size: 0.8125rem;
  font-weight: 500;
  font-stretch: 108%;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}
.hero__meta time { font-variant-numeric: tabular-nums; }

.hero__field {
  grid-column: 2 / 13;
  grid-row: 1;
  position: relative;
  container-type: inline-size;
  display: flex;
  align-items: flex-end;
  min-height: 420px;
  padding-block: var(--s-7) var(--s-6);
  overflow: clip;
}
.hero__field::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--rule);
  background: var(--ink);
  transform-origin: 0 50%;
}

h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.75rem, 11cqi, 9.75rem);   /* the type is the composition */
  font-weight: 800;
  font-stretch: calc(125% - var(--p) * 63%);
  line-height: 0.88;
  letter-spacing: -0.035em;
}
h1 .l { display: block; white-space: nowrap; }

.band {
  position: absolute;
  z-index: 0;
  left: -50%;
  top: 27%;
  width: 200%;
  height: clamp(56px, 12cqi, 176px);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 1.5cqi 52cqi 0 0;
  background: var(--red);
  color: var(--on-red);
  white-space: nowrap;
  rotate: calc(-15deg - var(--p) * 26deg);
  transform-origin: 50% 50%;
}

/* The band carries the product: the group's cash, restated live, at poster size */
.band__in { display: grid; justify-items: end; gap: 0.5cqi; }
.band__label { font-size: clamp(0.8125rem, 1.15cqi, 1rem); font-weight: 600; font-stretch: 108%; }
.band__fig {
  font-size: clamp(1.5rem, 4cqi, 3.75rem);
  font-weight: 700;
  font-stretch: 88%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 0.9;
}
.band__fig b { display: inline-block; font-weight: inherit; }
.band__fig b.flip { animation: flip 0.5s var(--ease) both; }

.hero__lede {
  grid-column: 2 / 7;
  grid-row: 2;
  padding-block: var(--s-6) var(--s-7);
}
.hero__lede p {
  max-width: 44ch;
  font-size: clamp(1.0625rem, 1.32vw, 1.1875rem);
  line-height: 1.45;
  text-wrap: pretty;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-6);
  margin-top: var(--s-6);
}

.hero__facts {
  grid-column: 9 / 13;
  grid-row: 2;
  align-self: start;
  padding-block: var(--s-6) var(--s-7);
  font-size: 0.9375rem;
  line-height: 1.35;
}
.hero__facts div {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: var(--s-4);
  padding-block: var(--s-3);
  border-top: var(--rule) solid var(--line);
}
.hero__facts div:first-child { border-top: 0; padding-top: 4px; }
.hero__facts dt { color: var(--ink-2); }
.hero__facts dd { font-weight: 600; }

/* ---------- Sections on the grid ---------- */
.position, .method, .voice {
  padding-block: var(--section);
  border-top: var(--rule) solid var(--ink);
}

/* ---------- Cash position ---------- */
.position { align-items: start; }
.position__intro { grid-column: 1 / 5; }
.position__intro > p {
  max-width: 38ch;
  margin-top: var(--s-5);
  color: var(--ink-2);
  text-wrap: pretty;
}

.base { margin-top: var(--s-7); }
.base legend {
  padding: 0;
  margin-bottom: var(--s-3);
  font-size: 0.875rem;
  font-weight: 600;
}
.base__opts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 340px;
  border: var(--rule) solid var(--ink);
}
.base label { position: relative; display: block; }
.base label + label { border-left: var(--rule) solid var(--ink); }
.base input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.base span {
  display: grid;
  place-items: center;
  min-height: 48px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-stretch: 106%;
  letter-spacing: 0.02em;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.base label:hover span { background: #1111111a; }
.base input:checked + span { background: var(--ink); color: var(--paper); }
.base input:disabled { cursor: not-allowed; }
.base input:disabled + span { color: var(--ink-2); background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--line) 5px 6px); }
.base input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 3px; position: relative; z-index: 1; }

.position .select { margin-top: var(--s-5); max-width: 340px; }
.feed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--s-5);
  margin-top: var(--s-4);
  font-size: 0.875rem;
}
.feed__status { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-2); }
.feed__status time { font-variant-numeric: tabular-nums; color: var(--ink); }
.feed__dot { width: 8px; height: 8px; background: var(--red); }
.feed__dot.is-tick { animation: tick 0.9s var(--ease); }
.feed.is-paused .feed__dot { background: var(--ink-2); }
.feed__toggle {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.feed__toggle:hover { text-decoration-thickness: 2px; }

@keyframes tick {
  from { scale: 2.2; }
  to { scale: 1; }
}

.position__sheet { grid-column: 5 / 13; padding-inline: 0; }

.sheet {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 1rem;
}
.sheet caption {
  padding: 0 var(--pad) var(--s-4);
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
}
/* Table columns sit exactly on grid columns: 2, 2, 1, 2, 1 of the 8 it spans */
.c-acc, .c-nat, .c-base { width: 25%; }
.c-rate, .c-share { width: 12.5%; }

.sheet th, .sheet td {
  padding: var(--s-4) var(--pad);
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}
.sheet thead th {
  padding-block: var(--s-3);
  border-block: var(--rule) solid var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
  vertical-align: bottom;
  line-height: 1.25;
}
.sheet__sub { display: block; font-weight: 400; color: var(--ink-2); white-space: nowrap; }
.sheet .num { text-align: right; }
.sheet tbody tr { border-bottom: var(--rule) solid var(--line); }
.sheet tbody th { font-weight: 600; line-height: 1.25; }
.sheet__bank {
  display: block;
  margin-top: 3px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--ink-2);
}

.fig {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.45;
}
.fig b { display: inline-block; font-weight: inherit; }
.fig b.flip { animation: flip 0.5s var(--ease) both; }
@keyframes flip {
  from { transform: translateY(-55%) rotateX(88deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
[data-fig="value"] { font-weight: 500; }

.share { position: relative; }
.share::after {
  content: "";
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: var(--s-3);
  height: 3px;
  background: var(--ink);
  scale: var(--share, 0) 1;
  transform-origin: 100% 50%;
  transition: scale 0.6s var(--ease);
}

/* The sum is the point of the page, so it is set as an ink block with the figure at poster size */
.sheet tfoot { background: var(--ink); color: var(--paper); }
.sheet tfoot ::selection { background: var(--red); color: var(--on-red); }
.sheet tfoot th, .sheet tfoot td { vertical-align: middle; }
.sheet__sum th, .sheet__sum td { padding-block: var(--s-4) 0; }
.sheet tfoot th { font-weight: 700; line-height: 1.25; }
.sheet tfoot .sheet__bank { color: var(--paper-2); }
.sheet__total td { padding-block: var(--s-5) var(--s-5); }
.total .fig {
  display: block;
  font-size: clamp(2rem, 5.5vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.copy {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.copy:hover { text-decoration-thickness: 2px; }
.copy:focus-visible { outline-color: var(--paper); }
.sheet tr[hidden] { display: none; }

.sheet__note {
  max-width: 62ch;
  padding: var(--s-4) var(--pad) 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
  text-wrap: pretty;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Method ---------- */
.method h2 { grid-column: 1 / 9; }
.steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  padding-inline: 0;
  margin-top: var(--s-8);
}
.step {
  grid-column: span 4;
  padding-inline: var(--pad);
  position: relative;
}
.step::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: var(--rule);
  background: var(--ink);
}
.step:nth-child(2) { margin-top: var(--s-9); }
.step:nth-child(3) { margin-top: calc(var(--s-9) * 2); }
.step__fig {
  width: 100%;
  max-width: 300px;
  height: auto;
  margin-block: var(--s-6) var(--s-7);
  overflow: visible;
}
.step h3 {
  display: flex;
  align-items: flex-end;
  gap: var(--s-4);
  font-size: 1.75rem;
  font-weight: 700;
  font-stretch: 100%;
  letter-spacing: -0.015em;
  line-height: 1;
}
.step__n {
  font-size: 6rem;
  font-weight: 800;
  font-stretch: 62%;
  line-height: 0.74;
  letter-spacing: -0.02em;
}
.step p {
  max-width: 36ch;
  margin-top: var(--s-5);
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ---------- Security programme ---------- */
.security {
  position: relative;
  z-index: 1;
  padding-block: var(--section);
  background: var(--ink);
  color: var(--paper);
}
.security ::selection { background: var(--red); color: var(--on-red); }
.security .grid { position: relative; align-items: end; }
.security h2 { grid-column: 1 / 8; }
.security__intro {
  grid-column: 9 / 13;
  max-width: 40ch;
  color: var(--paper-2);
  text-wrap: pretty;
}
.programme {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  padding-inline: 0;
  margin-top: var(--s-8);
  border-bottom: var(--rule) solid var(--paper);
}
.programme__row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
  padding-block: var(--s-5);
  border-top: var(--rule) solid var(--line-inv);
}
.programme__row:first-child { border-top-color: var(--paper); }
.programme__row > * { padding-inline: var(--pad); }
.programme dt {
  grid-column: 1 / 4;
  font-size: 0.9375rem;
  font-weight: 600;
  font-stretch: 108%;
}
.programme__main {
  grid-column: 4 / 9;
  font-size: clamp(1.25rem, 1.9vw, 1.6875rem);
  font-weight: 500;
  font-stretch: 88%;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.programme__note {
  grid-column: 9 / 13;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--paper-2);
  text-wrap: pretty;
}

/* ---------- Quote ---------- */
.voice { border-top: 0; align-items: end; }
.voice__fig { grid-column: 4 / 13; grid-row: 1; }
.voice blockquote { position: relative; }
.voice blockquote::before {
  content: "\201C";
  position: absolute;
  right: 100%;
  top: -0.04em;
  margin-right: 0.06em;
  font-size: clamp(4rem, 11vw, 10rem);
  font-weight: 800;
  font-stretch: 100%;
  line-height: 0.8;
  color: var(--red);
}
.voice blockquote p {
  font-size: clamp(1.75rem, 4.15vw, 3.75rem);
  font-weight: 600;
  font-stretch: 80%;
  line-height: 1.03;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.voice figcaption {
  display: grid;
  gap: 2px;
  margin-top: var(--s-7);
  font-size: 0.9375rem;
}
.voice figcaption strong { font-weight: 700; }
.voice figcaption span { color: var(--ink-2); }
.voice__aside {
  grid-column: 1 / 3;
  grid-row: 1;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-2);
}

/* ---------- Closing ---------- */
.close { border-top: var(--rule) solid var(--ink); align-items: stretch; }
.close__block {
  grid-column: 1 / 9;
  display: flex;
  align-items: flex-end;
  min-height: clamp(420px, 44vw, 640px);
  padding: var(--s-7) 22% var(--s-7) var(--pad);
  background: var(--red);
  color: var(--paper);
  clip-path: polygon(0 0, 100% 0, 80% 100%, 0 100%);
}
.close__block ::selection { background: var(--ink); color: var(--paper); }
.close h2 {
  font-size: clamp(2.5rem, 6.1vw, 5.75rem);
  font-weight: 800;
  font-stretch: 100%;
  line-height: 0.9;
  letter-spacing: -0.03em;
}
.close__form {
  grid-column: 9 / 13;
  align-self: end;
  padding-block: var(--s-8) var(--s-7);
}
.close__lede { text-wrap: pretty; }

.form { margin-top: var(--s-6); }
.form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
}
.form input {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: var(--s-1);
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  font-size: 1.25rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s var(--ease);
}
.form input::placeholder { color: #6a6761; opacity: 1; }
.form input:focus-visible { border-bottom-color: var(--red); box-shadow: 0 2px 0 var(--red); }
.form input[aria-invalid="true"] { border-bottom-color: var(--red); }
/* Autofill keeps the paper ground instead of the browser's tint */
.form input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100px var(--paper) inset;
}
.form input:-webkit-autofill:focus-visible { box-shadow: 0 0 0 100px var(--paper) inset, 0 2px 0 var(--red); }
.form__msg {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: var(--s-3);
  align-items: start;
  min-height: 1.4em;
  margin-block: var(--s-3) var(--s-4);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}
.form__msg:empty { display: block; }
.form__msg:not(:empty)::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 0.3em;
  background: var(--red);
}
.form__fine { margin-top: var(--s-4); font-size: 0.8125rem; color: var(--ink-2); text-wrap: pretty; }

.done { margin-top: var(--s-6); outline: none; }
.done svg { color: var(--red); }
.done h3 {
  margin-top: var(--s-4);
  font-size: 1.75rem;
  font-weight: 700;
  font-stretch: 88%;
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.done p { margin-block: var(--s-3) var(--s-4); overflow-wrap: anywhere; }
.done strong { font-weight: 600; }
.done:not([hidden]) { animation: rise 0.6s var(--ease) both; }
@keyframes rise {
  from { clip-path: inset(0 0 100% 0); translate: 0 12px; }
  to { clip-path: inset(0); translate: 0 0; }
}

/* ---------- Footer ---------- */
.foot__grid { padding-block: var(--s-7) var(--s-6); row-gap: var(--s-7); border-top: var(--rule) solid var(--ink); }
.foot__word {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.07em;
  padding-inline: var(--pad);
  overflow: clip;
  font-size: min(calc((100vw - 2 * var(--margin) - 2 * var(--pad)) / 5.27), 23rem);    /* the wordmark as a poster line: at full width it spans the grid less one stem */
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.8;
  letter-spacing: -0.04em;
  white-space: nowrap;
  padding-bottom: 0.06em;
}
/* A red block takes whatever width the wordmark leaves: half the line while the word is condensed, a bar once it is wide */
.foot__word::after {
  content: "";
  flex: 1 1 0;
  min-width: 0;
  margin-block: 0.05em 0.066em;    /* cap height to baseline */
  background: var(--red);
}
.foot__col { font-size: 0.9375rem; display: grid; align-content: start; gap: var(--s-2); }
.foot__col h2 {
  margin-bottom: var(--s-2);
  font-size: 0.8125rem;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: 0;
  line-height: 1.5;
  color: var(--ink-2);
}
.foot__col a { text-decoration: none; justify-self: start; }
.foot__col a:hover { text-decoration: underline; }
.foot__col--about { grid-column: 1 / 5; gap: var(--s-5); }
.foot__col--about p { max-width: 30ch; font-weight: 600; text-wrap: balance; }
.foot__col--about address { color: var(--ink-2); font-size: 0.875rem; line-height: 1.45; }
nav.foot__col:nth-of-type(1) { grid-column: 7 / 9; }
nav.foot__col:nth-of-type(2) { grid-column: 9 / 11; }
nav.foot__col:nth-of-type(3) { grid-column: 11 / 13; }
.foot__legal {
  grid-column: 1 / -1;
  padding-top: var(--s-5);
  border-top: var(--rule) solid var(--line);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* ==========================================================================
   Components
   A themed kit drawn from the tokens above: square, ruled, paper and ink with one red.
   Select: .select > .select__label + .select__btn + ul.select__list[role=listbox] + hidden input.
   Notice: .notices (fixed region) > .notice (--done or --problem). Created by notify() in script.js.
   Confirm: dialog.confirm > h2 + p + .confirm__actions (cancel, confirm). Opened by confirmWith().
   ========================================================================== */

/* ---------- Select: a ruled register ---------- */
.select { position: relative; }
html:not(.js) .select { display: none; }      /* it filters with script; without script the table shows the group */
.select__label {
  display: block;
  margin-bottom: var(--s-3);
  font-size: 0.875rem;
  font-weight: 600;
}
.select__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s-4);
  border: var(--rule) solid var(--ink);
  background: var(--paper);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.select__btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select__btn svg { flex: none; transition: rotate 0.35s var(--ease); }
.select__btn:hover { background: #1111111a; }
.select.is-open .select__btn { background: var(--ink); color: var(--paper); }
.select.is-open .select__btn svg { rotate: 180deg; }
.select__btn[disabled] { color: var(--ink-2); cursor: not-allowed; background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--line) 5px 6px); }

.select__list {
  position: absolute;
  z-index: 15;
  top: 100%;
  left: 0;
  right: 0;
  max-height: min(336px, 60svh);
  margin: -1px 0 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: var(--rule) solid var(--ink);
  border-bottom-width: 4px;                  /* the register closes on a heavy rule */
  background: var(--paper);
  scroll-margin-block: var(--s-4);
  scrollbar-color: var(--ink) var(--paper);
  scrollbar-width: thin;
  outline: none;
}
.select__list::-webkit-scrollbar { width: 8px; }
.select__list::-webkit-scrollbar-track { background: var(--paper); }
.select__list::-webkit-scrollbar-thumb { background: var(--ink); }
.select__list:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.select__list [role="option"] {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  min-height: 48px;
  padding: var(--s-2) var(--s-4);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
}
.select__list [role="option"] + [role="option"] { border-top: var(--rule) solid var(--line); }
.select__list [role="option"]::before { content: ""; width: 10px; height: 10px; }      /* the red square marks the entry in force */
.select__list [role="option"][aria-selected="true"]::before { background: var(--red); }
.select__list [role="option"][aria-selected="true"] { font-weight: 700; }
.select__list [role="option"].is-active { background: var(--ink); color: var(--paper); }
.select__meta { font-family: var(--mono); font-size: 0.8125rem; font-weight: 400; color: var(--ink-2); white-space: nowrap; }
.is-active .select__meta { color: var(--paper-2); }

/* ---------- Notice: a slip pinned to the base of the page ---------- */
.notices {
  position: fixed;
  z-index: 40;
  left: var(--margin);
  bottom: var(--margin);
  display: grid;
  gap: var(--s-2);
  width: min(440px, calc(100vw - 2 * var(--margin)));
  pointer-events: none;
}
.notice {
  display: grid;
  grid-template-columns: 12px 1fr 44px;
  align-items: start;
  gap: var(--s-4);
  padding: var(--s-4) 0 var(--s-4) var(--s-4);
  background: var(--ink);
  color: var(--paper);
  pointer-events: auto;
}
.notice ::selection { background: var(--red); color: var(--on-red); }
.notice__mark { width: 12px; height: 12px; margin-top: 0.3em; background: var(--red); }
.notice p { display: grid; gap: 2px; font-size: 0.9375rem; line-height: 1.35; overflow-wrap: anywhere; }
.notice strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.notice span { color: var(--paper-2); font-size: 0.875rem; }
.notice span:empty { display: none; }
.notice button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--paper);
}
.notice button:hover { color: var(--on-red); background: var(--red); }
.notice button:focus-visible { outline-color: var(--paper); outline-offset: -4px; }
/* A problem is the same slip in red, with an ink mark */
.notice--problem { background: var(--red); color: var(--on-red); }
.notice--problem .notice__mark { background: var(--ink); }
.notice--problem span { color: var(--on-red); }
.notice--problem button:hover { background: var(--ink); color: var(--paper); }

/* ---------- Confirmation dialog: a small poster on an ink ground ---------- */
.confirm {
  width: min(560px, calc(100vw - 2 * var(--margin)));
  max-height: calc(100svh - 2 * var(--margin));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}
.confirm::backdrop { background: #111111d9; }
/* The brand's diagonal, cut into the top corner */
.confirm::before {
  content: "";
  display: block;
  height: clamp(56px, 12vw, 88px);
  background: var(--red);
  clip-path: polygon(0 0, 100% 0, 100% 28%, 0 100%);
}
.confirm h2 {
  padding: var(--s-4) var(--s-5) 0;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  font-stretch: 82%;
  line-height: 0.95;
}
.confirm p { padding: var(--s-4) var(--s-5) var(--s-6); max-width: 46ch; text-wrap: pretty; overflow-wrap: anywhere; }
.confirm p strong { font-weight: 600; }
.confirm__actions { display: grid; grid-template-columns: 1fr 1fr; border-top: var(--rule) solid var(--ink); }
.confirm__actions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 64px;
  padding: var(--s-3) var(--s-5);
  border: 0;
  background: var(--paper);
  font-size: 0.9688rem;
  font-weight: 600;
  font-stretch: 106%;
  text-align: left;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.confirm__actions button:hover { background: #1111111a; }
.confirm__actions [data-confirm-ok] { background: var(--ink); color: var(--paper); }
.confirm__actions [data-confirm-ok]:hover { background: var(--red); color: var(--on-red); }
.confirm__actions button:focus-visible { outline-offset: -6px; }
.confirm__actions [data-confirm-ok]:focus-visible { outline-color: var(--paper); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Load: hairlines draw in, then the band cuts across the field. All of it rests within 0.65s. */
  .lines:not(.lines--inv) i { animation: draw-y 0.5s var(--ease) calc(var(--i) * 12ms) backwards; }
  .top::after { animation: draw-x 0.5s var(--ease) backwards; }
  .hero__field::after { animation: draw-x 0.5s var(--ease) 0.05s backwards; }
  .band { animation: band-in 0.55s var(--ease) 0.08s backwards; }

  /* Components: the register unrolls, the slip rises, the poster drops in over a darkening ground */
  .select__list:not([hidden]) { animation: unroll 0.3s var(--ease) both; }
  .notice { animation: slip-in 0.45s var(--ease) both; }
  .notice.is-leaving { animation: slip-out 0.22s ease-in both; }
  .confirm[open] { animation: poster-in 0.4s var(--ease) both; }
  .confirm[open]::backdrop { animation: ground-in 0.3s ease-out both; }
  .confirm.is-closing { animation: poster-out 0.18s ease-in both; }
  .confirm.is-closing::backdrop { animation: ground-in 0.18s ease-in reverse both; }
  @keyframes unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
  @keyframes slip-in { from { clip-path: inset(100% 0 0 0); translate: 0 16px; } to { clip-path: inset(0); translate: 0 0; } }
  @keyframes slip-out { to { clip-path: inset(0 100% 0 0); } }
  @keyframes poster-in { from { clip-path: inset(0 0 100% 0); translate: 0 -16px; } to { clip-path: inset(0); translate: 0 0; } }
  @keyframes poster-out { to { clip-path: inset(100% 0 0 0); opacity: 0; } }
  @keyframes ground-in { from { opacity: 0; } }

  @keyframes draw-y { from { transform: scaleY(0); } }
  @keyframes draw-x { from { transform: scaleX(0); } }
  @keyframes band-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }

  /* Scroll: the first screen of scroll takes --p from 0 to 1 */
  @supports (animation-timeline: scroll()) {
    .hero {
      animation: hero-p linear both;
      animation-timeline: scroll(root block);
      animation-range: 0 85vh;
    }
    @keyframes hero-p { to { --p: 1; } }

    /* The footer wordmark answers the headline: it widens as it arrives */
    .foot__word {
      animation: word-open linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 28%;
    }
    @keyframes word-open { from { font-stretch: 62%; } to { font-stretch: 125%; } }
  }
}

@media (prefers-reduced-motion: reduce) {
  .fig b.flip, .band__fig b.flip, .feed__dot.is-tick, .done:not([hidden]) { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1099px) {
  .position__intro { grid-column: 1 / 9; }
  .position__sheet { grid-column: 1 / -1; margin-top: var(--s-7); }
  .c-acc, .c-nat, .c-base { width: 25%; }
  .c-rate { width: 16.666%; }
  .c-share { width: 8.334%; }
  .total .fig { font-size: clamp(2rem, 8vw, 5.75rem); }
  .position .select { max-width: 340px; }

  .hero__lede { grid-column: 2 / 8; }
  .hero__facts { grid-column: 8 / 13; }

  .programme dt { grid-column: 1 / 4; }
  .programme__main { grid-column: 4 / 9; }

  .voice__fig { grid-column: 3 / 13; }
  .voice__aside { grid-column: 3 / 9; grid-row: 2; margin-top: var(--s-7); }

  .close__block { grid-column: 1 / 8; padding-right: 18%; }
  .close__form { grid-column: 8 / 13; }
}

/* Narrow tablets: the nav closes up so it clears the brand */
@media (min-width: 760px) and (max-width: 899px) {
  .brand { grid-column: 1 / 3; }
  .nav { grid-column: 3 / 13; gap: var(--s-5); font-size: 0.875rem; }
  .nav__cta { gap: var(--s-3); padding-inline: var(--s-4); }
}

/* ---------- Phone ---------- */
@media (max-width: 759px) {
  :root { --top-h: 56px; }

  .lines i:not(:nth-child(3n + 1)) { visibility: hidden; }

  /* Header: brand, menu button, drop panel */
  .brand { grid-column: 1 / 8; }
  .js .menu-btn {
    grid-column: 8 / 13;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 44px;
    margin-block: auto;
    padding: 0 var(--pad);
    border: 0;
    background: none;
    font-size: 0.9375rem;
    font-weight: 600;
  }
  .menu-btn path { transition: translate 0.3s var(--ease), rotate 0.3s var(--ease); transform-origin: 8px 8px; transform-box: view-box; }
  .top.is-open .menu-btn__a { translate: 0 3px; rotate: 45deg; }
  .top.is-open .menu-btn__b { translate: 0 -3px; rotate: -45deg; }

  .nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 0;
    font-size: 1.25rem;
    font-weight: 600;
  }
  .nav a:nth-child(n) {
    min-height: 56px;
    padding-inline: var(--pad);
    margin-inline: 0;
    border-top: var(--rule) solid var(--line);
  }
  .nav a:not(.nav__cta)::after { display: none; }
  .nav__cta { font-size: 1rem; border-top: 0; }
  .js .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding-inline: var(--margin);
    background: var(--paper);
    border-bottom: var(--rule) solid var(--ink);
  }
  .js .top.is-open .nav { display: grid; }
  html:not(.js) .top { position: static; }   /* without the script the nav is always open: let it scroll away */

  /* Hero */
  .hero { min-height: 0; grid-template-rows: auto; }
  .hero__meta {
    grid-row: 1;
    border-left: var(--rule) solid var(--line);   /* rotated 180deg: this is the right edge */
    font-size: 0.75rem;
    padding-block: var(--s-4);
  }
  .hero__field {
    min-height: min(64svh, 520px);
    padding-block: var(--s-7) var(--s-5);
  }
  h1 { font-size: clamp(2.75rem, 19.4cqi, 6rem); font-stretch: calc(108% - var(--p) * 46%); line-height: 0.88; }
  h1 .w { display: block; }
  .band {
    top: 22%;
    height: 22cqi;
    rotate: calc(-22deg - var(--p) * 24deg);
  }
  .band { align-items: flex-start; padding: 2.4cqi 54cqi 0 0; }
  .band__label { display: none; }
  .band__fig { font-size: 6.4cqi; }
  .hero__lede { grid-column: 1 / -1; grid-row: 2; padding-block: var(--s-5) 0; }
  .hero__actions { margin-top: var(--s-5); }
  .hero__actions .btn { width: 100%; }
  .hero__facts { grid-column: 1 / -1; grid-row: 3; padding-block: var(--s-6) var(--s-7); }

  /* Position: the table becomes a list of ledger entries */
  .position__intro { grid-column: 1 / -1; }
  .base__opts { max-width: none; }
  .position .select { max-width: none; }
  .sheet, .sheet tbody, .sheet tfoot, .sheet tr, .sheet th, .sheet td { display: block; }
  .sheet colgroup { display: none; }
  .sheet thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .sheet caption { display: block; border-bottom: var(--rule) solid var(--ink); padding-bottom: var(--s-3); }
  .sheet tbody tr, .sheet tfoot tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px var(--s-4);
    padding: var(--s-4) var(--pad);
    position: relative;
  }
  .sheet th, .sheet td { padding: 0; }
  .sheet tbody th { grid-column: 1; grid-row: 1 / 3; }
  .sheet tbody td[data-label="In base"] { grid-column: 2; grid-row: 1; }
  .sheet tbody td[data-label="In base"] .fig { font-size: 1rem; }
  .sheet tbody td[data-label="Balance"] { grid-column: 2; grid-row: 2; color: var(--ink-2); }
  .sheet tbody td[data-label="Balance"] .fig, .sheet tbody td[data-label="Rate"] .fig, .sheet tbody td[data-label="Share"] .fig { font-size: 0.8125rem; }
  .sheet tbody td[data-label="Rate"] { grid-column: 1; grid-row: 3; text-align: left; color: var(--ink-2); margin-top: var(--s-2); }
  .sheet tbody td[data-label="Rate"]::before { content: "Rate "; font-family: var(--sans); font-size: 0.8125rem; }
  .sheet tbody td[data-label="Share"] { grid-column: 2; grid-row: 3; position: static; margin-top: var(--s-2); }
  .sheet tbody td[data-label="Share"] { display: flex; flex-direction: row-reverse; align-items: center; gap: var(--s-3); }
  .share::after { position: static; flex: none; width: calc(var(--share, 0) * 72px); scale: none; transition: width 0.6s var(--ease); }
  .sheet tfoot tr { align-items: center; padding-block: var(--s-3) 0; }
  .sheet__sum th { grid-column: 1; grid-row: 1; }
  .sheet__sum td:last-child { grid-column: 2; grid-row: 1; }
  .sheet__sum td:nth-child(2) { grid-column: 1 / -1; grid-row: 3; text-align: left; margin-top: var(--s-3); }
  .sheet tfoot .sheet__total { display: block; padding-block: var(--s-2) var(--s-5); }
  .sheet__sum { border-bottom: 0; }
  .sheet tfoot .sheet__sum { padding-bottom: 0; }
  .total .fig { font-size: clamp(1.5rem, 8.2vw, 3.5rem); text-align: left; }
  .sheet tfoot tr.sheet__total { order: 0; }

  .notices { bottom: var(--s-4); }
  .confirm__actions { grid-template-columns: 1fr; }
  .confirm__actions [data-confirm-cancel] { border-bottom: var(--rule) solid var(--ink); }

  /* Method: the staircase becomes a column */
  .method h2 { grid-column: 1 / -1; }
  .steps { grid-template-columns: minmax(0, 1fr); margin-top: var(--s-7); }
  .step { grid-column: 1; }
  .step:nth-child(n) { margin-top: 0; padding-bottom: var(--s-7); }
  .step:last-child { padding-bottom: 0; }
  .step__fig { margin-block: var(--s-6) var(--s-6); }
  .step__n { font-size: 4.5rem; }
  .step p { max-width: none; }

  /* Security */
  .security h2, .security__intro { grid-column: 1 / -1; }
  .security__intro { margin-top: var(--s-5); max-width: none; }
  .programme { display: block; margin-top: var(--s-7); }
  .programme__row { display: block; padding-block: var(--s-5); }
  .programme__main { margin-top: var(--s-2); }
  .programme__note { margin-top: var(--s-2); }

  /* Quote */
  .voice__fig { grid-column: 1 / -1; }
  .voice blockquote::before { position: static; display: block; margin: 0 0 -0.28em -0.04em; font-size: 6rem; }
  .voice__aside { grid-column: 1 / -1; }

  /* Closing */
  .close__block {
    grid-column: 1 / -1;
    min-height: 320px;
    padding: var(--s-9) 14% var(--s-6) var(--pad);
    clip-path: polygon(0 0, 100% 0, 100% 78%, 0 100%);
    padding-bottom: 96px;
  }
  .close__form { grid-column: 1 / -1; padding-block: var(--s-6) var(--s-8); }

  /* Footer */
  .foot__grid { row-gap: var(--s-6); padding-bottom: var(--s-8); }
  .foot__col--about { grid-column: 1 / -1; }
  nav.foot__col:nth-of-type(1) { grid-column: 1 / 5; }
  nav.foot__col:nth-of-type(2) { grid-column: 5 / 9; }
  nav.foot__col:nth-of-type(3) { grid-column: 9 / 13; }
  .foot__col a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; }
  nav.foot__col { gap: 0; }
}

/* Smallest phones: the three footer lists keep one line per link */
@media (max-width: 379px) {
  nav.foot__col { padding-right: 0; font-size: 0.875rem; }
  .foot__col a { white-space: nowrap; }
}
