/* Guardian website — the v2 design system.
 *
 * TRANSCRIBED FROM app/Sources/GuardianApp/ThemeV2.swift, the source of truth for every
 * platform. Values match the macOS app, the Windows dashboard (windows-app/.../tokens.css)
 * and the mobile app (mobile/src/design/tokens.ts). Change one and you change all four.
 *
 * Two rules carry most of the weight (docs/prd.md):
 *  1. Dark first, never dark only. The site follows the visitor's OS setting.
 *  2. Colour is never the only cue. The product owner is colourblind; every status also
 *     carries a word, a glyph or a line style. `.pill` pairs them once, here.
 */

/* Guardian Serif: the heading face, built from the logo's own letters (docs/wordmark-and-font.md
   in the repo). One weight, declared across the whole range so a 500 or 600 heading uses it as
   drawn instead of a synthetic bold. */
@font-face { font-family: "Guardian Serif"; font-weight: 100 900; font-display: swap; src: url("fonts/GuardianSerif-Regular.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 500; font-display: swap; src: url("fonts/Lora-Medium.ttf") format("truetype"); }
@font-face { font-family: "Lora"; font-weight: 600; font-display: swap; src: url("fonts/Lora-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-display: swap; src: url("fonts/SourceSans3-Regular.ttf") format("truetype"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-display: swap; src: url("fonts/SourceSans3-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-display: swap; src: url("fonts/SourceSans3-Bold.ttf") format("truetype"); }

/* Dark. The website's page takes the app icon's own tone, #181A1D, so the site and the
   icon read as one object — and the hero video (re-graded to a black background and
   screen-blended) dissolves into it with no visible edge. Cards on the site are lifted to
   #202329. This inverts the apps' layering, where cards are the deeper tone; that is a
   deliberate website choice, not a token change for the apps. */
:root, :root.force-dark {
  --bg: #181A1D;
  --card: #202329;
  --inset: #121416;
  --text: #F3F2EE;
  --text2: #B8BDC6;
  --outline: #777F8B;
  --primary: #CFB881;
  --primary-text: #111316;
  --positive: #8DBFA5;
  --danger: #E39289;
  --info: #93AFCB;
  --outline-rgb: 119, 127, 139;

  /* Attention does not flip, so "clay means attention" holds in both themes. It is told
     apart from primary by POLARITY — white on dark versus dark on light — not by hue. */
  --attention: #B85630;
  --attention-text: #FFFFFF;

  --hair: rgba(var(--outline-rgb), .35);
  --edge: rgba(var(--outline-rgb), .50);

  --r-btn: 12px;
  --r-input: 12px;
  --r-card: 18px;
  --r-dialog: 24px;

  --head: "Guardian Serif", "Lora", Georgia, serif;
  --body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

/* The landing page opts out of light mode with `class="force-dark"` on <html>: its hero
   video only blends correctly onto a dark page. Every other page follows the OS. */
@media (prefers-color-scheme: light) {
  :root:not(.force-dark) {
    --bg: #F7F5EF;
    --card: #FFFFFF;
    /* Not white: --card already is, and a white inset made every tile vanish. */
    --inset: #F2EFE8;
    --text: #252525;
    --text2: #595F68;
    --outline: #737983;
    /* Light cannot use the logo gold — 1.78:1 on the cream page. Same hue, carried down. */
    --primary: #7A5E28;
    --primary-text: #FFFFFF;
    --positive: #2E7458;
    --danger: #A63E36;
    --info: #3D6487;
    --outline-rgb: 115, 121, 131;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--head); font-weight: 500; margin: 0; line-height: 1.18; letter-spacing: -.005em; }
p { margin: 0; }
a { color: var(--primary); text-underline-offset: 3px; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- type -------------------------------------------------------------------------- */
.display { font-size: clamp(36px, 6vw, 60px); line-height: 1.08; }
.title { font-size: clamp(28px, 4vw, 40px); }
.section-title { font-size: 22px; }
.lead { font-size: clamp(18px, 2.1vw, 21px); color: var(--text2); line-height: 1.55; }

/* No widows or orphans. Headings and display lines split into lines of even length rather
   than filling each line and stranding a word on the last one; running text only avoids a
   lone last word. Browsers without text-wrap just wrap normally. */
h1, h2, h3, .big, .huge, .verse, .title { text-wrap: balance; }
p, li, .lead, figcaption, blockquote { text-wrap: pretty; }
.muted { color: var(--text2); }
.small { font-size: 15px; }
.tiny { font-size: 14px; }
.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text2);
}

/* ---- layout ------------------------------------------------------------------------ */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrapflex { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hairline { height: 1px; background: var(--hair); border: 0; margin: 0; }

/* ---- buttons ------------------------------------------------------------------------
   Kinds differ by FILL and BORDER, never hue alone: filled primary, outlined secondary,
   bare text. There is no "danger" kind — the wording says what a destructive action does. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: var(--r-btn);
  border: 1.5px solid var(--primary); background: var(--primary); color: var(--primary-text);
  font-family: var(--body); font-size: 17px; font-weight: 600; white-space: nowrap;
  text-decoration: none; cursor: pointer; transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--outline); }
.btn.text { background: transparent; color: var(--primary); border-color: transparent; padding: 0 10px; }
.btn.attention { background: var(--attention); border-color: var(--attention); color: var(--attention-text); }
.btn.small { height: 44px; padding: 0 16px; font-size: 16px; }
.btn.full { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---- surfaces ---------------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--r-card);
  padding: 22px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { padding: 20px 22px 6px; }
.note {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--inset); border: 1px dashed rgba(var(--outline-rgb), .6);
  color: var(--text2); font-size: 15px; line-height: 1.45;
}
.note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.banner {
  padding: 11px 14px; border-radius: var(--r-input); font-size: 15px;
  background: var(--inset); border: 1.5px solid var(--outline);
}
.banner.attention { background: var(--attention); border-color: var(--attention); color: var(--attention-text); }

/* ---- rows -------------------------------------------------------------------------- */
.list > * + * { border-top: 1px solid var(--hair); }
.item { display: flex; align-items: center; gap: 14px; padding: 15px 22px; }
.item.muted-row { opacity: .72; }
.tile {
  width: 44px; height: 44px; border-radius: 14px; background: var(--inset);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.tile svg { width: 22px; height: 22px; }
.item-title { font-weight: 600; font-size: 17px; }
.item-sub { color: var(--text2); font-size: 15px; line-height: 1.4; margin-top: 2px; }

/* ---- status pills — glyph AND word, always ------------------------------------------
   Neutral outline, text-coloured word. Two things change, both of which survive greyscale:
   SOLID clay for states that want someone to act; DASHED and muted for states that are not
   a claim about protection. Exactly GD2Status on the Mac. */
.pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 4px 11px; border-radius: 999px; border: 1.5px solid var(--outline);
  font-size: 14px; font-weight: 600; line-height: 1.2; color: var(--text);
}
.pill svg { width: 14px; height: 14px; flex: none; }
.pill.solid { background: var(--attention); border-color: var(--attention); color: var(--attention-text); }
.pill.dashed { border-style: dashed; color: var(--text2); }
.pill.soon { border-style: dashed; color: var(--text2); }

/* ---- form fields ------------------------------------------------------------------- */
label, .label { display: block; font-size: 15px; font-weight: 600; color: var(--text2); margin: 0 0 6px; }
.field {
  width: 100%; height: 52px; padding: 0 14px; font-size: 16px;
  color: var(--text); background: var(--inset);
  border: 1.5px solid var(--outline); border-radius: var(--r-input);
}
textarea.field { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
select.field { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text2) 50%), linear-gradient(135deg, var(--text2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.field:focus { outline: none; border-width: 2px; border-color: var(--primary); }
.hint { font-size: 14px; color: var(--text2); margin-top: 6px; line-height: 1.4; }
.err { color: var(--danger); font-size: 15px; display: flex; gap: 6px; align-items: flex-start; }

/* ---- segmented tabs — selection carried by a panel, a tick and weight -------------- */
.seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--inset);
  border: 1px solid var(--hair); overflow-x: auto;
}
.seg button {
  flex: 1 0 auto; height: 42px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text2); font-size: 15px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  transition: background .32s var(--ease), color .32s var(--ease);
}
.seg button .tick { width: 14px; height: 14px; opacity: 0; }
.seg button[aria-selected="true"] { background: var(--card); border-color: var(--edge); color: var(--text); font-weight: 700; }
.seg button[aria-selected="true"] .tick { opacity: 1; }
.seg .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--attention); color: var(--attention-text);
}

/* ---- the mark ---------------------------------------------------------------------- */
.mark { flex: none; }

/* ---- site header and footer -------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hair);
}
.site-head .wrap { height: 68px; display: flex; align-items: center; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
/* The wordmark is the traced logo, never typeset. It is a mask so it takes --primary: the logo
   gold on dark, #7A5E28 on light, where the gold itself would barely show. */
.wordmark { display: inline-block; height: 24px; aspect-ratio: 1928 / 426; background: var(--primary);
  -webkit-mask: url("guardian-wordmark.svg") no-repeat center / contain;
          mask: url("guardian-wordmark.svg") no-repeat center / contain; }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
/* Header links match the mark and wordmark beside them: primary gold, in the heading face. */
.nav a:not(.btn) { color: var(--primary); text-decoration: none; font-family: var(--head); font-size: 18px; font-weight: 400; }
.nav a:not(.btn):hover { color: var(--text); }
.site-head .btn.secondary { color: var(--primary); border-color: var(--primary); }
@media (max-width: 860px) { .nav .navlink { display: none; } }

.site-foot { border-top: 1px solid var(--hair); padding: 40px 0 48px; margin-top: 40px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: flex-start; justify-content: space-between; }
.site-foot a { color: var(--text2); text-decoration: none; font-weight: 600; font-size: 15px; }
.site-foot a:hover { color: var(--text); }

/* ---- entrance motion: fade and rise, staggered 60ms. None at all under Reduce Motion. */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 340ms var(--ease) both; }
.rise-1 { animation-delay: 60ms; } .rise-2 { animation-delay: 120ms; }
.rise-3 { animation-delay: 180ms; } .rise-4 { animation-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
