/*
 * Fluvia FZC — the parent company's one page.
 *
 * The visual system is Extracto's, inherited rather than invented: the tokens
 * below are copied from `frontend/src/app/globals.css` so the two sites are
 * recognisably one company's work. Three rules carry most of it:
 *
 *   1. HAIRLINES, NOT ELEVATION. 1px borders, square corners, warm off-white.
 *      No shadow, no radius, no gradient on a component. A card is a rectangle.
 *   2. CELLS, NOT CONTROLS. A control inside a ruled bar is a cell OF that bar:
 *      full height, one leading hairline, closed by the bar's own edges. One
 *      filled action per bar; everything beside it loses its box.
 *   3. ONE AMBER, RATIONED. `--color-accent` is a FILL (the action).
 *      `--color-accent-ink` is the amber things are DRAWN with (marks, text),
 *      and it is the only one that ever sits on the page ground — the fill is
 *      too light against off-white to carry a glyph.
 *
 * Logical properties throughout (`inline-start`, `padding-inline`, `border-s`
 * equivalents), because /ar/ is the same stylesheet in RTL and a physical
 * `left` is a defect the moment the page mirrors.
 */

/* ── Tokens, from Extracto's globals.css ─────────────────────────────────── */
:root {
  --color-surface: #fafaf9;
  --color-surface-alt: #f3f2f0;
  --color-ink: #2d2d2b;
  --color-accent: #e8943a;
  --color-accent-ink: #a05c10;
  --color-border: #cbc7c1;
  --color-muted: #6a6a68;
  --color-on-accent: #241f1a;

  /* The type ladder, same numbers as the product. */
  --text-2xs: 12px;
  --text-xs: 13px;
  --text-bar: 14px;
  --text-sm: 15px;
  --text-base: 16px;
  --text-lg: 19px;
  --text-xl: 21px;
  --text-2xl: 25px;
  --text-3xl: 31px;
  --text-4xl: 38px;

  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Backdrop, matching the product's own layer. */
  --backdrop-gutter: 20px;
  --backdrop-nav: 56px;
  --backdrop-diamond: 46px;
  --backdrop-line: rgb(45 45 43 / 0.02);
  --backdrop-warm: rgb(232 148 58 / 0.10);
  --backdrop-cool: rgb(45 45 43 / 0.045);

  --shell-max: 1152px;
  --bar-h: 56px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #1a1a18;
    --color-surface-alt: #252523;
    --color-ink: #e8e6e3;
    --color-accent: #d4832a;
    --color-accent-ink: #d4832a;
    --color-border: #3d3d3a;
    --color-muted: #9a9996;
    --color-on-accent: #241f1a;
    --backdrop-line: rgb(232 230 227 / 0.028);
    --backdrop-warm: rgb(212 131 42 / 0.11);
    --backdrop-cool: rgb(232 230 227 / 0.04);
    color-scheme: dark;
  }
}

@media (min-width: 640px) { :root { --backdrop-gutter: 24px; } }
@media (min-width: 1024px) { :root { --backdrop-gutter: 40px; } }

/* ── Reset, only what this page needs ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--color-border) transparent;
}
h1, h2, h3, p, dl, dd, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
address { font-style: normal; }
::selection { background-color: color-mix(in oklab, var(--color-accent) 30%, transparent); }

:where(a, button):focus-visible {
  outline: 2px solid var(--color-accent-ink);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ── The backdrop: two washes and a 45° weave, faint ─────────────────────
   Fixed behind everything, masked off under the bar and faded before the
   foot, exactly as the product paints it. It draws NO vertical rules and no
   column lines — those were deliberately removed there and must not appear
   here either. Below 640px the lattice is dropped entirely: at 46px on a
   375px screen it reads as noise under the text rather than as texture. */
.page-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 46% at 12% 12%, var(--backdrop-warm) 0%, transparent 68%),
    radial-gradient(52% 44% at 92% 88%, var(--backdrop-cool) 0%, transparent 70%);
}
.page-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, var(--backdrop-line) 0 1px, transparent 1px var(--backdrop-diamond)),
    repeating-linear-gradient(-45deg, var(--backdrop-line) 0 1px, transparent 1px var(--backdrop-diamond));
  background-position: var(--backdrop-gutter) var(--backdrop-nav);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--backdrop-nav), #000 72%, transparent 96%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 var(--backdrop-nav), #000 72%, transparent 96%);
}
@media (max-width: 639px) {
  .page-backdrop::before { background-image: none; }
  .page-backdrop { background:
    radial-gradient(72% 40% at 10% 8%, var(--backdrop-warm) 0%, transparent 70%),
    radial-gradient(60% 38% at 96% 92%, var(--backdrop-cool) 0%, transparent 72%); }
}

/* ── Shell: the 1152px measure every edge agrees with ────────────────────
   `border-inline` is the product's own shell treatment — the page is a sheet
   with two ruled edges, not a floating column. */
.shell {
  max-width: var(--shell-max);
  margin-inline: auto;
  border-inline: 1px solid var(--color-border);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 1151px) { .shell { border-inline: 0; } }

/* ── Bars: items-stretch, cells meet, the bar's own rule closes them ───── */
.bar {
  display: flex;
  align-items: stretch;
  min-height: var(--bar-h);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in oklab, var(--color-surface) 82%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.bar-foot {
  position: static;
  border-bottom: 0;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  backdrop-filter: none;
  background: transparent;
  /* Wraps, and the header does not. Measured at 375px: six trailing cells of
     nowrap text ran 6px past the viewport and gave the whole document a
     horizontal scrollbar — the one defect on a page whose every other edge
     agrees with the shell. A bar of links may become two rows; a masthead
     with one action may not, so only this one wraps. */
  flex-wrap: wrap;
}
/* On a wrapped row the leading hairline is wrong on whichever cell falls
   first on the new line, so below the wrap point the cells are separated by
   space instead — the rule they would otherwise draw belongs to a row that no
   longer exists. */
@media (max-width: 559px) {
  .bar-foot .cell { border-inline-start: 0; padding-inline: 12px; }
  .bar-foot .spacer { display: none; }
  .bar-foot { padding-block: 6px; gap: 2px 0; }
}

.cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 16px;
  border-inline-start: 1px solid var(--color-border);
  font-size: var(--text-bar);
  color: var(--color-ink);
  white-space: nowrap;
}
/* The first cell of a bar has nothing to its start to be separated from. */
.bar > .cell:first-child { border-inline-start: 0; }

/* Structural, not decorative: it carries the rule across the empty middle and
   pushes the trailing group to the edge. Deleting it collapses the bar. */
.spacer { flex: 1 1 auto; padding: 0; }

.cell-quiet { color: var(--color-muted); transition: color 120ms ease; }
a.cell-quiet:hover { color: var(--color-ink); }

/* One filled action per bar. Everything beside it is muted text in a cell. */
.cell-action {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 500;
}
.cell-action:hover { background: color-mix(in oklab, var(--color-accent) 88%, var(--color-ink)); }
.arrow { flex: none; opacity: 0.8; }

.wordmark { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.02em; gap: 10px; }
/* The mark takes its ink from the bar, so it inverts with the theme for free;
   only the current keeps its own amber, because that is the one thing in the
   drawing that is not structure. */
.mark { flex: none; color: var(--color-ink); }

/* An inline link inside prose: underlined, because a colour alone is not a
   signal and this system spends its one colour elsewhere. */
.link {
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
  transition: text-decoration-color 120ms ease;
}
.link:hover { text-decoration-color: var(--color-accent-ink); }

.eyebrow {
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0;
}

/* ── The register entry ─────────────────────────────────────────────────
   Seven columns of twelve for the statement, five for the record — the
   product's compositional invariant (58.3333% / 41.6667%), not a round
   pixel figure. */
.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 900px) {
  .entry { grid-template-columns: 58.3333% 41.6667%; }
  .entry-record { border-inline-start: 1px solid var(--color-border); }
}
.entry-statement { padding: 56px 24px 48px; }
@media (min-width: 900px) { .entry-statement { padding: 88px 40px 80px; } }

/* The display size is the product's own clamp with a lower ceiling: at 4rem
   this sentence set five lines deep and pushed the bench off the fold, which
   is a different composition from the one the contract describes. 3.5rem holds
   the same weight in four. */
.entry-statement h1 {
  margin-top: 20px;
  font-size: clamp(2.125rem, 4.6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.lede {
  margin-top: 24px;
  max-width: 46ch;
  color: var(--color-muted);
  font-size: var(--text-base);
}

/* The licence, treated as what it is: a record, set in mono, ruled in dashes
   like the product's own document slips. */
.entry-record { display: flex; flex-direction: column; }
.record-head {
  display: flex;
  align-items: stretch;
  min-height: 44px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
.record-title {
  display: inline-flex;
  align-items: center;
  padding-inline: 20px;
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.record-state {
  display: inline-flex;
  align-items: center;
  margin-inline-start: auto;
  padding-inline: 20px;
  border-inline-start: 1px solid var(--color-border);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent-ink);
}
.record-body { padding: 8px 20px 20px; }
.record-body .row {
  display: grid;
  grid-template-columns: 40% 1fr;
  gap: 12px;
  padding-block: 11px;
  border-bottom: 1px dashed var(--color-border);
}
.record-body .row:last-child { border-bottom: 0; }
.record-body dt { font-size: var(--text-xs); color: var(--color-muted); }
.record-body dd { margin: 0; font-size: var(--text-sm); }
@media (min-width: 900px) { .record-body { padding: 12px 40px 32px; } }

/* The holdings index, closing the record column. It is `margin-top: auto` so
   it sits on the column's bottom edge whatever the statement beside it does —
   the two columns are different lengths by nature, and a block that floats in
   the middle of the taller one reads as a mistake rather than a decision. */
.holdings { margin-top: auto; border-top: 1px solid var(--color-border); }
.record-head-inner { border-bottom: 1px solid var(--color-border); min-height: 40px; }
.holding-list { display: flex; flex-direction: column; }
.holding-list li + li { border-top: 1px dashed var(--color-border); }
.holding-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  transition: background-color 120ms ease;
}
@media (min-width: 900px) { .holding-list a { padding-inline: 40px; } }
.holding-list a:hover { background: var(--color-surface-alt); }
.holding-name { font-size: var(--text-base); font-weight: 500; }
.holding-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ── Section rules ──────────────────────────────────────────────────────── */
.section-rule {
  padding: 40px 24px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 20px;
}
@media (min-width: 900px) { .section-rule { padding: 64px 40px 24px; } }
.section-note { color: var(--color-muted); font-size: var(--text-sm); }

/* ── Plates: the bench ──────────────────────────────────────────────────── */
.bench { border-bottom: 1px solid var(--color-border); }
.plate {
  margin: 0 24px 24px;
  border: 1px solid var(--color-border);
  background: color-mix(in oklab, var(--color-surface) 88%, transparent);
}
@media (min-width: 900px) { .plate { margin: 0 40px 32px; } }

.plate-bar {
  display: flex;
  align-items: stretch;
  min-height: 52px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}
.plate-name {
  display: inline-flex;
  align-items: center;
  padding-inline: 20px;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.plate-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 20px;
  border-inline-start: 1px solid var(--color-border);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
/* The one amber mark on a plate: a live product is printed, a pending one is
   the keyline alone. */
.dot { width: 6px; height: 6px; background: var(--color-accent-ink); flex: none; }
.dot-idle { background: transparent; border: 1px solid var(--color-border); }

.plate-body { padding: 24px 20px 8px; }
@media (min-width: 900px) { .plate-body { padding: 32px 40px 12px; } }
.plate-claim { max-width: 62ch; font-size: var(--text-base); }
.plate-claim-quiet { color: var(--color-muted); }

.spec { margin-top: 24px; }
.spec .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding-block: 12px;
  border-bottom: 1px dashed var(--color-border);
}
@media (min-width: 700px) {
  .spec .row { grid-template-columns: 22% 1fr; gap: 20px; align-items: baseline; }
}
.spec dt {
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.spec dd { margin: 0; font-size: var(--text-sm); }
.spec .pending { color: var(--color-muted); font-style: italic; }
.spec-quiet dd { color: var(--color-muted); }

.plate-foot {
  display: flex;
  align-items: stretch;
  min-height: 48px;
  border-top: 1px solid var(--color-border);
}
.plate-foot > .cell:first-child { border-inline-start: 0; }
.plate-foot-note {
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.plate-pending { background: transparent; }

/* ── Colophon ───────────────────────────────────────────────────────────── */
.colophon-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--color-border);
}
@media (min-width: 900px) {
  .colophon-grid { grid-template-columns: 50% 50%; }
  .colophon-side { border-inline-start: 1px solid var(--color-border); }
}
.record-wide { padding: 12px 24px 28px; }
@media (min-width: 900px) { .record-wide { padding: 20px 40px 40px; } }
.record-wide .row { grid-template-columns: 38% 1fr; }

.colophon-side { padding: 20px 24px 32px; display: grid; gap: 32px; }
@media (min-width: 900px) { .colophon-side { padding: 28px 40px 40px; } }
.colophon-side .record-title { padding-inline: 0; }
.addr address { margin-top: 10px; color: var(--color-muted); }
.act-list { margin-top: 10px; display: grid; gap: 0; }
.act-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding-block: 11px;
  border-bottom: 1px dashed var(--color-border);
  color: var(--color-muted);
}
@media (min-width: 560px) {
  .act-list li { grid-template-columns: 72px 1fr; gap: 16px; align-items: baseline; }
}
.act-list li:last-child { border-bottom: 0; }
.act-code { color: var(--color-ink); }

.hide-sm { display: none; }
@media (min-width: 700px) { .hide-sm { display: inline-flex; } }

/* ── The policy index ───────────────────────────────────────────────────
   Six rows, one dashed rule between them, the same construction as every
   other list of records on the page. */
.policy-list { display: flex; flex-direction: column; }
.policy-list li + li { border-top: 1px dashed var(--color-border); }
.policy-list a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 24px;
  transition: background-color 120ms ease;
}
@media (min-width: 900px) { .policy-list a { padding: 18px 40px; } }
.policy-list a:hover { background: var(--color-surface-alt); }
.policy-name { font-size: var(--text-base); font-weight: 500; }
.policy-note { font-size: var(--text-xs); color: var(--color-muted); }
.side-note { color: var(--color-muted); font-size: var(--text-sm); margin-top: 8px; }
.addr .link { display: inline-block; margin-top: 8px; }

/* ── Document pages ─────────────────────────────────────────────────────
   One measure, one rhythm: more space above a heading than below it, and a
   reading width that stops well short of the shell so the eye never has to
   travel the full 1152px. */
.doc { padding-bottom: 24px; }
.doc-head {
  padding: 56px 24px 32px;
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 900px) { .doc-head { padding: 80px 40px 40px; } }
.doc-head h1 {
  margin-top: 14px;
  font-size: clamp(1.75rem, 3.4vw, 2.375rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.doc-head .lede { margin-top: 16px; }
.doc-date { display: block; margin-top: 20px; color: var(--color-muted); }

.doc-section {
  padding: 36px 24px 4px;
  max-width: 74ch;
}
@media (min-width: 900px) { .doc-section { padding: 44px 40px 4px; } }
.doc-section + .doc-section { border-top: 1px dashed var(--color-border); }
.doc-section h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.doc-section p { margin-bottom: 14px; }
.doc-list { margin: 0 0 16px; display: flex; flex-direction: column; }
.doc-list li {
  padding: 11px 0 11px 0;
  padding-inline-start: 18px;
  border-bottom: 1px dashed var(--color-border);
  position: relative;
}
.doc-list li:last-child { border-bottom: 0; }
/* A square, not a bullet: this system has no round shapes in it. */
.doc-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 1.15em;
  width: 5px;
  height: 5px;
  background: var(--color-accent-ink);
}

/* ── The one orchestrated entrance ──────────────────────────────────────
   Armed by script only, so a page with no JS — or a reader who asked for
   less motion — gets the finished page immediately rather than a blank one. */
.reveal-armed { opacity: 0; transform: translateY(10px); }
.reveal-in {
  opacity: 1;
  transform: none;
  transition: opacity 520ms cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .reveal-armed { opacity: 1; transform: none; }
  .reveal-in { transition: none; }
}

/* ── RTL: the mirror is free because every rule above is logical ─────────
   The two exceptions are the weave's phase (a 45° lattice mirrors to -45°,
   which is the same drawing) and the arrow glyph, which points at the edge
   the reader leaves from. */
[dir="rtl"] .arrow { transform: scaleX(-1); }
