/* ==========================================================================
   Personal CV — styles
   Design: Glass Panels Split — Glass Panels Wide with a split calling card:
   who you are on the left, the pitch and actions on the right. Keeps
   the full-screen aurora and the pinned glass menu (which highlights
   the section being read), on a wider single column: every section
   runs full width, so experience never sits beside anything.
   Baseline target: Baseline 2024 (see CLAUDE.md). Scroll-driven reveals
   are a progressive enhancement behind @supports.
   ========================================================================== */

/* ---------- Design tokens ---------------------------------------------- */
:root {
  /* Follow the system by default. The theme toggle only rewrites
     <meta name="color-scheme">; these rules map it back to CSS. */
  color-scheme: light dark;

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }

  /* Backdrop */
  --bg: light-dark(oklch(96% 0.016 255), oklch(14.5% 0.028 265));
  --aurora-1: light-dark(oklch(82% 0.11 255), oklch(38% 0.16 262));
  --aurora-2: light-dark(oklch(87% 0.08 210), oklch(34% 0.09 220));
  --aurora-3: light-dark(oklch(82% 0.1 285), oklch(30% 0.13 285));

  /* Glass */
  --glass: light-dark(oklch(100% 0 0 / 0.62), oklch(22% 0.035 262 / 0.62));
  --glass-strong: light-dark(oklch(100% 0 0 / 0.82), oklch(26% 0.04 262 / 0.82));
  --glass-edge: light-dark(oklch(100% 0 0 / 0.75), oklch(100% 0 0 / 0.12));
  --glass-shadow: light-dark(oklch(45% 0.12 262 / 0.14), oklch(5% 0.03 262 / 0.5));
  --blur: blur(24px) saturate(1.6);

  /* Semantic colors */
  --surface: var(--glass-strong);
  --text: light-dark(oklch(21% 0.035 264), oklch(96% 0.01 255));
  --text-2: light-dark(oklch(33% 0.035 264), oklch(87% 0.02 255));
  --muted: light-dark(oklch(43% 0.035 264), oklch(77% 0.03 255));
  --border: light-dark(oklch(84% 0.035 260), oklch(40% 0.035 262));
  --accent: light-dark(oklch(48% 0.2 264), oklch(80% 0.12 248));
  --accent-ink: light-dark(oklch(43% 0.19 264), oklch(86% 0.08 248));
  --accent-soft: color-mix(in oklab, var(--accent) 11%, var(--glass-strong));
  --on-accent: light-dark(oklch(100% 0 0), oklch(17% 0.04 264));
  --fill-1: light-dark(oklch(49% 0.21 263), oklch(47% 0.19 263));
  --fill-2: light-dark(oklch(44% 0.2 278), oklch(40% 0.17 280));
  --on-fill: oklch(100% 0 0);
  --success: light-dark(oklch(52% 0.15 150), oklch(82% 0.17 150));

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  /* A wide single column: sections stay stacked full width, so a long
     experience list never has to sit beside anything. */
  --content: 60rem;
  --measure: 46rem;
  --header: 60rem;
  --radius: 1.25rem;
  --panel-radius: clamp(1.5rem, 1.25rem + 0.8vw, 2rem);
  --dot-bg: light-dark(oklch(97.5% 0.01 260), oklch(24% 0.035 262));
  /* White in both themes on purpose: company logos are made for white. */
  --logo-plate: oklch(100% 0 0);
  --card-bg: var(--glass);
  --card-border: var(--glass-edge);
  --lift: -3px;
  --lift-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 2rem 3.5rem -1.75rem var(--glass-shadow);

  accent-color: var(--accent);
}

/* ---------- Reset & base ----------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  /* A word wider than its box (the email, a URL, or any word on a very
     narrow screen) breaks instead of spilling out of its panel. */
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

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

img {
  block-size: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;

  &:hover {
    text-decoration-thickness: 2px;
  }
}

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

.icon {
  inline-size: 1.1em;
  block-size: 1.1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: -10rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;

  &:focus {
    inset-block-start: 1rem;
  }
}

.container {
  inline-size: min(100% - 2rem, var(--content));
  margin-inline: auto;
}

/* ---------- Theme-specific content: .when-light / .when-dark ---------- */
/* Shown only in the rendered theme (the theme toggle's icons, the App Store
   badge). Rendered dark = (system dark AND not forced light) OR forced dark.
   These rules only hide, so each element keeps its own display. Paper is
   always light (see Print). */
@media screen and (prefers-color-scheme: light) {
  :root:not(:has(> head > meta[name="color-scheme"][content="dark"])) .when-dark {
    display: none;
  }
}

@media screen and (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .when-light {
    display: none;
  }
}

@media screen {
  :root:has(> head > meta[name="color-scheme"][content="light"]) .when-dark,
  :root:has(> head > meta[name="color-scheme"][content="dark"]) .when-light {
    display: none;
  }
}

@media print {
  :root .when-dark {
    display: none;
  }
}

/* ---------- Theme toggle: show the action that is available ----------- */
.theme-toggle :is(.when-light, .when-dark) {
  display: contents;
}

.theme-toggle .icon {
  inline-size: 1.15rem;
  block-size: 1.15rem;
}

body {
  position: relative;
  isolation: isolate;
}

/* ---------- Aurora backdrop -------------------------------------------- */
/* Fixed, soft blobs of blue behind everything; panels frost over them. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(40rem 32rem at 6% 4%, var(--aurora-1), transparent 70%),
    radial-gradient(36rem 30rem at 94% 16%, var(--aurora-2), transparent 70%),
    radial-gradient(44rem 34rem at 72% 98%, var(--aurora-3), transparent 70%),
    radial-gradient(30rem 26rem at 8% 92%, var(--aurora-2), transparent 70%),
    var(--bg);
}

/* ---------- Glass surface ---------------------------------------------- */
:where(.header-inner, main > section, .card) {
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 1.5rem 3rem -1.5rem var(--glass-shadow);
}

/* Without backdrop blur, make panels nearly opaque so text stays legible. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass: light-dark(oklch(100% 0 0 / 0.92), oklch(22% 0.035 262 / 0.94));
  }
}

/* ---------- Header ----------------------------------------------------- */
.site-header {
  container: header / inline-size;
  z-index: 10;
  border-block-end: 1px solid var(--header-border, var(--border));
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.header-inner {
  inline-size: min(100% - 2rem, var(--header));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand actions"
    "nav   nav";
  align-items: center;
  column-gap: 1rem;
  padding-block: 0.75rem 0;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  justify-self: start;
  min-inline-size: 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.brand-name {
  line-height: 1.2;

  & > span {
    white-space: nowrap;
  }
}

/* The hero already shows the name in large type, so the header shows only
   the initials while the hero's name is on screen (site.js sets
   data-hero-name-visible); once it scrolls under the bar, the name fades in.
   It keeps its space, so nothing shifts. Without JS it is always shown.
   (Not a scroll-driven animation: those can get stuck after switching tabs.) */
.site-header[data-hero-name-visible] .brand:not(:focus-visible) .brand-name {
  opacity: 0;
  translate: var(--brand-name-shift, none);
}

/* Motion is opt-in: a short slide on top of the fade. */
@media (prefers-reduced-motion: no-preference) {
  .brand-name {
    --brand-name-shift: 0 0.375rem;
    transition: opacity 0.25s ease, translate 0.25s ease;
  }
}

/* Very narrow: let each half of the name wrap too, so the brand and the
   buttons still fit side by side. */
@container header (width < 20rem) {
  .brand-name > span {
    white-space: normal;
  }
}

/* Extremely narrow: there's no room for the brand and the buttons on one
   row, so stack the brand, the buttons and the menu, centered. */
@container header (width < 15rem) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "actions"
      "nav";
    justify-items: center;
    padding-inline: 0.5rem;
  }

  .brand {
    justify-self: center;
    flex-direction: column;
    text-align: center;
  }

  .site-nav {
    justify-self: stretch;
  }
}

.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  inline-size: 2rem;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.site-nav {
  grid-area: nav;
  min-inline-size: 0;

  & ul {
    display: flex;
    gap: 0.25rem;
    margin: 0 -0.625rem;
    padding: 0.375rem 1.5rem 0.5rem 0;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
    /* Fade the trailing edge to hint that the row scrolls */
    mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
  }

  & ul::-webkit-scrollbar {
    display: none;
  }

  & a {
    display: block;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;

    &:hover {
      color: var(--text);
      background: var(--surface);
    }
  }
}

.header-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.lang-switch,
.theme-toggle {
  display: inline-grid;
  place-items: center;
  min-inline-size: 2.5rem;
  block-size: 2.5rem;
  padding: 0 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;

  &:hover {
    color: var(--text);
    background: var(--surface);
  }
}

@container header (width >= 50rem) {
  .header-inner {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "brand nav actions";
    padding-block: 0.75rem;
  }

  .header-actions {
    justify-self: end;
  }

  .site-nav ul {
    justify-content: center;
    margin: 0;
    padding: 0;
    overflow: visible;
    mask-image: none;
  }
}

@media (width >= 50rem) {
  .site-header {
    position: sticky;
    inset-block-start: 0;
  }

  main section[id] {
    scroll-margin-block-start: 5.5rem;
  }
}

/* A floating glass bar, centered over the column. */
.site-header {
  position: sticky;
  inset-block-start: 0.75rem;
  margin-block-start: 0.75rem;
  border: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.header-inner {
  padding: 0.5rem 0.75rem 0;
  border-radius: 1.25rem;
}

.brand-mark {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2)) var(--fill-1);
  color: var(--on-fill);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.site-nav a,
.lang-switch,
.theme-toggle {
  border-radius: 999px;
}

.site-nav a:hover {
  color: var(--accent-ink);
}

@container header (width >= 50rem) {
  .header-inner {
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    border-radius: 999px;
  }
}

main section[id] {
  scroll-margin-block-start: 6rem;
}

/* The section being read (marked by site.js) gets a glass pill. */
.site-nav a[aria-current] {
  background: var(--glass-strong);
  color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}

/* ---------- Panels ----------------------------------------------------- */
main {
  display: grid;
  gap: clamp(1rem, 0.75rem + 1vw, 1.5rem);
  padding-block: clamp(1.5rem, 1rem + 2vw, 2.5rem) 2rem;
}

main > section {
  min-inline-size: 0;
  padding: clamp(1.5rem, 1rem + 2.5vw, 3rem) clamp(1.25rem, 0.75rem + 2.5vw, 3rem);
  border-radius: var(--panel-radius);
}

/* Projects is a group of glass cards rather than a panel of its own. */
main > section#projects {
  padding-inline: 0;
  border: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.section-title {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;

  &::after {
    content: "";
    inline-size: 1.75rem;
    block-size: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--aurora-2), var(--fill-1)) var(--fill-1);
  }
}

/* This title sits straight on the aurora, so it uses the stronger ink. */
#projects .section-title {
  color: var(--text-2);
}

/* ---------- Hero: the calling card ------------------------------------- */
main > section.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: clamp(2.5rem, 1.75rem + 4vw, 5rem);
  background: var(--glass-strong);
  text-align: center;
}

.hero-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.125rem;
}

.avatar {
  inline-size: 6.5rem;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 5px var(--glass-strong),
    0 0 0 6px var(--glass-edge),
    0 1rem 2.5rem -0.75rem var(--glass-shadow);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--glass);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 550;
  box-shadow: inset 0 0 0 1px var(--glass-edge);

  &::before {
    content: "";
    inline-size: 0.5rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 25%, transparent);
  }
}

.hero h1 {
  margin: 1.25rem 0 0.375rem;
  font-size: clamp(1.75rem, 1.75rem + 3.5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

.hero-role {
  margin: 0;
  color: var(--accent-ink);
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  font-weight: 600;
}

.hero-location {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0.625rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.hero-pitch {
  max-inline-size: 40ch;
  margin: 1.5rem 0 0;
  color: var(--text-2);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.6;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-block-start: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-block-size: 2.75rem;
  padding: 0 1.125rem;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 0.5rem 1.25rem -0.75rem var(--glass-shadow);

  &:hover {
    border-color: color-mix(in oklab, var(--accent) 40%, var(--glass-edge));
    color: var(--accent-ink);
  }
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2)) var(--fill-1);
  color: var(--on-fill);
  box-shadow: 0 0.5rem 1.25rem -0.5rem color-mix(in oklab, var(--fill-1) 70%, transparent);

  &:hover {
    border-color: transparent;
    color: var(--on-fill);
    filter: brightness(1.08);
  }
}

/* ---------- Experience timeline (the Minimal Blue rail) ---------------- */
.timeline {
  --rail-x: 1.5rem;
  display: grid;
  gap: 2.25rem;
  margin: 0;
  padding: 0;
  padding-inline-start: var(--rail-x);
  border-inline-start: 2px solid var(--rail, var(--border));
  list-style: none;
}

.entry {
  container: entry / inline-size;
  position: relative;
}

/* A ring on the rail for every role; filled for the current one. */
.timeline > .entry::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(-1 * var(--rail-x) - 7px);
  inset-block-start: 0.4rem;
  inline-size: 12px;
  aspect-ratio: 1;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--dot-bg, var(--bg));
}

.timeline > .entry.is-current::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}

.entry-head {
  display: grid;
  gap: 0.125rem;
}

.entry-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.entry-meta,
.entry-dates {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-meta a {
  font-weight: 500;
}

.entry-dates {
  font-variant-numeric: tabular-nums;
}

.entry.is-current .entry-dates {
  color: var(--accent-ink);
  font-weight: 500;
}

/* Company logo: a tile before the title, company and dates. */
.entry-logo {
  grid-row: 1 / span 3;
  align-self: center;
  display: grid;
  place-items: center;
  inline-size: 3rem;
  aspect-ratio: 1;
  padding: 0.375rem;
  border-radius: 22.5%;
  background: var(--logo-plate);
  box-shadow: 0 0 0 1px var(--border);

  & img {
    max-block-size: 100%;
    object-fit: contain;
  }
}

.entry-head:has(> .entry-logo) {
  grid-template-columns: auto 1fr;
  column-gap: 0.875rem;

  & > :not(.entry-logo) {
    grid-column: 2;
  }
}

@container entry (width >= 34rem) {
  .entry-head {
    grid-template-columns: 1fr auto;
    align-items: baseline;
    column-gap: 1rem;
  }

  .entry-dates {
    grid-area: 1 / 2;
    text-align: end;
  }

  .entry-head:has(> .entry-logo) {
    grid-template-columns: auto 1fr auto;

    & > .entry-logo {
      grid-row: 1 / span 2;
    }

    & > .entry-dates {
      grid-area: 1 / 3;
    }
  }
}

.entry-body {
  margin: 0.75rem 0 0;
  padding-inline-start: 1.1rem;
  color: var(--text-2);

  & li + li {
    margin-block-start: 0.35rem;
  }

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

.entry-list {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- About ------------------------------------------------------ */
.prose {
  color: var(--text-2);
  font-size: 1.0625rem;

  & p {
    margin: 0 0 1rem;
  }

  & p:last-child {
    margin-block-end: 0;
  }
}

/* ---------- Tags ------------------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0.875rem 0 0;
  padding: 0;
  list-style: none;

  & li {
    padding: 0.2rem 0.625rem;
    border: 1px solid transparent; /* visible in forced-colors mode */
    border-radius: 999px;
    background: var(--tag-bg, var(--accent-soft));
    color: var(--tag-ink, var(--accent-ink));
    font-size: 0.775rem;
    font-weight: 500;
    line-height: 1.5;
  }
}

/* ---------- Projects --------------------------------------------------- */
#projects {
  container: projects / inline-size;
}

.project-grid {
  display: grid;
  gap: 1rem;
}

@container projects (width >= 36rem) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--card-border, var(--border));
  border-radius: var(--radius);
  background: var(--card-bg, var(--surface));

  & .tags {
    margin: 0;
  }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.card-icon {
  inline-size: 3rem;
  aspect-ratio: 1;
  border-radius: 22.5%;
}

.card-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.card-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.card-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: auto 0 0;
  padding: 0.25rem 0 0;
  list-style: none;
  font-size: 0.875rem;
  font-weight: 600;

  & a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-ink);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  /* Official store badges: used as provided, at the same 40px height
     (Apple's on-screen minimum; Google's must be no smaller than Apple's).
     The list gap keeps the required clear space of ¼ of the height. */
  & .store-badge {
    border-radius: 0.4375rem;

    & img {
      block-size: 2.5rem;
      inline-size: auto;
    }
  }
}

/* ---------- Skills ----------------------------------------------------- */
#skills {
  container: skills / inline-size;
}

.skill-groups {
  display: grid;
  gap: 1.5rem 2rem;
}

@container skills (width >= 36rem) {
  .skill-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.skill-group h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
}

.skill-group .tags {
  margin-block-start: 0.625rem;
}

/* ---------- Contact & footer ------------------------------------------ */
.contact-lead {
  margin: 0;
  font-size: clamp(1.5rem, 1.25rem + 1.25vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.contact-email {
  display: inline-block;
  margin-block-start: 0.75rem;
  font-size: clamp(1.0625rem, 1rem + 0.5vw, 1.3125rem);
  font-weight: 600;
}

.site-footer {
  color: var(--muted);
  font-size: 0.85rem;

  & .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-block: 1.75rem 2.5rem;
  }

  & p {
    margin: 0;
  }

  & a {
    color: inherit;
  }
}

/* ---------- Centered details ------------------------------------------- */
.prose {
  max-inline-size: var(--measure);
  margin-inline: auto;
  line-height: 1.75;
  text-align: center;
}

/* The timeline stays left-aligned for scanning, inside a centered measure. */
.timeline {
  max-inline-size: var(--measure);
  margin-inline: auto;
}

.entry-list {
  gap: 1.5rem;
  text-align: center;
}

.entry-list .entry-head {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.entry-list .entry-dates {
  order: -1;
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tags li {
  border-color: var(--glass-edge);
}

.card {
  align-items: center;
  padding: 1.5rem;
  text-align: center;
}

.card-head {
  flex-direction: column;
  gap: 0.75rem;
}

.card-icon {
  inline-size: 3.5rem;
  box-shadow: 0 0.75rem 1.5rem -0.5rem var(--glass-shadow);
}

.card-desc {
  max-inline-size: 34ch;
}

.card .tags,
.card-links {
  justify-content: center;
}

.skill-groups {
  gap: 1.75rem 2rem;
}

.skill-group {
  text-align: center;

  & .tags {
    justify-content: center;
  }
}

.contact {
  text-align: center;

  & .actions {
    margin-block-start: 1.75rem;
  }
}

.contact-lead {
  font-size: clamp(1.625rem, 1.25rem + 1.75vw, 2.5rem);
  letter-spacing: -0.03em;
}

/* The footer sits straight on the aurora, so it uses the stronger ink. */
.site-footer {
  color: var(--text-2);
}

.site-footer .container {
  display: grid;
  justify-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding-block: 0.5rem 2.5rem;
  text-align: center;
}

/* ---------- A wider column ---------------------------------------------- */
/* Desktops get more room, but every section still runs full width, one
   after another, so a long experience list never has to sit beside
   anything. The extra width goes to the sections that benefit from it. */
#about,
#education {
  container: section / inline-size;
}

#education {
  container-name: education;
}

/* About: a wider measure, still centered */
.prose {
  max-inline-size: var(--measure);
}

/* Experience: full width, capped at a comfortable line length */
.timeline {
  max-inline-size: 52rem;
}

/* Skills: three columns when there's room */
@container skills (width >= 48rem) {
  .skill-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Education: entries side by side */
@container education (width >= 40rem) {
  .entry-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

/* ---------- Split calling card ------------------------------------------ */
/* On wide screens the calling card uses the width: who you are on the
   left half (in normal flow, so it sets the card's height), the pitch and
   actions on the right half, meeting at the middle, with a hairline
   between. */
@media (width >= 56rem) {
  main > section.hero {
    --split-gap: clamp(2rem, 0.5rem + 3.5vw, 3.5rem);
    position: relative;
    padding-inline-end: calc(50% + var(--split-gap) / 2);
    padding-block: clamp(2.5rem, 1.75rem + 3vw, 4rem);

    &::after {
      content: "";
      position: absolute;
      inset-block: clamp(2rem, 1.5rem + 2vw, 3rem);
      inset-inline-start: 50%;
      border-inline-start: 1px solid var(--border);
    }
  }

  main > section.hero > :is(.hero-pitch, .actions) {
    position: absolute;
    inset-inline: calc(50% + var(--split-gap) / 2) var(--split-gap);
    margin: 0;
    text-align: start;
  }

  main > section.hero > .hero-pitch {
    inset-block-end: calc(50% + 0.625rem);
    max-inline-size: none;
  }

  main > section.hero > .actions {
    inset-block-start: calc(50% + 0.875rem);
    justify-content: flex-start;
  }
}

/* ---------- Extremely narrow screens ----------------------------------- */
/* Below phone widths every rem of gutter and padding is precious: give it
   back to the text. */
@media (width < 20rem) {
  .container,
  .header-inner {
    inline-size: min(100% - 1rem, var(--content));
  }

  main > section {
    padding-inline: 0.75rem;
  }

  .card {
    padding: 1rem 0.75rem;
  }

  .timeline {
    --rail-x: 1rem;
  }

  .entry-body {
    padding-inline-start: 0.875rem;
  }

  /* Icons wrap above their label rather than squeezing it letter by letter. */
  .btn,
  .hero-location {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0.125rem;
    text-align: center;
  }

  .btn {
    padding: 0.375rem 0.75rem;
  }
}

/* ---------- Motion (opt-in) ------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  @view-transition {
    navigation: auto;
  }

  .btn,
  .site-nav a,
  .lang-switch,
  .theme-toggle,
  .card-links a {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  }

  /* The current role's dot gives off a slow, quiet ping. */
  .timeline > .entry.is-current::after {
    content: "";
    position: absolute;
    inset-inline-start: calc(-1 * var(--rail-x) - 7px);
    inset-block-start: 0.4rem;
    inline-size: 12px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent);
    animation: ping 3s cubic-bezier(0, 0, 0.2, 1) infinite;
    pointer-events: none;
  }

  @keyframes ping {
    from { opacity: 0.45; scale: 1; }
    70%, to { opacity: 0; scale: 2.6; }
  }
}

/* Tiles float up a little under the pointer (Bento's hover). */
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  :is(main > section:not(#projects), .card) {
    transition:
      translate 0.3s cubic-bezier(0.2, 0.7, 0.3, 1),
      box-shadow 0.3s ease,
      border-color 0.3s ease,
      background-color 0.3s ease;
  }

  :is(main > section:not(#projects), .card):hover {
    translate: 0 var(--lift, -4px);
    box-shadow: var(--lift-shadow);
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .card {
    --lift: -6px;
  }

  main > section:not(#projects):hover,
  .card:hover {
    border-color: color-mix(in oklab, var(--accent) 28%, var(--glass-edge));
  }
}

/* Sections rise into place the first time they scroll into view. site.js
   marks the ones below the fold as pending and reveals each once, for good;
   without JS everything simply shows. (A one-shot, time-based animation, not
   a scroll-driven one: view() timelines can go stale after switching tabs and
   leave sections invisible.) */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(2.5rem) scale(0.97);
    }
  }

  .reveal-pending {
    opacity: 0;
    transform: translateY(2.5rem) scale(0.97);
  }

  .revealing {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
  }
}

/* ---------- Forced colors --------------------------------------------- */
@media (forced-colors: active) {
  main > section,
  .card,
  .header-inner {
    border: 1px solid CanvasText;
  }

  .brand-mark,
  .btn-primary,
  .status::before,
  .section-title::after {
    forced-color-adjust: auto;
  }

  .timeline > .entry::before {
    border-color: CanvasText;
  }
}

/* ---------- Print: a clean one-pager ---------------------------------- */
@media print {
  :root {
    color-scheme: light !important;
  }

  /* Paper: no aurora, no tinted page, no motion, no shadows. Sections not
     yet revealed on screen still print. */
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
  }

  .reveal-pending {
    opacity: 1 !important;
    transform: none !important;
  }

  body {
    background: none;
    font-size: 10.5pt;
  }

  body::before,
  main > section.hero::after {
    display: none;
  }

  .site-header,
  .skip-link,
  .actions,
  .status {
    display: none !important;
  }

  main {
    display: block;
    padding: 0;
  }

  main > section,
  main > section.hero,
  .card {
    padding: 0.5rem 0;
    border: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    translate: none;
  }

  main > section.hero {
    padding-block-end: 1rem;
  }

  main > section.hero > .hero-pitch {
    position: static;
  }

  .section-title {
    margin-block-end: 1rem;
    break-inside: avoid;
    break-after: avoid;
  }

  /* A tighter rhythm and print-sized type, so the CV fits in fewer pages. */
  main > section {
    padding-block: 0.375rem;
  }

  .avatar {
    inline-size: 4.5rem;
  }

  .hero h1 {
    margin-block-start: 0.75rem;
    font-size: 26pt;
  }

  .hero-role {
    font-size: 13pt;
  }

  .hero-pitch {
    margin-block-start: 0.75rem;
    font-size: 11pt;
  }

  .prose {
    font-size: 10.5pt;
    line-height: 1.55;
  }

  .section-title {
    gap: 0.375rem;
    margin-block-end: 0.75rem;
  }

  .timeline {
    gap: 1.25rem;
  }

  .project-grid {
    gap: 0.75rem 1.5rem;
  }

  .card {
    gap: 0.375rem;
  }

  .card-icon {
    inline-size: 2.25rem;
  }

  .card-desc {
    font-size: 10pt;
  }

  .contact-lead {
    font-size: 16pt;
  }

  .site-footer p:last-child {
    display: none;
  }

  .site-footer .container {
    padding-block: 0.5rem 0;
  }

  .entry,
  .card,
  .skill-group {
    break-inside: avoid;
  }
}
