/* Protect.Wales - Cyber threat weather. Plain CSS3, no build step. */

:root {
  --ink: #0b0c0c;
  --white: #ffffff;
  --sky: #13294b;
  --primary: #00703c;
  --muted: #f3f2f1;
  --muted-fg: #505a5f;
  --border: #b1b4b6;
  --focus: #ffdd00;

  --level-settled: #00703c;
  --level-elevated: #ffdd00;
  --level-stormy: #f47738;
  --level-critical: #d4351c;

  --font-sans: 'Source Sans 3', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid var(--border); }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p { font-size: inherit; font-weight: inherit; overflow-wrap: break-word; }
ol, ul { list-style: none; }
a { color: inherit; text-decoration: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid transparent;
  background-color: var(--focus);
  color: var(--ink);
  box-shadow: 0 -2px var(--focus), 0 4px var(--ink);
  text-decoration: none;
}

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

/* ---------- Utilities ---------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}
.container { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: 1rem; }
.muted { color: var(--muted-fg); }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.icon {
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.underline { text-decoration: underline; text-underline-offset: 4px; }

.h-2xl { font-size: 1.5rem; line-height: 2rem; font-weight: 700; }
.h-3xl { font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; }
.eyebrow {
  font-size: 0.875rem; line-height: 1.25rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-fg);
}
.eyebrow--light { color: rgb(255 255 255 / 0.75); }
.lead { margin-top: 0.5rem; max-width: 42rem; font-size: 1.125rem; line-height: 1.75rem; color: var(--muted-fg); }
.section-pad { padding-block: 3rem; }
.link-primary { font-weight: 600; color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }

/* Level and warning colours */
.lvl-settled { background: var(--level-settled); color: var(--white); }
.lvl-elevated { background: var(--level-elevated); color: var(--ink); }
.lvl-stormy { background: var(--level-stormy); color: var(--ink); }
.lvl-critical { background: var(--level-critical); color: var(--white); }

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

.site-header { background: var(--ink); color: var(--white); }
.skip-link {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.skip-link:focus {
  position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal;
  display: block; padding: 0.5rem 1rem; font-size: 1.125rem; line-height: 1.75rem; text-decoration: underline;
}
.site-header__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--white); }
.brand__icon { width: 2rem; height: 2rem; color: var(--level-elevated); stroke-width: 2.25; }
.brand__text { display: flex; flex-direction: column; }
.brand__name { font-size: 1.5rem; line-height: 2rem; font-weight: 700; letter-spacing: -0.025em; }
.brand__sub { font-size: 0.875rem; line-height: 1.25rem; color: rgb(255 255 255 / 0.75); }
.site-header__tagline { display: none; font-size: 0.875rem; line-height: 1.25rem; color: rgb(255 255 255 / 0.75); }

.site-nav { border-top: 1px solid rgb(255 255 255 / 0.2); }
.site-nav__list { display: flex; column-gap: 1.5rem; overflow-x: auto; }
.site-nav__list li { flex-shrink: 0; }
.site-nav__list a {
  display: block; padding-block: 0.75rem;
  border-bottom: 4px solid transparent;
  font-weight: 600; color: var(--white); text-underline-offset: 4px;
}
.site-nav__list a:hover { border-bottom-color: var(--white); text-decoration: underline; }

/* ---------- Warning banner ---------- */

.banner__inner { display: flex; flex-direction: column; gap: 0.5rem; padding-block: 0.75rem; }
.banner__title { display: flex; align-items: center; gap: 0.75rem; font-size: 1.125rem; line-height: 1.75rem; font-weight: 700; }
.banner__icon { width: 1.5rem; height: 1.5rem; stroke-width: 2.5; }
.banner__meta a { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

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

.hero { background: var(--sky); color: var(--white); }
.hero__grid { display: grid; gap: 2.5rem; padding-block: 2.5rem; }
.hero__date { font-size: 1.125rem; line-height: 1.75rem; color: rgb(255 255 255 / 0.8); }
.hero__title { margin-top: 0.25rem; font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; text-wrap: pretty; }
.hero__now { margin-top: 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
.hero__badge {
  display: flex; align-items: center; justify-content: center;
  width: 9rem; height: 9rem; border-radius: 9999px; flex-shrink: 0;
}
.hero__badge-icon { width: 5rem; height: 5rem; stroke-width: 1.75; }
.hero__level { font-size: 3.75rem; line-height: 1; font-weight: 700; }
.hero__rank { margin-top: 0.75rem; font-size: 1.125rem; line-height: 1.75rem; }
.hero__warning { display: inline-block; margin-right: 0.5rem; padding: 0.125rem 0.5rem; font-weight: 700; }
.hero__rank-text { color: rgb(255 255 255 / 0.85); }
.hero__summary { margin-top: 1.5rem; max-width: 36rem; font-size: 1.25rem; line-height: 1.625; text-wrap: pretty; }

.scale-wrap { margin-top: 2rem; }
.scale { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.25rem; }
.scale li { display: flex; flex-direction: column; gap: 0.5rem; }
.scale__bar { display: block; width: 100%; height: 0.75rem; opacity: 0.4; }
.scale li[data-level="settled"] .scale__bar { background: var(--level-settled); }
.scale li[data-level="elevated"] .scale__bar { background: var(--level-elevated); }
.scale li[data-level="stormy"] .scale__bar { background: var(--level-stormy); }
.scale li[data-level="critical"] .scale__bar { background: var(--level-critical); }
.scale__label { font-size: 0.875rem; line-height: 1.25rem; color: rgb(255 255 255 / 0.7); }
.scale li[aria-current="true"] .scale__bar { opacity: 1; outline: 2px solid var(--white); outline-offset: 2px; }
.scale li[aria-current="true"] .scale__label { font-weight: 700; color: var(--white); }

.drivers { align-self: start; border-radius: 0.15rem; background: var(--white); padding: 1.5rem; color: var(--ink); }
.drivers__title { font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; }
.drivers__sub { margin-top: 0.25rem; }
.drivers__list { margin-top: 1.25rem; border-block: 1px solid var(--border); }
.driver { display: flex; flex-direction: column; gap: 0.5rem; padding-block: 0.75rem; }
.driver + .driver { border-top: 1px solid var(--border); }
.driver__top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.driver__label { font-weight: 600; }
.driver__value { text-align: right; }
.driver__num { font-size: 1.5rem; line-height: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.driver__bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  font-size: 0.875rem; line-height: 1.25rem; color: var(--muted-fg);
}
.driver__meter { display: flex; align-items: center; gap: 0.5rem; }
.meter { position: relative; display: block; width: 5rem; height: 0.375rem; background: var(--muted); }
.meter__fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--sky); }
.driver__intensity { width: 4rem; text-align: right; }
.drivers__foot { margin-top: 1rem; font-size: 0.875rem; line-height: 1.25rem; color: var(--muted-fg); }

/* ---------- Day by day ---------- */

.recent { background: var(--muted); border-bottom: 1px solid var(--border); }
.recent__inner { padding-block: 2.5rem; }
.recent__head { display: flex; flex-direction: column; gap: 0.5rem; }
.recent__intro { max-width: 36rem; }
.days {
  margin-top: 1.5rem; display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(7.5rem, 1fr); gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem;
}
.day {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  border-top: 8px solid var(--border); background: var(--white);
  padding: 0.75rem 0.75rem 1rem; text-align: center;
}
.day[data-level="settled"] { border-top-color: var(--level-settled); }
.day[data-level="elevated"] { border-top-color: var(--level-elevated); }
.day[data-level="stormy"] { border-top-color: var(--level-stormy); }
.day[data-level="critical"] { border-top-color: var(--level-critical); }
.day[aria-current="date"] { box-shadow: 0 0 0 2px var(--ink); }
.day__name { font-weight: 700; }
.day__date { font-size: 0.875rem; line-height: 1.25rem; color: var(--muted-fg); }
.day__icon { display: flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 9999px; }
.day__icon .icon { width: 1.75rem; height: 1.75rem; }
.day__level { font-weight: 600; }
.day__stats {
  width: 100%; border-top: 1px solid var(--border); padding-top: 0.5rem;
  text-align: left; font-size: 0.875rem; line-height: 1.25rem;
}
.day__stats div { display: flex; justify-content: space-between; gap: 0.5rem; }
.day__stats div + div { margin-top: 0.125rem; }
.day__stats dt { color: var(--muted-fg); }
.day__stats dd { font-weight: 600; font-variant-numeric: tabular-nums; }

.outlook { margin-top: 1.5rem; max-width: 48rem; border-left: 4px solid var(--sky); background: var(--white); padding: 1rem; }
.outlook__title { font-weight: 700; }
.outlook__text { margin-top: 0.25rem; text-wrap: pretty; }

/* ---------- Briefing + warnings ---------- */

.main-grid { display: grid; gap: 3rem; padding-block: 3rem; }
.briefing, .warnings, #actions, #observations, #get-help { scroll-margin-top: 1rem; }
.briefing__headline { margin-top: 0.25rem; font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; text-wrap: pretty; }
.briefing__meta { margin-top: 0.5rem; }
.briefing__body { margin-top: 1.5rem; font-size: 1.125rem; line-height: 1.625; }
.briefing__body > * + * { margin-top: 1.5rem; }
.briefing__body h3 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; }
.briefing__body h3 + p { margin-top: 0.25rem; text-wrap: pretty; }

.warnings__sub { margin-top: 0.25rem; }
.warnings__totals { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.warnings__totals li { padding: 0.125rem 0.5rem; font-size: 0.875rem; line-height: 1.25rem; font-weight: 700; }
.warnings__list { margin-top: 1rem; }
.warnings__list > li + li { margin-top: 0.75rem; }
.notice { margin-top: 1rem; border-left: 4px solid var(--border); padding: 1rem; }
.notice--ok { border-left-color: var(--level-settled); background: var(--muted); }

.warning {
  border-left: 8px solid var(--border); background: var(--white); padding: 1rem;
  box-shadow: 0 0 0 1px var(--border);
}
.warning[data-colour="Yellow"] { border-left-color: var(--level-elevated); }
.warning[data-colour="Amber"] { border-left-color: var(--level-stormy); }
.warning[data-colour="Red"] { border-left-color: var(--level-critical); }
.warning__row { display: flex; align-items: flex-start; gap: 0.75rem; }
.warning__icon { margin-top: 0.125rem; display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; flex-shrink: 0; }
.warning__icon .icon { width: 1.25rem; height: 1.25rem; stroke-width: 2.5; }
.warning__body { min-width: 0; }
.warning__title { font-weight: 700; line-height: 1.375; }
.warning__title a { text-decoration: underline; text-underline-offset: 4px; }
.warning__title a:hover { text-decoration-thickness: 2px; }
.warning__affects { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; }
.warning__detail {
  margin-top: 0.25rem; font-size: 0.875rem; line-height: 1.25rem; color: var(--muted-fg);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.warning__meta { margin-top: 0.5rem; font-size: 0.875rem; line-height: 1.25rem; }
.warnings__more { margin-top: 1rem; }

/* ---------- Actions ---------- */

.actions { background: var(--muted); border-block: 1px solid var(--border); }
.actions__grid { margin-top: 2rem; display: grid; gap: 1.5rem; }
.action-card { display: flex; flex-direction: column; border-top: 4px solid var(--primary); background: var(--white); padding: 1.5rem; }
.action-card__head { display: flex; align-items: center; gap: 0.75rem; }
.action-card__head .icon { width: 1.5rem; height: 1.5rem; color: var(--primary); }
.action-card__title { font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; }
.action-card__desc { margin-top: 0.25rem; color: var(--muted-fg); }
.action-card__list { margin-top: 1.25rem; }
.action-card__list li { display: flex; gap: 0.75rem; }
.action-card__list li + li { margin-top: 1.25rem; }
.action-card__num {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 1.75rem; height: 1.75rem; border-radius: 9999px;
  background: var(--ink); color: var(--white); font-size: 0.875rem; line-height: 1.25rem; font-weight: 700;
}
.action-card__step { font-weight: 700; }
.action-card__detail { margin-top: 0.125rem; line-height: 1.625; text-wrap: pretty; }

/* ---------- Observations ---------- */

.stations { margin-top: 2rem; display: grid; column-gap: 2rem; row-gap: 0.5rem; }
.station { border-top: 2px solid var(--ink); padding-block: 1.25rem; min-width: 0; }
.station__source {
  font-size: 0.875rem; line-height: 1.25rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-fg);
}
.station__name { margin-top: 0.25rem; font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; }
.station__measures { margin-top: 0.25rem; color: var(--muted-fg); text-wrap: pretty; }
.station__reading { margin-top: 1rem; }
.station__num { font-size: 2.25rem; line-height: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.station__offline { margin-top: 1rem; font-weight: 600; }
.station__details { margin-top: 0.75rem; font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.25rem; }
.station__details li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station__details li + li { margin-top: 0.25rem; }
.station__link { margin-top: 1rem; display: inline-block; }

/* ---------- Get help ---------- */

.help { background: var(--ink); color: var(--white); }
.help__grid { display: grid; gap: 2rem; padding-block: 3rem; }
.help__intro { margin-top: 0.75rem; max-width: 36rem; font-size: 1.125rem; line-height: 1.75rem; color: rgb(255 255 255 / 0.85); text-wrap: pretty; }
.help__links { margin-top: 1.5rem; font-size: 1.125rem; line-height: 1.75rem; }
.help__links li + li { margin-top: 0.75rem; }
.help__links a { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.help__card { align-self: start; border-left: 8px solid var(--level-elevated); background: var(--white); padding: 1.5rem; color: var(--ink); }
.help__card-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.help__phone { width: 1.25rem; height: 1.25rem; }
.help__card-sub { margin-top: 0.5rem; font-size: 0.875rem; line-height: 1.25rem; color: var(--muted-fg); }
.help__number { margin-top: 0.25rem; font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.help__number a { text-underline-offset: 4px; }
.help__number a:hover { text-decoration: underline; }
.help__danger { margin-top: 0.75rem; font-size: 0.875rem; line-height: 1.25rem; }

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

.site-footer { border-top: 8px solid var(--primary); background: var(--muted); }
.site-footer__inner { padding-block: 2.5rem; }
.site-footer__grid { display: grid; gap: 2rem; }
.site-footer__heading { font-size: 1.125rem; line-height: 1.75rem; font-weight: 700; }
.site-footer__about { margin-top: 0.5rem; max-width: 42rem; text-wrap: pretty; }
.site-footer__sources { margin-top: 0.5rem; display: flex; flex-wrap: wrap; column-gap: 1rem; row-gap: 0.25rem; }
.site-footer__sources a { text-decoration: underline; text-underline-offset: 4px; }
.site-footer__legal { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.5rem; font-size: 0.875rem; line-height: 1.25rem; color: var(--muted-fg); }

/* ---------- Hide unused filters on html pages ---------- */

.hide-filter {
    display: none !important;
}

/* ---------- Trending ---------- */

.station__title {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.station__badge {
    padding: 2px 8px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #d4351c;
    color: #fff;
    border-radius: 999px;
}

/* ---------- Breakpoints (match sm 40rem, md 48rem, lg 64rem) ---------- */

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
}

@media (max-width: 768px) {

    .nav-toggle {
        display: block;
    }

    .site-nav {
        display: none;
    }

    .site-nav.is-open {
        display: block;
    }

    .site-nav__list {
        flex-direction: column;
        gap: 0;
    }

    .site-nav__list li {
        border-bottom: 1px solid rgba(255,255,255,.1);
    }

    .site-nav__list a {
        display: block;
        padding: 1rem;
    }
}

@media (min-width: 40rem) {
  .hero__now { flex-direction: row; align-items: center; }
}

@media (min-width: 48rem) {
  .container { padding-inline: 1.5rem; }
  .site-header__tagline { display: block; }
  .banner__inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .hero__grid { padding-block: 3.5rem; }
  .hero__title { font-size: 2.25rem; line-height: 2.5rem; }
  .hero__badge { width: 11rem; height: 11rem; }
  .hero__badge-icon { width: 6rem; height: 6rem; }
  .hero__level { font-size: 4.5rem; }
  .recent__head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .actions__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help__grid { grid-template-columns: 1.2fr 1fr; }
  .site-footer__grid { grid-template-columns: 2fr 1fr; }
}

@media (min-width: 64rem) {
  .hero__grid { grid-template-columns: 1.25fr 1fr; }
  .main-grid { grid-template-columns: 1.6fr 1fr; }
  .stations { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
