/* ==========================================================================
   THE WARM STUDY — portfolio design system
   Palette: bone paper, warm ink, one clay accent, arch portrait motif.
   No frameworks, no build step. Static HTML/CSS/JS.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   --------------------------------------------------------------------------
   🎨 THE ENTIRE COLOR SCHEME LIVES IN THESE 9 VALUES.
   Change a hex here and it updates everywhere on every page.

   Easiest way to experiment: open palette-lab.html in your browser —
   live color pickers, one-click preset palettes, automatic contrast
   checks, and a copy-paste block to bring your winner back here.

   Ready-made alternatives are commented out right below this block.
   (Note: 404.html carries its own standalone copy of these colors —
   update it too once you settle on a palette.)
   -------------------------------------------------------------------------- */
:root {
  --bone: #FAF7F2;      /* page background */
  --cream: #F2EDE4;     /* surfaces: cards, chips, menu overlay */
  --hairline: #E4DCCF;  /* borders & rules (decorative only, never text) */
  --ink: #1C1917;       /* headings + body text */
  --muted: #5C554D;     /* dates, captions, secondary copy */
  --clay: #9A4B2E;      /* THE accent: links, buttons, dots, underlines */
  --espresso: #23201C;  /* footer band */
  --sand: #E8C4A8;      /* links + kickers on the espresso footer */
  --on-accent: #FFFFFF; /* text sitting on top of the accent (buttons) */
  --on-espresso: #FAF7F2; /* text sitting on the espresso footer */

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  --radius-btn: 12px;
  --radius-card: 18px;
  --shadow-card: 0 20px 40px -20px rgb(28 25 23 / 0.22);
  --shadow-portrait: 0 24px 48px -24px rgb(28 25 23 / 0.18);

  --nav-height: 64px;
}

/* --------------------------------------------------------------------------
   🎨 PRESET PALETTES — to try one, copy its values over the ones in :root
   above (only the 9 color lines). All three pass WCAG AA contrast checks;
   palette-lab.html has one-click buttons for each.
   --------------------------------------------------------------------------

   THE MONOGRAPH — ivory paper + oxblood, quiet and literary
   --bone: #FBF9F4;
   --cream: #F3EFE6;
   --hairline: #E5DFD2;
   --ink: #191714;
   --muted: #57524A;
   --clay: #7D2E2A;
   --espresso: #201D19;
   --sand: #E7C3B8;
   --on-accent: #FFFFFF;
   --on-espresso: #FBF9F4;

   EVERGREEN — cool paper + deep forest green, calm and grounded
   --bone: #F7F6F1;
   --cream: #EDEBE0;
   --hairline: #DEDBCE;
   --ink: #1B1C18;
   --muted: #545750;
   --clay: #2E5F44;
   --espresso: #1B231F;
   --sand: #C9DECB;
   --on-accent: #FFFFFF;
   --on-espresso: #F7F6F1;

   MIDNIGHT STUDY — dark and cinematic, terracotta glow (experimental:
   shadows and the photo placeholder pattern read more subtly on dark)
   --bone: #141210;
   --cream: #1F1C18;
   --hairline: #383329;
   --ink: #F4EFE7;
   --muted: #B0A79A;
   --clay: #D98F6C;
   --espresso: #0C0B0A;
   --sand: #E8C4A8;
   --on-accent: #1C1917;
   --on-espresso: #F4EFE7;
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--bone);
  background-image: radial-gradient(circle at 78% 10%, var(--cream), transparent 55%);
  background-repeat: no-repeat;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--clay);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

::selection {
  background: var(--clay);
  color: var(--on-accent);
}

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

.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 100;
  background: var(--ink);
  color: var(--bone);
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  font-weight: 500;
}

.skip-link:focus-visible {
  top: 0;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.display {
  font-size: clamp(2.75rem, 1rem + 7.5vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
}

h2,
.h2 {
  font-size: clamp(1.75rem, 1.1rem + 3vw, 2.5rem);
}

h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0;
}

p {
  max-width: 65ch;
}

.kicker {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--clay);
}

.muted {
  color: var(--muted);
}

.dates {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1188px; /* 1140 + padding */
  margin-inline: auto;
  padding-inline: 24px;
}

/* anchor jumps land below the sticky header */
[id] {
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.section {
  padding-block: clamp(4rem, 9vw, 6.5rem);
}

.section + .section {
  border-top: 1px solid var(--hairline);
}

.section-head {
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.section-head .kicker {
  display: block;
  margin-bottom: 0.75rem;
}

.section-head p {
  margin-top: 0.9rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   5. Header & navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  background: rgb(250 247 242 / 0.92); /* fallback for pre-color-mix browsers */
  background: color-mix(in srgb, var(--bone) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.nav {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
  view-transition-name: brand;
}

.brand-dot {
  color: var(--clay);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
  list-style: none;
}

.nav-links a {
  position: relative;
  display: inline-block;
  padding-block: 6px;
  font-weight: 500;
  font-size: 0.9875rem;
  color: var(--ink);
  text-decoration: none;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms var(--ease-out);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Hamburger (mobile only) */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
}

.nav-toggle-bar {
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);
}

/* the sr-only label is also a span, so count bars from the end */
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-last-of-type(2) {
  transform: translateY(4px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-last-of-type(1) {
  transform: translateY(-4px) rotate(-45deg);
}

/* Full-screen mobile menu overlay */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--cream);
  display: flex;
  overflow-y: auto;
  /* keep links clear of the sticky header, scrollable on short landscape phones */
  padding: calc(var(--nav-height) + 16px) 24px 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms var(--ease-out), visibility 0s linear 250ms;
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 250ms var(--ease-out);
}

.menu-list {
  list-style: none;
  text-align: center;
  display: grid;
  gap: 1.5rem;
  margin: auto; /* safe centering: stays reachable when it overflows */
}

.menu-list a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 350ms var(--ease-out) var(--d, 0ms), transform 350ms var(--ease-out) var(--d, 0ms);
}

.menu-overlay.open .menu-list a {
  opacity: 1;
  transform: none;
}

.menu-list a[aria-current="page"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clay);
}

html.menu-open,
html.menu-open body {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), background-color 200ms var(--ease-out);
}

.btn-primary {
  background: var(--clay);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 12.5px 22.5px;
}

@media (hover: hover) {
  .btn-primary:hover {
    background: color-mix(in srgb, var(--clay) 88%, black);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--clay) 50%, transparent);
  }

  .btn-ghost:hover {
    background: var(--cream);
    transform: translateY(-2px);
  }
}

.btn:active {
  transform: scale(0.98);
}

/* Inline text link with sliding arrow */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--clay);
  text-decoration: none;
}

.arrow-link .arrow {
  transition: transform 250ms var(--ease-out);
}

@media (hover: hover) {
  .arrow-link:hover .arrow {
    transform: translateX(4px);
  }
}

/* --------------------------------------------------------------------------
   7. Chips & placeholder pattern
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--cream);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

.chip svg {
  color: var(--clay);
  flex-shrink: 0;
}

.tag {
  display: inline-block;
  padding: 3px 12px;
  background: var(--bone);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

/* Designed image placeholder: cream + diagonal hairlines + serif glyph */
.ph-pattern {
  background-color: var(--cream);
  background-image: repeating-linear-gradient(45deg, transparent 0 10px, var(--hairline) 10px 11px);
}

.ph-glyph {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: var(--clay);
}

/* --------------------------------------------------------------------------
   8. Hero (Home)
   -------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
}

.hero-beacon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.4rem;
}

.beacon-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clay);
  animation: beacon-pulse 2.5s ease-in-out infinite;
}

@keyframes beacon-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.hero-eyebrow {
  display: block;
  margin-bottom: 0.6rem;
}

.hero-rule {
  width: 64px;
  height: 2px;
  background: var(--clay);
  margin-bottom: 1.4rem;
  transform-origin: left;
  animation: grow-x 500ms var(--ease-out) 600ms both;
}

.hero-name {
  margin-bottom: 1.4rem;
}

.hero-name .line {
  display: block;
  overflow: hidden;
  /* breathing room so g/j/p/q/y descenders survive the 1.02 line-height clip box */
  padding-block: 0.08em 0.14em;
  margin-block: -0.08em -0.14em;
}

.hero-name .line-inner {
  display: block;
  transform: translateY(125%);
  animation: rise 650ms var(--ease-out) var(--d, 0ms) both;
}

.hero-title {
  font-size: clamp(1.125rem, 1rem + 1vw, 1.375rem);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1.6rem;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 2.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Entrance choreography: elements with .anim fade up at their --d delay */
.anim {
  animation: fade-up 500ms var(--ease-out) var(--d, 0ms) both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  to {
    transform: translateY(0);
  }
}

@keyframes grow-x {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   9. The signature arch portrait
   -------------------------------------------------------------------------- */
.portrait {
  position: relative;
  /* leave 16px of air for the offset outline arch */
  width: min(380px, calc(100% - 16px));
  margin-inline: auto;
}

.portrait-frame {
  position: relative;
  z-index: 1;
  aspect-ratio: 380 / 460;
  /* a true semicircular arch at any size: 50% of width = 41.3% of the 380:460 height */
  border-radius: 50% 50% 20px 20px / 41.3% 41.3% 20px 20px;
  overflow: hidden;
  box-shadow: var(--shadow-portrait);
  display: flex;
  align-items: center;
  justify-content: center;
  view-transition-name: portrait;
  animation: portrait-in 700ms var(--ease-out) 200ms both;
}

.portrait-frame .ph-glyph {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Offset clay outline arch behind the photo */
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--clay);
  border-radius: 50% 50% 20px 20px / 41.3% 41.3% 20px 20px;
  transform: translate(16px, 16px);
  animation: arch-draw 700ms var(--ease-out) 200ms both;
  pointer-events: none;
}

@keyframes portrait-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes arch-draw {
  from {
    opacity: 0;
    transform: translate(8px, 8px);
  }
  to {
    opacity: 1;
    transform: translate(16px, 16px);
  }
}

/* Larger About-page twin (the view-transition morph target) */
.portrait-lg {
  width: min(420px, calc(100% - 16px));
  margin-inline: 0;
  margin-block: clamp(2rem, 5vw, 3rem);
}

/* --------------------------------------------------------------------------
   10. Experience timeline
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  list-style: none;
  padding-left: 32px;
  display: grid;
  gap: clamp(2rem, 4vw, 2.75rem);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--hairline);
  transform-origin: top;
}

.js .timeline::before {
  transform: scaleY(0);
  transition: transform 700ms var(--ease-out);
}

.js .timeline.is-visible::before {
  transform: scaleY(1);
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--clay);
}

.timeline-item .dates {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.timeline-item h3 {
  font-size: 1.125rem;
  margin-bottom: 0.15rem;
}

.timeline-item .org {
  font-weight: 500;
  color: var(--ink);
}

.timeline-item p {
  color: var(--muted);
  margin-top: 0.35rem;
}

/* --------------------------------------------------------------------------
   11. Certification cards
   -------------------------------------------------------------------------- */
.cert-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* Certifications beside a photo: side by side on wide screens, stacked on phones */
.cert-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
}

@media (min-width: 900px) {
  .cert-layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

.cert-photo img {
  width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.cert-photo figcaption {
  margin-top: 0.7rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.cert-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--cream);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 16px 20px;
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}

@media (hover: hover) {
  .cert-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
  }
}

.cert-card svg {
  color: var(--clay);
  flex-shrink: 0;
  margin-top: 3px;
}

.cert-card strong {
  display: block;
  font-weight: 600;
  line-height: 1.4;
}

.cert-card span {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   12. Project cards (Work)
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--cream);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}

.card-media {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--hairline);
  transition: background-position 250ms var(--ease-out);
}

.card-media .ph-glyph {
  font-size: 2rem;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px 24px;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
}

.card h3 .title-line {
  background-image: linear-gradient(var(--clay), var(--clay));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 250ms var(--ease-out);
  padding-bottom: 2px;
}

.card p {
  color: var(--muted);
  font-size: 0.9875rem;
  flex: 1;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
  }

  .card:hover .card-media {
    /* shift across the 45° stripes, not along them */
    background-position: 8px 0;
  }

  .card:hover h3 .title-line {
    background-size: 100% 2px;
  }

  .card:hover .arrow-link .arrow {
    transform: translateX(4px);
  }
}

.card:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   13. About page
   -------------------------------------------------------------------------- */
.prose {
  max-width: 65ch;
}

.prose > * + * {
  margin-top: 1.2rem;
}

.pull-quote {
  position: relative;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.35;
  max-width: 24ch;
  padding-top: 2.4rem;
}

.pull-quote::before {
  content: "\201C";
  position: absolute;
  top: 0;
  left: -0.06em;
  font-size: 3.2em;
  line-height: 1;
  color: var(--clay);
  opacity: 0.85;
}

.chapter {
  padding-block: clamp(2.25rem, 5vw, 3.5rem);
}

.chapter + .chapter {
  border-top: 1px solid var(--hairline);
}

.chapter-no {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--clay);
  display: block;
  margin-bottom: 0.5rem;
}

.chapter h2 {
  margin-bottom: 1rem;
}

.chapter p {
  color: var(--muted);
}

.dropcap::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--clay);
  float: left;
  font-size: 3.4em;
  line-height: 0.85;
  padding-right: 0.09em;
  padding-top: 0.04em;
}

.values-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 20px;
}

.value-card {
  background: var(--cream);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 24px;
}

.value-card .chapter-no {
  margin-bottom: 0.75rem;
}

.value-card strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.value-card p {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   14. Contact page
   -------------------------------------------------------------------------- */
.contact-hero {
  padding-block: clamp(4rem, 10vw, 7rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-hero .kicker {
  margin-bottom: 1rem;
}

.contact-hero .display {
  margin-bottom: 1.2rem;
}

.contact-hero .display + .contact-actions {
  margin-top: 1.2rem;
}

.contact-hero > p {
  color: var(--muted);
  max-width: 46ch;
  margin-bottom: 2.4rem;
}

.contact-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 1rem;
}

.btn-mail {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  padding: 18px 28px;
  border-radius: 14px;
  overflow-wrap: anywhere;
}

.btn-copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 200ms var(--ease-out), transform 200ms var(--ease-out);
}

@media (hover: hover) {
  .btn-copy:hover {
    background: var(--cream);
  }
}

.btn-copy:active {
  transform: scale(0.96);
}

.btn-copy .icon-check {
  display: none;
  color: var(--clay);
}

.btn-copy.copied .icon-copy {
  display: none;
}

.btn-copy.copied .icon-check {
  display: block;
}

.copy-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--bone);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.btn-copy.copied .copy-tip,
.btn-copy.copy-error .copy-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Optional contact form (ships commented out in contact.html) */
.contact-form {
  width: min(560px, 100%);
  margin-top: clamp(2rem, 5vw, 3rem);
  display: grid;
  gap: 8px;
  text-align: left;
}

.contact-form label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 12px;
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  color: var(--ink);
  background: color-mix(in srgb, var(--bone) 55%, white);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 16px;
  width: 100%;
}

.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 0;
  border-color: var(--clay);
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-form .btn {
  justify-self: start;
  margin-top: 16px;
}

.contact-rows {
  list-style: none;
  width: min(560px, 100%);
  margin-top: clamp(2.5rem, 6vw, 4rem);
  text-align: left;
  border-top: 1px solid var(--hairline);
}

.contact-rows li {
  border-bottom: 1px solid var(--hairline);
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 12px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 200ms var(--ease-out);
}

.contact-row .label {
  font-weight: 600;
}

.contact-row .value {
  color: var(--muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
  text-align: right;
  flex: 1;
}

.contact-row .arrow {
  color: var(--clay);
  transition: transform 250ms var(--ease-out);
  flex-shrink: 0;
}

@media (hover: hover) {
  .contact-row:hover {
    background: var(--cream);
  }

  .contact-row:hover .arrow {
    transform: translateX(4px);
  }
}

/* --------------------------------------------------------------------------
   15. Footer (espresso band with CTA)
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--espresso);
  color: var(--on-espresso);
  margin-top: clamp(3rem, 8vw, 5rem);
}

.footer-cta {
  padding-block: clamp(3.5rem, 8vw, 5.5rem);
  border-bottom: 1px solid rgb(250 247 242 / 0.12); /* fallback */
  border-bottom: 1px solid color-mix(in srgb, var(--on-espresso) 12%, transparent);
}

.footer-cta .kicker {
  color: var(--sand);
  display: block;
  margin-bottom: 0.9rem;
}

.footer-cta h2 {
  font-size: clamp(1.9rem, 1.2rem + 3.5vw, 3rem);
  margin-bottom: 1.4rem;
  max-width: 18ch;
}

.footer-cta .arrow-link {
  color: var(--sand);
  font-size: 1.125rem;
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 26px;
  font-size: 0.9rem;
  color: rgb(250 247 242 / 0.75); /* fallback */
  color: color-mix(in srgb, var(--on-espresso) 75%, var(--espresso));
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
}

.footer-base a {
  color: var(--sand);
  text-decoration: none;
}

.footer-base a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* clay fails 3:1 on espresso — use sand for focus rings in the footer */
.site-footer :focus-visible {
  outline-color: var(--sand);
}

/* --------------------------------------------------------------------------
   16. Scroll reveal
   -------------------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 550ms var(--ease-out) var(--d, 0ms),
    transform 550ms var(--ease-out) var(--d, 0ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* the timeline <ol> carries data-reveal only to trigger its line-grow —
   don't stack its fade/rise on top of the items' own reveals */
.js .timeline[data-reveal] {
  opacity: 1;
  transform: none;
}

/* never hide revealed content on paper */
@media print {
  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------------------------------------------------
   17. Page transitions
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  /* Primary: cross-document View Transitions (Chromium, Safari 18.2+) */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root) {
    animation: 240ms var(--ease-in) both vt-out;
  }

  ::view-transition-new(root) {
    animation: 420ms var(--ease-out) 60ms both vt-in;
  }

  /* Fallback for browsers without cross-document view transitions:
     html gets .no-vt from the inline head script, main.js drives .page-leave */
  .no-vt body {
    animation: page-enter 350ms var(--ease-out) both;
  }

  .page-leave body {
    /* drop the page-enter fill so the fade-out can actually win the cascade */
    animation: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 200ms var(--ease-in), transform 200ms var(--ease-in);
  }
}

/* While a cross-document view transition is running, the portrait is the
   morphing shared element — its entrance keyframes would render it
   transparent mid-flight, so suppress them for the duration.
   (Two separate rules: an unknown pseudo-class would invalidate a shared one.) */
:root:active-view-transition .portrait,
:root:active-view-transition .portrait::after,
:root:active-view-transition .portrait-frame {
  animation: none !important;
}

.vt-active .portrait,
.vt-active .portrait::after,
.vt-active .portrait-frame {
  animation: none !important;
}

@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   18. Responsive: desktop hero grid, mobile nav
   -------------------------------------------------------------------------- */
@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .hero-copy {
    grid-column: 1 / 8;
  }

  .hero-figure {
    grid-column: 8 / 13;
  }
}

@media (max-width: 899px) {
  .hero .portrait {
    margin-inline: 0;
    width: min(260px, 74vw);
  }

  .hero-actions .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .timeline-item .dates {
    margin-bottom: 0.5rem;
  }
}

@media (min-width: 768px) {
  .menu-overlay {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   19. Reduced motion: everything settles instantly, one soft body fade
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    animation: fade-in 200ms ease both !important;
    animation-duration: 200ms !important;
  }
}
