/* ===================================================================
   ADAMP.COM — Worm System v1.0
   Shared stylesheet · all pages reference this file.
   Tokens are the source of truth. Don't override them per-page.
   =================================================================== */

:root {
  /* ---------- Color tokens ---------- */
  --ink:           #111111;        /* the only true black */
  --paper:         #f4f1ea;        /* cream — body/reading */
  --cream:         #f1ecdf;        /* slightly warmer — type on midnight */
  --rule:          #ddd6c6;        /* hairline on paper */

  --purple-deep:   #1a1144;        /* midnight — wayfinding bg */
  --purple-deeper: #0e0830;        /* strip/footer black-purple */
  --purple:        #5b32d4;        /* institutional mark */
  --purple-bright: #8a6cf0;        /* type accent on midnight */
  --purple-tab:    #3a2d72;        /* mid tone on midnight */

  --warm:          #e84e1b;        /* orange accent · sparingly */
  --warm-soft:     #ff7a3d;        /* on midnight */
  --gold:          #f0d97a;        /* signal yellow · sparingly */

  --muted:         #6a6a6a;        /* secondary on paper */
  --muted-dark:    #9a90bc;        /* secondary on midnight */

  /* ---------- Type scale (matches Helvetica metrics) ---------- */
  --t-display:     clamp(48px, 6vw, 88px);
  --t-h1:          clamp(36px, 4.5vw, 64px);
  --t-h2:          clamp(20px, 2vw, 28px);
  --t-h3:          22px;
  --t-body-lg:     19px;     /* article body (Georgia) */
  --t-body:        16px;     /* default */
  --t-small:       14px;
  --t-meta:        12px;     /* mono metadata */
  --t-micro:       11px;     /* nav, labels */
  --t-tag:         10px;     /* uppercase tags */

  /* ---------- Spacing ---------- */
  --s-1:           4px;
  --s-2:           8px;
  --s-3:           12px;
  --s-4:           16px;
  --s-5:           24px;
  --s-6:           32px;
  --s-7:           48px;
  --s-8:           64px;
  --s-9:           80px;
  --s-10:          120px;

  /* ---------- Page rhythm ---------- */
  --gutter:        32px;
  --max-w:         1400px;
  --read-w:        64ch;

  /* ---------- Type stacks ---------- */
  --font-sans:     "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif:    "Georgia", "Times New Roman", serif;
  --font-mono:     "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  color: var(--ink);
  background: var(--paper);
}

/* Body modifier for purple pages */
body.midnight { background: var(--purple-deep); color: var(--cream); }

.mono { font-family: var(--font-mono); }

/* ===================================================================
   TOP STRIP — appears on every page, sets the institutional tone
   =================================================================== */
.strip {
  background: var(--purple-deeper);
  color: var(--cream);
  padding: 6px var(--gutter);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-tag);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 12px;
}
.strip a { color: var(--cream); text-decoration: none; border-bottom: 1px dotted #555; }
.strip a:hover { color: var(--gold); }
.strip .pill {
  background: var(--purple);
  color: #fff;
  padding: 3px 10px;
  letter-spacing: 0.2em;
}

/* ===================================================================
   MASTHEAD — wordmark left, registration data right
   .masthead.big = home page treatment (large wordmark)
   .masthead     = inner-page treatment (compact, 220px wordmark)
   =================================================================== */
.masthead {
  padding: var(--s-5) var(--gutter);
  border-bottom: 2px solid currentColor;
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-6);
}
.masthead.big {
  padding: var(--s-8) var(--gutter) var(--s-7);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
}
.midnight .masthead { border-bottom-color: var(--cream); }

.wordmark { line-height: 0; display: block; }
.wordmark svg { display: block; width: 205px; height: auto; }
.masthead.big .wordmark svg { width: 100%; max-width: 670px; }

.reg, .crumbs {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.8;
}
.midnight .reg, .midnight .crumbs { color: var(--muted-dark); }
.reg {
  display: inline-grid;
  grid-template-columns: auto auto auto;  /* label · value */
  column-gap: 8px;
  align-items: baseline;
}
.reg b   { justify-self: end; }            /* labels right-align to the dot */
.reg .sep { justify-self: center; opacity: 0.65; }
.reg .val { justify-self: start; }         /* values left-align from the dot */
.reg b, .crumbs a { color: var(--ink); text-decoration: none; }
.midnight .reg b, .midnight .crumbs a { color: var(--cream); }
.crumbs a { border-bottom: 1px dotted #888; }
.crumbs .now { color: var(--purple); }
.midnight .crumbs .now { color: var(--purple-bright); }

/* ===================================================================
   NAV — uppercase mono, active state underline
   =================================================================== */
.nav {
  border-bottom: 1px solid currentColor;
  padding: var(--s-3) var(--gutter);
  display: flex; gap: var(--s-6); flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: var(--t-meta);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}
.midnight .nav { border-bottom-color: var(--cream); }
.midnight .nav a { color: var(--cream); }
.nav a:hover { color: var(--purple); }
.midnight .nav a:hover { color: var(--purple-bright); }
.nav a.active { color: var(--purple); }
.midnight .nav a.active { color: var(--purple-bright); }
.nav a.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -14px;
  height: 3px;
  background: currentColor;
}
.nav .signal { margin-left: auto; color: var(--warm); }
.midnight .nav .signal { color: var(--warm-soft); }

/* "MORE" disclosure — desktop shows the full flat nav; the <details> is inert.
   Phones (≤520) hide the secondary/RSS links and reveal them (plus the home
   registration block) behind a tappable MORE. No JavaScript. */
.nav-more { display: none; }

/* ===================================================================
   SECTION HEAD — used everywhere, sets typographic anchor
   =================================================================== */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--s-7);
  border-top: 4px solid currentColor;
  padding-top: var(--s-4);
  gap: var(--s-5);
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: var(--t-h2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  margin: 0;
}
.section-head .marker {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.midnight .section-head .marker { color: var(--muted-dark); }

/* ===================================================================
   PATCHES v2 — mission patches with SHAPE variety (the fix)
   .patch-grid wraps; each .patch is a card with a clipped emblem
   =================================================================== */
.patch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-7) var(--s-6);
}
.patch {
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s;
}
.patch:hover { transform: translateY(-4px); }
.patch:hover .emblem-mount { background: var(--purple-tab); }
.midnight .patch { color: var(--cream); }

.emblem-mount {
  /* The card it's "pinned" to. Sits darker than the page. */
  background: rgba(0,0,0,0.18);
  border: 1px solid currentColor;
  padding: 22px;
  margin-bottom: var(--s-4);
  position: relative;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
body:not(.midnight) .emblem-mount {
  background: var(--paper);
  border-color: var(--ink);
}

/* Stitch corners — four cream dots in the mounting card */
.emblem-mount::before,
.emblem-mount::after {
  content: "";
  position: absolute;
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}
.emblem-mount::before { top: 8px; left: 8px; box-shadow: calc(100% + 8px - 5px) 0 currentColor; }
.emblem-mount::after  { bottom: 8px; left: 8px; box-shadow: calc(100% + 8px - 5px) 0 currentColor; }

.emblem {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.emblem svg { width: 100%; height: 100%; display: block; }

.patch h3 {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}
.patch p {
  font-size: var(--t-meta);
  color: var(--muted);
  margin: 0;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.midnight .patch p { color: var(--muted-dark); }

/* ===================================================================
   POSTS — list/card primitives for stream + archive pages
   =================================================================== */
.post-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s-5);
}
.post {
  padding: var(--s-5);
  border: 1px solid currentColor;
  color: inherit;
  text-decoration: none;
  display: flex; flex-direction: column;
  transition: background 0.15s;
  background: transparent;
}
.post:hover { background: rgba(0,0,0,0.04); }
.midnight .post:hover { background: rgba(255,255,255,0.04); }

.post .type {
  font-family: var(--font-mono);
  font-size: var(--t-tag);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: var(--s-4);
  display: flex; justify-content: space-between;
  gap: 8px;
}
.post .type .label { color: var(--purple); }
.midnight .post .type .label { color: var(--purple-bright); }
.post .type .time { color: var(--muted); }
.midnight .post .type .time { color: var(--muted-dark); }

.post h3 {
  font-size: var(--t-h3);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 var(--s-3);
  letter-spacing: -0.01em;
}
.post .body { font-size: var(--t-small); line-height: 1.5; flex: 1; opacity: 0.85; }
.post .footer-meta {
  margin-top: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-tag);
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.midnight .post .footer-meta { color: var(--muted-dark); }
.post .footer-meta b { color: var(--ink); }
.midnight .post .footer-meta b { color: var(--cream); }

/* photo slot — striped placeholder */
.photo-slot {
  aspect-ratio: 1;
  background: repeating-linear-gradient(135deg, #d8cba0, #d8cba0 8px, #c9bb8e 8px, #c9bb8e 16px);
  border: 1px solid #b8a878;
  display: flex; align-items: center; justify-content: center;
  color: #6a5a30;
  font-family: var(--font-mono);
  font-size: var(--t-tag);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center; padding: 12px;
}
.midnight .photo-slot {
  background: repeating-linear-gradient(135deg, #3a2d72, #3a2d72 8px, #2a1a5e 8px, #2a1a5e 16px);
  border-color: var(--purple-tab);
  color: var(--cream);
}

/* ===================================================================
   FOOTER — universal, on every page
   =================================================================== */
.foot {
  background: var(--purple-deeper);
  color: var(--cream);
  padding: var(--s-9) var(--gutter) var(--s-5);
  font-family: var(--font-sans);
}
.foot-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: var(--s-7);
  margin-bottom: var(--s-7);
  max-width: var(--max-w);
  margin-left: auto; margin-right: auto;
}
.foot-grid h4 {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-dark);
  margin: 0 0 var(--s-3);
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 1.9; }
.foot-grid a {
  color: var(--cream);
  text-decoration: none;
  border-bottom: 1px solid var(--purple-tab);
}
.foot-grid a:hover { color: var(--purple-bright); border-color: var(--purple-bright); }
.foot-grid .lockup .wordmark svg { width: 186px; height: auto; }
.foot-grid .lockup p { color: var(--muted-dark); font-size: 13px; margin: 16px 0 0; max-width: 36ch; line-height: 1.5; }

.foot-bottom {
  border-top: 1px solid var(--purple-tab);
  padding-top: var(--s-4);
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--t-tag);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-dark);
  max-width: var(--max-w);
  margin-left: auto; margin-right: auto;
  flex-wrap: wrap;
  gap: 12px;
}
.foot-bottom .answer { color: var(--warm-soft); }

/* ===================================================================
   RESPONSIVE — desktop > tablet > phone
   =================================================================== */
@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .masthead.big { grid-template-columns: 1fr; }
  .reg { justify-content: start; }  /* left-align the grid when the masthead stacks */
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .post-grid > * { grid-column: span 12 !important; }
}
@media (max-width: 520px) {
  /* Strip collapses to a single centered badge — the transmission/clock lines
     are decorative, so drop them on phones to keep it to one line. */
  .strip { font-size: 9px; gap: 8px; justify-content: center; }
  .strip span:not(.pill) { display: none; }
  .nav { gap: var(--s-4); }
  /* Collapse the secondary nav + RSS into MORE; keep INDEX/ARTICLES/NOTES/PHOTOS.
     MORE sits inline after PHOTOS so the resting nav is one line; it only takes
     the full width once open, giving the panel room to stack below. */
  .nav > a.nav-secondary { display: none; }
  .nav-more { display: block; }
  .nav-more[open] { width: 100%; }
  .nav-more > summary {
    list-style: none;
    cursor: pointer;
    color: inherit;
    width: max-content;
  }
  .nav-more > summary::-webkit-details-marker { display: none; }
  .nav-more > summary::after { content: ' +'; opacity: 0.55; }
  .nav-more[open] > summary::after { content: ' –'; }
  .nav-more .more-panel {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    padding-top: var(--s-4);
  }
  .nav-more .more-panel .signal { margin-left: 0; }
  /* Registration now lives inside MORE on phones, not the masthead. */
  .masthead .reg { display: none; }
  .foot-bottom { flex-direction: column; gap: 6px; }
  .patch-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- WordPress content alignment & captions ---------- */
/* Emitted by editor content and the [caption] shortcode across 23 years of
   migrated posts (30 aligncenter, 10 alignright, 2 alignleft, 25 captions).
   These live in the shared base because post content renders in several
   template contexts (articles, notes, pages). */
.alignleft {
  float: left;
  margin: var(--s-1) var(--s-5) var(--s-3) 0;
  max-width: 50%;
}

.alignright {
  float: right;
  margin: var(--s-1) 0 var(--s-3) var(--s-5);
  max-width: 50%;
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Every <img> on the site comes from the_content() — constrain them all so a
   wide content image can never overflow its column (caused horizontal scroll on
   the About bio). Background-image art and SVG chrome are unaffected. */
img { max-width: 100%; height: auto; }

img.alignleft, img.alignright, img.aligncenter { height: auto; }

.wp-caption {
  max-width: 100%;
  margin-bottom: var(--s-5);
}

.wp-caption img {
  display: block;
  height: auto;
  max-width: 100%;
}

.wp-caption-text {
  margin: var(--s-2) 0 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
}

.midnight .wp-caption-text { color: var(--muted-dark); }

/* ---------- Accessibility ---------- */
/* Canonical WP screen-reader utility: visually hidden, available to AT.
   WordPress core emits this class (search/comment form labels, "skip to
   content"), so the theme must style it or the text renders on-screen. */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--cream);
  border-radius: 3px;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
  clip: auto !important;
  clip-path: none;
  color: var(--purple-deep);
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}
