/* ==========================================================================
   veliyat.com: single stylesheet
   Version 6 design direction (A5). Self-hosted Inter font, system monospace
   for eyebrows, cards, chips, timeline line, and sticky header.
   ========================================================================== */

/* ---- Fonts -------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations"),
    url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

/* ---- Tokens ------------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* Refined Light Theme */
  --color-bg: #faf9f6;
  --color-surface: #f3f2ee;
  --color-surface-hover: #eae8e2;
  --color-text: #171717;
  --color-text-bold: #0a0a0a;
  --color-muted: #666666;
  --color-rule: rgba(0, 0, 0, 0.08);
  --color-accent: #0d766e;
  --color-accent-subtle: rgba(13, 118, 110, 0.08);
  --color-on-accent: #ffffff;
  --color-header-bg: rgba(250, 249, 246, 0.88);

  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --text-base: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);
  --text-small: 0.9375rem;
  --text-h1: clamp(2.35rem, 1.8rem + 2.5vw, 3.6rem);
  --text-lede: clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  --text-h2: clamp(1.4rem, 1.25rem + 0.6vw, 1.75rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2.75rem;
  --space-7: 4.5rem;

  --measure: 44rem;
  --measure-wide: 72rem;
  --gutter: 1rem;
  --header-height: 4rem;
  --radius: 0.625rem;
  --radius-sm: 0.35rem;
  --radius-pill: 9999px;

  --portrait-w: 7.5rem;
  --portrait-h: 9.375rem;
  --duration-fast: 150ms;
}

@media (min-width: 40rem) {
  :root {
    --gutter: 2rem;
    --portrait-w: 14rem;
    --portrait-h: 17.5rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Refined Dark Theme */
    --color-bg: #0a0a0a;
    --color-surface: #141414;
    --color-surface-hover: #1f1f1f;
    --color-text: #e5e5e5;
    --color-text-bold: #ffffff;
    --color-muted: #8c8c8c;
    --color-rule: rgba(255, 255, 255, 0.1);
    --color-accent: #2dd4bf;
    --color-accent-subtle: rgba(45, 212, 191, 0.12);
    --color-on-accent: #042f2e;
    --color-header-bg: rgba(10, 10, 10, 0.88);
  }
}

/* ---- Base --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-h1);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h2 {
  font-size: var(--text-h2);
  letter-spacing: -0.02em;
}

h1[id],
h2[id],
h3[id],
section[id],
article[id] {
  scroll-margin-top: calc(var(--header-height) + 1.25rem);
}

p,
ul,
ol {
  margin: 0;
}

p+p {
  margin-top: var(--space-4);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness var(--duration-fast) ease,
    color var(--duration-fast) ease;
}

a:hover {
  text-decoration-thickness: 0.18em;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Eyebrows ----------------------------------------------------------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

/* ---- Layout ------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap-wide {
  max-width: var(--measure-wide);
}

.prose-measure {
  max-width: var(--measure);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 600;
  border-radius: var(--radius);
  transform: translateY(-300%);
  z-index: 200;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---- Sticky Header ------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-rule);
  transition: background-color var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

/* ---- Hero / Intro ------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-top: var(--space-6);
}

.hero-text>*+* {
  margin-top: var(--space-4);
}

.lede {
  font-size: var(--text-lede);
  line-height: 1.45;
  font-weight: 450;
  color: var(--color-text);
  max-width: 32ch;
}

.support {
  color: var(--color-muted);
  font-size: var(--text-base);
  line-height: 1.6;
}

@media (min-width: 40rem) {
  .hero {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
    padding-top: var(--space-7);
  }

  .hero .portrait {
    order: 2;
  }

  .hero .hero-text {
    flex: 1;
    max-width: 36rem;
  }
}

/* Portrait frame */
.portrait {
  flex: none;
  width: var(--portrait-w);
  height: var(--portrait-h);
  background-color: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.portrait picture,
.portrait img {
  display: block;
  width: 100%;
  height: 100%;
}

.portrait img {
  object-fit: cover;
  object-position: center;
}

/* ---- Home Hero with Portrait Background --------------------------------- */
.hero-home {
  position: relative;
  width: 100%;
  display: block;
  background-image: url("/assets/img/ravi-transparent.png");
  background-image: image-set(url("/assets/img/ravi-transparent.webp") type("image/webp"),
      url("/assets/img/ravi-transparent.png") type("image/png"));
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: auto 16rem;
  padding-top: var(--space-7);
  padding-bottom: 18rem;
}

.hero-home .hero-text {
  width: 100%;
  max-width: 100%;
}

.hero-home .hero-text>*+* {
  margin-top: var(--space-4);
}

.hero-home .lede,
.hero-home .support {
  max-width: 36rem;
}

@media (min-width: 48rem) {
  .hero-home {
    background-position: right clamp(2rem, 5vw, 5rem) center;
    background-size: auto min(92%, 26rem);
    padding-top: var(--space-7);
    padding-bottom: var(--space-6);
    min-height: 26rem;
    display: flex;
    align-items: center;
  }

  .hero-home .hero-text {
    flex: 0 1 38rem;
    max-width: 38rem;
  }
}

@media (min-width: 64rem) {
  .hero-home {
    background-position: right clamp(3rem, 7vw, 7rem) center;
    background-size: auto min(94%, 28rem);
    min-height: 28rem;
    padding-top: calc(var(--space-7) + 6rem);
  }
}

/* ---- Buttons ------------------------------------------------------------ */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 0;
  list-style: none;
  margin-top: var(--space-5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6rem 1.35rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--text-small);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: all var(--duration-fast) ease;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 12px var(--color-accent-subtle);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-rule);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-muted);
  color: var(--color-text-bold);
  transform: translateY(-1px);
}

.btn-external {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-surface);
  color: var(--color-text-bold);
  border: 1px solid var(--color-rule);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-external:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--color-accent-subtle);
  text-decoration: none;
}

.btn-external .icon-external {
  display: inline-block;
  flex-shrink: 0;
  color: var(--color-accent);
  transition: transform var(--duration-fast) ease;
}

.btn-external:hover .icon-external {
  transform: translate(2px, -2px);
}

.project-action {
  margin-top: var(--space-3);
  margin-bottom: var(--space-4);
}

.action-subtext {
  margin-top: var(--space-2) !important;
  font-size: 0.875rem;
  line-height: 1.4;
}

.action-subtext a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--duration-fast) ease;
}

.action-subtext a:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.2em;
}

.action-subtext .icon-code {
  flex-shrink: 0;
  color: var(--color-muted);
  transition: color var(--duration-fast) ease;
}

.action-subtext a:hover .icon-code {
  color: var(--color-accent);
}

/* ---- Home Cards --------------------------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding: 0;
}

@media (min-width: 52rem) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    margin-top: var(--space-7);
  }
}

.card {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  transition: transform var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px var(--color-accent-subtle);
  text-decoration: none;
}

.card h2 {
  color: var(--color-text-bold);
  font-size: 1.35rem;
  margin-top: var(--space-1);
}

.card p {
  margin-top: var(--space-3);
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: 1.6;
  flex: 1 0 auto;
}

.card .card-arrow {
  margin-top: var(--space-4);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-accent);
  align-self: flex-start;
  transition: transform var(--duration-fast) ease;
}

.card:hover .card-arrow,
.card:focus-visible .card-arrow {
  transform: translateX(4px);
}

/* ---- Sections ----------------------------------------------------------- */
.section {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-rule);
}

.section>h2+* {
  margin-top: var(--space-3);
}

.section>*+.more {
  margin-top: var(--space-4);
}

.section-first {
  margin-top: var(--space-6);
}

.more {
  font-weight: 600;
}

.more a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-accent);
  text-decoration: none;
  font-size: var(--text-small);
  transition: gap var(--duration-fast) ease, color var(--duration-fast) ease;
}

.more a::after {
  content: "→";
  display: inline-block;
  transition: transform var(--duration-fast) ease;
}

.more a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.25em;
}

.more a:hover::after {
  transform: translateX(4px);
}

/* ---- "On this page" Jump Links Row -------------------------------------- */
.on-this-page {
  margin-top: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.on-this-page-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.on-this-page ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  padding: 0;
  list-style: none;
}

.on-this-page a {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-rule);
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--duration-fast) ease;
}

.on-this-page a:hover,
.on-this-page a:focus-visible {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-surface-hover);
  text-decoration: none;
}

/* ---- "Next" Card -------------------------------------------------------- */
.next-card-wrap {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-rule);
}

.next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text-bold);
  font-weight: 600;
  font-size: 1.05rem;
  transition: all var(--duration-fast) ease;
}

.next-card:hover,
.next-card:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-surface-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--color-accent-subtle);
  text-decoration: none;
}

.next-card .card-arrow {
  font-size: 1.25rem;
  color: var(--color-accent);
  transition: transform var(--duration-fast) ease;
}

.next-card:hover .card-arrow,
.next-card:focus-visible .card-arrow {
  transform: translateX(4px);
}

/* ---- Timeline (brief v16): one row per role, date + role + organisation ---- */
.timeline {
  position: relative;
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  max-width: 52rem;
}
/* the vertical line, through the centre of the dots */
.timeline::before {
  content: "";
  position: absolute;
  left: calc(0.75rem + 0.5rem - 1px);
  top: 1.35rem;
  bottom: 1.35rem;
  width: 2px;
  background: var(--color-rule);
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 1rem 1fr;
  column-gap: var(--space-4);
  row-gap: 0.1rem;
  align-items: baseline;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--duration-fast) ease;
}
.timeline li::before {
  content: "";
  grid-row: 1 / span 2;
  align-self: start;
  justify-self: center;
  margin-top: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-accent);
  transition: background-color var(--duration-fast) ease;
}
.timeline li:hover { background: var(--color-surface); }
.timeline li:hover::before { background: var(--color-accent); }

.timeline .when {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
}
.timeline .what {
  grid-column: 2;
  line-height: 1.45;
  color: var(--color-muted);
}
.timeline .role { color: var(--color-text-bold); font-weight: 600; }
.timeline .org::before { content: "·" / ""; margin: 0 0.45em; color: var(--color-muted); }

@media (min-width: 40rem) {
  .timeline li { grid-template-columns: 1rem 6.75rem 1fr; }
  .timeline li::before { grid-row: 1; align-self: start; margin-top: calc((1.45em - 10px) / 2); }
  .timeline .when { grid-column: 2; }
  .timeline .what { grid-column: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .timeline li, .timeline li::before { transition: none; }
}

/* ---- Chips (Tech lists) ------------------------------------------------- */
.chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  margin: 0.15rem 0.15rem;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  font-size: 0.85em;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
  vertical-align: baseline;
}

.chip-sep {
  display: none;
}

/* ---- Long-form pages (Work, Teaching, Videos, Resume, About) ------------- */
.prose>*+* {
  margin-top: var(--space-3);
}

.prose h3 {
  margin-top: var(--space-5);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.prose ul {
  padding-left: 1.35rem;
}

.prose li {
  line-height: 1.6;
}

.prose li::marker {
  color: var(--color-accent);
}

.prose li+li {
  margin-top: var(--space-2);
}

.meta {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-muted);
  padding: 0.2rem 0.65rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-pill);
  margin-block: 0.25rem 0.5rem;
}

.contact-line {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: 1.6;
}

.contact-line strong {
  color: var(--color-text-bold);
  font-weight: 700;
}

/* GitHub repo tags in Work */
.prose li>a[href*="github.com/veliyat/"] {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-rule);
  text-decoration: none;
  color: var(--color-accent);
  transition: border-color var(--duration-fast) ease, background-color var(--duration-fast) ease;
}

.prose li>a[href*="github.com/veliyat/"]:hover {
  border-color: var(--color-accent);
  background-color: var(--color-surface-hover);
}

.role {
  margin-top: var(--space-5);
}

.role:first-of-type {
  margin-top: var(--space-3);
}

.role> :first-child {
  margin-top: 0;
}

.role>*+* {
  margin-top: var(--space-3);
}

.role-subhead {
  margin-top: var(--space-3);
  font-size: var(--text-small);
  color: var(--color-text-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-7);
  padding-block: var(--space-5) var(--space-6);
  border-top: 1px solid var(--color-rule);
  font-size: var(--text-small);
}

.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding-block: var(--space-1);
  color: var(--color-muted);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.footer-links a:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.25em;
}

.copyright {
  color: var(--color-muted);
  font-size: 0.875rem;
}

@media (min-width: 40rem) {
  .site-footer .wrap {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .footer-links {
    gap: 0 var(--space-5);
  }

  .copyright {
    margin-top: 0;
  }
}

/* ---- Print (Resume) ----------------------------------------------------- */
@page {
  size: A4;
  margin: 1.0cm 1.2cm;
}

@media print {
  :root {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-muted: #333333;
    --color-rule: #cccccc;
    --color-accent: #000000;
  }

  body {
    font-size: 9pt;
    line-height: 1.35;
    min-height: 0;
    color: #000000;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }

  .site-header,
  .skip-link,
  .site-nav,
  .site-footer,
  .on-this-page,
  .next-card-wrap,
  .card-arrow,
  .eyebrow,
  .no-print {
    display: none !important;
  }

  .wrap {
    max-width: none;
    padding-inline: 0;
  }

  .hero {
    padding-top: 0;
    gap: 0;
  }

  .hero-text>*+* {
    margin-top: 0.25rem;
  }

  h1 {
    font-size: 18pt;
    line-height: 1.1;
  }

  .contact-line {
    font-size: 9pt;
    line-height: 1.35;
    color: #222222;
  }

  .contact-line strong {
    font-weight: 700;
    color: #000000;
  }

  h2 {
    font-size: 12pt;
    margin-top: 0;
    break-after: avoid;
    page-break-after: avoid;
  }

  h3 {
    font-size: 10pt;
    margin-top: 0;
    break-after: avoid;
    page-break-after: avoid;
  }

  .meta {
    font-size: 8.5pt;
    color: #444444;
    padding: 0;
    border: none;
    background: none;
    break-after: avoid;
    page-break-after: avoid;
  }

  .role-subhead {
    break-after: avoid;
    page-break-after: avoid;
  }

  .section {
    margin-top: 0.65rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--color-rule);
  }

  .section-first {
    margin-top: 0.5rem;
  }

  .section>h2+* {
    margin-top: 0.2rem;
  }

  .role {
    margin-top: 0.45rem;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .role:first-of-type {
    margin-top: 0.25rem;
  }

  .role>*+* {
    margin-top: 0.2rem;
  }

  .prose ul {
    padding-left: 1.1rem;
    margin-top: 0.2rem;
  }

  .prose li+li {
    margin-top: 0.12rem;
  }

  .chip {
    display: inline !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: none !important;
    font-size: inherit !important;
    font-weight: normal !important;
    color: inherit !important;
  }

  .chip-sep {
    display: inline !important;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* ---- Motion ------------------------------------------------------------- */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }

  .btn:hover,
  .btn-external:hover,
  .btn-external:hover .icon-external,
  .card:hover,
  .card:hover .card-arrow,
  .next-card:hover,
  .next-card:hover .card-arrow {
    transform: none !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
/* ---- Phone layout fixes (website-handoff/home-mobile.css) ---- */
@media (max-width: 47.99rem) {
  .hero-home {
    padding-top: 1.75rem;
    padding-bottom: 0;
    background-position: right 1.5rem top 1.75rem;
    background-size: auto 9.5rem;
  }
  .hero-home h1 {
    min-height: 9.5rem;
    padding-right: 10.25rem;
    display: flex;
    align-items: center;
  }
  .hero-home .lede { margin-top: 1rem; }
  .actions .btn { flex: 1 1 0; }
  .actions li { flex: 1 1 0; display: flex; }
  .cards-grid { margin-top: 2rem; gap: 0.75rem; }
  .card { padding: 1.1rem 1.25rem; }
  .card .eyebrow { display: none; }
  .card h2 { display: flex; justify-content: space-between; align-items: baseline; }
  .card .card-arrow { display: none; }
  .card h2::after { content: "→"; color: var(--color-accent); font-weight: 600; }
  .footer-links { gap: 0 1rem; }
}
@media (max-width: 47.99rem) {
  .actions li, .actions .btn { flex: 1 1 auto; }
  .btn { white-space: nowrap; padding-inline: 1rem; }
}
@media (max-width: 23.99rem) {
  .hero-home { background-position: right 1rem top 1.75rem; background-size: auto 8rem; }
  .hero-home h1 { min-height: 8rem; padding-right: 8.75rem; }
}

/* ---- Site navigation (one design at every width) ---- */
.site-nav ul {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 3.25rem;
  padding-inline: 0.25rem;
  color: var(--color-muted);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--duration-fast) ease;
}
.site-nav a:hover { color: var(--color-text); }
.site-nav a:active { color: var(--color-accent); }
.site-nav a[aria-current="page"] { color: var(--color-text); }
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-accent);
}
@media (max-width: 23.99rem) {
  .site-nav a { font-size: 0.9375rem; padding-inline: 0.125rem; }
}
@media (min-width: 48rem) {
  .site-nav ul { justify-content: flex-start; gap: 2rem; }
  .site-nav a { min-height: 3.75rem; }
}

/* Menu text lines up exactly with the page content edge */
.site-nav li:first-child a { margin-left: -0.25rem; }
.site-nav li:last-child a { margin-right: -0.25rem; }
@media (max-width: 23.99rem) {
  .site-nav li:first-child a { margin-left: -0.125rem; }
  .site-nav li:last-child a { margin-right: -0.125rem; }
}

/* Inner pages: wide layout, but text blocks keep a comfortable line length */
main > .wrap-wide > *:not(.hero-home):not(.cards-grid):not(.video-section):not(.hero-compact):not(.contact-panel):not(.fightrons):not(.full) {
  max-width: var(--measure);
}

/* Print: the resume uses the full page width */
@media print {
  .wrap-wide,
  main > .wrap-wide > * {
    max-width: none;
  }
}

/* ---- Video cards -------------------------------------------------------- */
.video-group-note {
  margin-top: var(--space-2);
  color: var(--color-muted);
  max-width: var(--measure);
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  margin-top: var(--space-5);
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.video-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  transition: transform var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}

.video-card:hover,
.video-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px var(--color-accent-subtle);
  text-decoration: none;
}

.video-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--color-surface-hover);
}

.video-title {
  padding: var(--space-4) var(--space-4) 0;
  color: var(--color-text-bold);
  font-weight: 600;
  line-height: 1.35;
}

.video-lang {
  align-self: flex-start;
  margin: var(--space-2) var(--space-4) 0;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-size: 0.8125rem;
  font-weight: 600;
}

.video-card > :last-child { margin-bottom: var(--space-4); }

/* ---- External links (brief A2) ------------------------------------------
   .ext marks every link that leaves the site. Markup supplies a
   <span class="ext-arrow" aria-hidden="true">↗</span> and a visually
   hidden " (opens in a new tab)" span. */
.ext-arrow {
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.85em;
  line-height: 1;
  text-decoration: none;
  transition: transform var(--duration-fast) ease;
}

.ext:hover .ext-arrow,
.ext:focus-visible .ext-arrow {
  transform: translate(1px, -1px);
}

/* "More" links use → for internal pages; external ones use ↗ instead */
.more a.ext::after { content: none; }

.video-watch {
  padding: 0 var(--space-4);
  margin-top: 0.25rem;
  color: var(--color-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.video-card:hover .video-watch,
.video-card:focus-visible .video-watch {
  color: var(--color-accent);
}

@media print {
  .ext-arrow { display: none; }
}

/* ---- Compact page intro (Videos) ---- */
.hero-compact { padding-top: var(--space-6); gap: var(--space-4); }
.hero-compact .hero-text { max-width: none; }
.hero-compact .lede { max-width: none; }
.btn-lg { min-height: 3rem; padding: 0.75rem 1.5rem; font-size: 1rem; }
.hero-cta { margin: 0; }
@media (min-width: 40rem) {
  .hero-compact { align-items: center; justify-content: space-between; padding-top: var(--space-6); }
  .hero-compact .hero-text { flex: 1 1 auto; }
  .hero-cta { flex: none; }
}
@media (max-width: 39.99rem) {
  .hero-cta .btn { width: 100%; }
}
.hero-compact h1 { max-width: none; font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); }

/* ---- Home: contact panel (brief v14) ---- */
.contact-panel {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.contact-panel .contact-text p { margin-top: var(--space-3); color: var(--color-muted); max-width: 36rem; }
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.contact-actions li { display: flex; }
/* One size for every button in the row: hierarchy comes from fill, not size */
.contact-actions .btn {
  min-height: 2.75rem;
  padding: 0.6rem 1.25rem;
  font-size: var(--text-small);
}
.contact-actions .btn-icon { width: 1rem; height: 1rem; flex: none; margin-right: 0.5rem; }
@media (min-width: 52rem) {
  .contact-panel {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: var(--space-6);
  }
}
/* Phones: 2 x 2 grid of equal buttons */
@media (max-width: 39.99rem) {
  .contact-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .contact-actions .btn { width: 100%; padding-inline: 0.75rem; }
}

/* ---- Home: Fightrons (brief v15) ---- */
.fightrons {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}
.fightrons-text p { margin-top: var(--space-3); color: var(--color-muted); max-width: 32rem; }
.fightrons h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
}
.status-pill::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
}
.fightrons-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}
.fightrons-links li { display: flex; }
.fightrons-links .btn { min-height: 2.75rem; padding: 0.6rem 1.25rem; font-size: var(--text-small); }

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  transition: transform var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}
.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px var(--color-accent-subtle);
  text-decoration: none;
}
.project-label {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.project-card h3 { margin: 0; font-size: 1.35rem; color: var(--color-text-bold); }
.project-card p { margin: 0; color: var(--color-muted); font-size: var(--text-small); line-height: 1.6; }
.project-tools { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.project-tools .chip { margin: 0; background: var(--color-bg, transparent); }
.project-cta { margin-top: var(--space-2); font-weight: 600; font-size: var(--text-small); color: var(--color-accent); }

@media (min-width: 52rem) {
  .fightrons { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
}
@media (max-width: 39.99rem) {
  .fightrons-links { display: grid; grid-template-columns: 1fr 1fr; }
  .fightrons-links .btn { width: 100%; padding-inline: 0.75rem; }
}

/* ---- "In development" tag beside a heading; project card with two links (brief v17) ---- */
.has-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.project-card:hover,
.project-card:focus-visible { transform: none; border-color: var(--color-rule); box-shadow: none; }
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}
.project-links a { font-weight: 600; font-size: var(--text-small); color: var(--color-accent); text-decoration: none; }
.project-links a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* ---- Home cards: icon tile + meaningful eyebrow (brief v18) ---- */
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  margin-bottom: var(--space-4);
  transition: background-color var(--duration-fast) ease, color var(--duration-fast) ease;
}
.card-icon svg { width: 1.25rem; height: 1.25rem; }
.card:hover .card-icon,
.card:focus-visible .card-icon { background: var(--color-accent); color: var(--color-on-accent); }

/* Desktop and tablet: no icons, the eyebrow labels do that job */
@media (min-width: 48rem) {
  .card-icon { display: none; }
}

/* Phones: icon and title on one line, text below starting at the icon's edge */
@media (max-width: 47.99rem) {
  .card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.85rem;
    align-items: center;
  }
  .card-icon { grid-column: 1; grid-row: 1; width: 2.5rem; height: 2.5rem; margin: 0; }
  .card-icon svg { width: 1.3rem; height: 1.3rem; }
  .card h2 { grid-column: 2; grid-row: 1; margin-top: 0; }
  .card p { grid-column: 1 / -1; grid-row: 2; margin-top: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .card-icon { transition: none; }
}

/* ==== Work page, Home-consistent layout (brief v19) ==== */

/* Intro: compact, like Videos */
.work-intro { padding-bottom: 0; }

/* Project panels: text left, details right */
.case {
  display: grid; gap: var(--space-5);
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  scroll-margin-top: 5rem;
}
.case h2 { margin-top: var(--space-2); }
.case p { margin: var(--space-3) 0 0; }
.case-main > p:not(.case-meta) { color: var(--color-text); }
.case-note { color: var(--color-muted) !important; font-size: var(--text-small); }
.case-note strong { color: var(--color-text-bold); }
.case-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin-top: var(--space-2) !important; }
.case-meta .case-when { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--color-accent); }
.case-meta .case-role { font-weight: 600; color: var(--color-text-bold); }
.case-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; padding: 0; list-style: none; }
.case-actions li { display: flex; }
.case-actions .btn { min-height: 2.75rem; padding: 0.6rem 1.25rem; font-size: var(--text-small); }
.case-side { display: flex; flex-direction: column; gap: var(--space-3); }
.case-label {
  margin: 0; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--color-muted);
}
.case-label + * { margin-top: 0; }
.case-side .case-label:not(:first-child) { margin-top: var(--space-3); }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.ticks li { position: relative; padding-left: 1.5rem; font-size: var(--text-small); line-height: 1.55; color: var(--color-text); }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 0.45em; width: 0.55rem; height: 0.55rem;
  border-radius: 50%; border: 2px solid var(--color-accent);
}
.chip-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.chip-list .chip { margin: 0; background: var(--color-bg); }
@media (min-width: 56rem) {
  .case { grid-template-columns: 1fr 1fr; gap: var(--space-6); padding: var(--space-6); }
}

/* Client project cards */
.full.section h2 { margin-top: var(--space-2); }
.client-grid { display: grid; gap: var(--space-4); margin-top: var(--space-5); }
.client-card {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius);
}
.client-card h3 { margin: 0; font-size: 1.35rem; color: var(--color-text-bold); }
.client-card p { margin: 0; color: var(--color-muted); font-size: var(--text-small); line-height: 1.6; }
.client-card .case-meta { margin: 0 !important; }
.client-card .project-links { margin-top: auto; padding-top: var(--space-2); }
.client-card .project-links a { font-weight: 600; font-size: var(--text-small); color: var(--color-accent); text-decoration: none; }
.client-card .project-links a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
@media (min-width: 48rem) { .client-grid { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); } }

/* GitHub repos: small cards */
.section-intro { margin-top: var(--space-3); color: var(--color-muted); max-width: 44rem; }
.repo-grid { display: grid; gap: var(--space-3); margin: var(--space-5) 0 0; padding: 0; list-style: none; }
.repo-grid li { display: flex; }
.repo-card {
  display: flex; flex-direction: column; gap: 0.4rem; width: 100%;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius);
  text-decoration: none; color: var(--color-text);
  transition: transform var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.repo-card:hover, .repo-card:focus-visible { transform: translateY(-2px); border-color: var(--color-accent); text-decoration: none; }
.repo-name { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; color: var(--color-accent); }
.repo-desc { font-size: var(--text-small); line-height: 1.55; color: var(--color-muted); }
@media (min-width: 48rem) { .repo-grid { grid-template-columns: 1fr 1fr; } }
@media (prefers-reduced-motion: reduce) { .repo-card { transition: none; } .repo-card:hover { transform: none; } }

.next-card-wrap.full { margin-top: var(--space-6); }

.case h2, .client-card h3, .full.section h2 { margin-bottom: 0; }
.case h2 + .case-meta { margin-top: var(--space-3) !important; }
.client-card h3 + .case-meta { margin-top: -0.25rem !important; }

/* ==== Teaching page (brief v20); reuses the Work page blocks ==== */
.first-block { margin-top: var(--space-5); }
.client-card .ticks li { color: var(--color-muted); }
.client-grid .client-card .ticks { margin-top: var(--space-1); }

/* Corporate training (v23): topics strip, then every company once with the topics it was trained in */
.training { margin-top: var(--space-7); }
.training h2 { margin-top: var(--space-2); }
.training-lede { margin: var(--space-4) 0 0; max-width: 44rem; font-size: var(--text-lede); line-height: 1.55; color: var(--color-text); }
.training-label { margin: var(--space-6) 0 0; font-size: 1rem; font-weight: 700; color: var(--color-accent); }
.training-note { margin: 0.35rem 0 0; font-size: var(--text-small); color: var(--color-muted); }

.topic-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
@media (min-width: 64rem) { .topic-strip { grid-template-columns: repeat(4, 1fr); } }
.topic-card { display: flex; flex-direction: column; gap: 0.2rem; padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius); }
.topic-title { font-weight: 700; color: var(--color-text-bold); line-height: 1.35; }
.topic-years { font-size: var(--text-small); font-weight: 600; color: var(--color-accent); font-variant-numeric: tabular-nums; }

.client-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 var(--space-4); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
@media (min-width: 64rem) { .client-list { grid-template-columns: repeat(3, 1fr); } }
.client-item { display: flex; flex-direction: column; gap: 0.15rem; padding: var(--space-3) 0; border-top: 1px solid var(--color-rule); }
.client-name { font-size: 1rem; font-weight: 700; color: var(--color-text-bold); }
.client-where { font-size: var(--text-small); font-weight: 500; color: var(--color-muted); }
.client-where::before { content: "·" / ""; margin: 0 0.4em; }
.client-topics { font-size: 0.875rem; color: var(--color-muted); line-height: 1.5; }

.training-extra { display: grid; gap: 0 var(--space-6); }
@media (min-width: 48rem) { .training-extra { grid-template-columns: 1fr 1fr; } }
.training-extra .chip-list { margin-top: var(--space-3); gap: 0.45rem; }
.training-extra .chip { padding: 0.3rem 0.85rem; border-radius: var(--radius-pill); font-size: 0.9rem; }

/* How I design a course: three numbered cards */
.approach-grid { display: grid; gap: var(--space-4); margin: var(--space-5) 0 0; padding: 0; list-style: none; }
.approach-card {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius);
}
.approach-num { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--color-accent); letter-spacing: 0.1em; }
.approach-card p { margin: 0; font-size: var(--text-small); line-height: 1.6; color: var(--color-text); }
@media (min-width: 48rem) { .approach-grid { grid-template-columns: repeat(3, 1fr); } }

/* A panel with no side column */
@media (min-width: 56rem) { .case-single { grid-template-columns: 1fr; } .case-single .case-main { max-width: 44rem; } }
@media (min-width: 40rem) { .topic-card { padding: var(--space-4) var(--space-5); } .client-name { font-size: 1.05rem; } .client-topics { font-size: var(--text-small); } }

/* ==== Resume page (brief v21): recruiter-first layout ==== */
.resume-head { padding-top: var(--space-6); }
.resume-head h1 { margin-top: var(--space-2); font-size: clamp(2.4rem, 1.8rem + 2.5vw, 3.5rem); line-height: 1.05; }
.resume-title { margin: var(--space-2) 0 0; font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); font-weight: 600; color: var(--color-text); }
/* Contact (v24): labelled grid, 2 × 2 on phones, one row of four on wider screens */
.resume-contact { display: grid; grid-template-columns: repeat(2, auto); justify-content: start; gap: var(--space-4) var(--space-5); margin: var(--space-5) 0 0; padding: var(--space-4) 0; border-top: 1px solid var(--color-rule); border-bottom: 1px solid var(--color-rule); max-width: 48rem; }
@media (min-width: 40rem) { .resume-contact { grid-template-columns: repeat(4, auto); justify-content: start; column-gap: var(--space-6); } }
.rc-item { min-width: 0; }
/* Phones: icons instead of labels; Based in and Email each on their own line first, then LinkedIn and GitHub handles side by side */
.rc-icon { display: none; }
@media (max-width: 39.99rem) {
  .resume-contact { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); } /* Based in and Email share a line when they fit */
  .rc-item dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rc-item dd { margin: 0; }
  .rc-item dd { display: flex; align-items: center; gap: 0.5rem; }
  .rc-icon { display: block; flex: none; color: var(--color-accent); }
  .rc-logo { color: var(--color-text-bold); } /* brand marks stay single-colour neutral, per LinkedIn and GitHub brand rules */
}
.rc-item dt { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-muted); }
.rc-item dd { margin: 0.25rem 0 0; font-weight: 600; color: var(--color-text-bold); white-space: nowrap; }
.rc-item a { color: inherit; text-decoration: none; }
.rc-item a:hover, .rc-item a:focus-visible { color: var(--color-accent); text-decoration: underline; text-underline-offset: 0.2em; }
.print-only { display: none; }
@media print { .print-only { display: block; } .rc-icon { display: none !important; } .resume-contact { grid-template-columns: repeat(5, auto); gap: 2pt 14pt; padding: 4pt 0; margin-top: 6pt; } .rc-item dt { font-size: 6.5pt; } .rc-item dd { font-size: 8.5pt; margin: 0; } }
.resume-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; padding: 0; list-style: none; }
.resume-actions li { display: flex; }
.resume-actions .btn { min-height: 2.75rem; padding: 0.6rem 1.25rem; font-size: var(--text-small); }

/* At a glance */
.glance { display: grid; gap: var(--space-3); margin-top: var(--space-6); }
.glance-item { display: flex; flex-direction: column; gap: 0.3rem; padding: var(--space-4) var(--space-5); background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius); }
.glance-big { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: var(--color-text-bold); }
.glance-small { font-size: var(--text-small); line-height: 1.5; color: var(--color-muted); }
@media (min-width: 40rem) { .glance { grid-template-columns: 1fr 1fr; } }
@media (min-width: 64rem) { .glance { grid-template-columns: repeat(4, 1fr); } }

/* Sections (v22): heading above the content, one column, reading width.
   No side columns: the eye goes straight down the page. */
.rsec { margin-top: var(--space-7); scroll-margin-top: 5rem; }
.rsec-title { margin: 0 0 var(--space-5); font-size: var(--text-h2); letter-spacing: -0.02em; }
.rsec-body { margin: 0; padding: 0; list-style: none; }
.resume-summary { margin: 0; font-size: var(--text-lede); line-height: 1.6; color: var(--color-text); max-width: 46rem; }

/* Skills: one row per group, the group name then a tag cloud of pills */
.skill-grid { display: grid; gap: var(--space-4); max-width: 60rem; }
.skill-row { display: grid; gap: 0.5rem; }
.skill-name { margin: 0; font-size: var(--text-small); font-weight: 700; color: var(--color-accent); }
@media (min-width: 40rem) { .skill-row { grid-template-columns: 10rem 1fr; align-items: baseline; gap: var(--space-4); } }

/* Pills: fully rounded tags on the Resume page */
.resume-page .chip-list, .rsec .chip-list { gap: 0.45rem; }
.rsec .chip { padding: 0.3rem 0.85rem; border-radius: var(--radius-pill); font-size: 0.9rem; line-height: 1.4; }

/* Experience: the site's career line, one role per stop */
.xp-list { display: grid; gap: var(--space-6); max-width: 48rem; padding-left: var(--space-5) !important; border-left: 2px solid var(--color-rule); }
.xp-item { position: relative; }
.xp-item::before { content: ""; position: absolute; left: calc(-1 * var(--space-5) - 7px); top: 0.45rem; width: 12px; height: 12px; border-radius: 50%; background: var(--color-bg); border: 2px solid var(--color-accent); }
.xp-item:first-child::before { background: var(--color-accent); }
.xp-side { display: flex; flex-wrap: wrap; gap: 0 0.5rem; font-size: var(--text-small); }
.xp-when { font-weight: 600; color: var(--color-accent); font-variant-numeric: tabular-nums; }
.xp-where { color: var(--color-muted); }
.xp-where::before { content: "·" / ""; margin-right: 0.5rem; }
.xp-title { margin: 0.2rem 0 0; font-size: 1.2rem; font-weight: 700; line-height: 1.35; color: var(--color-text-bold); }
.xp-org { font-weight: 500; color: var(--color-muted); }
.xp-org::before { content: "·" / ""; margin: 0 0.45em; }
.xp-body > p { margin: 0.6rem 0 0; line-height: 1.65; color: var(--color-text); }
.xp-label { font-family: var(--font-mono); font-size: 0.7rem !important; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--color-muted) !important; margin-top: var(--space-4) !important; }
.xp-points { margin: 0.6rem 0 0; padding-left: 1.15rem; display: grid; gap: 0.45rem; }
.xp-points li { line-height: 1.65; color: var(--color-text); }
.xp-points li::marker { color: var(--color-accent); }
.xp-body .chip-list { margin-top: var(--space-4); }

/* Projects: cards like Work's client cards, two across */
.proj-list { display: grid; gap: var(--space-4); }
@media (min-width: 48rem) { .proj-list { grid-template-columns: repeat(2, 1fr); } }
.proj-item { display: flex; flex-direction: column; padding: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius); }
.proj-head { display: flex; flex-direction: column; gap: 0.15rem; }
.proj-name { margin: 0; font-size: 1.15rem; color: var(--color-text-bold); }
.proj-meta { font-size: var(--text-small); color: var(--color-muted); }
.proj-item > p { margin: 0.6rem 0 0; line-height: 1.6; color: var(--color-text); }
.proj-foot { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); margin-top: auto; padding-top: var(--space-4); }
.proj-links { display: flex; gap: var(--space-4); font-weight: 600; }
.proj-links a { color: var(--color-accent); text-decoration: none; }
.proj-links a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* Education */
.edu-list { display: grid; gap: var(--space-4); max-width: 48rem; }
.edu-list li { display: grid; gap: 0.15rem; }
.edu-when { font-size: var(--text-small); font-weight: 600; color: var(--color-accent); font-variant-numeric: tabular-nums; }
.edu-what { line-height: 1.5; color: var(--color-muted); }
.edu-what strong { color: var(--color-text-bold); font-weight: 700; }
.bio-text { margin: 0; line-height: 1.65; color: var(--color-muted); max-width: 46rem; }

/* Print (fallback only; the downloadable resume is a separate file) */
@media print {
  .rsec { margin-top: 10pt; }
  .rsec-title { margin-bottom: 4pt; font-size: 12pt; break-after: avoid; }
  .resume-summary { font-size: 9.5pt; }
  .glance { grid-template-columns: repeat(4, 1fr); gap: 4pt; margin-top: 6pt; }
  .glance-item, .proj-item { padding: 4pt 6pt; background: none; border: 1px solid #ccc; border-radius: 3pt; break-inside: avoid; }
  .glance-big { font-size: 10pt; } .glance-small { font-size: 7.5pt; }
  .proj-list { grid-template-columns: 1fr 1fr; gap: 4pt; }
  .skill-grid { gap: 2pt; }
  .skill-row { grid-template-columns: 30mm 1fr; gap: 4pt; }
  .skill-name { font-size: 8.5pt; }
  .xp-list { gap: 7pt; max-width: none; }
  .xp-item { break-inside: avoid; }
  .xp-title { font-size: 10pt; }
  .xp-side, .xp-body > p, .xp-points li, .proj-item > p { font-size: 8.5pt; line-height: 1.35; }
  .xp-points { gap: 1pt; }
  .chip-list .chip { display: inline; padding: 0; border: 0; background: none; font-size: 8.5pt; }
  .chip-list .chip + .chip::before { content: ", "; }
  .chip-list { display: block; }
  .proj-links { display: none; }
}

/* ==== 404 page (brief v25) ==== */
.nf { display: grid; gap: var(--space-6); align-items: center; padding-top: var(--space-7); }
@media (min-width: 56rem) { .nf { grid-template-columns: 1fr 1fr; gap: var(--space-7); } }
.nf h1 { margin-top: var(--space-2); font-size: var(--text-h1); line-height: 1.05; letter-spacing: -0.03em; }
.nf-lede { margin: var(--space-4) 0 0; font-size: var(--text-lede); line-height: 1.5; color: var(--color-muted); max-width: 30rem; }
.nf-actions { margin: var(--space-5) 0 0; }

/* Terminal card: dark in both modes */
.nf-term { border-radius: var(--radius); overflow: hidden; background: #0f1514; border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 18px 40px -24px rgba(0,0,0,0.45); }
.nf-term-bar { display: flex; gap: 0.4rem; padding: 0.7rem 0.9rem; background: #171f1e; border-bottom: 1px solid rgba(255,255,255,0.06); }
.nf-term-bar span { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: rgba(255,255,255,0.18); }
.nf-term-body { margin: 0; padding: var(--space-5); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.9; color: #c9d4d2; white-space: pre-wrap; overflow-wrap: anywhere; }
.nf-prompt { color: #2dd4bf; margin-right: 0.3em; }
.nf-status { display: inline-block; margin: 0.15rem 0; font-size: 1.6rem; font-weight: 700; line-height: 1.4; color: #2dd4bf; }
.nf-cursor { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.15em; vertical-align: -0.15em; background: #2dd4bf; }
@media (prefers-reduced-motion: no-preference) { .nf-cursor { animation: nf-blink 1.1s steps(1) infinite; } }
@keyframes nf-blink { 50% { opacity: 0; } }

/* Links to the main pages */
.nf-links { margin-top: var(--space-7); }
.nf-links-title { margin: 0; font-size: 1rem; font-weight: 700; color: var(--color-accent); }
.nf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin: var(--space-3) 0 0; padding: 0; list-style: none; }
@media (min-width: 56rem) { .nf-grid { grid-template-columns: repeat(4, 1fr); } }
.nf-card { position: relative; display: flex; flex-direction: column; gap: 0.2rem; height: 100%; padding: var(--space-4) var(--space-5); padding-right: 2.5rem; background: var(--color-surface); border: 1px solid var(--color-rule); border-radius: var(--radius); color: inherit; text-decoration: none; transition: border-color var(--duration-fast), transform var(--duration-fast); }
.nf-card:hover, .nf-card:focus-visible { border-color: var(--color-accent); transform: translateY(-2px); }
.nf-card-name { font-weight: 700; color: var(--color-text-bold); }
.nf-card-line { font-size: var(--text-small); color: var(--color-muted); line-height: 1.4; }
.nf-arrow { position: absolute; top: var(--space-4); right: var(--space-4); color: var(--color-accent); }
@media (prefers-reduced-motion: reduce) { .nf-card { transition: none; } .nf-card:hover, .nf-card:focus-visible { transform: none; } }
