/* ==========================================================================
   graphicmatt.com — companion to cityhallwatcher.com.
   Tokens follow the CHW system so the two sites read as one family.
   ========================================================================== */

:root {
  --blue:      #274490;
  --blue-dark: #1E3574;
  --deep:      #16264F;
  --tint:      #EAEEF9;
  --paper:     #FFFFFF;
  --card:      #FFFFFF;
  --ink:       #16264F;
  --body:      #38415A;
  --muted:     #5C6478;
  --faint:     #61697D;
  --rule:      #E3E0D6;
  --rule-soft: #EDEAE0;
  --hover:     #FAFAF6;
  --link:      var(--blue);

  --f-display: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --f-body:    'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --f-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1080px;
  --gut: 16px;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
}
@media (min-width: 768px) { :root { --gut: 32px; } }

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1730; --card: #16203F; --tint: #1A2650;
    --ink: #EEF1FA; --body: #C9CFDF; --muted: #9AA3BA; --faint: #8C95AC;
    --rule: #2A3558; --rule-soft: #222D4D; --hover: #1B2647;
    --link: #9DB4F2;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--body);
  font-family: var(--f-body); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 {
  font-family: var(--f-display); color: var(--ink); font-weight: 800;
  letter-spacing: -.02em; line-height: 1.12; margin: 0 0 .5em; text-wrap: balance;
}
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }
.wrap--narrow { max-width: 760px; }
.section { padding-block: clamp(40px, 6vw, 72px); }
.section--top { padding-top: clamp(32px, 5vw, 56px); }
.section--tint { background: var(--tint); }
.kicker {
  font-family: var(--f-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 .75rem;
}
.kicker a { color: inherit; }
.lede { font-size: clamp(1.05rem, 2vw, 1.2rem); max-width: 62ch; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 700; font-size: .98rem;
  padding: 11px 20px; border-radius: var(--r-sm); text-decoration: none;
  background: var(--blue); color: #fff; border: 1px solid var(--blue);
}
.btn:hover { background: var(--blue-dark); color: #fff; }
.btn--ghost { background: transparent; color: var(--link); border-color: var(--rule); }
.btn--ghost:hover { background: var(--hover); color: var(--link); }
.btn--light { background: #fff; color: var(--blue); border-color: #fff; }
.btn--light:hover { background: var(--tint); color: var(--blue); }
.btn--sm { padding: 7px 14px; font-size: .9rem; }

/* --- Masthead ----------------------------------------------------------- */
.masthead { background: var(--blue); color: #fff; }
.masthead__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand__mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  background: #fff; color: var(--blue); font-family: var(--f-display); font-weight: 800; font-size: .8rem;
}
.brand__name { font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav > a:not(.btn) {
  color: #C9D4F0; text-decoration: none; font-size: .94rem; font-weight: 600;
  padding: 8px 10px; border-radius: var(--r-sm);
}
.nav > a:not(.btn):hover, .nav > a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.1); }
.nav .btn { margin-left: 6px; }

/* --- Home --------------------------------------------------------------- */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(32px, 5vw, 56px); border-bottom: 1px solid var(--rule); }
.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0 32px; }
.proof { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px 36px; }
.proof a { text-decoration: none; display: flex; flex-direction: column; }
.proof__n { font-family: var(--f-display); font-weight: 800; font-size: 1.7rem; color: var(--ink); line-height: 1.1; }
.proof__l { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.section__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section__head h2 { margin: 0; }
.years { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.years a {
  display: flex; justify-content: space-between; align-items: baseline; text-decoration: none;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px;
}
.years a:hover { border-color: var(--link); }
.years__y { font-family: var(--f-display); font-weight: 800; color: var(--ink); font-size: 1.15rem; }
.years__n { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); }

/* --- Entry lists (CHW "Recent issues") ---------------------------------- */
.posts { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.post {
  display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--rule-soft);
  text-decoration: none; color: inherit;
}
.post:last-child { border-bottom: 0; }
.post:hover { background: var(--hover); }
.post[hidden] { display: none; }
.post__date { font-family: var(--f-mono); font-size: .74rem; color: var(--faint); flex-shrink: 0; width: 64px; }
.posts .post__date:where(:not(:only-child)) { white-space: nowrap; }
.post__title {
  font-family: var(--f-display); font-weight: 600; font-size: 1rem; color: var(--ink);
  line-height: 1.35; flex: 1; min-width: 180px;
}
.post:hover .post__title { color: var(--link); }
.ext { color: var(--faint); font-weight: 400; }
.pub { font-family: var(--f-mono); font-size: .7rem; font-weight: 400; color: var(--muted); white-space: nowrap; }
.tag {
  font-family: var(--f-mono); font-size: .62rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule);
  border-radius: 999px; padding: 2px 7px; vertical-align: 2px; white-space: nowrap;
}
@media (max-width: 560px) { .post__title { flex-basis: 100%; order: 3; } }

.badge {
  display: inline-flex; align-items: center;
  font-family: var(--f-mono); font-size: .66rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px;
  white-space: nowrap; background: var(--t, var(--tint)); color: var(--c, var(--blue));
}
@media (prefers-color-scheme: dark) { .badge { background: var(--c); color: #fff; } }

/* Full-date variant used on the home page */
.section .posts .post__date { width: auto; min-width: 64px; }

/* --- Archive ------------------------------------------------------------ */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 8px 0 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 600 .88rem var(--f-body); cursor: pointer; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
}
.chip span { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--c, var(--blue)); border-color: var(--c, var(--blue)); color: #fff; }
.chip[aria-pressed="true"] span { color: rgba(255,255,255,.8); }
.filter-q input {
  font: 1rem var(--f-body); padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--card); color: var(--ink); width: min(280px, 100%);
}
.year { margin-bottom: 36px; }
.year[hidden] { display: none; }
.year__h { font-size: 1.4rem; margin-bottom: 12px; }
.year__h a { color: var(--ink); text-decoration: none; }
.year-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.year-nav a { font-family: var(--f-mono); font-size: .85rem; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); text-decoration: none; }
.year-nav a[aria-current="page"] { background: var(--blue); color: #fff; border-color: var(--blue); }

/* --- Entry page --------------------------------------------------------- */
.entry { padding-block: clamp(32px, 5vw, 56px); }
.entry__head .kicker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.entry__head h1 { font-size: clamp(1.9rem, 4.4vw, 2.7rem); margin-bottom: 28px; }
.prose { font-size: 1.08rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose h2, .prose h3, .prose h4 { margin: 1.6em 0 .5em; }
.prose h2 { font-size: 1.5rem; } .prose h3 { font-size: 1.25rem; }
.prose blockquote {
  margin: 1.4em 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--rule);
  color: var(--muted);
}
.prose figure { margin: 1.8em 0; }
.prose figure img { border: 1px solid var(--rule-soft); border-radius: var(--r-sm); background: #fff; }
.prose figcaption { font-size: .88rem; color: var(--muted); margin-top: .5em; }
.img-missing {
  display: block; padding: 14px 16px; border: 1px dashed var(--rule); border-radius: var(--r-sm);
  font-size: .88rem; color: var(--muted);
}
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 6px 8px; text-align: left; }
.prose iframe { max-width: 100%; }
.entry__source {
  margin-top: 40px; padding: 16px 18px; background: var(--tint); border-radius: var(--r);
  font-size: .92rem;
}
.entry__source p { margin: 0; }
.entry__nav { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 28px; }
.entry__nav a {
  display: block; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r);
  text-decoration: none; color: var(--ink); font-family: var(--f-display); font-weight: 600; line-height: 1.3;
}
.entry__nav a:hover { border-color: var(--link); }
.entry__nav .kicker { display: block; margin-bottom: 4px; }
.entry__nav-next { text-align: right; }
@media (max-width: 560px) { .entry__nav { grid-template-columns: 1fr; } .entry__nav-next { text-align: left; } }

/* --- Search (Pagefind UI) ----------------------------------------------- */
#search {
  --pagefind-ui-primary: var(--blue); --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--card); --pagefind-ui-border: var(--rule);
  --pagefind-ui-tag: var(--tint); --pagefind-ui-font: var(--f-body);
}

/* --- Footer ------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: 28px; font-size: .9rem; color: var(--muted); }
.site-footer__inner { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.site-footer p { margin: 0; }
