/* p5.css — UK Planning API design system.
 *
 * Material, monochrome. Colour is deliberately absent: the only thing worth
 * colour-coding on this site is data coverage, and coverage is shown with three
 * weights of grey so a red/green reading can't be mistaken for good/bad quality.
 * Served locally — no CDN, no webfont, so the strict CSP holds and the page works
 * offline.
 *
 * Shared by the homepage (S6) and the dashboard (S7). Edit here, not per template.
 */

:root {
  --bg:        #FAFAFA;
  --surface:   #FFFFFF;
  --text:      #212121;
  --text-2:    #616161;
  --text-3:    #9E9E9E;
  --border:    #E0E0E0;
  --border-2:  #EEEEEE;
  --accent:    #212121;

  --e1: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
  --e2: 0 3px 6px rgba(0,0,0,.16), 0 3px 6px rgba(0,0,0,.23);
  --e3: 0 10px 20px rgba(0,0,0,.19), 0 6px 6px rgba(0,0,0,.23);

  --r: 4px;
  --u: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 680px; margin: 0 auto; padding: 0 24px; }

/* ── Type ─────────────────────────────────────────────────────────────── */
h1 { font-size: 34px; font-weight: 500; letter-spacing: -.4px; line-height: 1.25; }
h2 { font-size: 22px; font-weight: 500; letter-spacing: -.2px; }
h3 { font-size: 16px; font-weight: 500; }
p  { color: var(--text-2); }
a  { color: var(--text); }

.lead      { font-size: 17px; color: var(--text-2); }
.muted     { color: var(--text-3); font-size: 13px; }
.eyebrow   { font-size: 11px; font-weight: 500; letter-spacing: 1.2px;
             text-transform: uppercase; color: var(--text-3); }

/* ── Surfaces ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--e1);
  padding: 24px;
}
.card-2 { box-shadow: var(--e2); }
.card-flat { box-shadow: none; border: 1px solid var(--border); }

section { padding: 56px 0; }
section:last-of-type { padding-bottom: 40px; }
section + section { border-top: 1px solid var(--border-2); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #FFF;
  border: none;
  border-radius: var(--r);
  padding: 12px 24px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--e1);
  transition: box-shadow .15s ease, background .15s ease;
}
.btn:hover  { background: #000; box-shadow: var(--e2); }
.btn:active { box-shadow: var(--e1); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); box-shadow: none;
}
.btn-ghost:hover { background: #F5F5F5; box-shadow: none; }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2);
        margin-bottom: 6px; }

/* Grid and flex children default to min-width:auto, which means they refuse to
 * shrink below their content. A <pre> with a long URL then pushes the whole page
 * wider than the viewport — measured at 89px of horizontal scroll on a 390px
 * screen before this rule. Everything that can hold wide content needs min-width:0. */
.two-col > *, .stats > *, .scroll-x { min-width: 0; }
pre, table { max-width: 100%; }

/* ── Stat grid ────────────────────────────────────────────────────────── */
/* Fixed 3 columns rather than auto-fit: six stats on auto-fit laid out 5 + 1,
 * leaving an orphan on its own row. */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat  { background: var(--surface); border-radius: var(--r); box-shadow: var(--e1);
         padding: 20px; }
.stat .val { font-size: 26px; font-weight: 500; letter-spacing: -.5px; }
.stat .lbl { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Four-up variant: the burndown has exactly four figures, and the 3-column
 * default left the fourth stranded on its own row. */
.stats-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .stats-4 { grid-template-columns: 1fr; } }

/* ── Coverage bars — the only place "colour" is encoded, as 3 greys ───── */
.cov-row   { display: grid; grid-template-columns: 1fr 64px; gap: 12px;
             align-items: center; padding: 6px 0;
             border-bottom: 1px solid var(--border-2); }
.cov-row:last-child { border-bottom: none; }
.cov-name  { font-size: 13px; }
.cov-track { height: 6px; background: #EEEEEE; border-radius: 3px; overflow: hidden;
             margin-top: 5px; }
.cov-fill  { height: 100%; border-radius: 3px; }
.cov-usable   .cov-fill { background: #212121; }
.cov-partial  .cov-fill { background: #9E9E9E; }
.cov-unusable .cov-fill { background: #E0E0E0; }
.cov-pct   { font-size: 12px; text-align: right; color: var(--text-2);
             font-variant-numeric: tabular-nums; }
.cov-unusable .cov-name, .cov-unusable .cov-pct { color: var(--text-3); }

.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px;
        border: 1px solid var(--border); color: var(--text-2); background: #F5F5F5; }

/* ── Tables ───────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3);
     padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border-2); }
tr:last-child td { border-bottom: none; }

/* ── Code ─────────────────────────────────────────────────────────────── */
pre  { background: #212121; color: #EEEEEE; padding: 16px 18px; border-radius: var(--r);
       font-size: 12.5px; line-height: 1.6; overflow-x: auto;
       font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: #F5F5F5; padding: 2px 6px; border-radius: 3px; font-size: 12.5px;
       font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre code { background: none; padding: 0; }

/* ── Nav ──────────────────────────────────────────────────────────────── */
.nav { border-bottom: 1px solid var(--border); background: var(--surface); }
.nav-inner { max-width: 960px; margin: 0 auto; padding: 14px 24px;
             display: flex; align-items: center; gap: 24px; }
.nav .brand { font-weight: 500; letter-spacing: -.2px; text-decoration: none; }
.nav a { font-size: 14px; color: var(--text-2); text-decoration: none; }
.nav a:hover { color: var(--text); }
.nav .spacer { flex: 1; }

/* ── Explorer ─────────────────────────────────────────────────────────── */
.explorer-results { margin-top: 8px; max-height: 240px; overflow-y: auto;
                    border: 1px solid var(--border); border-radius: var(--r);
                    background: var(--surface); display: none; }
.explorer-results.open { display: block; }
.explorer-results button {
  display: block; width: 100%; text-align: left; padding: 10px 14px;
  background: none; border: none; border-bottom: 1px solid var(--border-2);
  font: inherit; font-size: 14px; cursor: pointer; color: var(--text);
}
.explorer-results button:hover { background: #F5F5F5; }
.explorer-results button:last-child { border-bottom: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  h1 { font-size: 27px; }
  section { padding: 40px 0; }
  .two-col { grid-template-columns: 1fr; }
  .wrap, .wrap-narrow { padding: 0 18px; }
  .nav-inner { gap: 14px 18px; flex-wrap: wrap; padding: 12px 18px; }
  .nav .brand { flex: 1 0 100%; }
  .card { padding: 20px; }
}

@media (max-width: 400px) {
  .stats { grid-template-columns: 1fr; }
}

/* Wide content must scroll inside itself, never the page body. */
.scroll-x { overflow-x: auto; }

/* ── Footer ───────────────────────────────────────────────────────────── */
/* Moved here from _p5_footer.html: the footer appears on every page, so its
 * rules belong in the shared sheet rather than being re-parsed inline each
 * time (and inline <style> is the kind of thing a strict CSP later blocks). */
.p5-footer { border-top: 1px solid #E0E0E0; margin-top: 56px; padding: 28px 24px;
               background: #FAFAFA; }
  .p5-footer-inner { max-width: 960px; margin: 0 auto; display: flex; gap: 32px;
                     flex-wrap: wrap; justify-content: space-between;
                     font-size: 13px; line-height: 1.7; color: #616161; }
  .p5-footer strong { color: #212121; }
  .p5-footer a { color: #616161; text-decoration: none; }
  .p5-footer a:hover { color: #212121; text-decoration: underline; }
  .p5-footer-links { display: flex; flex-direction: column; gap: 2px; }
  @media (max-width: 560px) { .p5-footer-inner { flex-direction: column; gap: 20px; } }
