/* Reyno Benedict — personal site
   Tokens follow DESIGN.md ("Academic & Studio Minimal"). No framework, no build step. */

/* ---------- Fonts (self-hosted, SIL OFL 1.1 — see assets/fonts/*-OFL.txt) ---------- */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/newsreader-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/hanken-grotesk-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('../fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
}

/* ---------- Tokens ---------- */
:root {
  --canvas: #fafaf9;
  --surface: #ffffff;
  --surface-subtle: #f5f5f4;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --line-hover: #94a3b8;
  --accent: #0d9488;
  /* Darker teal for accent-coloured text: #0d9488 is only ~3.6:1 on the canvas. */
  --accent-text: #0f766e;
  --accent-2: #0284c7;

  --font-serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  --container: 72rem;
  --margin: 1.25rem;
  --gutter: 1rem;
  --header-h: 4rem;

  --radius: 0.25rem;
  --radius-lg: 0.5rem;
  --ease: 150ms linear;
}

@media (min-width: 768px) {
  :root {
    --margin: 2rem;
    --gutter: 1.5rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --margin: 4rem;
    --gutter: 2.5rem;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-md));
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
}

::selection {
  background: #ccfbf1;
  color: var(--ink);
}

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

/* Reduced-motion handling for transitions/animations lives in motion.css. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Typography roles ---------- */
.display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
}

.headline-lg {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.headline-md {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.33;
  letter-spacing: -0.01em;
}

.headline-sm {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.4;
}

.lede {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-2);
}

.body-lg {
  font-size: 1.125rem;
  line-height: 1.75;
  letter-spacing: -0.005em;
}

.body-sm {
  font-size: 0.875rem;
  line-height: 1.6;
}

.label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.35;
  letter-spacing: 0.04em;
}

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

.faint {
  color: var(--ink-3);
}

.accent {
  color: var(--accent-text);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  /* env() is 0 unless the viewport opts into viewport-fit=cover; harmless otherwise. */
  padding-inline: max(var(--margin), env(safe-area-inset-left)) max(var(--margin), env(safe-area-inset-right));
}

.section {
  padding-block: var(--space-2xl);
  border-top: 1px solid var(--line);
}

@media (min-width: 768px) {
  .section {
    padding-block: 5rem;
  }
}

/* Asymmetric 4 / 8 editorial split on desktop */
.split {
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 1024px) {
  .split {
    grid-template-columns: 4fr 8fr;
    gap: var(--gutter);
    align-items: start;
  }
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .section-head--row {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-lg);
  }
  .section-head--row p {
    max-width: 26rem;
    text-align: right;
  }
}

.skip-link {
  position: absolute;
  left: var(--space-md);
  top: -3rem;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.875rem;
}

.skip-link:focus {
  top: var(--space-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.1875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  transition: color var(--ease);
}

.brand:hover {
  color: var(--accent-text);
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  font-size: 0.875rem;
}

.nav__link {
  position: relative; /* anchor for the underline in motion.css */
  display: inline-block;
  padding-block: var(--space-sm);
  color: var(--ink-2);
  text-decoration: none;
}

.nav__link:hover,
.nav__link[aria-current='true'] {
  color: var(--ink);
}
/* Underline indicator for hover/active lives in motion.css. */

.nav__toggle {
  display: none;
}

/* Mobile: links collapse behind a button (progressive enhancement — without JS they wrap). */
@media (max-width: 767px) {
  .js .nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 2.75rem;
    padding: 0 var(--space-sm);
    margin-right: calc(var(--space-sm) * -1);
    background: none;
    border: 0;
    font: inherit;
    font-size: 0.875rem;
    color: var(--ink);
    cursor: pointer;
  }

  .nav__toggle-bars {
    position: relative;
    width: 1rem;
    height: 1px;
    background: currentColor;
  }

  .nav__toggle-bars::before,
  .nav__toggle-bars::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transition: transform var(--ease);
  }

  .nav__toggle-bars::before {
    top: -5px;
  }

  .nav__toggle-bars::after {
    top: 5px;
  }

  .nav__toggle[aria-expanded='true'] .nav__toggle-bars {
    background: transparent;
  }

  .nav__toggle[aria-expanded='true'] .nav__toggle-bars::before {
    transform: translateY(5px) rotate(45deg);
  }

  .nav__toggle[aria-expanded='true'] .nav__toggle-bars::after {
    transform: translateY(-5px) rotate(-45deg);
  }

  .js .nav__list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-sm) max(var(--margin), env(safe-area-inset-right)) var(--space-md)
      max(var(--margin), env(safe-area-inset-left));
    background: var(--surface);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.08);
  }

  .js .nav__list.is-open {
    display: flex;
  }

  .js .nav__list .nav__link {
    display: block;
    min-height: 2.75rem;
    padding-block: 0.75rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .js .nav__list li:last-child .nav__link {
    border-bottom: 0;
  }

  /* No-JS fallback: let links wrap under the brand. */
  html:not(.js) .site-header__inner {
    height: auto;
    flex-wrap: wrap;
    padding-block: var(--space-sm);
  }

  html:not(.js) .nav__list {
    flex-wrap: wrap;
    gap: var(--space-md);
  }
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}

.btn--primary {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
}

.btn--primary:hover {
  background: var(--accent-text);
  border-color: var(--accent-text);
}

.btn--ghost {
  color: var(--ink);
  border: 1px solid var(--line);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--line-hover);
  background: var(--surface);
}

.icon {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color var(--ease), text-decoration-color var(--ease);
}

.text-link:hover {
  color: var(--accent-text);
  text-decoration-color: var(--accent);
}

.text-link .icon {
  width: 0.875rem;
  height: 0.875rem;
}
/* Arrow nudge on hover/focus lives in motion.css. */

/* Links inside project rows, lists and footers get a >= 24px target (WCAG 2.2 2.5.8)
   without changing the underline look: padding sits outside the text box. */
.project__links .text-link,
.more-projects__item > .text-link,
.projects-footer .text-link {
  min-height: 1.5rem;
  padding-block: 0.25rem;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--space-xl) var(--space-2xl);
}

@media (min-width: 768px) {
  .hero {
    padding-block: var(--space-2xl) 5rem;
  }
}

.hero__grid {
  display: grid;
  gap: var(--space-xl);
}

/* Tablet: text and card side by side, card slightly narrower. */
@media (min-width: 768px) {
  .hero__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--gutter);
    align-items: center;
  }
}

/* Desktop: the 8 / 4 editorial split. */
@media (min-width: 1024px) {
  .hero__grid {
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  }
}

.hero__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 44rem;
  min-width: 0;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
}

/* Identity card.
   Phones: compact horizontal card (4:5 photo column + left-aligned text) so it never dominates the first screen.
   >= 768: vertical portrait card. */
.id-card {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  max-width: 30rem;
  padding: var(--space-md);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

@media (max-width: 359px) {
  .id-card {
    gap: 0.75rem;
    padding: 0.75rem;
  }
}

/* 4:5 portrait so the almamater jacket and UB badge stay visible. */
.id-card__picture {
  display: block;
  width: 100%;
  min-width: 0;
}

.id-card__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.id-card__body {
  min-width: 0;
}

.id-card__name {
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.id-card__role {
  margin-top: var(--space-xs);
  color: var(--ink-2);
}

.id-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
  color: var(--ink-3);
}

/* Compact card: the "·" separator would dangle when the meta wraps; the gap separates items instead. */
@media (max-width: 767px) {
  .id-card__meta [aria-hidden='true'] {
    display: none;
  }
}

@media (min-width: 768px) {
  .id-card {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    justify-self: end;
    max-width: 22rem;
    padding: var(--space-lg);
    text-align: center;
  }
  .id-card__body {
    width: 100%;
  }
  .id-card__name {
    font-size: 1.125rem;
  }
  .id-card__meta {
    justify-content: center;
    gap: var(--space-xs) var(--space-md);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
  }
}

/* ---------- About ---------- */
.prose {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 46rem;
}

/* ---------- Exploring (cards; informational, not interactive) ---------- */
.areas {
  display: grid;
  gap: var(--space-md);
}

/* 2 x 2 from large phones through laptops; four across only when there is room. */
@media (min-width: 640px) {
  .areas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .areas {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.card__title {
  margin-bottom: var(--space-sm);
}

.card__text {
  color: var(--ink-2);
  margin-bottom: var(--space-md);
}

.dot-list {
  display: grid;
  gap: var(--space-xs);
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

/* Cards in the same row share title / text / list tracks, so list tops line up. */
@supports (grid-template-rows: subgrid) {
  .areas > .card {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    row-gap: 0;
  }
  .areas > .card > .dot-list {
    align-self: start;
    margin-top: 0;
  }
}

.dot-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.dot-list li::before {
  content: '';
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-3px);
}

/* ---------- Projects (publication-style record) ---------- */
.projects {
  border-bottom: 1px solid var(--line);
}

/* Base row. background stays transparent; the hover tint lives in motion.css. */
.project {
  display: grid;
  gap: var(--space-md);
  padding-block: var(--space-lg);
  padding-inline: 0;
  border-top: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: transparent;
}

/* Tablet: meta | body, links under the body (a third column would squeeze the text to ~300px). */
@media (min-width: 768px) {
  .project {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: var(--space-md) var(--gutter);
    padding-block: var(--space-lg);
  }
  .project > .project__meta {
    grid-column: 1;
    grid-row: 1 / span 3;
  }
  .project > .project__body,
  .project > .project__links,
  .project > .project__details {
    grid-column: 2;
  }
}

/* Laptop+: meta | body | links for regular rows. */
@media (min-width: 1024px) {
  .project:not(.project--featured) {
    grid-template-columns: 7.5rem minmax(0, 1fr) 11rem;
  }
  .project:not(.project--featured) > .project__links {
    grid-column: 3;
    grid-row: 1;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 0.25rem;
  }
  .project:not(.project--featured) > .project__meta {
    grid-row: 1 / span 2;
  }
  .project:not(.project--featured) > .project__details {
    grid-column: 2 / -1;
    grid-row: 2;
  }
}

/* Featured: Level 1 surface (white, hairline, 8px radius), larger title, wider body. */
.project--featured {
  padding: var(--space-lg) var(--space-md);
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.project--featured + .project {
  margin-top: var(--space-lg);
}

@media (min-width: 768px) {
  .project--featured {
    padding: var(--space-lg) var(--space-lg);
  }
}

.project--featured .project__title {
  font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.project__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  color: var(--ink-3);
}

@media (min-width: 768px) {
  .project__meta {
    flex-direction: column;
    gap: var(--space-xs);
    padding-top: 0.4rem;
  }
}

.project__body {
  min-width: 0;
  max-width: 44rem;
}

.project--featured .project__body {
  max-width: none;
}

.project__kicker {
  margin-bottom: var(--space-sm);
}

.project__title {
  margin-bottom: var(--space-sm);
}

.project__desc {
  max-width: 65ch;
  color: var(--ink-2);
}

.project__note {
  margin-top: var(--space-sm);
  color: var(--ink-3);
}

.project__facts {
  display: grid;
  gap: var(--space-md);
}

.project__fact {
  min-width: 0;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
}

.project__fact dt {
  margin-bottom: var(--space-xs);
}

.project__fact dd {
  max-width: 70ch;
  color: var(--ink-2);
}

@media (min-width: 1024px) {
  .project--featured .project__facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg) var(--gutter);
  }
}

/* Expandable details (native <details>; motion lives in motion.css). */
.project__details {
  min-width: 0;
}

.project__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 2.75rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.project__toggle::-webkit-details-marker {
  display: none;
}

.project__toggle:hover,
.project__details[open] > .project__toggle {
  border-color: var(--line-hover);
}

.project__chevron {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.project__details[open] .project__chevron {
  transform: rotate(180deg);
}

.project__toggle-label--open,
.project__details[open] .project__toggle-label--closed {
  display: none;
}

.project__details[open] .project__toggle-label--open {
  display: inline;
}

.project__panel {
  padding-top: var(--space-lg);
}

/* Future screenshot slot (featured). */
.project__media {
  margin-top: var(--space-lg);
}

.project__media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center top;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.project__media figcaption {
  margin-top: var(--space-sm);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.5rem;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  align-content: start;
}

/* More on GitHub */
.more-projects {
  margin-top: var(--space-xl);
}

.more-projects__title {
  margin-bottom: var(--space-md);
}

.more-projects__list {
  display: grid;
  column-gap: var(--gutter);
}

@media (min-width: 768px) {
  .more-projects__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.more-projects__item {
  min-width: 0;
  padding-block: var(--space-md);
  border-top: 1px solid var(--line);
}

.more-projects__desc {
  max-width: 60ch;
  margin-top: var(--space-xs);
}

.more-projects__item .chips {
  margin-top: var(--space-sm);
}

.projects-footer {
  margin-top: var(--space-xl);
}

/* ---------- Academic ---------- */
.panel {
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

@media (min-width: 480px) {
  .panel {
    padding: var(--space-lg);
  }
}

@media (min-width: 768px) {
  .panel {
    padding: var(--space-xl);
  }
}

.panel__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 640px) {
  .panel__head {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-lg);
  }
}

.panel__sub {
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.course-list {
  display: grid;
  gap: var(--space-xs) var(--space-lg);
  color: var(--ink-2);
}

@media (min-width: 640px) {
  .course-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.course-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.course-list li::before {
  content: '';
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-hover);
  transform: translateY(-3px);
}

/* ---------- Contact ---------- */
.contact {
  max-width: 44rem;
}

.contact > .body-lg {
  max-width: 40rem;
  margin-top: var(--space-sm);
}

/* 1 column on small phones, 2 x 2 from 480px up (restrained; four across would crowd the email). */
.contact__links {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

@media (min-width: 480px) {
  .contact__links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm) var(--space-md);
  }
}

.contact__links > li {
  min-width: 0;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  height: 100%;
  padding: 0.625rem 0.875rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.contact-link__icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--ink-2);
}

.contact-link__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-link__value {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--accent-text);
  border-color: var(--accent);
}

.contact-link:hover .contact-link__icon,
.contact-link:focus-visible .contact-link__icon {
  color: var(--accent-text);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  padding-block: var(--space-xl) calc(var(--space-xl) + env(safe-area-inset-bottom));
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  color: var(--ink-2);
}

@media (min-width: 640px) {
  .site-footer__inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .skip-link,
  .hero__actions {
    display: none;
  }
  .section {
    padding-block: var(--space-lg);
  }
  .text-link::after {
    content: ' (' attr(href) ')';
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--ink-3);
  }
}

/* Without JS the mobile nav wraps under the brand, so the sticky header is taller. */
@media (max-width: 767px) {
  html:not(.js) {
    scroll-padding-top: 7.5rem;
  }
}

/* CV link under the contact grid. */
.contact__cv {
  margin-top: var(--space-lg);
}

/* ---------- CV viewer (native <dialog>, DESIGN.md Level 3 overlay) ---------- */
.cv-dialog {
  width: min(56rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.cv-dialog[open] {
  display: flex;
  flex-direction: column;
}

.cv-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

/* Lock page scroll behind the open viewer. */
html:has(.cv-dialog[open]) {
  overflow: hidden;
}

.cv-dialog__bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--line);
}

.cv-dialog__heading {
  min-width: 0;
  margin-right: auto;
}

.cv-dialog__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease);
}

.cv-dialog__btn:hover {
  background: var(--surface-subtle);
  border-color: var(--line);
}

.cv-dialog__zoom[aria-pressed='true'] {
  border-color: var(--line-hover);
  background: var(--surface-subtle);
}

.cv-dialog__close {
  padding: 0;
}

.cv-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--space-md);
  background: var(--surface-subtle);
}

.cv-dialog__page {
  width: 100%;
  height: auto;
  margin-inline: auto;
  border: 1px solid var(--line);
  background: #fff;
}

/* Zoomed: render the page at its natural 1000px width and pan inside the body. */
.cv-dialog__body.is-zoomed .cv-dialog__page {
  width: 1000px;
  max-width: none;
}

.cv-dialog__foot {
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--line);
}

/* Phones: full-screen sheet. */
@media (max-width: 639px) {
  .cv-dialog {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .cv-dialog__bar {
    padding-left: var(--margin);
    padding-top: max(var(--space-sm), env(safe-area-inset-top));
  }

  .cv-dialog__body {
    padding: var(--space-sm);
  }

  .cv-dialog__foot {
    padding-inline: var(--margin);
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  }
}

.cv-dialog__body:focus-visible {
  outline-offset: -3px;
}
