/* ==========================================================================
   d4vinder shared design system
   One stylesheet for the studio site and every app subsite. Apple-inspired:
   clean surfaces, San Francisco system type, generous space, hairline rules,
   a single accent colour per site that each subsite may override.

   Override the accent per app by setting --accent on :root or [data-app] in a
   small local stylesheet loaded after this one. British English throughout.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Monaco, "Cascadia Mono",
               "Roboto Mono", monospace;

  /* Surfaces and ink (light) */
  --bg: #ffffff;
  --bg-alt: #fbfbfd;          /* Apple off-white */
  --bg-sunken: #f5f5f7;
  --ink: #1d1d1f;             /* near-black text */
  --ink-2: #6e6e73;           /* secondary grey */
  --ink-3: #86868b;           /* tertiary grey */
  --hairline: #d2d2d7;
  --card: #ffffff;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);

  /* Accent (overridable per subsite). Studio default is Apple blue. */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --on-accent: #ffffff;

  /* Shape and motion */
  --radius: 18px;
  --radius-lg: 28px;
  --radius-pill: 980px;
  --nav-h: 48px;
  --maxw: 1024px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #0b0b0d;
    --bg-sunken: #1d1d1f;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #86868b;
    --hairline: #3a3a3c;
    --card: #1c1c1e;
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --accent: #2997ff;
    --accent-hover: #47a6ff;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47059;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 3rem 0; }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
code {
  background: var(--bg-sunken);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

/* ---------- Navigation (translucent, blurred, Apple-style) ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  min-height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent);
}
.nav-inner {
  max-width: var(--maxw);
  min-height: var(--nav-h);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav a { color: var(--ink); text-decoration: none; }
.nav-home {
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.nav-home:hover { color: var(--accent); text-decoration: none; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 17px; letter-spacing: -0.02em;
}
.brand img { width: 24px; height: 24px; border-radius: 6px; }
/* Studio brand mark (the d4 badge) replaces the wordmark text */
.brand img.brandmark { width: auto; height: 26px; border-radius: 0; }
.site-footer .brand img.brandmark { height: 22px; }
.nav-home { display: inline-flex; align-items: center; }
/* Small brand mark, used in the nav backlink and in footers. Must not depend
   on its container, or an unscoped copy renders at the image's natural size. */
img.brandmark-sm { height: 18px; width: auto; display: inline-block; vertical-align: middle; border-radius: 0; }
.site-footer img.brandmark-sm { height: 20px; }
.nav-links {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.nav-links a {
  font-size: 13px; color: var(--ink-2);
  padding: 6px 10px; border-radius: 8px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--ink); font-weight: 500; }

/* ---------- Layout containers ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 5rem 22px; }
.wrap-wide { max-width: var(--maxw); margin: 0 auto; padding: 4rem 22px; }
.section { padding: 6rem 22px; }
.section > .inner-w { max-width: var(--maxw); margin: 0 auto; }
.section-alt { background: var(--bg-alt); }
.section-sunken { background: var(--bg-sunken); }
.section-dark { background: #000; color: #f5f5f7; }
.section-dark .lede, .section-dark .eyebrow { color: #a1a1a6; }

/* ---------- Typography helpers ---------- */
.eyebrow {
  text-transform: none;
  font-size: 15px; font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
  letter-spacing: 0;
}
h1, h2, h3 { letter-spacing: -0.02em; color: var(--ink); }
.display {
  font-size: clamp(40px, 7vw, 80px);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.4em;
}
.headline {
  font-size: clamp(30px, 4.5vw, 52px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.4em;
}
.gradient-ink {
  background: linear-gradient(120deg, var(--ink), var(--accent) 140%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.lede {
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.4;
  color: var(--ink-2);
  font-weight: 400;
  margin: 0 auto 1.6em;
  max-width: 42ch;
}
.tag {
  font-size: clamp(21px, 2.6vw, 28px);
  font-weight: 600; color: var(--ink);
  margin: 0 0 0.5em;
}
.updated { color: var(--ink-3); font-size: 15px; margin-top: -0.5em; }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: 400; line-height: 1;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  transition: background 0.2s var(--ease), transform 0.1s var(--ease), opacity 0.2s var(--ease);
  cursor: pointer; text-decoration: none; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.chev { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 16px; }
.chev::after { content: "\203A"; font-size: 1.15em; line-height: 1; }
a.chev:hover { text-decoration: none; }
a.chev:hover span { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: clamp(4rem, 10vw, 8rem) 0 clamp(3rem, 6vw, 5rem); }
.hero .logo, .app-hero .logo { width: 108px; height: 108px; border-radius: 24px; margin: 0 auto 28px; box-shadow: var(--card-shadow); }
.hero .hero-mark { width: 76px; height: 76px; margin: 0 auto 22px; }
.app-hero { text-align: center; padding: clamp(3.5rem, 8vw, 7rem) 0 clamp(2.5rem, 5vw, 4rem); }

/* ---------- Feature / app card grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 3rem 0 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow); }
.card .ico { font-size: 30px; display: block; margin-bottom: 14px; line-height: 1; }
.card h3 { font-size: 21px; font-weight: 600; margin: 0 0 8px; }
.card p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.card a { font-weight: 500; }

/* App tile (links to a subsite) */
.app-tile {
  display: flex; flex-direction: column; align-items: flex-start;
  text-decoration: none; color: inherit;
}
.app-tile:hover { text-decoration: none; }
.app-tile .app-icon { width: 72px; height: 72px; border-radius: 17px; margin-bottom: 18px; box-shadow: var(--card-shadow); }
.app-tile .meta { margin-top: auto; padding-top: 14px; }
.app-tile .app-name { font-size: 22px; font-weight: 600; }
.app-tile .app-sub { color: var(--ink-2); font-size: 16px; margin: 4px 0 0; }
.app-tile.soon { opacity: 0.62; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  color: var(--ink-2); background: var(--bg-sunken);
  padding: 4px 10px; border-radius: var(--radius-pill); margin-bottom: 16px;
}

/* Capability list */
.caps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 34px 28px; margin-top: 3rem; }
.cap h3 { font-size: 19px; margin: 0 0 8px; }
.cap p { margin: 0; color: var(--ink-2); font-size: 16px; }
.cap .ico { font-size: 26px; display: block; margin-bottom: 10px; }

/* ---------- Documentation layout (guide) ---------- */
.doc { display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: start; }
.toc {
  position: sticky; top: calc(var(--nav-h) + 24px);
  display: flex; flex-direction: column; gap: 2px;
  font-size: 14px;
  max-height: calc(100vh - var(--nav-h) - 48px); overflow: auto;
}
.toc strong { display: block; margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.toc strong:first-child { margin-top: 0; }
.toc a { color: var(--ink-2); padding: 4px 0; }
.toc a:hover { color: var(--accent); text-decoration: none; }
.doc-body { min-width: 0; max-width: 720px; }
.doc-body h1 { font-size: clamp(32px, 5vw, 44px); margin: 0 0 0.3em; }
.doc-body h2 { font-size: 27px; margin: 2.4em 0 0.6em; scroll-margin-top: calc(var(--nav-h) + 20px); }
.doc-body h3 { font-size: 20px; margin: 1.8em 0 0.5em; }
.doc-body p, .doc-body li { color: var(--ink); }
.doc-body ul, .doc-body ol { padding-left: 1.3em; }
.doc-body li { margin: 0.35em 0; }

/* ---------- Notes / callouts ---------- */
.note {
  background: var(--bg-sunken);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 1.6em 0;
  font-size: 16px; color: var(--ink-2);
}
.note strong { color: var(--ink); }
.note.warn { border-left-color: #ff9f0a; }

/* ---------- FAQ ---------- */
.faq { margin: 1.5rem 0; border-top: 1px solid var(--hairline); }
.faq details { border-bottom: 1px solid var(--hairline); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 20px 2px; font-size: 19px; font-weight: 500;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 26px; font-weight: 300; transition: transform 0.2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > *:not(summary) { margin: 0 2px 20px; color: var(--ink-2); }
.faq details ul { padding-left: 1.2em; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--hairline);
  font-size: 12px; color: var(--ink-3);
  padding: 34px 22px;
}
.site-footer .inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
}
.site-footer .brand { font-size: 15px; color: var(--ink); }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer .spacer { flex: 1 1 40px; }
.site-footer .disclaimer { flex-basis: 100%; margin: 14px 0 0; line-height: 1.5; color: var(--ink-3); }
/* The legal row sits directly above the statutory identity line, so the two
   read as one block rather than two loose paragraphs. */
.site-footer .legal-links { margin-top: 18px; }
.site-footer .legal-links + .disclaimer { margin-top: 6px; }

/* ---------- Utilities ---------- */
.center { text-align: center; }
.mw-40 { max-width: 40ch; margin-left: auto; margin-right: auto; }
.stack-sm > * + * { margin-top: 0.8rem; }

/* The brand mark artwork is black; invert it so it stays visible on dark. */
@media (prefers-color-scheme: dark) {
  img.brandmark, img.brandmark-sm, .hero .hero-mark { filter: invert(1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .doc { grid-template-columns: 1fr; gap: 24px; }
  .toc { position: static; max-height: none; flex-flow: row wrap; gap: 6px 14px; }
  .toc strong { flex-basis: 100%; margin: 10px 0 2px; }
  .section { padding: 4rem 22px; }
}
@media (max-width: 540px) {
  body { font-size: 16px; }
  /* Let the bar grow to a second row instead of clipping the links. */
  .nav-inner { flex-wrap: wrap; padding-top: 7px; padding-bottom: 7px; gap: 2px 12px; }
  .nav-links { width: 100%; margin-left: 0; gap: 0 2px; }
  .nav-links a { padding: 5px 8px 5px 0; }
  .wrap, .wrap-wide { padding-left: 18px; padding-right: 18px; }
}

/* ---------- Feedback widget (used site-wide and on /feedback) ---------- */
.fb-btn { position: fixed; bottom: 22px; right: 22px; z-index: 90; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border: none; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font: 500 15px/1 var(--font); cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: background .2s var(--ease), transform .1s var(--ease); }
.fb-btn:hover { background: var(--accent-hover); }
.fb-btn:active { transform: scale(.97); }
.fb-overlay { position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,.4); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: flex-end; }
.fb-modal { background: var(--card); color: var(--ink); width: 100%; max-width: 420px; height: 100dvh; overflow: auto; box-shadow: -8px 0 40px rgba(0,0,0,.25); padding: 22px; }
@media (min-width: 560px) { .fb-overlay { align-items: center; justify-content: center; padding: 20px; } .fb-modal { height: auto; max-height: 90vh; border-radius: var(--radius-lg); } }
.fb-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 18px; }
.fb-close { border: none; background: none; font-size: 26px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.fb-form { display: flex; flex-direction: column; gap: 12px; }
.fb-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.fb-input { font: 16px/1.4 var(--font); color: var(--ink); background: var(--bg); border: 1px solid var(--hairline); border-radius: 12px; padding: 10px 12px; width: 100%; }
.fb-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea.fb-input { resize: vertical; }
.fb-hp { position: absolute; left: -5000px; }
.fb-msg { font-size: 14px; padding: 10px 12px; border-radius: 10px; }
.fb-msg-error { background: rgba(255,59,48,.1); color: #c02b21; }
.fb-submit { margin-top: 4px; justify-content: center; }
.fb-done { text-align: center; padding: 18px 6px; }
.fb-tick { width: 48px; height: 48px; border-radius: 50%; background: rgba(48,209,88,.15); color: #1a9e46; font-size: 24px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.fb-done-title { font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.fb-done-sub { color: var(--ink-2); font-size: 15px; margin: 0 0 16px; }

/* ---------- Admin area ---------- */
.admin-body { background: var(--bg-alt); min-height: 100vh; }
.admin-bar { background: var(--card); border-bottom: 1px solid var(--hairline); }
.admin-bar .nav-inner { justify-content: flex-start; gap: 18px; }
.admin-bar .admin-nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.admin-bar .admin-nav a { font-size: 13px; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; }
.admin-bar .admin-nav a:hover, .admin-bar .admin-nav a.active { color: var(--ink); text-decoration: none; }
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 32px 22px 64px; }
.admin-login { max-width: 360px; margin: 8vh auto; padding: 28px; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.stat { background: var(--card); border: 1px solid var(--hairline); border-radius: 14px; padding: 16px; }
.stat .n { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.stat .l { font-size: 13px; color: var(--ink-2); }
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--bg-alt); }
.tbl tr:last-child td { border-bottom: none; }
.tbl a { font-weight: 500; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg-sunken); color: var(--ink-2); }
.badge.open, .badge.triaged { background: rgba(0,113,227,.12); color: #0060c0; }
.badge.in_progress, .badge.waiting_on_user { background: rgba(255,159,10,.15); color: #a86400; }
.badge.resolved { background: rgba(48,209,88,.15); color: #1a9e46; }
.badge.closed, .badge.wont_fix { background: var(--bg-sunken); color: var(--ink-3); }
.thread { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.msg { border: 1px solid var(--hairline); border-radius: 14px; padding: 14px 16px; background: var(--card); }
.msg.user { background: var(--bg-alt); }
.msg.admin { border-color: color-mix(in srgb, var(--accent) 35%, var(--hairline)); }
.msg.internal { background: rgba(255,159,10,.08); border-color: rgba(255,159,10,.3); }
.msg .who { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.msg .body { font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.admin-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.admin-input { font: 15px/1.4 var(--font); color: var(--ink); background: var(--bg); border: 1px solid var(--hairline); border-radius: 10px; padding: 9px 11px; }
.admin-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.notice { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.notice.ok { background: rgba(48,209,88,.15); color: #1a7e3a; }
.notice.err { background: rgba(255,59,48,.1); color: #c02b21; }

/* ---------- Editorial layer ----------
   Typographic, asymmetric treatments for the studio voice. Monospace accents
   nod to the terminal without turning the site into a gimmick. */

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
a:hover { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.display, .headline { text-wrap: balance; }
section[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* Monospace kicker line, used above headings */
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 20px;
}
.kicker b { color: var(--accent); font-weight: 600; }

/* Left-aligned hero: type does the work, no decoration */
.hero-editorial { text-align: left; padding: clamp(4.5rem, 12vw, 8.5rem) 0 clamp(3rem, 7vw, 5rem); }
.hero-editorial .display { max-width: 16ch; }
.hero-editorial .lede { margin-left: 0; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-top: 6px; }
.quietlink { font-size: 16px; color: var(--ink-2); }
.quietlink:hover { color: var(--accent); }

/* Numbered section headers: 01 / Apps */
.sechead { display: flex; align-items: baseline; gap: 16px; margin: 0 0 0.6em; }
.sechead .num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.sechead h2 { margin: 0; }
.seclede { color: var(--ink-2); font-size: 18px; max-width: 56ch; margin: 0 0 2.6rem; }

/* Featured app row: asymmetric, hairline-topped, no card chrome */
.feature {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 30px;
  align-items: start;
  padding: 36px 0 30px;
  border-top: 1px solid var(--hairline);
}
.feature .app-icon { width: 84px; height: 84px; border-radius: 19px; box-shadow: var(--card-shadow); }
.feature h3 { font-size: 26px; margin: 0 0 2px; letter-spacing: -0.02em; }
.feature .strap { font-size: 17px; color: var(--ink-2); margin: 0 0 12px; }
.feature .blurb { font-size: 16px; line-height: 1.55; color: var(--ink); max-width: 58ch; margin: 0; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; padding: 0; list-style: none; }
.spec-chips li {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 11px;
}
.workshop { border-top: 1px solid var(--hairline); padding: 24px 0 0; color: var(--ink-3); font-size: 15px; }

/* Practice: an editorial index, not a card grid */
.rows { border-top: 1px solid var(--hairline); }
.rowitem {
  display: grid;
  grid-template-columns: 56px 230px 1fr;
  gap: 12px 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--hairline);
}
.rowitem .n { font-family: var(--font-mono); font-size: 13px; color: var(--accent); padding-top: 3px; }
.rowitem h3 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.rowitem p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.55; max-width: 62ch; }

/* About: a pull statement, not a paragraph soup */
.pull {
  font-size: clamp(24px, 3.6vw, 40px);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.02em;
  max-width: 30ch;
  margin: 0 0 26px;
  text-wrap: balance;
}
.section-dark .kicker { color: #6e6e73; }
.signature { font-family: var(--font-mono); font-size: 13px; color: #86868b; }

/* Contact: one enormous, unmissable address */
.bigmail {
  display: inline-block;
  font-size: clamp(24px, 4.6vw, 46px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 5px;
}
.bigmail:hover { color: var(--accent); text-decoration: none; }

/* Monospace feature tag used on app subsite cards (replaces emoji) */
.tagmono {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: 6px;
  padding: 3px 9px;
  margin-bottom: 14px;
}

@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; gap: 18px; }
  .rowitem { grid-template-columns: 44px 1fr; }
  .rowitem p { grid-column: 2; }
  .sechead { gap: 12px; }
}

/* ---------- App subsite editorial layer ----------
   Used by pfAdmin and future app subsites. Asymmetric hero with a terminal
   card, a capabilities index, steps, and a dark privacy band. */

.app-hero-ed {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(28px, 5vw, 60px);
  align-items: center;
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
}
.app-hero-ed .id { display: flex; align-items: center; gap: 14px; margin: 0 0 20px; }
.app-hero-ed .id img { width: 56px; height: 56px; border-radius: 13px; box-shadow: var(--card-shadow); }
.app-hero-ed .id .name { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.app-hero-ed h1 { font-size: clamp(32px, 4.2vw, 50px); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 18px; }
.app-hero-ed .lede { margin: 0 0 26px; max-width: 48ch; }

/* Terminal card: dark in both colour schemes, as terminals are */
.term {
  background: #0c1016;
  border: 1px solid #202a36;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}
.term-bar { display: flex; align-items: center; gap: 6px; padding: 11px 14px; border-bottom: 1px solid #202a36; }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: #2b3646; }
.term-bar .term-title { margin-left: 8px; font-size: 11px; letter-spacing: 0.08em; color: #55657a; text-transform: uppercase; }
.term-body { padding: 16px 18px 20px; color: #8fa1b5; }
.term-body .p { color: #5ac8fa; }
.term-body .g { color: #45d268; }
.term-body .w { color: #e7ecf2; }

/* Capabilities index variant: wider first column for the mono tag */
.rows-app .rowitem { grid-template-columns: 118px 220px 1fr; }
.rows-app .tagmono { margin: 0; }

/* Compact toolbox: secondary features as an inline index */
.toolbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 44px; margin-top: 8px; }
.toolbox .tool { padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.toolbox .tool .tagmono { margin: 0 10px 0 0; vertical-align: 1px; }
.toolbox .tool h4 { display: inline; font-size: 16px; font-weight: 600; margin: 0 8px 0 0; letter-spacing: -0.01em; }
.toolbox .tool p { display: inline; margin: 0; color: var(--ink-2); font-size: 15px; }

/* Numbered steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 10px; }
.step .n { display: block; font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.step h3 { font-size: 19px; margin: 0 0 8px; letter-spacing: -0.01em; }
.step p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }

/* Fact list for the dark privacy band */
.facts { display: grid; gap: 13px; margin: 26px 0 30px; padding: 0; list-style: none; }
.facts li {
  position: relative;
  padding-left: 28px;
  font-size: clamp(17px, 2.1vw, 21px);
  font-weight: 500;
  color: #f5f5f7;
  max-width: 44ch;
}
.facts li::before { content: "\2713"; position: absolute; left: 0; color: #45d268; font-weight: 600; }

@media (max-width: 860px) {
  .app-hero-ed { grid-template-columns: 1fr; }
  .app-hero-ed h1 { max-width: none; }
  .steps { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 760px) {
  .rows-app .rowitem { grid-template-columns: 1fr; gap: 8px; }
  .rows-app .rowitem p { grid-column: auto; }
}

/* ---------- Compact dropdown menu (mobile) ----------
   Pure CSS disclosure via <details>, no JavaScript. Desktop keeps inline
   links; below 700px the links collapse into a tidy panel. */
.navdd { display: none; position: relative; margin-left: auto; }
.navdd summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; }
.navdd summary::-webkit-details-marker { display: none; }
.navdd summary:hover, .navdd[open] summary { background: var(--bg-sunken); }
.navdd-ico { position: relative; display: block; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; }
.navdd-ico::before, .navdd-ico::after { content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; }
.navdd-ico::before { top: -5px; }
.navdd-ico::after { top: 5px; }
.navdd-panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--card-shadow);
  padding: 8px;
  display: flex; flex-direction: column;
  z-index: 130;
}
.navdd-panel a, .navdd-panel .navdd-btn {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 9px;
  font-size: 15px; color: var(--ink);
  background: none; border: none; font-family: var(--font); cursor: pointer;
}
.navdd-panel a:hover, .navdd-panel .navdd-btn:hover { background: var(--bg-sunken); text-decoration: none; }
.navdd-panel .sep { height: 1px; background: var(--hairline); margin: 6px 4px; }

@media (max-width: 700px) {
  .nav-links, .admin-bar .admin-nav { display: none; }
  .navdd { display: block; }
  .nav .nav-inner { flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
}

/* ---------- Manual theme override (Theme button) ----------
   Auto mode follows prefers-color-scheme as before. Forcing a theme sets
   data-theme on <html>; these higher-specificity blocks beat the automatic
   media-query rules in either direction. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff; --bg-alt: #fbfbfd; --bg-sunken: #f5f5f7;
  --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #86868b;
  --hairline: #d2d2d7; --card: #ffffff;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --accent: #0071e3; --accent-hover: #0077ed;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --bg-alt: #0b0b0d; --bg-sunken: #1d1d1f;
  --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #86868b;
  --hairline: #3a3a3c; --card: #1c1c1e;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --accent: #2997ff; --accent-hover: #47a6ff;
}
:root[data-theme="dark"] img.brandmark,
:root[data-theme="dark"] img.brandmark-sm,
:root[data-theme="dark"] .hero-mark { filter: invert(1); }
:root[data-theme="light"] img.brandmark,
:root[data-theme="light"] img.brandmark-sm,
:root[data-theme="light"] .hero-mark { filter: none; }
:root[data-theme="dark"] .term { border-color: #26303e; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }

/* Theme button styling in both nav contexts */
.nav-links .theme-btn {
  font: 13px/1 var(--font); color: var(--ink-2);
  background: none; border: none; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.nav-links .theme-btn:hover { color: var(--ink); background: var(--bg-sunken); }
.navdd-panel .theme-btn {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 9px;
  font-size: 15px; color: var(--ink);
  background: none; border: none; cursor: pointer; font-family: var(--font);
}
.navdd-panel .theme-btn:hover { background: var(--bg-sunken); }

/* Theme button renders as an icon; the word appears only in the dropdown panel */
.theme-btn svg { width: 16px; height: 16px; display: block; }
.nav-links .theme-btn, .admin-nav .theme-btn { display: inline-flex; align-items: center; padding: 8px; color: var(--ink-2); background: none; border: none; border-radius: 8px; cursor: pointer; }
.nav-links .theme-btn:hover, .admin-nav .theme-btn:hover { color: var(--ink); background: var(--bg-sunken); }
.nav-links .theme-word, .admin-nav .theme-word { display: none; }
.navdd-panel .theme-btn { display: flex; align-items: center; gap: 10px; }
.navdd-panel .theme-btn svg { width: 15px; height: 15px; }

/* ===== Feedback widget, redesigned ===== */

.fb-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 90;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px 12px 16px; border: none;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font: 500 15px/1 var(--font); cursor: pointer;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 6px rgba(0,0,0,.12);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.fb-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 46%, transparent), 0 3px 8px rgba(0,0,0,.14); }
.fb-btn:active { transform: translateY(0) scale(.98); }
.fb-btn svg { width: 17px; height: 17px; }

.fb-overlay {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(15,18,22,.5);
  -webkit-backdrop-filter: saturate(160%) blur(4px); backdrop-filter: saturate(160%) blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: fb-fade .18s var(--ease) both;
}
.fb-modal {
  position: relative; background: var(--card); color: var(--ink);
  width: 100%; max-width: 480px; max-height: 94dvh; overflow-y: auto;
  padding: 26px 26px 22px; border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 44px rgba(0,0,0,.28);
  animation: fb-up .26s var(--ease) both;
}
@media (min-width: 560px) {
  .fb-overlay { align-items: center; padding: 24px; }
  .fb-modal { border-radius: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.32); animation: fb-pop .22s var(--ease) both; }
}
@keyframes fb-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes fb-up { from { opacity: 0; transform: translateY(28px) } to { opacity: 1; transform: none } }
@keyframes fb-pop { from { opacity: 0; transform: translateY(10px) scale(.98) } to { opacity: 1; transform: none } }

/* Header */
.fb-head { margin: 2px 0 20px; padding-right: 34px; }
.fb-badge {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.fb-badge svg { width: 21px; height: 21px; }
.fb-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 5px; }
.fb-sub { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin: 0; max-width: 40ch; }

.fb-close {
  position: absolute; top: 20px; right: 20px;
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--bg-sunken); color: var(--ink-2);
  font-size: 19px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.fb-close:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); color: var(--ink); }

/* Form */
.fb-form { display: flex; flex-direction: column; gap: 16px; }
.fb-field { display: flex; flex-direction: column; gap: 7px; }
.fb-lab, .fb-label { font-size: 13px; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 440px) { .fb-row { grid-template-columns: 1fr; } }

/* Category as segmented chips */
.fb-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-cat {
  font: 500 14px/1 var(--font); color: var(--ink-2);
  background: var(--bg-sunken); border: 1px solid transparent;
  border-radius: 999px; padding: 8px 15px; cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.fb-cat:hover { color: var(--ink); }
.fb-cat.is-active {
  color: var(--accent); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Inputs: filled, calm, clear focus */
.fb-input {
  font: 15px/1.45 var(--font); color: var(--ink);
  background: var(--bg-sunken); border: 1.5px solid transparent;
  border-radius: 12px; padding: 12px 14px; width: 100%;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.fb-input::placeholder { color: var(--ink-3); }
.fb-input:focus {
  outline: none; background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
textarea.fb-input { resize: vertical; min-height: 96px; }
select.fb-input { -webkit-appearance: none; appearance: none; background-image: none; }

.fb-hp { position: absolute; left: -5000px; }

.fb-msg { font-size: 14px; padding: 11px 14px; border-radius: 10px; margin: -2px 0 0; }
.fb-msg-error { background: color-mix(in srgb, #ff3b30 12%, transparent); color: #c0271d; }

.fb-submit {
  width: 100%; justify-content: center; margin-top: 2px;
  border-radius: 13px; padding: 14px; font-size: 16px; font-weight: 500;
}
.fb-submit:disabled { opacity: .6; cursor: default; }
.fb-fine { font-size: 12px; color: var(--ink-3); text-align: center; margin: 4px 0 0; }

/* Success state */
.fb-done { text-align: center; padding: 22px 8px 12px; animation: fb-fade .2s var(--ease) both; }
.fb-tick {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, #30d158 18%, transparent); color: #1a9e46; font-size: 30px;
}
.fb-done-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.fb-done-sub { color: var(--ink-2); font-size: 15px; line-height: 1.5; margin: 0 auto 20px; max-width: 34ch; }
.fb-refchip {
  display: inline-block; font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--bg-sunken); border-radius: 8px; padding: 3px 10px;
}


/* ===== Admin nav: tidy More dropdown + right cluster ===== */
.admin-bar .admin-tag { font-size: 12px; color: var(--ink-3); background: var(--bg-sunken); padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.admin-bar .admin-sep { width: 1px; height: 20px; background: var(--hairline); margin: 0 3px; }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "\25BE"; font-size: 9px; opacity: .7; }
.menu[open] > summary, .menu > summary:hover, .menu.active > summary { color: var(--ink); background: var(--bg-sunken); }
.menu > .navdd-panel { top: calc(100% + 8px); min-width: 214px; }
.menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 4px 12px 8px; }
.menu-group { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 10px 12px 3px; opacity: .8; }
.menu-group:first-child { padding-top: 4px; }
/* Panel links must be full-width blocks, beating the inline .admin-nav a rule */
.admin-nav .navdd-panel a { display: block; width: 100%; padding: 10px 12px; border-radius: 9px; font-size: 15px; color: var(--ink); }
.admin-nav .navdd-panel a:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }
.admin-nav .navdd-panel a.active { color: var(--accent); font-weight: 500; }

/* ===== Homepage hero logo ===== */
.hero-editorial .hero-logo { height: 56px; width: auto; display: block; margin: 0 0 24px; }


/* ===== Hero watermark: the d4 mark, stylised and layered behind the text ===== */
.hero-editorial { position: relative; overflow: hidden; }
.hero-editorial > * { position: relative; z-index: 1; }
.hero-watermark {
  position: absolute; z-index: 0; pointer-events: none;
  top: 50%; right: -40px; transform: translateY(-50%);
  width: min(58vw, 560px); aspect-ratio: 1 / 1; opacity: .07;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 35%, var(--ink)));
  -webkit-mask: url(/assets/img/d4-logo-black.png) center / contain no-repeat;
          mask: url(/assets/img/d4-logo-black.png) center / contain no-repeat;
}
:root[data-theme="dark"] .hero-watermark { opacity: .11; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-watermark { opacity: .11; } }
@media (max-width: 720px) {
  .hero-watermark { right: 50%; top: 40%; transform: translate(50%, -50%); width: 96vw; opacity: .05; }
}

/* ===== Capability pillars ===== */
.pillars { border-top: 1px solid var(--hairline); margin-top: 2.6rem; }
.pillar { display: grid; grid-template-columns: 150px 1fr; gap: 18px 40px; padding: 38px 0; border-bottom: 1px solid var(--hairline); }
.pillar .ptag { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: .02em; padding-top: 6px; }
.pillar h3 { font-size: 23px; line-height: 1.16; letter-spacing: -0.02em; margin: 0 0 12px; }
.pillar > div > p { margin: 0 0 18px; color: var(--ink-2); font-size: 16.5px; line-height: 1.62; max-width: 62ch; }
.howto b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; }
.howto ul { margin: 0; padding-left: 1.1em; color: var(--ink); font-size: 15px; line-height: 1.5; max-width: 62ch; }
.howto li { margin: 6px 0; }
@media (max-width: 720px) { .pillar { grid-template-columns: 1fr; gap: 10px; } .pillar .ptag { padding-top: 0; } }

/* Watermark as a real image (mask is unreliable under CSP); faint, stylised */
img.hero-watermark { background: none; -webkit-mask: none; mask: none; height: auto; aspect-ratio: auto; opacity: .06; }
:root[data-theme="dark"] img.hero-watermark { filter: invert(1); opacity: .10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) img.hero-watermark { filter: invert(1); opacity: .10; } }

/* GitHub link in the footer */
.site-footer .ghlink { display: inline-flex; align-items: center; gap: 6px; }
.site-footer .ghlink svg { display: block; }

/* Union Jack flag + Made in England stamp */
.flag { display: inline-block; vertical-align: middle; border-radius: 2px; }
.kicker .flag { width: 17px; height: 11px; margin: 0 5px 0 3px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.made-stamp {
  display: inline-flex; align-items: center; gap: 9px;
  border: 2px solid currentColor; border-radius: 8px; padding: 6px 11px;
  transform: rotate(-3deg);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  color: #1b3a6b; background: color-mix(in srgb, #1b3a6b 5%, transparent);
}
.made-stamp .flag { width: 22px; height: 14px; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
:root[data-theme="dark"] .made-stamp { color: #a9c0e6; background: color-mix(in srgb, #a9c0e6 9%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .made-stamp { color: #a9c0e6; background: color-mix(in srgb, #a9c0e6 9%, transparent); } }

/* Work cards with screenshots */
.work-card { padding: 0; overflow: hidden; }
.work-shot { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center; display: block; border-bottom: 1px solid var(--hairline); background: var(--bg-sunken); }
.work-body { padding: 16px 20px 20px; display: flex; flex-direction: column; }
.work-card .app-name { margin-top: 6px; }
.work-card .app-sub { margin: 4px 0 0; }
.work-card .meta { margin-top: 14px; }

/* Feedback dialog: visible field and chip outlines, and stronger contrast in dark */
.fb-input { border: 1.5px solid var(--hairline); }
.fb-cat { border: 1px solid var(--hairline); }
:root[data-theme="dark"] .fb-input { background: #0f0f12; border-color: #3a3a3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fb-input { background: #0f0f12; border-color: #3a3a3c; } }

/* ===== Tools dropdown in the desktop nav (hover or keyboard focus) ===== */
.navdrop { position: relative; display: inline-flex; align-items: center; }
.navdrop-panel {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 12px);
  min-width: 232px; background: var(--card); border: 1px solid var(--hairline);
  border-radius: 14px; box-shadow: var(--card-shadow); padding: 8px;
  display: none; flex-direction: column; z-index: 130;
}
.navdrop:hover .navdrop-panel, .navdrop:focus-within .navdrop-panel { display: flex; }
/* invisible bridge so the pointer can cross the gap without closing it */
.navdrop-panel::before { content: ""; position: absolute; top: -12px; left: 0; right: 0; height: 12px; }
.nav-links .navdrop-panel a { display: block; width: 100%; padding: 9px 12px; border-radius: 9px; font-size: 15px; color: var(--ink); }
.nav-links .navdrop-panel a:hover { background: var(--bg-sunken); color: var(--ink); text-decoration: none; }
.navdrop-panel .sep { height: 1px; background: var(--hairline); margin: 6px 4px; }

/* ===== Frosted glass menus (Apple-style). Panels stay solid cards where
   backdrop-filter is unsupported, so text never sits on raw page content. ===== */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .navdd-panel, .navdrop-panel {
    background: color-mix(in srgb, var(--card) 92%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    border-color: color-mix(in srgb, var(--hairline) 70%, transparent);
  }
  .navdd-panel a:hover, .navdd-panel .navdd-btn:hover,
  .nav-links .navdrop-panel a:hover {
    background: color-mix(in srgb, var(--bg-sunken) 75%, transparent);
  }
}

/* ============================================================================
   ADMIN CONSOLE  (redesign 2026-07-08)
   A left-rail operations console for the studio: the whole surface visible
   and grouped, a monospace telemetry voice, and an unmissable environment
   identity (amber DEV replica vs green LIVE production). Public-site classes
   used by the pages (.tbl .stat .badge .notice .admin-field) are refined
   here, not replaced.
   ========================================================================== */
.admin-body { background: var(--bg); }
.side-toggle { position: absolute; }

.admin-shell {
  --env: #ff9f0a; --env-ink: #a86400;
  display: flex; align-items: flex-start; min-height: 100vh;
}
.admin-shell[data-env="prod"] { --env: #1a9e46; --env-ink: #147d38; }
@media (prefers-color-scheme: dark) {
  .admin-shell { --env-ink: #ffb340; }
  .admin-shell[data-env="prod"] { --env-ink: #30d158; }
}

/* ---- the rail ---- */
.side {
  position: sticky; top: 0; align-self: stretch;
  width: 236px; flex: 0 0 236px; height: 100vh; overflow-y: auto;
  background: var(--bg-sunken);
  border-right: 1px solid var(--hairline);
  box-shadow: inset 3px 0 0 var(--env);
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px 12px;
}
.side-head { padding: 6px 8px 12px; }
.side-brand {
  display: inline-flex; align-items: baseline; gap: 8px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 17px;
}
.side-brand:hover { text-decoration: none; }
.side-brand img.brandmark { height: 22px; width: auto; transform: translateY(3px); }
.side-brand span { font-family: var(--font-mono); letter-spacing: -0.02em; }
.env-id { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.env-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px/1 var(--font-mono); letter-spacing: 0.12em;
  color: var(--env-ink);
  background: color-mix(in srgb, var(--env) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--env) 40%, transparent);
  padding: 5px 9px; border-radius: 7px;
}
.env-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--env);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--env) 70%, transparent);
  animation: env-pulse 2.4s var(--ease) infinite;
}
@keyframes env-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--env) 55%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .env-dot { animation: none; } }
.env-sub { font: 500 12px/1 var(--font-mono); color: var(--ink-3); letter-spacing: 0.02em; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { padding: 6px 0 4px; }
.side-group-hub {
  margin-top: 6px; padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--env) 45%, var(--hairline));
}
.side-eyebrow {
  font: 600 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--ink-3); margin: 0 0 6px; padding: 0 8px;
}
.side-group-hub .side-eyebrow { color: var(--env-ink); }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); font-size: 14px; font-weight: 450; text-decoration: none;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.side-link:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); text-decoration: none; }
.side-ico { display: inline-flex; width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 16px; }
.side-ico svg { width: 16px; height: 16px; }
.side-link:hover .side-ico { color: var(--ink-2); }
.side-link.active {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent); font-weight: 600;
  box-shadow: inset 2.5px 0 0 var(--accent);
}
.side-link.active .side-ico { color: var(--accent); }
.side-group-hub .side-link.active {
  background: color-mix(in srgb, var(--env) 15%, transparent);
  color: var(--env-ink); box-shadow: inset 2.5px 0 0 var(--env);
}
.side-group-hub .side-link.active .side-ico { color: var(--env-ink); }

.side-foot { border-top: 1px solid var(--hairline); padding: 12px 8px 4px; margin-top: 6px; }
.side-user { display: flex; align-items: center; gap: 8px; font: 500 13px/1 var(--font-mono); color: var(--ink-2); }
.side-user-dot { width: 7px; height: 7px; border-radius: 50%; background: #1a9e46; }
.side-foot-row { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.side-foot-row a { font-size: 13px; color: var(--ink-2); }
.side-foot-row a:hover { color: var(--accent); }
.side-signout button {
  width: 100%; font: 500 13px/1 var(--font); color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 9px;
  padding: 9px; cursor: pointer; transition: border-color .15s var(--ease), color .15s var(--ease);
}
.side-signout button:hover { color: #c02b21; border-color: color-mix(in srgb, #ff3b30 45%, var(--hairline)); }

/* mobile bits, hidden on desktop */
.side-top, .side-burger, .side-scrim { display: none; }

/* ---- content pane ---- */
.admin-wrap { flex: 1 1 auto; min-width: 0; max-width: 1040px; margin: 0; padding: 30px 34px 72px; }
.admin-wrap > h1.headline:first-child,
.admin-wrap > h1:first-child { margin-top: 4px; }

/* ---- refined instruments (public classes kept working) ---- */
.stat {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 15px 16px; position: relative;
}
.stat .n { font-family: var(--font-mono); font-size: 27px; font-weight: 600; letter-spacing: -0.03em; }
.stat .l { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.stat-row { gap: 12px; margin: 18px 0 26px; }

.tbl { border-radius: 12px; }
.tbl th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; }
.tbl td { font-size: 14px; }
.tbl tbody tr:hover td, .tbl tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }

.badge { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.02em; padding: 3px 8px; }

/* Armed state of a confirm-form button (admin.js two-step confirm).
   !important because the action buttons carry inline colours. */
button.badge.confirm-armed {
  background: rgba(255, 59, 48, 0.14) !important;
  color: #c0261c !important;
}

/* Touch devices: action pills become real tap targets, and table rows
   let their forms wrap instead of cramming three buttons on one line. */
@media (pointer: coarse) {
  button.badge { font-size: 13px; padding: 10px 14px; }
  .tbl td form.confirm-form { display: inline-block !important; margin: 3px 6px 3px 0; }
}

/* Narrow screens: fixed column widths overflow a phone, so the table
   scrolls sideways inside its own box instead of clipping the buttons. */
@media (max-width: 700px) {
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 900px) {
  .admin-shell { display: block; }
  .side-top {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 60;
    padding: 10px 16px; background: var(--bg-sunken);
    border-bottom: 1px solid var(--hairline); box-shadow: inset 0 -3px 0 var(--env);
  }
  .side-top-brand { display: inline-flex; align-items: baseline; gap: 6px; font: 600 16px/1 var(--font-mono); color: var(--ink); margin-right: auto; }
  .side-top-brand img { height: 20px; transform: translateY(3px); }
  .side-burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 34px; height: 34px; padding: 8px; border-radius: 8px; cursor: pointer;
  }
  .side-burger span, .side-burger::before, .side-burger::after {
    content: ""; display: block; height: 2px; border-radius: 2px; background: var(--ink);
  }
  .side {
    position: fixed; top: 0; left: 0; z-index: 120; height: 100dvh; width: 264px;
    transform: translateX(-100%); transition: transform .22s var(--ease);
  }
  .side-toggle:checked ~ .admin-shell .side { transform: none; }
  .side-scrim {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(15,18,22,.42); opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease);
  }
  .side-toggle:checked ~ .admin-shell .side-scrim { opacity: 1; pointer-events: auto; }
  .admin-wrap { max-width: none; padding: 22px 18px 60px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---------- Share buttons (Decrypted posts) ---------- */
.share {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.share-label { font-size: 14px; color: var(--ink-2); margin-right: 4px; }
.share-btn {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.share-btn[hidden] { display: none; } /* inline-block above must not defeat the hidden attribute */
.share-links { display: contents; }
.share-has-native .share-links { display: none; }

/* ---------- Topic chips (Decrypted) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-size: 13.5px;
  text-decoration: none;
}
.chip span { color: var(--ink-3); font-size: 12px; }
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-active span { color: var(--bg); opacity: .7; }
.chip-active:hover { color: var(--bg); border-color: var(--ink); }

/* ---------- Archive search (Decrypted index; box created by search.js) ---------- */
.search-box { margin-top: 22px; }
.search-box input {
  width: 100%;
  max-width: 420px;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
}
.search-status { font-size: 13px; color: var(--ink-2); margin: 12px 0 -10px; }

/* ==========================================================================
   Decrypted index redesign (2026-07-14): front-page hierarchy.
   Masthead with inline search, one filter strip, a featured lead story,
   a compact scannable list, and the subscribe band moved to the foot.
   Built entirely on the existing tokens - no new palette or typeface.
   ========================================================================== */
.dec-masthead {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px 32px; flex-wrap: wrap; margin: 6px 0 20px;
}
.dec-masthead-id { flex: 1 1 380px; min-width: 0; }
.dec-h1 { font-size: clamp(34px, 6vw, 52px); margin: 4px 0 10px; }
.dec-tagline { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; max-width: 540px; }
.dec-tagline a { color: var(--accent); }
.dec-search-slot { flex: 1 1 260px; max-width: 340px; }
.dec-search-slot:empty { display: none; }
.dec-search-slot .search-box { margin-top: 0; }
.dec-search-slot .search-box input { width: 100%; max-width: none; }

.dec-filter { margin: 0 0 22px; }
.dec-filter .chips { margin-top: 0; }

/* The lead story: a clickable card with a stretched title link, so the
   eyebrow's topic links stay independently clickable. */
.dec-lead {
  position: relative; margin-bottom: 14px;
  padding: 24px 26px 24px 28px;
  border: 1px solid var(--hairline); border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
  transition: border-color .15s ease;
}
.dec-lead::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 4px; border-radius: 0 4px 4px 0; background: var(--accent);
}
.dec-lead:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline)); }
.dec-lead-eyebrow {
  margin: 0 0 12px; font-family: var(--font-mono); font-size: 12px;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
}
.dec-lead-topic { color: var(--ink-3); text-decoration: none; position: relative; z-index: 1; }
.dec-lead-topic:hover { color: var(--accent); }
.dec-lead-title {
  margin: 0; font-size: clamp(24px, 3.2vw, 32px); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.14;
}
.dec-lead-title a { color: var(--ink); text-decoration: none; }
.dec-lead-title a::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
.dec-lead:hover .dec-lead-title a { color: var(--accent); }
.dec-lead-sum { margin: 12px 0 0; color: var(--ink-2); font-size: 16.5px; line-height: 1.55; max-width: 64ch; }
.dec-lead-more { display: inline-block; margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--accent); }

.dec-list-h {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); margin: 30px 0 2px;
}

/* Compact list rows: whole row is one link, summary clamped to two lines. */
.dec-list { border-top: none; }
.dec-row {
  display: grid; grid-template-columns: 64px 1fr; gap: 4px 20px; align-items: baseline;
  padding: 18px 0; border-bottom: 1px solid var(--hairline);
  text-decoration: none; color: inherit;
}
.dec-row:first-child { border-top: 1px solid var(--hairline); }
.dec-row-date {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .03em;
  color: var(--ink-3); padding-top: 3px; white-space: nowrap;
}
.dec-row-body { display: block; min-width: 0; }
.dec-row-title { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: var(--ink); }
.dec-row-sum {
  margin-top: 4px; color: var(--ink-2); font-size: 14.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dec-row:hover .dec-row-title { color: var(--accent); }

/* Subscribe band at the foot of the list. */
.dec-subscribe {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px 28px; flex-wrap: wrap; margin: 16px 0 8px;
  padding: 20px 24px; border: 1px solid var(--hairline); border-radius: 18px;
  background: var(--bg-sunken);
}
.dec-subscribe-copy { flex: 1 1 240px; }
.dec-subscribe-h { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.dec-subscribe-copy p { margin: 0; font-size: 13.5px; color: var(--ink-3); line-height: 1.5; }
.dec-subscribe-form { display: flex; gap: 10px; flex: 1 1 320px; }
.dec-subscribe-form input[type="email"] {
  flex: 1; min-width: 0; font-size: 15px; font-family: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--hairline); border-radius: 980px; padding: 10px 16px;
}
.dec-hp { position: absolute; left: -5000px; }

@media (max-width: 640px) {
  .dec-search-slot { flex-basis: 100%; max-width: none; }
  .dec-row { grid-template-columns: 1fr; gap: 2px; }
  .dec-row-date { padding-top: 0; }
  .dec-subscribe-form { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .dec-lead { transition: none; } }

/* ---------- Homepage: latest-from-Decrypted feed + NCSC links ---------- */
.home-dec { display: grid; grid-template-columns: 1fr 260px; gap: 24px 48px; align-items: start; margin-top: 10px; }
.home-dec-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px;
}
.home-dec-feed .dec-row:first-child { border-top: 1px solid var(--hairline); }
.home-links-sub { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin: 0 0 12px; }
.home-links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hairline); }
.home-links li { border-bottom: 1px solid var(--hairline); }
.home-links a { display: block; padding: 11px 0; color: var(--ink); font-size: 15px; text-decoration: none; }
.home-links a:hover { color: var(--accent); }
.home-links a::after { content: " \2197"; color: var(--ink-3); font-size: 12px; }
@media (max-width: 760px) { .home-dec { grid-template-columns: 1fr; gap: 28px; } }
