/* ==========================================================================
   Weaver fan network — shared design system
   Used by weaver-network.uk, weavernetwork.org.uk and weavernetworkuk.com.
   Source of truth lives in /home/weaver/domains/_shared; run sync.sh to copy
   into each site's public_html/assets/.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces: undyed wool, millstone, ink */
  --bg: #f6f3ec;
  --bg-elev: #ffffff;
  --bg-sunk: #ece7dc;
  --ink: #17201d;
  --ink-2: #3f4b47;
  --ink-3: #66726d;
  --line: #d8d0c0;
  --line-strong: #b9b09d;

  /* Network green */
  --brand: #0b6b57;
  --brand-hover: #085645;
  --brand-deep: #06463a;
  --brand-ink: #ffffff;
  --brand-tint: #dcefe7;
  --brand-text: #0a5f4d;

  /* Five threads, one per district */
  --leeds: #c4462b;      /* madder */
  --bradford: #3d4fa3;   /* indigo */
  --calderdale: #8a4f9e; /* heather */
  --kirklees: #c98f12;   /* weld */
  --wakefield: #cc3d7a;  /* rhubarb */

  /* Status */
  --ok: #1f7a3a;
  --warn: #9a6200;
  --bad: #b3261e;
  --ok-tint: #dff1e3;
  --warn-tint: #fbefd6;
  --bad-tint: #f9e0dd;

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.75vw, 1.9rem);
  --step-3: clamp(1.8rem, 1.5rem + 1.5vw, 2.7rem);
  --step-4: clamp(2.3rem, 1.8rem + 2.6vw, 4rem);
  --step-5: clamp(2.8rem, 2rem + 4vw, 5.6rem);

  /* Space & shape */
  --gutter: clamp(16px, 4vw, 40px);
  --radius-s: 6px;
  --radius: 12px;
  --radius-l: 20px;
  --shadow: 0 1px 2px rgb(23 32 29 / 0.06), 0 4px 16px rgb(23 32 29 / 0.06);
  --shadow-l: 0 2px 4px rgb(23 32 29 / 0.06), 0 12px 40px rgb(23 32 29 / 0.1);
  --measure: 68ch;
  --wide: 1200px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513;
    --bg-elev: #161f1c;
    --bg-sunk: #0b100e;
    --ink: #ebe8e0;
    --ink-2: #c3c8c3;
    --ink-3: #939d98;
    --line: #2b3632;
    --line-strong: #43514b;
    --brand: #36b88f;
    --brand-hover: #4fcca3;
    --brand-deep: #0d3a30;
    --brand-ink: #06231c;
    --brand-tint: #133229;
    --brand-text: #5fd0aa;
    --leeds: #e8735a;
    --bradford: #8695e6;
    --calderdale: #c08ad4;
    --kirklees: #e6b23e;
    --wakefield: #ec6fa2;
    --ok: #5cc87a;
    --warn: #e9b14d;
    --bad: #f07a70;
    --ok-tint: #12301c;
    --warn-tint: #33270e;
    --bad-tint: #3a1714;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-l: 0 2px 4px rgb(0 0 0 / 0.3), 0 12px 40px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1513;
  --bg-elev: #161f1c;
  --bg-sunk: #0b100e;
  --ink: #ebe8e0;
  --ink-2: #c3c8c3;
  --ink-3: #939d98;
  --line: #2b3632;
  --line-strong: #43514b;
  --brand: #36b88f;
  --brand-hover: #4fcca3;
  --brand-deep: #0d3a30;
  --brand-ink: #06231c;
  --brand-tint: #133229;
  --brand-text: #5fd0aa;
  --leeds: #e8735a;
  --bradford: #8695e6;
  --calderdale: #c08ad4;
  --kirklees: #e6b23e;
  --wakefield: #ec6fa2;
  --ok: #5cc87a;
  --warn: #e9b14d;
  --bad: #f07a70;
  --ok-tint: #12301c;
  --warn-tint: #33270e;
  --bad-tint: #3a1714;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  --shadow-l: 0 2px 4px rgb(0 0 0 / 0.3), 0 12px 40px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--brand-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--kirklees); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.01em; font-variation-settings: "SOFT" 50, "WONK" 0; }
h1 { font-size: var(--step-5); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li + li { margin-top: 0.35em; }
hr { border: 0; height: 1px; background: var(--line); margin: 2.5rem 0; }
small { font-size: var(--step--1); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.tnum { font-variant-numeric: tabular-nums; }
::selection { background: var(--kirklees); color: #17201d; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--brand); color: var(--brand-ink); padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-s) 0;
}
.skip-link:focus { left: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { width: 100%; max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(3rem, 8vw, 6.5rem); }
.section-tight { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section-alt { background: var(--bg-sunk); }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.lede { font-size: var(--step-1); color: var(--ink-2); line-height: 1.5; max-width: 60ch; }
.eyebrow {
  font-family: var(--font-body); font-weight: 700; font-size: var(--step--1);
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--brand-text); margin: 0 0 0.75rem;
  display: inline-flex; align-items: center; gap: 0.6rem;
}
.eyebrow::before { content: ""; width: 1.6rem; height: 3px; border-radius: 2px; background: currentColor; }
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.muted { color: var(--ink-3); }

/* ---------- Fan network bar (cross-site) ---------- */
.fanbar {
  background: var(--brand-deep); color: #e7f3ee; font-size: var(--step--1);
}
.fanbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.25rem; padding-block: 0.45rem; }
.fanbar-label { font-weight: 700; letter-spacing: 0.04em; opacity: 0.85; }
.fanbar nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.fanbar a { color: #e7f3ee; text-decoration: none; opacity: 0.8; }
.fanbar a:hover { opacity: 1; text-decoration: underline; }
.fanbar a[aria-current="page"] { opacity: 1; font-weight: 700; }
@media (max-width: 640px) {
  .fanbar .wrap { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .fanbar .wrap::-webkit-scrollbar { display: none; }
  .fanbar nav { flex-wrap: nowrap; }
}
:root[data-theme="dark"] .fanbar { background: #08231d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fanbar { background: #08231d; } }

/* ---------- Site header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1; }
.brand-name span { display: block; font-family: var(--font-body); font-weight: 400; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-top: 0.2rem; }
.site-nav ul { list-style: none; display: flex; gap: 0.25rem; margin: 0; padding: 0; }
.site-nav li + li { margin: 0; }
.site-nav a {
  display: block; padding: 0.5rem 0.8rem; border-radius: 999px; color: var(--ink-2);
  text-decoration: none; font-weight: 700; font-size: 0.95rem;
}
.site-nav a:hover { background: var(--bg-sunk); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--brand-tint); color: var(--brand-text); }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .site-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg-elev); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-l); display: none; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 0.5rem var(--gutter) 1rem; }
  .site-nav a { border-radius: var(--radius-s); padding: 0.8rem 0.75rem; }
}

/* ---------- The weave (signature motif) ---------- */
.weave-band {
  height: 14px;
  background:
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.16) 0 5px, transparent 5px 10px),
    linear-gradient(90deg, var(--leeds) 0 20%, var(--bradford) 20% 40%, var(--calderdale) 40% 60%, var(--kirklees) 60% 80%, var(--wakefield) 80% 100%);
  -webkit-mask: repeating-linear-gradient(0deg, #000 0 4px, rgb(0 0 0 / 0.78) 4px 7px);
          mask: repeating-linear-gradient(0deg, #000 0 4px, rgb(0 0 0 / 0.78) 4px 7px);
}
.weave-band.thin { height: 6px; }
.thread-dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; background: var(--c, var(--brand)); vertical-align: 0.05em; }
.t-leeds { --c: var(--leeds); }
.t-bradford { --c: var(--bradford); }
.t-calderdale { --c: var(--calderdale); }
.t-kirklees { --c: var(--kirklees); }
.t-wakefield { --c: var(--wakefield); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.8rem 1.3rem; border-radius: 999px; border: 2px solid transparent;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); transition: background 0.15s, transform 0.15s;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-sunk); }
.btn-small { padding: 0.5rem 0.9rem; font-size: 0.92rem; }
.btn svg { width: 1.1em; height: 1.1em; }

/* ---------- Cards & callouts ---------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem); box-shadow: var(--shadow);
}
.card h3 { font-size: var(--step-1); margin-bottom: 0.4em; }
.card > :last-child { margin-bottom: 0; }
.card-thread { border-top: 5px solid var(--c, var(--brand)); }
.callout {
  border-left: 5px solid var(--c, var(--brand)); background: var(--bg-elev);
  padding: 1rem 1.25rem; border-radius: 0 var(--radius-s) var(--radius-s) 0; margin: 1.5rem 0;
}
.callout > :last-child { margin-bottom: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: var(--step--1); font-weight: 700; background: var(--bg-sunk); color: var(--ink-2); border: 1px solid var(--line);
}
.pill-brand { background: var(--brand-tint); color: var(--brand-text); border-color: transparent; }
.stat { font-family: var(--font-display); font-size: var(--step-4); font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--brand-text); }
.stat-label { color: var(--ink-2); margin-top: 0.5rem; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line-strong); }
.timeline > li { position: relative; padding-left: 2.6rem; margin: 0 0 1.9rem; }
.timeline > li::before {
  content: ""; position: absolute; left: 3px; top: 0.3rem; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); border: 4px solid var(--c, var(--brand));
}
.timeline .when { font-family: var(--font-mono); font-size: var(--step--1); font-weight: 700; color: var(--ink-3); letter-spacing: 0.02em; }
.timeline h3 { font-size: var(--step-1); margin: 0.15rem 0 0.3rem; }
.timeline p { margin: 0; color: var(--ink-2); }
.timeline .future::before { border-style: dashed; }

/* ---------- FAQ ---------- */
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 1.1rem 2.5rem 1.1rem 0; position: relative;
  font-weight: 700; font-size: var(--step-1); font-family: var(--font-display);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%);
  font-family: var(--font-body); font-size: 1.6rem; color: var(--brand-text); transition: transform 0.2s;
}
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 0 1.25rem; color: var(--ink-2); max-width: var(--measure); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--ink-2); background: var(--bg-sunk); }
tr:last-child td { border-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-sunk); border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.95rem; }
.site-footer .wrap { padding-block: 3rem 2rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.site-footer h2 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 700; margin-bottom: 0.75rem; color: var(--ink); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 0.4rem; }
.site-footer a { color: var(--ink-2); }
.disclaimer {
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: var(--step--1); color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between;
}
.disclaimer p { margin: 0; max-width: 80ch; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }
