/* Cyber Risk Barometer — News section (front page and story pages).
   Same look as the cyberindex.org holding page (public/index.html): IBM Plex Sans, pale grey page
   with white panels, brick-red accent, a simple masthead with a bottom rule, and the same tokens
   for dark mode. Dark mode follows the system setting; the sun/moon button (js/theme.js) sets
   data-theme on <html> to override it. The share cards stay dark. */
:root {
  --bg: #f3f5f8; --surface: #ffffff; --ink: #0f1a2a; --ink-2: #465163; --muted: #6e7889; --rule: #dce1e9;
  --accent: #c2391a; --accent-hover: #9e2d13; --link: #2a78d6;
  --display: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
:root[data-theme="dark"] { --bg: #0d131c; --surface: #141c28; --ink: #e7ecf3; --ink-2: #aeb8c7; --muted: #808b9c; --rule: #263142; --accent: #f0714f; --accent-hover: #f58a6d; --link: #6aa8f0; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body); margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 64px; }
.wrap.wide { max-width: 1080px; }
.eyebrow { font: 500 .74rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.draft { color: var(--accent); font-weight: 700; }

/* ---------- masthead (as the holding page) ---------- */
.mast { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; padding-block: 20px; border-bottom: 1px solid var(--rule); }
.mast b { font-family: var(--display); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.mast-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.mast-nav a { color: var(--ink-2); font-weight: 600; font-size: .95rem; }
.mast-nav a:hover { color: var(--ink); text-decoration: underline; }
.mast-nav a.on { color: var(--ink); }
.mast-nav .eyebrow { margin-left: 6px; }
.wrap:not(.wide) .mast-nav .eyebrow { display: none; }
@media (max-width: 760px) { .mast-nav .eyebrow { display: none; } .mast-nav { gap: 6px 14px; } }

/* ---------- front page ---------- */
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 800; margin-top: 48px; }
.hero h1 span { color: var(--accent); }
.hero .lede { font-size: 1.12rem; color: var(--ink-2); margin: 18px 0 0; max-width: 62ch; }
.front { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; margin-top: 36px; }
@media (max-width: 860px) { .front { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; }
.card h2 { font-size: 1.25rem; font-weight: 700; padding: 20px 20px 6px; }
.side { display: grid; gap: 20px; }
.side .sub-box { margin: 0; }
.side ul { margin: 0; padding: 4px 20px 18px; list-style: none; display: grid; gap: 10px; }
.side li a { display: block; color: var(--ink-2); line-height: 1.4; }
.side li a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.side li b { display: block; color: var(--ink); font-weight: 600; }
.side p { padding: 0 20px 18px; color: var(--ink-2); font-size: .95rem; }

/* featured carousel: each slide is the story's share card, which already carries the headline and
   standfirst, so under it there is only the tag, the date and the ‹ › controls. */
.feature { position: relative; display: grid; overflow: hidden; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); }
.slide { grid-area: 1 / 1; display: flex; flex-direction: column; opacity: 0; transition: opacity .5s; pointer-events: none; }
.slide.on { opacity: 1; z-index: 1; pointer-events: auto; }
.slide { padding: 26px 24px 64px; gap: 12px; }
.slide h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.slide p { color: var(--ink-2); font-size: 1.05rem; max-width: 60ch; }
.slide .go { color: var(--accent); font-weight: 600; margin-top: auto; }
.slide:hover h2 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.ctrl { position: absolute; right: 16px; bottom: 10px; z-index: 3; display: flex; gap: 8px; }
.ctrl button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font: inherit; font-size: 20px; cursor: pointer; }
.ctrl button:hover { border-color: var(--accent); color: var(--accent); }
.count { position: absolute; right: 122px; bottom: 21px; z-index: 3; font: 600 .9rem/1 var(--mono); color: var(--ink-2); }
.dots { position: absolute; left: 24px; bottom: 26px; z-index: 3; display: flex; gap: 6px; }
.dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--rule); transition: background .3s; }
.dots i.on { background: var(--accent); }
.slide:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 14px; }
.feature:not(:has(.ctrl)) .slide { padding-bottom: 26px; }
@media (max-width: 760px) { .slide { padding: 20px 18px 64px; } .ctrl { right: 12px; } .count { right: 116px; } .dots { left: 18px; } .dots i { width: 12px; } }

/* latest stories, numbered */
.latest { margin-top: 20px; }
.latest ol { list-style: none; margin: 0; padding: 4px 12px 12px; }
.latest li + li { border-top: 1px solid var(--rule); }
.latest li a { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; padding: 12px 8px; border-radius: 10px; }
.latest li a:hover { background: var(--bg); }
.latest .n { width: 24px; height: 24px; margin-top: 1px; border-radius: 6px; background: var(--accent); color: #fff; font: 700 .8rem/24px var(--body); text-align: center; }
.latest .t { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.latest .d { color: var(--muted); font-size: .8rem; margin-top: 2px; }

/* ---------- tiles ---------- */
.tile { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 20px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); transition: border-color .15s; }
.tile:hover { border-color: var(--accent); }
.tile .t { font-weight: 700; font-size: 1.1rem; line-height: 1.3; }
.tile .d { color: var(--ink-2); font-size: .9rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tile:hover .t { text-decoration: underline; text-underline-offset: 3px; }
.band { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--rule); }
.band h2 { font: 500 .74rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr; } }

/* ---------- subscribe box (as the holding page) ---------- */
.sub-box { margin: 44px 0 8px; padding: 22px 20px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); }
.sub-box h2 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 700; padding: 0; }
.sub-box p { margin: 0 0 14px; color: var(--ink-2); padding: 0; }
.sub-form { display: flex; flex-wrap: wrap; gap: 10px; }
.sub-form input[type=email] { flex: 1 1 200px; min-width: 0; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.sub-form button { font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.sub-form button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.sub-form button[disabled] { opacity: .6; cursor: default; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sub-note { font-size: .76rem; color: var(--muted); margin-top: 10px; }
.sub-msg { font-size: .88rem; margin-top: 10px; min-height: 1.2em; }

/* ---------- footer (as the holding page) ---------- */
footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: .82rem; color: var(--muted); display: grid; gap: 6px; }
footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- story page ---------- */
.story .crumbs { color: var(--muted); font-size: .88rem; margin-top: 28px; }
.story .crumbs a:hover { color: var(--ink); text-decoration: underline; }
.story h1 { font-size: clamp(2rem, 5.4vw, 3rem); font-weight: 800; margin-top: 14px; }
.story .dek { color: var(--ink-2); font-size: 1.15rem; line-height: 1.45; margin-top: 16px; }
.story .meta { color: var(--muted); font-size: .88rem; margin-top: 14px; }
.story .hero { margin: 26px 0 8px; border-radius: 14px; border: 1px solid var(--rule); }
.prose { font-size: 1.05rem; line-height: 1.7; margin-top: 24px; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.45rem; line-height: 1.25; margin-top: 1.8em; }
.prose h3 { font-size: 1.15rem; margin-top: 1.5em; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: 12px; border: 1px solid var(--rule); margin: 1.4em 0; }
.prose ul, .prose ol { padding-left: 1.3em; color: var(--ink); }
.prose li + li { margin-top: .4em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 18px; margin-left: 0; color: var(--ink-2); }
.prose pre { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-size: .88rem; line-height: 1.5; }
.prose code { font-size: .9em; font-family: var(--mono); }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.prose th { font: 500 .72rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.prose em { color: var(--ink-2); }

/* Provenance caption under every picture, chart and table (same wording as the report and GovKPIs). */
.chart-caption { font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--muted); letter-spacing: .02em; margin: 8px 0 0 !important; }
.prose img + .chart-caption { margin-top: -12px !important; margin-bottom: 1.6em !important; }
.story .hero + .chart-caption { margin-top: 2px !important; margin-bottom: 1.6em !important; }
.prose table + .chart-caption, .prose pre + .chart-caption { margin-top: 8px !important; }
/* Pictures are <picture>s (portrait version on phones); keep the image rules working through the wrapper. */
.prose picture, .story picture { display: block; }
.prose picture img { margin: 1.4em 0; }
.prose picture + .chart-caption { margin-top: -12px !important; margin-bottom: 1.6em !important; }
.story picture + .chart-caption { margin-top: 2px !important; margin-bottom: 1.6em !important; }
@media (max-width: 640px) { .prose img, .story .hero { border-radius: 10px; } }
