/* ==========================================================================
   Tagufi — Public Web Phase 1
   One stylesheet for every page. No framework, no build step, no external
   requests: the site is uploaded as plain files, so anything it cannot fetch
   from its own web root does not exist.

   THEMES. Light is the token baseline in :root. Dark is applied twice, on
   purpose:
     1. @media (prefers-color-scheme: dark) — for visitors who never touch the
        toggle, including those with JavaScript off;
     2. :root[data-theme="dark"] — set by the toggle, which must win over the
        system preference in BOTH directions. That is why the media query is
        scoped with :not([data-theme="light"]); without it, a visitor on a dark
        OS could not choose light.

   COLOUR. --accent (#FE501D) and the navy are sampled from the app icon, so the
   site and the store listing are the same brand. On light backgrounds the
   accent is only 3.3:1, so links and small text use --accent-ink instead, which
   clears 4.5:1. Both are checked, not assumed.
   ========================================================================== */

/* ------------------------------ Tokens ---------------------------------- */

:root {
  color-scheme: light;

  --bg:            #FBFAF8;
  --bg-soft:       #F4F1EC;
  --surface:       #FFFFFF;
  --surface-2:     #F7F5F1;
  --surface-inset: #F1EEE8;

  --ink:           #14172B;
  --ink-muted:     #565B72;
  --ink-subtle:    #666B80;
  --ink-inverse:   #FBFAF8;

  --line:          rgba(20, 23, 43, 0.10);
  --line-strong:   rgba(20, 23, 43, 0.18);

  --accent:        #FE501D;   /* fills, marks, graphics */
  --accent-ink:    #C23A0E;   /* links and small text on light surfaces */
  --accent-soft:   rgba(254, 80, 29, 0.10);
  --accent-line:   rgba(254, 80, 29, 0.28);

  --navy:          #06091C;
  --panel-bg:      #0B1030;
  --on-accent:     #1A0A03;

  /* Store badges invert against the page so they read as badges in both themes. */
  --badge-bg:      #14172B;
  --badge-ink:     #FFFFFF;
  --badge-line:    transparent;

  --shadow-sm: 0 1px 2px rgba(20, 23, 43, 0.05), 0 2px 6px rgba(20, 23, 43, 0.04);
  --shadow-md: 0 2px 4px rgba(20, 23, 43, 0.04), 0 12px 28px -12px rgba(20, 23, 43, 0.16);
  --shadow-lg: 0 4px 8px rgba(20, 23, 43, 0.05), 0 32px 64px -24px rgba(20, 23, 43, 0.24);

  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --wrap:      1120px;
  --wrap-text: 720px;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, "Noto Sans",
          sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Hero artwork. Kept as its own scale so the illustration can follow the
     theme without borrowing surface tokens that are tuned for text. */
  --art-frame:     #FFFFFF;
  --art-screen:    #E8ECE4;
  --art-block:     #D8DED0;
  --art-road:      #FFFFFF;
  --art-road-soft: #F3F5F0;
  --art-water:     #C4D8E3;
  --art-card:      #FFFFFF;
  --art-text:      #C0C5D1;
  --art-text-soft: #D8DCE4;
  --art-shadow:    0 26px 46px rgba(20, 23, 43, 0.20);
}

:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

/* The dark palette, declared once and applied through both selectors below. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #06091C;
    --bg-soft:       #090E26;
    --surface:       #0D1330;
    --surface-2:     #111838;
    --surface-inset: #0A0F27;

    --ink:           #F3EFE9;
    --ink-muted:     #A7ADC4;
    --ink-subtle:    #838AA1;
    --ink-inverse:   #06091C;

    --line:          rgba(243, 239, 233, 0.11);
    --line-strong:   rgba(243, 239, 233, 0.20);

    --accent:        #FE501D;
    --accent-ink:    #FF7448;
    --accent-soft:   rgba(254, 80, 29, 0.14);
    --accent-line:   rgba(254, 80, 29, 0.34);

    --panel-bg:      #131B40;
    --badge-bg:      #F3EFE9;
    --badge-ink:     #0A0E22;
    --badge-line:    transparent;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.36);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.34), 0 16px 32px -14px rgba(0, 0, 0, 0.60);
    --shadow-lg: 0 6px 12px rgba(0, 0, 0, 0.36), 0 40px 72px -28px rgba(0, 0, 0, 0.72);

    --art-frame:     #171E42;
    --art-screen:    #0A0F26;
    --art-block:     #121A3D;
    --art-road:      #1C2450;
    --art-road-soft: #161D42;
    --art-water:     #0D2438;
    --art-card:      #141B3E;
    --art-text:      #2B3465;
    --art-text-soft: #212949;
    --art-shadow:    0 30px 54px rgba(0, 0, 0, 0.62);
  }
}

:root[data-theme="dark"] {
  --bg:            #06091C;
  --bg-soft:       #090E26;
  --surface:       #0D1330;
  --surface-2:     #111838;
  --surface-inset: #0A0F27;

  --ink:           #F3EFE9;
  --ink-muted:     #A7ADC4;
  --ink-subtle:    #838AA1;
  --ink-inverse:   #06091C;

  --line:          rgba(243, 239, 233, 0.11);
  --line-strong:   rgba(243, 239, 233, 0.20);

  --accent:        #FE501D;
  --accent-ink:    #FF7448;
  --accent-soft:   rgba(254, 80, 29, 0.14);
  --accent-line:   rgba(254, 80, 29, 0.34);

  --panel-bg:      #131B40;
  --badge-bg:      #F3EFE9;
  --badge-ink:     #0A0E22;
  --badge-line:    transparent;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.36);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.34), 0 16px 32px -14px rgba(0, 0, 0, 0.60);
  --shadow-lg: 0 6px 12px rgba(0, 0, 0, 0.36), 0 40px 72px -28px rgba(0, 0, 0, 0.72);

  --art-frame:     #171E42;
  --art-screen:    #0A0F26;
  --art-block:     #121A3D;
  --art-road:      #1C2450;
  --art-road-soft: #161D42;
  --art-water:     #0D2438;
  --art-card:      #141B3E;
  --art-text:      #2B3465;
  --art-text-soft: #212949;
  --art-shadow:    0 30px 54px rgba(0, 0, 0, 0.62);
}

/* ------------------------------ Base ------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchors land below the sticky header rather than under it. */
  scroll-padding-top: 92px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.68;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.28s var(--ease), color 0.28s var(--ease);
}

img, svg { max-width: 100%; }
img { height: auto; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 650; color: var(--ink); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); color: var(--ink); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 40px);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
  transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ------------------------------ Type ------------------------------------ */

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 620;
  letter-spacing: -0.021em;
  line-height: 1.16;
  text-wrap: balance;
  margin: 0;
}

.display {
  font-size: clamp(2.6rem, 1.55rem + 4.4vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 640;
}

.h-section { font-size: clamp(1.7rem, 1.28rem + 1.7vw, 2.5rem); letter-spacing: -0.028em; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 620;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin: 0 0 18px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
}

.lede {
  font-size: clamp(1.08rem, 1rem + 0.42vw, 1.32rem);
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 56ch;
  text-wrap: pretty;
  margin: 0;
}

.section {
  padding-block: clamp(64px, 8.5vw, 128px);
  position: relative;
}
.section--tight { padding-block: clamp(48px, 6vw, 88px); }
.section + .section { border-top: 1px solid var(--line); }

.section-head { max-width: 62ch; margin-bottom: clamp(36px, 4.5vw, 60px); }
.section-head .lede { margin-top: 18px; }

/* ------------------------------ Header ---------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.site-header[data-stuck="true"] { border-bottom-color: var(--line); }

@supports not (backdrop-filter: blur(4px)) {
  .site-header { background: var(--bg); }
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 640;
  font-size: 1.14rem;
  letter-spacing: -0.02em;
  margin-right: auto;
  padding: 6px 0;
}
.brand .mark { width: 26px; height: 26px; flex: none; display: block; }
.brand:hover { color: var(--ink); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 520;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
              background-color 0.18s var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
/* Without JS the toggle cannot do anything, so it is not shown. */
html:not(.js) .theme-toggle { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.18s var(--ease),
              border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--on-accent); }

.btn--ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn svg { width: 17px; height: 17px; flex: none; display: block; }

.header-cta { display: none; }
@media (min-width: 700px) { .header-cta { display: inline-flex; } }

/* Below 660px the brand, four links and the toggle cannot share one row without
   pushing the toggle off-screen. The nav moves to its own row rather than
   collapsing into a hamburger: four links do not need a menu, and a menu needs
   JavaScript that the rest of the header does not. */
@media (max-width: 660px) {
  .site-header .wrap {
    flex-wrap: wrap;
    min-height: 0;
    padding-block: 10px 0;
    row-gap: 0;
  }
  .site-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 0;
    margin-top: 8px;
    border-top: 1px solid var(--line);
  }
  .site-nav a { padding: 9px 6px; font-size: 0.9rem; }
  .brand span.word { font-size: 1.06rem; }
  html { scroll-padding-top: 124px; }
  .doc-toc, .prose h2 { scroll-margin-top: 128px; }
}
@media (max-width: 380px) {
  .site-nav a { padding: 9px 3px; font-size: 0.84rem; }
}

/* ------------------------------ Hero ------------------------------------ */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(56px, 7vw, 104px) clamp(56px, 7vw, 104px);
}

/* One restrained wash instead of gradients everywhere: a single soft radial
   behind the headline, invisible on close inspection, missed when removed. */
.hero::before {
  content: "";
  position: absolute;
  inset: -30% 40% 30% -20%;
  background: radial-gradient(50% 50% at 40% 50%, var(--accent-soft), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.hero .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  gap: clamp(40px, 5vw, 72px);
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr); }
}

.hero h1 { margin-bottom: 22px; }
.hero h1 .soft { color: var(--accent); }

.hero-fr {
  font-size: 1rem;
  color: var(--ink-subtle);
  margin: 0 0 26px;
  font-style: italic;
  letter-spacing: -0.005em;
}

.hero .lede { margin-bottom: 34px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 11px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 560;
  letter-spacing: -0.005em;
  margin-bottom: 26px;
}
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  flex: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero-meta {
  margin: 28px 0 0;
  font-size: 0.88rem;
  color: var(--ink-subtle);
}

/* ------------------------------ Store badges ---------------------------- */

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px 11px 17px;
  min-width: 190px;
  border-radius: 12px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  border: 1px solid var(--badge-line);
  text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
}
a.store-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--badge-ink);
}
.store-badge .glyph { width: 24px; height: 26px; flex: none; fill: currentColor; }
.store-badge .labels { display: flex; flex-direction: column; line-height: 1.15; }
.store-badge .label-top {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
  font-weight: 560;
}
.store-badge .label-bottom { font-size: 1.02rem; font-weight: 620; letter-spacing: -0.015em; }

/* A badge with no listing behind it is a div, never a dead link. */
div.store-badge { opacity: 0.55; cursor: default; }

@media (max-width: 420px) {
  .store-badge { min-width: 0; flex: 1 1 100%; justify-content: flex-start; }
}

/* ------------------------------ Phone artwork --------------------------- */

.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
}
.art-phone {
  width: min(100%, 356px);
  height: auto;
  display: block;
  /* drop-shadow() takes ONE shadow, not a --shadow-* list, so this is its own
     token; passing the list silently drops the whole filter. */
  filter: drop-shadow(var(--art-shadow));
}
.art-phone text {
  font-family: var(--font);
  font-weight: 560;
  letter-spacing: -0.01em;
}
.art-label { font-size: 19px; fill: var(--ink); }
.art-tab { font-size: 15px; fill: var(--ink-subtle); text-anchor: middle; }
.art-tab--on { fill: var(--on-accent); font-weight: 620; }

@media (max-width: 899px) {
  .art-phone { width: min(78vw, 320px); }
}

/* ------------------------------ Cards ----------------------------------- */

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 2.6vw, 34px);
  box-shadow: var(--shadow-sm);
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease),
              border-color 0.24s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }

.card h3 {
  font-size: 1.22rem;
  margin-bottom: 10px;
  letter-spacing: -0.024em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Says what is shipping versus what is arriving, rather than promising a
   feature the visitor may not find in the app yet. */
.tag {
  font-size: 0.68rem;
  font-weight: 620;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 9px;
  line-height: 1.3;
}
.card p { margin: 0; color: var(--ink-muted); font-size: 0.98rem; line-height: 1.62; }

.card-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 20px;
  border: 1px solid var(--accent-line);
}
.card-icon svg { width: 22px; height: 22px; display: block; }

/* ------------------------------ Questions ------------------------------- */

/* Four questions, so a two-column grid rather than three: a 3 + 1 row leaves an
   orphan and reads as an accident. */
.questions {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  margin-bottom: 36px;
}
.question {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 4px var(--radius) var(--radius) 4px;
  padding: 20px 22px;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  letter-spacing: -0.012em;
}

.answer {
  max-width: 62ch;
  font-size: 1.06rem;
  color: var(--ink-muted);
  margin: 0;
}
.answer strong { color: var(--ink); }

/* ------------------------------ Steps ----------------------------------- */

.steps {
  display: grid;
  gap: 0;
  counter-reset: step;
  border-top: 1px solid var(--line);
}
.step {
  display: grid;
  gap: 6px 28px;
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: clamp(22px, 2.6vw, 32px) 0;
  border-bottom: 1px solid var(--line);
}
@media (min-width: 760px) {
  .step { grid-template-columns: auto minmax(0, 15rem) minmax(0, 1fr); align-items: baseline; }
}
.step .n {
  counter-increment: step;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  font-weight: 620;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  padding-top: 0.35em;
}
.step .n::before { content: "0" counter(step); }
.step h3 { font-size: 1.14rem; letter-spacing: -0.022em; }
.step p { margin: 0; color: var(--ink-muted); font-size: 0.99rem; }

/* ------------------------------ City list ------------------------------- */

.cities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cities li {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.cities li:hover { border-color: var(--accent-line); color: var(--ink); }

/* ------------------------------ Download panel -------------------------- */

.download-panel {
  position: relative;
  overflow: hidden;
  background: var(--panel-bg);
  color: #F3EFE9;
  border-radius: clamp(20px, 2.6vw, 32px);
  padding: clamp(34px, 5vw, 68px);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(243, 239, 233, 0.10);
}
.download-panel::after {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  right: -180px; top: -220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(254, 80, 29, 0.20), transparent 68%);
  pointer-events: none;
}
.download-panel > * { position: relative; z-index: 1; }
.download-panel h2 { color: #FFFFFF; }
.download-panel .lede { color: #B9BED2; }
.download-panel .eyebrow { color: #9298B0; }

.download-grid {
  display: grid;
  gap: clamp(30px, 4vw, 56px);
  align-items: center;
}
@media (min-width: 820px) {
  .download-grid { grid-template-columns: minmax(0, 1fr) auto; }
}

.download-panel .store-badge {
  background: #F3EFE9;
  color: #0A0E22;
}

.qr-card {
  background: #FFFFFF;
  border-radius: 18px;
  padding: 18px 18px 14px;
  text-align: center;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  width: max-content;
  margin-inline: auto;
}
.qr-card img { width: 168px; height: 168px; display: block; }
.qr-card figcaption {
  margin-top: 12px;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #4A5068;
  max-width: 168px;
  letter-spacing: -0.005em;
}
/* The QR card stays white in both themes so the code always scans, so its text
   colours are fixed values checked against white — a theme token here would
   have been --ink-subtle, which is 3.9:1 on white and fails. */
.qr-card figcaption .fr { display: block; color: #5B6178; }

/* ------------------------------ Contribute band ------------------------- */

.band {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 3.4vw, 48px);
  display: grid;
  gap: 24px;
  align-items: center;
}
@media (min-width: 800px) {
  .band { grid-template-columns: minmax(0, 1fr) auto; }
}
.band h2 { font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem); margin-bottom: 10px; }
.band p { margin: 0; color: var(--ink-muted); max-width: 60ch; }

/* ------------------------------ Prose pages ----------------------------- */

.page-head {
  padding-block: clamp(44px, 5.5vw, 80px) clamp(24px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.page-head h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3.1rem); }
.page-head .lede { margin-top: 16px; }
.page-head h1 { margin-top: 4px; }

.doc-layout {
  display: grid;
  gap: clamp(32px, 4vw, 56px);
  padding-block: clamp(36px, 4.5vw, 64px) clamp(56px, 7vw, 96px);
  align-items: start;
}
@media (min-width: 1000px) {
  .doc-layout--toc { grid-template-columns: minmax(0, 1fr) 232px; }
}

.prose { max-width: var(--wrap-text); min-width: 0; }

.prose h1 {
  font-size: clamp(1.7rem, 1.4rem + 1.4vw, 2.2rem);
  margin: 0 0 8px;
}
.prose h2 {
  font-size: clamp(1.24rem, 1.12rem + 0.5vw, 1.5rem);
  letter-spacing: -0.024em;
  margin: 2.4em 0 0.6em;
  scroll-margin-top: 96px;
}
.prose h2:first-of-type { margin-top: 1.6em; }
.prose h3 {
  font-size: 1.05rem;
  font-weight: 640;
  margin: 1.9em 0 0.5em;
  color: var(--ink);
}
.prose p { margin: 0 0 1em; color: var(--ink-muted); }
.prose p strong, .prose li strong { color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.3em; color: var(--ink-muted); }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--accent); }
.prose a { color: var(--accent-ink); }

/* `.prose a` (0,1,1) out-specifies `.btn--primary` (0,1,0), which turned the
   button label into link-orange on an orange fill. These win it back. */
.prose .btn { text-decoration: none; }
.prose .btn--primary { color: var(--on-accent); }
.prose .btn--ghost { color: var(--ink); }

.prose .hint {
  font-size: 0.92rem;
  color: var(--ink-subtle);
  margin-bottom: 1.6em;
}

.prose .last-updated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-subtle);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  margin: 0 0 2em;
}
.prose .last-updated strong { color: var(--ink-muted); font-weight: 600; }

.prose pre.codeblock {
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 4px var(--radius) var(--radius) 4px;
  padding: 18px 20px;
  margin: 0 0 1.4em;
  font-family: var(--font);
  font-size: 0.99rem;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.prose section[dir="rtl"] { text-align: right; }
.prose section[dir="rtl"] ul { padding-right: 1.3em; padding-left: 0; }

/* ------------------------------ Language switch ------------------------- */

/* Two real links, one of them the page you are on. It lives in the header so it
   is in the same place on every page — including the home page, which has no
   document header to hang it from — and because it is a link rather than a
   button it works with JavaScript off. */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
}
.lang-switch > * {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 560;
  line-height: 1;
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.lang-switch a:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.lang-switch .lang-current {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  cursor: default;
}
/* Full language names where there is room, two letters where there is not. */
.lang-switch .lang-short { display: none; }
@media (max-width: 900px) {
  .lang-switch .lang-long { display: none; }
  .lang-switch .lang-short { display: inline; }
  .lang-switch > * { padding: 7px 10px; }
}

/* ------------------------------ Table of contents ----------------------- */

.doc-toc { display: none; }
@media (min-width: 1000px) {
  .doc-toc {
    display: block;
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 128px);
    overflow-y: auto;
    font-size: 0.86rem;
    border-left: 1px solid var(--line);
    padding-left: 20px;
  }
}
.doc-toc nav { display: block; }
.doc-toc .toc-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-subtle);
  font-weight: 620;
  margin: 0 0 12px;
}
.doc-toc ol { list-style: none; margin: 0; padding: 0; }
.doc-toc li { margin: 0 0 2px; }
.doc-toc a {
  display: block;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 4px 0;
  line-height: 1.4;
  transition: color 0.16s var(--ease);
}
.doc-toc a:hover { color: var(--ink); }
.doc-toc a[aria-current="true"] { color: var(--accent-ink); font-weight: 600; }

/* ------------------------------ Contact page ---------------------------- */

.contact-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  margin: 0 0 2em;
  padding: 0;
  list-style: none;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.contact-card h3 { font-size: 1.02rem; margin: 0 0 6px; }
.contact-card p { margin: 0; font-size: 0.94rem; color: var(--ink-muted); }

.email-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 0 0 1em;
}
/* The address is a real mailto link, identical to the one the Privacy and Terms
   pages render, so it works without JavaScript and reads correctly to a screen
   reader. It used to be obfuscated as "contact [at] tagufi [dot] com" with the
   href assembled in JS — which protected nothing, because the same address is
   published in plain text on three other pages. */
.email-box .email {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: var(--accent-ink);
  letter-spacing: -0.01em;
  text-underline-offset: 0.2em;
}
.email-box .btn { margin-left: auto; }

/* ------------------------------ 404 ------------------------------------- */

.notfound {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: clamp(64px, 12vw, 140px);
}
.notfound .mark--xl { width: 54px; height: 68px; margin: 0 auto 28px; display: block; }
.notfound .code {
  font-size: clamp(4rem, 3rem + 6vw, 7rem);
  font-weight: 640;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 14px;
}
.notfound h1 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); margin-bottom: 14px; }
.notfound p { color: var(--ink-muted); margin: 0 0 8px; max-width: 46ch; margin-inline: auto; }
.notfound .fr { color: var(--ink-subtle); font-size: 0.95rem; }
.notfound .actions { margin-top: 30px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

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

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding-block: clamp(44px, 5vw, 68px) 28px;
  font-size: 0.94rem;
}

.footer-top {
  display: grid;
  gap: clamp(30px, 4vw, 56px);
  padding-bottom: 36px;
}
@media (min-width: 760px) {
  .footer-top { grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); }
}

.footer-brand .brand { margin-right: 0; font-size: 1.2rem; }
.footer-brand p {
  margin: 14px 0 0;
  color: var(--ink-muted);
  max-width: 34ch;
  font-size: 0.94rem;
  line-height: 1.6;
}
.footer-brand .fr { display: block; color: var(--ink-subtle); font-size: 0.86rem; margin-top: 6px; }

.footer-col h2 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-subtle);
  font-weight: 620;
  margin: 0 0 14px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 9px; }
.footer-col a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.16s var(--ease);
}
.footer-col a:hover { color: var(--ink); text-decoration: none; }
.footer-col span { color: var(--ink-subtle); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-subtle);
  font-size: 0.86rem;
}
.footer-bottom .langs { display: inline-flex; gap: 8px; align-items: center; }

/* ------------------------------ Reveal ---------------------------------- */

html.js .reveal { opacity: 0; transform: translateY(14px); }
html.js .reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; }
  .card:hover, .btn:hover, a.store-badge:hover { transform: none; }
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ------------------------------ Print ----------------------------------- */

@media print {
  .site-header, .site-footer, .doc-toc, .lang-switch, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose { max-width: none; }
  .prose a { color: #000; text-decoration: underline; }
  .page-head { background: none; border: 0; padding-block: 0 12pt; }
}
