/* ============================================================
   Alex Villarroel. "The Index"
   Static personal hub. Plain CSS, self-hosted fonts.
   Created by Alex Villarroel.
   ============================================================ */

/* ---- Self-hosted fonts (variable woff2, latin subset) ----
   Inter + Fraunces are served by Google as variable files; one
   file covers the weight range, so each family loads once. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/fraunces-italic-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
}

/* ---- Design tokens ---- */
:root {
  --paper:    #F7F6F3;
  --paper-tint: #F1EDE5; /* warm clay-leaning band for subtle section alternation */
  --card:     #FFFFFF;
  --ink:      #1A1D21;
  --slate:    #4A4F57;
  --hairline: #E4E2DC;
  --brass:    #A07E4A;
  --brass-text: #85673A; /* darker brass for small link text (AA on paper) */
  --clay:     #A8542F; /* AA: white text on clay = 5.28:1 */
  --clay-hover: #934623;
  --sage:     #6B7257;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --maxw: 1080px;
  --radius: 14px;
  --shadow-soft: 0 3px 12px rgba(26, 29, 33, 0.06); /* resting depth on cards/boxes */
  --shadow-lift: 0 8px 24px rgba(26, 29, 33, 0.10);
  --shadow-plate: 0 10px 30px rgba(26, 29, 33, 0.14);
  --focus: var(--brass);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #16181B;
    --paper-tint: #1C1F23; /* faint lift above paper for banded sections */
    --card:     #1F2226;
    --ink:      #F2F1ED;
    --slate:    #B8BCC2;
    --hairline: #33373C;
    --brass:    #C7A56A;
    --brass-text: #C7A56A;
    --clay:     #B85633; /* AA: white text on clay = 4.75:1 (dark mode) */
    --clay-hover: #A44E2C;
    --sage:     #97A07E;
    --shadow-soft: 0 3px 12px rgba(0, 0, 0, 0.30);
    --shadow-lift: 0 8px 24px rgba(0, 0, 0, 0.40);
    --shadow-plate: 0 10px 30px rgba(0, 0, 0, 0.50);
  }
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Smooth in-page jumps, gated so reduced-motion users get an instant jump. */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--slate);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { color: var(--ink); font-family: var(--serif); line-height: 1.15; margin: 0; font-weight: 600; }
p { margin: 0; }
img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--brass-text); text-decoration-color: color-mix(in srgb, var(--brass) 50%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brass); }

/* ---- Focus visibility ---- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -56px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 16px;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ---- Layout ---- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; border-top: 1px solid var(--hairline); }
.section:first-of-type { border-top: none; }

.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--brass-text);
  margin: 0 0 20px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  margin-right: 10px;
  vertical-align: middle;
  border-radius: 2px;
  background: var(--clay);
  opacity: 0.85;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 16px;
}
.brandmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--slate);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"],
.nav a.is-active {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--brass);
  border-radius: 8px 8px 0 0;
}

/* ---- Hero ---- */
.hero { padding: 64px 0 56px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 48px;
  align-items: center;
}
.portrait-plate {
  border: 1px solid var(--hairline);
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-plate);
  max-width: 400px;
}
.portrait-plate img { border-radius: 8px; aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }

.hero h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); letter-spacing: -0.01em; }
.identity-lines { margin: 16px 0 0; }
.identity-lines span { display: block; color: var(--slate); font-size: 1.05rem; }
.principle {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--ink);
  margin: 22px 0 28px;
  display: inline-block;
  box-shadow: inset 0 -2px 0 var(--brass);
  padding-bottom: 2px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-clay {
  background: var(--clay);
  color: #FFFFFF;
}
.btn-clay:hover { background: var(--clay-hover); }

/* quiet secondary hub link beside the CTA */
.hero-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.hero-more {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--brass-text);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.hero-more:hover { text-decoration: underline; }

/* ---- Card grids ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card-grid.two-up { grid-template-columns: repeat(2, 1fr); }

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
a.card:hover { border-color: color-mix(in srgb, var(--brass) 40%, var(--hairline)); }

.card h3 { font-size: 1.2rem; }
.card .desc { color: var(--slate); font-size: 0.9rem; }
.card .tag {
  align-self: flex-start;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-text);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 6px;
}
.card .tag.tag-sage { color: var(--sage); }
.card .arrow {
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brass-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card .arrow .chev { transition: transform 0.18s ease; }

/* motion only when allowed */
@media (prefers-reduced-motion: no-preference) {
  a.card { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
  a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
  a.card:hover .chev { transform: translateX(4px); }
  .btn { transition: background 0.18s ease, transform 0.18s ease; }
}

/* ---- Section heading row (eyebrow + view all) ---- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.viewall {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brass-text);
  text-decoration: none;
  display: inline-flex;
  gap: 6px;
  min-height: 44px;
  align-items: center;
}
.viewall:hover { text-decoration: underline; }

/* ---- Channel chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--hairline);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.chip:hover { border-color: var(--brass); color: var(--brass-text); box-shadow: var(--shadow-lift); }
/* Click-to-copy chip (Discord handle). Button reset so it matches the link
   chips; with JS off it simply shows the handle as plain text. */
.chip-copy { cursor: pointer; appearance: none; -webkit-appearance: none; }
/* Inline brand badge. Colour follows the chip text (currentColor), so it
   tracks light/dark + hover. Drawn from a same-document SVG sprite: no
   external/CDN request, CSP-safe. */
.chip-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

/* ---- Find me (centered socials) ---- */
.find-me { text-align: center; }
.find-me .eyebrow { display: block; }
.find-me .chips { justify-content: center; }

/* ---- Balance band ---- */
.balance { text-align: center; }
.balance-gallery {
  list-style: none;
  padding: 0;
  margin: 0 auto 26px;
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
/* Flex + centered so the row stays centered to the page no matter how many
   tiles are present (3 today, up to 5 later). */
.balance-gallery li { margin: 0; flex: 0 1 224px; max-width: 240px; }
.balance-gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-lift);
}
.balance-line {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-text);
  margin: 0;
}
.balance-word {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  color: var(--ink);
  margin: 8px 0 0;
  display: inline-block;
  box-shadow: inset 0 -2px 0 var(--sage);
  padding-bottom: 2px;
}

/* ---- Quote sign-off ---- */
.quote {
  text-align: center;
  padding: 72px 0;
  border-top: 1px solid var(--brass);
}
.quote blockquote {
  margin: 0 auto;
  max-width: 720px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  color: var(--ink);
  line-height: 1.3;
}
.quote .attrib {
  margin-top: 18px;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}

/* ---- Contact ---- */
.contact { text-align: center; }
.contact .lead { max-width: 560px; margin: 0 auto 24px; color: var(--slate); font-size: 1.1rem; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 40px 0 56px;
  text-align: center;
}
.site-footer .chips { justify-content: center; margin-bottom: 20px; }
.site-footer .meta { font-size: 0.9rem; color: var(--slate); }
.site-footer .sign {
  font-family: var(--serif);
  font-style: italic;
  color: var(--brass-text);
  margin-top: 8px;
}

/* ---- Projects page bits ---- */
.page-title { padding: 56px 0 8px; }
.page-title h1 { font-size: clamp(2rem, 4.5vw, 2.8rem); }
.page-title .sub { margin-top: 12px; color: var(--slate); font-size: 1.1rem; max-width: 620px; }

.project-thumb {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--paper);
}
.project-thumb img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }

.empty-slot {
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate);
  font-size: 0.95rem;
  min-height: 120px;
  text-align: center;
}

/* Coming-soon project card (non-navigational, no external link) */
.card-soon { cursor: default; }
.thumb-soon {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: #243049;
  background: radial-gradient(120% 140% at 50% 0%, #1E3A8A 0%, #14213D 48%, #0E1220 100%);
}
.thumb-soon .soon-mark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #DCE4F5;
  border: 1px solid rgba(220, 228, 245, 0.4);
  border-radius: 999px;
  padding: 7px 16px;
  background: rgba(14, 18, 32, 0.5);
}
.card .tag.tag-soon { color: var(--slate); }

/* ---- Background (resume) page ---- */
.bg-intro {
  color: var(--slate);
  font-size: 1.05rem;
  max-width: 760px;
  margin: 0 0 8px;
}
.bg-list {
  margin: 14px 0 0;
  padding-left: 1.25em;
  max-width: 760px;
}
.bg-list li { margin: 8px 0; color: var(--slate); }
.bg-list li::marker { color: var(--brass); }
.bg-list strong { color: var(--ink); font-weight: 600; }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 18px;
}
.skill-group { cursor: default; }
.skill-group h3 { font-size: 1.05rem; margin-bottom: 6px; }
.skill-group .bg-list { margin-top: 10px; }
.skill-group .bg-list li { font-size: 0.95rem; }

@media (max-width: 700px) {
  .skill-grid { grid-template-columns: 1fr; }
}

/* ---- Section tone alternation (subtle banding for depth) ---- */
.section.tint { background: var(--paper-tint); }

/* Hidden brand-icon sprite. display:none parent still serves <use> clones,
   and keeps inline style attributes out of the markup (CSP style-src 'self'). */
.icon-sprite { display: none; }

/* ============================================================
   Background page: distinct content boxes
   Each major area (Experience, Building with AI, Life, etc.)
   reads as its own elevated card with a thin clay accent.
   ============================================================ */
.page-background .section { border-top: none; padding: 22px 0; }
.page-background .section:first-of-type { padding-top: 8px; }
.page-background .page-title { padding-bottom: 14px; }

.bg-box {
  position: relative;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 30px 34px 32px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
/* thin clay-to-brass accent along the top edge: the "more color" lift */
.bg-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--clay), var(--brass));
}
.bg-box > h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.bg-box .bg-intro + .bg-intro { margin-top: 14px; }
.bg-box .bg-intro { max-width: none; }

/* ---- Pull-quote (Socrates / Balance) ---- */
.pull-quote {
  margin: 22px 0 2px;
  padding: 18px 24px;
  border-left: 3px solid var(--clay);
  border-radius: 0 10px 10px 0;
  background: var(--paper-tint);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  line-height: 1.35;
  color: var(--ink);
}
.pull-quote cite {
  display: block;
  margin-top: 10px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}

/* ---- What I work with: capability sub-blocks ---- */
.cap-intro { margin-bottom: 4px; }
.cap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: start; /* collapsed cards keep their own height, no stretched gap */
  gap: 18px;
  margin-top: 22px;
}
.cap {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: var(--shadow-soft);
}
/* h3 promoted into the summary; the hairline underline becomes the
   summary border so the collapsed header keeps the same look. */
.cap > summary {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}
.cap > summary h3 {
  font-size: 1.15rem;
  /* Fraunces applies a contextual alternate / ligature that warps the "j" in
     capability titles like "Project Management and Consulting"; disable
     ligatures + alternates so the j renders as a plain, clean glyph. Harmless
     on the other capability titles. Same family of fix as the In-short block. */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "dlig" 0, "clig" 0, "calt" 0;
}
.cap p { color: var(--slate); font-size: 0.98rem; }
.cap p + p { margin-top: 12px; }
.cap--wide { grid-column: 1 / -1; }

/* One-line keyword "gist" row, reusing the quick-nav pill look. Keywords
   are factual, pulled from each capability's own paragraphs below. */
.cap-chips {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cap-chips li {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--brass-text);
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--clay) 7%, var(--card));
  border-radius: 999px;
  padding: 5px 12px;
}
.cap-chips + p { margin-top: 14px; }

@media (max-width: 760px) {
  .cap-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Disclosure (native <details>/<summary>) on the Background page.
   Narrative sections render open + collapsible; capabilities render
   collapsed + exclusive (name="capabilities"). Fully functional with
   JS disabled. Token-only styling, on-brand.
   ============================================================ */
summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: baseline;
  gap: .6rem;
}
summary::-webkit-details-marker { display: none; }

/* Clay chevron that rotates open. The rotation direction is set
   unconditionally (so reduced-motion users still see correct state);
   only the animated transition is gated behind reduced-motion. */
summary::after {
  content: "";
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--clay);
  border-bottom: 2px solid var(--clay);
  transform: rotate(45deg);
}
[open] > summary::after { transform: rotate(-135deg); }
@media (prefers-reduced-motion: no-preference) {
  summary::after { transition: transform 0.2s ease; }
}

/* Removing the marker must not lose keyboard focus visibility. */
summary:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Narrative disclosure: keep the <h2> as the visible summary heading. */
.bg-disclose > summary { margin-bottom: 14px; }
.bg-disclose > summary h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.01em;
}

/* Print / PDF: emit the FULL expanded page regardless of open state. */
@media print {
  details:not([open]) > *,
  .cap,
  .bg-disclose { display: block !important; }
}

/* ---- Identity block (bottom of background) ---- */
.identity-box { text-align: center; }
.identity-box .eyebrow::before { display: none; }
.identity-lines-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.identity-lines-list li {
  font-family: var(--serif);
  font-size: 1.08rem;
  color: var(--ink);
  /* Fraunces applies a contextual alternate / ligature to a double "J" that
     warps the "JJ" in "BJJ Blue Belt"; disable ligatures + alternates so each
     J renders as a plain, identical glyph. Harmless on the other lines. */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "dlig" 0, "clig" 0, "calt" 0;
}
.identity-lines-list .lead-line { color: var(--brass-text); font-style: italic; }

/* ---- Background contact box ---- */
.bg-contact { text-align: center; }
.bg-contact .lead { max-width: 560px; margin: 0 auto 22px; color: var(--slate); font-size: 1.08rem; }

/* ============================================================
   Background page: in-page quick-nav ("On this page")
   Sticky flat pill row that couples under the sticky site header,
   with a solid background so pills never sit on see-through
   scrolled content. Works with JS off (plain anchors).
   ============================================================ */
.page-nav {
  position: sticky;
  top: 60px; /* sits flush under the 60px sticky site header */
  z-index: 40; /* above page content, below the header (z 50) */
  padding: 10px 0;
  background: var(--paper);
}
.page-nav-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 22px 20px;
  box-shadow: var(--shadow-soft);
}
.page-nav-card::before { content: none; }
.page-nav-title { margin: 0 0 12px; }

.page-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.page-nav-list > li { margin: 0; }

.page-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--slate);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}
/* Hover / focus / active all carry the clay accent. Text stays --ink so
   contrast clears AA in both light and dark; clay reads via border + tint. */
.page-nav a:hover,
.page-nav a:focus-visible {
  border-color: var(--clay);
  color: var(--ink);
  background: color-mix(in srgb, var(--clay) 8%, var(--card));
}
.page-nav a.is-active {
  border-color: var(--clay);
  color: var(--ink);
  background: color-mix(in srgb, var(--clay) 14%, var(--card));
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--clay);
}

@media (prefers-reduced-motion: no-preference) {
  .page-nav a { transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease; }
}

/* Keep jumped-to targets clear of the sticky site header + sticky quick-nav. */
.page-background .section[id],
.page-background .cap[id] { scroll-margin-top: 150px; }

@media (max-width: 520px) {
  .page-nav-card { padding: 16px 16px 18px; }
  /* Pills wrap to more rows on narrow screens, so the sticky stack is
     taller; give jumped-to targets a little more clearance. */
  .page-background .section[id],
  .page-background .cap[id] { scroll-margin-top: 200px; }
}

/* ---- Visually-hidden (screen-reader only; keeps heading outline clean) ---- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .portrait-plate { margin: 0 auto; }
  .hero { text-align: center; }
  .principle { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .card-grid, .card-grid.two-up { grid-template-columns: 1fr; }
}

/* Tablet: keep cards 2-up instead of jumping 3-up straight to 1-up */
@media (min-width: 600px) and (max-width: 860px) {
  .card-grid, .card-grid.two-up { grid-template-columns: repeat(2, 1fr); }
}

/* Balance gallery reflows down on smaller screens, staying centered. */
@media (max-width: 600px) {
  .balance-gallery { max-width: 460px; }
  .balance-gallery li { flex-basis: 130px; }
}
@media (max-width: 380px) {
  .balance-gallery { max-width: 300px; }
  .balance-gallery li { flex-basis: 120px; }
}

@media (max-width: 520px) {
  .wrap { padding: 0 18px; }
  .section { padding: 44px 0; }
  .hero h1 { font-size: 2.2rem; }
}
