/* ─── @font-face (self-hosted Fraunces) ─────────────────────── */
@font-face {
  font-family: 'Fraunces';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/fraunces-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/fraunces-italic-400.woff2') format('woff2');
}

/* ─── Tokens (light + dark via system preference) ───────────── */
:root {
  --bg: #faf8f3;        /* warm paper */
  --surface: #fffdf9;
  --text: #1c1a17;
  --text-muted: #6b6358;
  --border: #e3dacb;
  --accent: #2f6d6a;    /* deep teal */
  --accent-ink: #fff;   /* text on accent */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
          Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --maxw: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1413;
    --surface: #141c1a;
    --text: #f1efe9;
    --text-muted: #9aa39f;
    --border: #243029;
    --accent: #5fb6ad;
    --accent-ink: #07100f;
  }
}

/* ─── Reset + base ──────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: var(--sans); line-height: 1.65; -webkit-font-smoothing: antialiased; color-scheme: light dark; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { background: var(--bg); color: var(--text); min-height: 100vh; }
main { max-width: var(--maxw); margin: 0 auto; padding: 3rem 1.75rem 4rem; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.icon { width: 1em; height: 1em; vertical-align: -0.12em; }

/* ─── Top bar ───────────────────────────────────────────────── */
.topbar { display: flex; justify-content: space-between; align-items: center; max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.75rem 0; }
.topbar .brand { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: 1.2rem; font-size: 0.9rem; }
.topbar nav a { color: var(--text); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }
/* Hamburger (no JS — :target menu; closes when a nav link changes the hash). */
.topbar .ham { display: none; cursor: pointer; color: var(--text); padding: 0.2rem; text-decoration: none; }
.topbar .ham:hover { color: var(--accent); }
.topbar .ham .icon { width: 1.4rem; height: 1.4rem; }

/* ─── Hero ──────────────────────────────────────────────────── */
.hero { padding: 1.5rem 0 2.5rem; }
.kicker { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.4rem, 7vw, 3.2rem); letter-spacing: -0.015em; line-height: 1.04; }
.hero .role { font-size: 1.08rem; color: var(--text-muted); margin-top: 0.6rem; }
.hero .lede { max-width: 38rem; margin-top: 1.1rem; }
.cta { margin-top: 1.6rem; display: flex; gap: 0.7rem; flex-wrap: wrap; }
.btn { font-size: 0.9rem; padding: 0.55rem 1.1rem; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid transparent; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--border); color: var(--text); }
/* Plain at rest; fills with the accent on hover, keyboard focus, or press. */
.btn-ghost:hover, .btn-ghost:focus-visible, .btn-ghost:active {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}

/* ─── Sections ──────────────────────────────────────────────── */
section { border-top: 1px solid var(--border); padding: 2.2rem 0; }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 1.3rem; }

/* Work */
.work { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
@media (max-width: 34rem) { .work { grid-template-columns: 1fr; } }
.wcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.4rem 1.2rem 1.1rem; display: flex; flex-direction: column; }
.wcard h3 { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.wcard p { font-size: 0.88rem; color: var(--text-muted); margin: 0.4rem 0 0.7rem; flex-grow: 1; }
.tags { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tag { font-size: 0.66rem; color: var(--accent); border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.55rem; }
.wcard .tags { margin-top: 0.3rem; }
.wcard .links { margin-bottom: 0.7rem; font-size: 0.82rem; display: flex; gap: 0.9rem; }
/* Indent title/body/links so their text lines up with the chip labels
   (chips carry their own L padding, so non-chip text needs to match). */
.wcard h3, .wcard p, .wcard .links { padding-left: calc(0.55rem + 1px); }

/* Keep It Neat ecosystem panel */
.kin-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.4rem 1.2rem 1.2rem; margin-bottom: 0.9rem; }
.kin-panel h3 { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.kin-panel p { font-size: 0.88rem; color: var(--text-muted); margin: 0.4rem 0 0.9rem; }
.kin-panel p a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--border); }
.kin-panel p a:hover { border-bottom-color: var(--accent); }
.kin-apps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.kin-apps a { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; color: var(--accent); border: 1px solid var(--border); border-radius: 999px; padding: 0.22rem 0.7rem; text-decoration: none; }
.kin-apps a:hover { border-color: var(--accent); }
.kin-apps a .icon { width: 0.72rem; height: 0.72rem; }

/* Writing teaser */
.post { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.5rem 0; }
.post a { font-family: var(--serif); font-size: 1.12rem; text-decoration: none; color: var(--text); }
.post a:hover { color: var(--accent); }
.post .date { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; }

/* Writing index entries (with previews) */
.entry { padding: 1.7rem 0; border-bottom: 1px solid var(--border); }
.entry:first-child { padding-top: 0.5rem; }
.entry:last-child { border-bottom: none; }
.entry h2 { font-family: var(--serif); font-weight: 600; font-size: 1.45rem; line-height: 1.15; margin-bottom: 0.3rem; }
.entry h2 a { text-decoration: none; color: var(--text); }
.entry h2 a:hover { color: var(--accent); }
.entry-meta { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.6rem; }
.entry-excerpt { color: var(--text-muted); max-width: 40rem; margin-bottom: 0.7rem; }
.entry-more { font-size: 0.85rem; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem; }
.entry-more:hover { text-decoration: underline; }

/* About */
.about p { margin-bottom: 1rem; max-width: 40rem; }
.skills { display: grid; gap: 0.6rem; margin-top: 1.2rem; }
.skill-row { font-size: 0.9rem; }
.skill-row b { color: var(--accent); font-weight: 650; }
.skill-row span { color: var(--text-muted); }

/* Experience */
.xp { margin-top: 1.4rem; }
.xp-entry { margin-bottom: 1.4rem; }
.xp-entry h3 { font-size: 0.98rem; font-weight: 650; }
.xp-entry h3 .co { color: var(--accent); }
.xp-entry .meta { font-size: 0.8rem; color: var(--text-muted); margin: 0.1rem 0 0.5rem; }
.xp-entry ul { padding-left: 1.1rem; }
.xp-entry li { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.3rem; }

/* ─── Résumé: numbered section TOC rail ─────────────────────── */
/* Sections are counted; the eyebrow echoes the rail's number (03 / …).
   The rail pins into the left margin on wide screens (content column
   stays 46rem, aligned with the topbar) and folds to a jump-row below. */
main.resume { counter-reset: sec; }
main.resume > section[id] { counter-increment: sec; scroll-margin-top: 2rem; }
main.resume > section[id] > .eyebrow::before {
  content: counter(sec, decimal-leading-zero) " / "; color: var(--accent);
}
main.resume > section[id]:target > .eyebrow { color: var(--accent); }

.resume-toc ol { list-style: none; }
.resume-toc a {
  display: flex; gap: 0.55rem; align-items: baseline;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
}
.resume-toc a .n { color: var(--accent); font-variant-numeric: tabular-nums; }
.resume-toc a:hover { color: var(--accent); }

/* Wide: pin the rail in the left margin beside the centered column */
@media (min-width: 76rem) {
  .resume-toc { position: fixed; top: 10rem; left: calc(50% - 36rem); width: 11rem; }
  .resume-toc a {
    padding: 0.32rem 0 0.32rem 0.8rem; border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
  }
  .resume-toc a:hover { border-left-color: var(--accent); }
}

/* Narrower: inline jump-link row under the hero (no room for the rail) */
@media (max-width: 75.99rem) {
  .resume-toc { margin: 0 0 0.2rem; }
  .resume-toc ol { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; }
}

/* Live scroll-spy — CSS-only, scroll-driven. Anchored to the section
   HEADINGS (not the section bodies) so it's height-independent — a section
   taller than the viewport would break a body-based `exit` range. Each link
   has an on/off pair: it lights when its own heading crosses a line ~25%
   down (roughly the rail's height) and unlights when the NEXT heading
   crosses it, each held by `forwards` fill. Progressive enhancement: only
   Chromium ships scroll-driven animations today, so it's gated behind
   @supports — elsewhere the rail keeps its :target click highlight and
   nothing regresses. */
@supports (animation-timeline: view()) {
  main.resume { timeline-scope: --h1, --h2, --h3, --h4, --h5, --h6; }
  #skills     > .eyebrow { view-timeline-name: --h1; view-timeline-inset: 25% 0; }
  #experience > .eyebrow { view-timeline-name: --h2; view-timeline-inset: 25% 0; }
  #projects   > .eyebrow { view-timeline-name: --h3; view-timeline-inset: 25% 0; }
  #mentoring  > .eyebrow { view-timeline-name: --h4; view-timeline-inset: 25% 0; }
  #leadership > .eyebrow { view-timeline-name: --h5; view-timeline-inset: 25% 0; }
  #education  > .eyebrow { view-timeline-name: --h6; view-timeline-inset: 25% 0; }

  /* on = this heading crossing; off = next heading crossing (off wins, it's
     last in the list). animation-range is the heading's brief crossing. */
  .resume-toc a { animation-range: exit 0% exit 100%, exit 0% exit 100%; }
  .resume-toc a[href="#skills"]     { animation: toc-on linear forwards, toc-off linear forwards; animation-timeline: --h1, --h2; }
  .resume-toc a[href="#experience"] { animation: toc-on linear forwards, toc-off linear forwards; animation-timeline: --h2, --h3; }
  .resume-toc a[href="#projects"]   { animation: toc-on linear forwards, toc-off linear forwards; animation-timeline: --h3, --h4; }
  .resume-toc a[href="#mentoring"]  { animation: toc-on linear forwards, toc-off linear forwards; animation-timeline: --h4, --h5; }
  .resume-toc a[href="#leadership"] { animation: toc-on linear forwards, toc-off linear forwards; animation-timeline: --h5, --h6; }
  .resume-toc a[href="#education"]  { animation: toc-on linear forwards; animation-timeline: --h6; }

  @keyframes toc-on  { to { color: var(--accent); border-left-color: var(--accent); } }
  @keyframes toc-off { to { color: var(--text-muted); border-left-color: transparent; } }
}

/* Mobile-only floating "back to top" — desktop has the pinned rail, so it's
   hidden there; shown only at the widths where the rail folds to a jump-row.
   Plain at rest, fills with the accent on tap/focus (mirrors .btn-ghost). */
.to-top { display: none; }
@media (max-width: 75.99rem) {
  .to-top {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 30;
    width: 2.75rem; height: 2.75rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); color: var(--accent);
    text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .to-top:hover, .to-top:focus-visible, .to-top:active {
    background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  }
  .to-top .icon { width: 1.25rem; height: 1.25rem; }
}

/* Contact + footer */
.contact .links { display: flex; gap: 1.2rem; font-size: 0.95rem; }
.contact .links a { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; }
footer { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1.5rem; font-size: 0.8rem; color: var(--text-muted); text-align: center; }

/* ─── Article (post pages) ──────────────────────────────────── */
.article { max-width: 40rem; }
.article h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2rem, 6vw, 2.6rem); line-height: 1.1; margin-bottom: 0.4rem; color: var(--accent); }
.article .date { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.article p { margin-bottom: 1.1rem; }
.article .hl { color: var(--accent); }   /* in-line phrase highlight (use sparingly) */
.article h2 { font-family: var(--serif); font-weight: 600; color: var(--accent); margin: 1.8rem 0 0.6rem; }
.article a.back { display: inline-flex; align-items: center; gap: 0.35rem; text-decoration: none; font-size: 0.9rem; margin-bottom: 2rem; }
.article blockquote { border-left: 3px solid var(--accent); padding: 0.2rem 0 0.2rem 1.2rem; margin: 1.4rem 0; color: var(--text-muted); font-style: italic; }

/* Prev/next post navigation (hand-wired — no build step, so update
   neighbours' links when adding a post). */
.post-nav { display: flex; justify-content: space-between; gap: 1.5rem; border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 1.5rem; }
.post-nav a { text-decoration: none; max-width: 48%; display: block; }
.post-nav a.older { margin-left: auto; text-align: right; }
.post-nav .lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); display: block; margin-bottom: 0.2rem; }
.post-nav .ttl { font-family: var(--serif); font-size: 1.05rem; color: var(--accent); }
.post-nav a:hover .ttl { text-decoration: underline; }

/* ─── Mobile ────────────────────────────────────────────────── */
@media (max-width: 34rem) {
  /* Header collapses to a hamburger (no JS — :target). Tapping a nav link
     changes the hash, which auto-closes the menu and scrolls to the section. */
  .topbar { position: relative; }
  .topbar .ham { display: inline-flex; align-items: center; }
  .topbar nav { display: none; }
  .topbar nav:target {
    display: flex; flex-direction: column; gap: 0.9rem;
    position: absolute; top: calc(100% + 0.4rem); right: 1.75rem; z-index: 20;
    min-width: 9rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 0.9rem 1.1rem; box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  }
}
