/* ==========================================================
   PROJECT WEST MIDLANDS - HOMEPAGE
   Uses the tokens in theme.css (load theme.css first).
========================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body.home { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--font); }
.home img { max-width: 100%; display: block; }
.home a { color: inherit; }
.home h1, .home h2, .home h3 { font-family: var(--font-head); color: var(--text-strong); margin: 0; }

.h-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 999; background: #fff; color: #000; padding: 8px 12px; }
.skip:focus { left: 8px; }

/* ---------- Top bar ---------- */

.h-bar { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); color: #fff; }
.h-bar::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: var(--brand-line); background: var(--primary); }
.h-bar-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.h-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.h-brand img { width: 38px; height: 38px; object-fit: contain; }
.h-brand strong { display: block; font-family: var(--font-head); font-size: 19px; font-weight: 700; line-height: 1.1; }
.h-brand small { display: block; font-size: 13px; color: rgba(255, 255, 255, .62); }
.h-nav { display: flex; align-items: center; gap: 4px; }
.h-nav a { text-decoration: none; padding: 8px 12px; font-weight: 600; font-size: 15px; color: rgba(255, 255, 255, .85); border-radius: 3px; }
.h-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.h-theme { width: 36px; height: 36px; margin-left: 4px; display: grid; place-items: center; background: none; color: rgba(255, 255, 255, .85); border: 1px solid rgba(255, 255, 255, .25); border-radius: 3px; cursor: pointer; }
.h-theme:hover { border-color: #fff; color: #fff; }
.h-nav a.h-signin { margin-left: 8px; background: var(--primary); color: #fff; padding: 8px 16px; }
.h-nav a.h-signin:hover { background: var(--primary-dark, #C86D37); }
.h-menu { display: none; background: none; border: 0; color: #fff; font-size: 20px; padding: 8px; cursor: pointer; }

/* ---------- Hero: the photo, the line, the live board ---------- */

.h-hero { position: relative; isolation: isolate; color: #fff; background: #0F1E38; overflow: hidden; }
.h-hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 40%; z-index: -2; }
/* Navy from the left so the type reads; the car and crew stay clear on the right. */
.h-hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(90deg, rgba(12, 24, 46, .96) 0%, rgba(12, 24, 46, .88) 34%, rgba(12, 24, 46, .35) 62%, rgba(12, 24, 46, .1) 100%),
                linear-gradient(0deg, rgba(12, 24, 46, .9) 0%, rgba(12, 24, 46, 0) 30%); }
.h-hero-inner { padding: clamp(72px, 11vw, 148px) 24px clamp(56px, 7vw, 96px); }
.h-hero h1 { color: #fff; font-weight: 700; font-size: clamp(46px, 7.4vw, 104px); line-height: .92; letter-spacing: -.01em; max-width: 9.5em; }
.h-hero h1 span { display: block; }

.h-hero p { margin: 26px 0 0; font-size: clamp(17px, 1.5vw, 19px); line-height: 1.55; color: rgba(255, 255, 255, .86); max-width: 46ch; }
.h-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.h-btn { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 13px 22px; font-weight: 700; font-size: 16px; border-radius: 3px; border: 2px solid transparent; }
.h-btn.primary { background: var(--primary); color: #fff; }
.h-btn.primary:hover { background: var(--primary-dark, #C86D37); }
.h-btn.ghost { border-color: rgba(255, 255, 255, .5); color: #fff; }
.h-btn.ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }
.h-btn:focus-visible, .h-nav a:focus-visible, .h-theme:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Live board (bottom of the hero) ---------- */

.h-board { background: rgba(9, 18, 35, .78); border-top: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(6px); }
.h-board .live-status { margin: 0; max-width: none; width: auto; border: 0; border-radius: 0; box-shadow: none; background: transparent; color: #fff; }
.h-board .ls-item { padding: 18px 20px; border-color: rgba(255, 255, 255, .12); }
.h-board .ls-item:first-child { padding-left: 0; }
.h-board .ls-item small { color: rgba(255, 255, 255, .62); }
.h-board .ls-item strong { color: #fff; }
.h-board .ls-sub { color: rgba(255, 255, 255, .62); }

/* ---------- Sections ---------- */

.h-section { padding: 88px 0; }
.h-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; }
.h-head h2 { font-size: clamp(30px, 3.4vw, 42px); font-weight: 700; line-height: 1.05; }
.h-head p { margin: 0; color: var(--muted); font-size: 17px; max-width: 46ch; justify-self: end; text-align: right; }
.h-lead { margin: 10px 0 0; color: var(--muted); font-size: 17px; max-width: 60ch; }

.h-depts { list-style: none; margin: 36px 0 0; padding: 0; border-top: 1px solid var(--line); }
.h-depts li { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) 170px; gap: 32px; align-items: baseline; padding: 24px 0 24px 20px; border-bottom: 1px solid var(--line); position: relative; }
.h-depts li::before { content: ""; position: absolute; left: 0; top: 24px; bottom: 24px; width: 4px; border-radius: 1px; background: var(--muted); }
.h-depts .d-police::before { background: #2A5BD7; }
.h-depts .d-ambulance::before { background: #1C8C4E; }
.h-depts .d-fire::before { background: #C8322F; }
.h-depts .d-highways::before { background: #E8A400; }
.h-depts .d-rnli::before { background: #F26B21; }
.h-depts .d-civilian::before { background: #7A8596; }
.h-depts h3 { font-size: 21px; font-weight: 600; }
.h-depts p { margin: 0; color: var(--text); max-width: 64ch; }
.h-how { font-size: 14px; font-weight: 600; color: var(--muted); text-align: right; }

/* ---------- MDT app ---------- */

.h-app { background: #0F1E38; color: #fff; padding: 88px 0; overflow: hidden; }
.h-app-inner { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 56px; align-items: center; }
.h-app h2 { color: #fff; font-size: clamp(30px, 3.4vw, 42px); font-weight: 700; line-height: 1.05; max-width: 14ch; }
.h-app-text > p { margin: 18px 0 0; color: rgba(255, 255, 255, .8); font-size: 17px; max-width: 46ch; }
.h-app-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; }
.h-app-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: rgba(255, 255, 255, .9); }
.h-app kbd { display: inline-block; min-width: 26px; padding: 2px 7px; border: 1px solid rgba(255, 255, 255, .3); border-bottom-width: 3px; border-radius: 4px; background: rgba(255, 255, 255, .06); font: 600 13px/1.4 var(--font); color: #fff; text-align: center; }
.h-app-list li kbd:last-of-type { margin-right: 6px; }
.h-app-note { margin: 14px 0 0; font-size: 14px; color: rgba(255, 255, 255, .6); }
.h-app-shot { margin: 0; position: relative; }
.h-app-shot img { width: 100%; height: auto; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); }
/* Sits over the edge of the screen, like a terminal mounted in the car. */
.h-app-shot::before { content: ""; position: absolute; inset: -14px -14px auto auto; width: 38%; height: 38%; border-top: 3px solid var(--primary); border-right: 3px solid var(--primary); border-radius: 0 8px 0 0; pointer-events: none; }

.h-join { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.h-steps { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; counter-reset: step; }
.h-steps li { counter-increment: step; border-top: 3px solid var(--nav-bg); padding-top: 18px; }
:root[data-theme="dark"] .h-steps li { border-top-color: var(--primary); }
.h-steps li::before { content: counter(step); display: block; font-family: var(--font-head); font-weight: 700; font-size: 44px; line-height: 1; color: var(--primary); margin-bottom: 12px; }
.h-steps h3 { font-size: 20px; font-weight: 600; }
.h-steps p { margin: 8px 0 0; color: var(--text); }
.h-steps a { color: var(--primary); font-weight: 600; }

.h-news { margin-top: 36px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; }
.h-news-item { padding: 22px 0; border-top: 1px solid var(--line); }
.h-news-item h3 { font-size: 20px; font-weight: 600; line-height: 1.25; margin-top: 6px; }
.h-news-item p { margin: 8px 0 0; color: var(--text); }
.h-news-item .h-news-meta { margin: 0; font-size: 13.5px; color: var(--muted); }
.h-news-meta span { font-weight: 700; color: var(--info); margin-right: 8px; }
.h-news-item.kind-business .h-news-meta span { color: var(--primary); }
.h-empty { color: var(--muted); }

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

.h-foot { background: var(--nav-bg); color: rgba(255, 255, 255, .75); padding: 40px 0; position: relative; }
.h-foot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--brand-line); background: var(--primary); }
.h-foot-inner { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; padding-top: 8px; }
.h-foot strong { color: #fff; font-family: var(--font-head); font-size: 18px; }
.h-foot p { margin: 6px 0 0; font-size: 14px; max-width: 52ch; }
.h-foot nav { display: flex; gap: 22px; }
.h-foot nav a { text-decoration: none; font-weight: 600; color: #fff; }
.h-foot nav a:hover { text-decoration: underline; }

/* ---------- Small screens ---------- */

@media (max-width: 960px) {
    .h-app-inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .h-head { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .h-head p { justify-self: start; text-align: left; }
    .h-board .live-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .h-depts li { grid-template-columns: 1fr; gap: 8px; }
    .h-how { text-align: left; }
    .h-steps, .h-news { grid-template-columns: 1fr; gap: 28px; }
    .h-news { gap: 0; }
    .h-board .ls-item:first-child { padding-left: 20px; }
}

@media (max-width: 760px) {
    .h-menu { display: block; }
    .h-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px; flex-direction: column; align-items: stretch; background: var(--nav-bg); padding: 10px 16px 18px; gap: 2px; }
    .h-nav.open { display: flex; }
    .h-nav a { padding: 12px 10px; }
    .h-nav a.h-signin { margin: 8px 0 0; text-align: center; justify-content: center; }
    .h-theme { margin: 6px 0 0 10px; }
    .h-wrap { padding: 0 16px; }
    .h-hero-inner { padding: 64px 16px 48px; }
    .h-hero::before { background: linear-gradient(0deg, rgba(12, 24, 46, .96) 0%, rgba(12, 24, 46, .82) 55%, rgba(12, 24, 46, .55) 100%); }
    .h-section, .h-app { padding: 56px 0; }
    .h-board .ls-item, .h-board .ls-item:first-child { padding: 14px 16px; }
    .h-app-shot::before { inset: -8px -8px auto auto; }
    .h-foot-inner { flex-direction: column; }
    .h-board .ls-item:first-child { padding-left: 20px; }
}

@media (prefers-reduced-motion: no-preference) {
    /* One moment: the headline settles in on load. */
    .h-hero h1 span { animation: h-rise .7s cubic-bezier(.2, .7, .2, 1) both; }
    .h-hero h1 span + span { animation-delay: .12s; }
    @keyframes h-rise { from { opacity: 0; transform: translateY(18px); } }
}
.h-btn.is-off { opacity: .55; pointer-events: none; } .h-btn small { font-weight: 500; opacity: .8; }

/* Tablets: menu behind the button so the brand and links don't squash */
@media (max-width: 960px) {
    .h-menu { display: block; }
    .h-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px; flex-direction: column; align-items: stretch; background: var(--nav-bg); padding: 10px 16px 18px; gap: 2px; z-index: 30; }
    .h-nav.open { display: flex; }
    .h-nav a { padding: 12px 10px; }
    .h-nav a.h-signin { margin: 8px 0 0; text-align: center; justify-content: center; }
    .h-theme { margin: 6px 0 0 10px; }
}
@media (max-width: 420px) { .h-brand small { display: none; } .h-brand strong { font-size: 17px; } }
@media (min-width: 1800px) { .h-wrap { max-width: 1440px; } }
