/*
Theme Name: Masselink
Theme URI: https://masselink.minservers.com
Author: Graphite & Moss
Description: Campaign block theme for Derek Masselink — white canvas, fir/moss inks, linocut plates.
Version: 1.4.2
Requires at least: 6.4
Requires PHP: 8.0
Text Domain: masselink
*/

/* Derek Masselink for North Cowichan Council — "the landscape architect's
   drawing board". White canvas, fir-green ink, moss accent; layered-ridge
   topography as the signature motif; priorities set as a site-plan legend;
   linocut plates carry the west-coast warmth so the canvas can stay cool.

   One family carries the voice: Geist, weight-contrasted. IBM Plex Mono is
   the surveyor's hand — eyebrows, legend keys, dates, the authorization
   line. Fir and moss are the only two inks; arbutus is a micro-accent. */

/* ---------- tokens ---------- */
:root {
  --paper: #ffffff;
  --paper-deep: #f6f7f8;
  --ink: #17211b;
  --ink-soft: #47554c;
  --fir: #2e4a3a;
  --moss: #6e8257;      /* rules, keys, borders — not small text */
  --moss-text: #55673f; /* moss darkened until it is text-safe on paper */
  --river: #3f626b;
  --arbutus: #9c4f2e;   /* micro-accent only */

  --font-display: "Geist", -apple-system, "Segoe UI", sans-serif;
  --font-body: "Geist", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 72rem;
  --measure: 64ch;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --band: clamp(4rem, 9vw, 7.5rem);

  --type-display: clamp(2.5rem, 1.3rem + 4.8vw, 5rem);
  --type-h2: clamp(1.9rem, 1.3rem + 2.2vw, 3.1rem);
  --type-h3: clamp(1.25rem, 1.1rem + .6vw, 1.6rem);
  --type-lead: clamp(1.15rem, 1.05rem + .5vw, 1.45rem);
  --type-body: 1.0625rem;
  --type-small: .9375rem;
  --type-label: .8125rem;

  --stroke: 1.5px;
  --radius: 3px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: var(--moss-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--fir); }
:focus-visible { outline: 2px solid var(--river); outline-offset: 3px; }
::selection { background: var(--moss); color: var(--paper); }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--fir); color: var(--paper);
  padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; color: var(--paper); }
/* Focus must survive the dark fir surfaces where river reads as near-black */
.band--fir :focus-visible, .site-footer :focus-visible {
  outline-color: var(--paper);
}
/* Subpages (privacy, 404) open on an h1 sized like a section heading */
main > .band h1 { font-size: var(--type-h2); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0 0 .6em;
  color: var(--fir);
  text-wrap: balance;
}
h2 { font-size: var(--type-h2); }
h3 { font-size: var(--type-h3); font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0 0 1em; max-width: var(--measure); }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--moss-text);
  margin: 0 0 1.1rem;
}

/* Contour rule: the section divider is a fragment of topo line, not a border */
.contour-rule {
  border: none;
  height: 14px;
  width: 100%;
  margin: 0 auto;
  max-width: var(--wrap);
  padding-inline: var(--gutter);
  background-origin: content-box;
  background-clip: content-box;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 14' preserveAspectRatio='none'%3E%3Cpath d='M0 8 C60 8 80 3 140 4 S260 12 330 9 S480 2 600 6' fill='none' stroke='%236E8257' stroke-width='1.4' stroke-opacity='.55'/%3E%3C/svg%3E")
    center / 100% 100% no-repeat;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(0px); /* deliberate: no blur, maplebay/g&m house rule */
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 1.1rem;
  min-height: 4.25rem;
  max-width: 78rem; /* six nav items + social icons outgrew the 72rem wrap */
}
.wordmark { white-space: nowrap; }
/* Six nav items since Our strengths (2026-08-18): the tagline yields first */
@media (max-width: 84rem) {
  .wordmark .for { display: none; }
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--fir);
  text-decoration: none;
  margin-right: auto;
}
.wordmark:hover { color: var(--fir); }
.wordmark .for {
  font-family: var(--font-mono);
  font-size: .72em;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--moss-text);
}
.site-nav { display: flex; gap: 1.05rem; align-items: center; }
.site-nav a {
  font-size: var(--type-small);
  color: var(--ink-soft);
  text-decoration: none;
}
.site-nav a:hover { color: var(--fir); text-decoration: underline; text-underline-offset: 4px; }
.btn {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--type-small);
  color: var(--paper);
  background: var(--fir);
  border: var(--stroke) solid var(--fir);
  border-radius: var(--radius);
  padding: .55rem 1.1rem;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}
.btn:hover { background: #55673f; border-color: #55673f; color: #ffffff; }
.btn--ghost { background: transparent; color: var(--fir); }
.btn--ghost:hover { background: var(--fir); color: var(--paper); }
.btn--big { font-size: 1.05rem; padding: .8rem 1.6rem; }
.btn--donate { background: var(--arbutus); border-color: var(--arbutus); }
.btn--donate:hover { background: #7f3f24; border-color: #7f3f24; }

/* ---------- social links ---------- */
.header-social { display: flex; gap: .15rem; align-items: center; }
.header-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; border-radius: var(--radius);
  color: var(--ink-soft);
  transition: color 160ms ease, background 160ms ease;
}
.header-social a:hover { color: var(--fir); background: color-mix(in srgb, var(--fir) 10%, transparent); }
.header-social svg { width: 18px; height: 18px; fill: currentColor; }
.footer-social { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: .9rem; }
.footer-social a {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: var(--type-small);
  text-decoration: none;
}
.footer-social a:hover { text-decoration: underline; text-underline-offset: 4px; }
.footer-social svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }

/* ---------- hero ---------- */
.hero { position: relative; padding-block: clamp(3.5rem, 8vw, 6.5rem) 0; }
.hero-inner { position: relative; z-index: 2; }
.hero-grid {
  display: grid;
  /* 3:2 (was 7:4) — Derek asked for a larger headshot, 2026-08-18 */
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero-portrait { margin: 0; justify-self: end; width: min(100%, 26rem); }
.hero h1 {
  font-size: var(--type-display);
  max-width: 13ch;
  margin-bottom: .45em;
}
.hero h1 em { font-style: normal; color: var(--moss-text); }
.hero .lead {
  font-size: var(--type-lead);
  color: var(--ink-soft);
  max-width: 52ch;
}
.hero-cta { display: flex; gap: .9rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-art {
  position: relative;
  margin-top: clamp(.5rem, 2.5vw, 1.5rem);
  height: clamp(180px, 30vw, 380px);
  overflow: hidden;
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-art::after {
  /* the drawing fades up into the page like a sheet edge */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, var(--paper), transparent 45%);
}

/* ---------- bands ---------- */
.band { padding-block: var(--band); }
.band--deep { background: var(--paper-deep); }
.band--fir { background: var(--fir); color: var(--paper); }
.band--fir h2, .band--fir h3 { color: var(--paper); }
.band--fir p { color: color-mix(in srgb, var(--paper) 88%, var(--fir)); }
.band--fir .eyebrow { color: #a9bf8e; }
.band--fir a { color: #c9d8b4; }
.band--fir a:hover { color: var(--paper); }

/* ---------- about ---------- */
.about-grid {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: start;
}
.about-plate { margin: 0; align-self: start; position: sticky; top: 6rem; }
.about-plate img { width: 100%; height: auto; }
.about-plate figcaption {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  color: var(--ink-soft);
  margin-top: .7rem;
  max-width: 40ch;
}
.portrait img { width: 100%; height: auto; border-radius: var(--radius); }
.portrait figcaption {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  color: var(--ink-soft);
  margin-top: .6rem;
}
.pull-quote {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  line-height: 1.35;
  color: var(--fir);
  border-left: 3px solid var(--moss);
  margin: 1.6rem 0 0;
  padding-left: 1.2rem;
  max-width: 44ch;
}
/* The endorsement outgrew the text column (2026-08-08 copy revision): as a
   grid child it spans both columns below the bio, so the band ends on the
   quote instead of a blank right rail. */
.about-grid .pull-quote { grid-column: 1 / -1; max-width: 54ch; margin-top: .4rem; }
.pull-quote cite {
  display: block;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--type-label);
  color: var(--ink-soft);
  margin-top: .7rem;
}

/* ---------- legend (priorities) ---------- */
.legend-intro { max-width: var(--measure); margin-bottom: 2.5rem; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.legend-item {
  display: grid;
  /* was a fixed 150px — Derek asked for larger commitment images, 2026-08-18 */
  grid-template-columns: clamp(150px, 21vw, 240px) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: start;
  padding-block: clamp(1.8rem, 4vw, 3rem);
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}
.legend-item:last-child { border-bottom: 1px solid color-mix(in srgb, var(--ink) 15%, transparent); }
.legend-key {
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
  padding-top: .3rem;
}
.legend-key img { width: 100%; height: auto; border-radius: var(--radius); }
.legend-item h3 { margin-bottom: .35em; }
.legend-item p { margin-bottom: .5em; }
.legend-item p:last-child { margin-bottom: 0; }

/* ---------- photo band ---------- */
.photo-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.photo-band figure { margin: 0; }
.photo-band img { width: 100%; height: auto; border-radius: var(--radius); }
.photo-band figcaption {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  color: var(--ink-soft);
  margin-top: .55rem;
}

/* ---------- get involved ---------- */
.involve-grid {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
form { max-width: 34rem; }
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-weight: 700;
  font-size: var(--type-small);
  margin-bottom: .35rem;
}
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="number"], .field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid color-mix(in srgb, var(--fir) 78%, transparent);
  border-radius: var(--radius);
  padding: .7rem .85rem;
  transition: border-color 160ms ease;
}
.field input:hover, .field textarea:hover { border-color: var(--fir); }
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--river); outline-offset: 1px; border-color: var(--river);
}
.checks { display: grid; gap: .5rem; margin: .4rem 0 1.2rem; }
.checks label {
  display: flex; align-items: center; gap: .6rem;
  font-size: var(--type-body); font-weight: 400;
}
.checks input { width: 1.05rem; height: 1.05rem; accent-color: var(--fir); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note { font-size: var(--type-small); color: var(--ink-soft); max-width: 46ch; }
.form-status { font-weight: 700; margin-top: .8rem; }
.form-status[data-state="ok"] { color: var(--moss-text); }
.form-status[data-state="error"] { color: var(--arbutus); }

/* ---------- voting info ---------- */
.vote-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin-top: 2rem;
}
.vote-card {
  border: none;
  border-top: 3px solid var(--moss);
  border-radius: 6px;
  background: var(--paper-deep);
  padding: 1.3rem 1.4rem;
}
.vote-card .when {
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--moss-text);
  margin-bottom: .4rem;
}
.vote-card p { font-size: var(--type-small); margin: 0; }
.vote-card strong { font-size: 1.05rem; display: block; margin-bottom: .2rem; }

/* ---------- news ---------- */
/* The post-template block puts `news-list-item` on the <ul>, so the per-story
   padding/rule must target the <li> (.wp-block-post) — on the <ul> it drew one
   rule around the whole list and let the stories run into each other. */
.news-list, .news-list-item { list-style: none; margin: 0; padding: 0; }
.news-list .wp-block-post {
  padding-block: clamp(1.6rem, 3.5vw, 2.5rem);
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}
.news-list .wp-block-post:last-child { border-bottom: 1px solid color-mix(in srgb, var(--ink) 15%, transparent); }
.news-list-item .wp-block-post-title { margin: 0 0 .35em; }
.news-list-item .wp-block-post-title a { color: var(--fir); text-decoration: none; }
.news-list-item .wp-block-post-title a:hover { text-decoration: underline; text-underline-offset: 4px; }
.news-list-item .wp-block-post-date {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--type-label);
  color: var(--moss-text);
  letter-spacing: .04em;
  margin-bottom: .6em;
}
.news-list-item .wp-block-post-excerpt p { margin-bottom: 0; }
/* Image on the listing: the post's Featured image, else the first image in its
   content (functions.php fallback); posts with neither render no figure. Height
   is capped so a portrait phone photo does not swallow the list. */
.news-list-item .news-thumb { margin: 0 0 1.1rem; }
.news-list-item .news-thumb img {
  width: auto; max-width: min(100%, 34rem); height: auto; max-height: 28rem;
  border-radius: var(--radius); display: block;
}
.news-back {
  font-family: var(--font-mono);
  font-size: var(--type-small);
  margin-top: 2.5rem;
}

/* ---------- footer ---------- */
.site-footer { background: var(--fir); color: #dfe5d8; padding-block: 3.5rem 2.5rem; }
.site-footer a { color: #c9d8b4; }
.site-footer a:hover { color: var(--paper); }
.footer-grid {
  display: grid; gap: 2rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  margin-bottom: 2.5rem;
}
.acknowledgment { font-size: var(--type-small); max-width: 58ch; color: #c5cfbc; }
.footer-contact { font-size: var(--type-small); }
.footer-contact p { margin-bottom: .4em; }
.authorization {
  border-top: 1px solid color-mix(in srgb, #dfe5d8 25%, transparent);
  padding-top: 1.4rem;
  font-family: var(--font-mono);
  font-size: var(--type-label);
  color: #b9c4ae;
}
.authorization strong { color: #dfe5d8; }
.colophon {
  margin-top: .9rem;
  font-family: var(--font-mono);
  font-size: var(--type-label);
  color: #94a189;
}

/* ---------- responsive ---------- */
@media (max-width: 68rem) {
  .about-grid, .involve-grid, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-portrait { justify-self: start; width: min(100%, 20rem); }
  .site-nav { display: none; } /* anchor nav collapses; header keeps wordmark + Donate */
  .header-social { display: none; } /* footer carries the social links on mobile */
  .site-header .wrap > .btn--ghost { display: none; } /* hero repeats Join; Donate stays */
  .wordmark .for { display: none; }
  .site-header .wrap { gap: .75rem; }
  .site-header .btn { padding: .45rem .7rem; }
  .legend-item { grid-template-columns: minmax(0, 1fr); }
  .legend-key { flex-direction: row; align-items: center; gap: .9rem; }
  .legend-key img { width: 148px; }
  .about-plate { width: min(100%, 32rem); justify-self: start; }
  .vote-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20.5rem), 1fr)); }
}

/* ---------- WordPress compatibility ----------
   The nav is a core block, so core's stylesheet reaches inside it. Each rule
   below answers one specific core declaration; nothing here is new design.
   (Core's flow-layout margins are switched off at the source instead, via
   `settings.spacing.blockGap: null` in theme.json — the ported stylesheet
   owns all spacing.) */

/* Core forces `color: inherit` on nav links at a specificity the ported
   `.site-nav a` cannot reach, so set the colour on the container and let it
   inherit down. `:hover` adds the weight the base selector lacked. */
.site-header .site-nav { color: var(--ink-soft); }
.site-header .site-nav a:hover { color: var(--fir); }

/* Core's image block gives every caption a bottom margin
   (`:where(.wp-block-image figcaption) { margin-bottom: 1em }`) that the
   static figures never had — it pushed the photo band 13px taller than the
   page it is a port of. Captions set their own top margin here; the space
   below a figure belongs to the section. */
.wp-block-image figcaption { margin-bottom: 0; }

/* A block paragraph carries classes, not inline styles: the three
   `style="max-width: 62ch"` paragraphs in "Working together" become `.mw-62`
   so they stay editable without the editor stripping the attribute. */
.mw-62 { max-width: 62ch; }

/* Core `body .is-layout-flex { display: flex }` outranks the responsive rule
   that collapses the anchor nav — which must also take the block's overlay
   menu button with it, since the static header has none. */
@media (max-width: 68rem) {
  .site-header .site-nav { display: none; }
}

/* ---------- donate (e-transfer pledge form, 2026-09-01) ---------- */
.involve-donate { margin: 1.2rem 0 0; }
.donate-form fieldset { border: 0; padding: 0; margin: 0 0 1.6rem; min-width: 0; }
.donate-form legend { margin-bottom: .6rem; }
.amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.amount-btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: .7rem .5rem; border-radius: var(--radius);
  color: var(--fir); background: var(--paper);
  border: 2px solid color-mix(in srgb, var(--fir) 78%, transparent);
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.amount-btn:hover { border-color: var(--fir); }
.amount-btn.is-selected { background: var(--fir); color: var(--paper); border-color: var(--fir); }
.amount-custom { display: flex; align-items: center; gap: .3rem; font-weight: 700; color: var(--fir); }
.amount-custom input[type="number"] {
  width: 100%; min-width: 0; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid color-mix(in srgb, var(--fir) 78%, transparent);
  border-radius: var(--radius); padding: .6rem .7rem;
}
.amount-custom input:hover { border-color: var(--fir); }
.amount-custom input:focus { outline: 2px solid var(--river); outline-offset: 1px; border-color: var(--river); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.field-row.three { grid-template-columns: 2fr 1fr 1.4fr; }
.attest { gap: .7rem; }
.attest label { align-items: flex-start; font-size: var(--type-small); }
.attest input { margin-top: .2rem; flex: none; }
.donate-result {
  max-width: 34rem; padding: 1.4rem 1.6rem;
  border: 2px solid var(--moss); border-radius: var(--radius); background: var(--paper-deep);
}
.donate-result:focus { outline: none; }
.donate-result h3 { margin-top: 0; }
.instructions { margin: 1rem 0; }
.instruction-row {
  display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: .4rem 1rem;
  align-items: start; margin-bottom: .8rem;
}
.instruction-row dt {
  font-family: var(--font-mono); font-size: var(--type-label);
  text-transform: uppercase; letter-spacing: .06em; color: var(--moss-text); padding-top: .35rem;
}
.instruction-row dd { margin: 0; }
.instruction-row code {
  display: block; font-family: var(--font-mono); font-size: var(--type-small);
  background: var(--paper); border: 1px solid var(--moss); border-radius: var(--radius);
  padding: .5rem .7rem; overflow-wrap: anywhere; user-select: all;
}
.btn--copy { margin-top: .5rem; font-size: var(--type-small); padding: .4rem .9rem; }
.copy-confirm { font-weight: 700; color: var(--moss-text); }
.contribution-rules { max-width: 62ch; margin-top: 3rem; }
@media (max-width: 40rem) {
  .amount-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row, .field-row.three { grid-template-columns: minmax(0, 1fr); }
  .instruction-row { grid-template-columns: minmax(0, 1fr); }
  .instruction-row dt { padding-top: 0; }
}
