/* Hallmark · genre: editorial · macrostructure: Long Document (studied-DNA hero: vertical role word beside a tall portrait) · theme: custom · nav: MT logo top-left, three-line icon top-right; hover or tap slides out the right side-nav · footer: one contact line on a navy band · enrichment: portrait (user-supplied)
 * vibe: "Nordic, quiet luxury, navy and champagne gold" · paper oklch(98.4% 0.003 250) · deep oklch(23% 0.05 258) · gold oklch(80% 0.09 85) (mệnh Thủy, Kim sinh Thủy)
 * fonts: Oswald (uppercase display only: logo, name, role word, section headings, figures) + Geist (everything else, 400–600) · axes: light / classical-serif / cool
 * Hallmark · pre-emit critique: P5 H5 E4 S4 R4 V4
 */

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

html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
svg { width: 1.125rem; height: 1.125rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: var(--radius-sm); }
.closing :focus-visible { outline-color: var(--color-gold); }

.skip {
  position: absolute; left: var(--space-md); top: var(--space-md); z-index: 30;
  padding: var(--space-xs) var(--space-md);
  background: var(--color-ink); color: var(--color-paper);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

/* ---------- Top bar: M.T logo left, menu icon right ---------- */

:root {
  --gutter: clamp(var(--space-lg), 6vw, 7rem);
  /* Page edge shared by every block, nearly edge to edge like the reference */
  --edge: clamp(var(--space-lg), 4vw, 4.5rem);
  --section-space: 6rem;
}

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-md) var(--edge);
  background: color-mix(in oklch, var(--color-paper) 88%, transparent);
  backdrop-filter: blur(8px);
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--color-deep);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.logo:hover { color: var(--color-accent); }
/* Oswald's full stop is square; draw a round one */
.logo-dot {
  display: inline-block;
  width: 0.2em; height: 0.2em;
  margin: 0 0.06em;
  border-radius: 50%;
  background: currentColor;
}

.menu-btn {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-sm);
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ink);
  font: 500 var(--text-sm) / 1 var(--font-body);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}
.menu-btn { min-width: 2.75rem; margin-right: calc(var(--space-sm) * -1); padding-inline: var(--space-sm); }
.menu-icon { position: relative; width: 1.5rem; height: 2px; border-radius: 1px; background: currentColor; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; right: 0; width: 100%; height: 2px; border-radius: 1px; background: currentColor; }
.menu-icon::before { top: -7px; }
.menu-icon::after { top: 7px; }

.menu-btn:hover { color: var(--color-accent); }

/* ---------- Side nav: hidden off-canvas on the right; the three-line icon slides it out ---------- */

.sidenav {
  position: fixed; inset: 0 0 0 auto; z-index: 20;
  width: 16rem;
  display: flex; flex-direction: column;
  padding: var(--space-xl);
  border-left: var(--rule-hair);
  background: var(--color-paper);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}
.sidenav.is-open {
  transform: none;
  visibility: visible;
  box-shadow: 0 0 48px var(--color-scrim);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.sidenav-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-xl);
  text-transform: uppercase;
  color: var(--color-deep);
  text-decoration: none;
  white-space: nowrap;
}
.sidenav ul { display: grid; gap: var(--space-2xs); margin-top: var(--space-3xl); }
.sidenav li a {
  display: flex; align-items: center; gap: var(--space-sm);
  min-height: 2.5rem;
  color: var(--color-ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.sidenav li a:hover { color: var(--color-deep); }
.sidenav li a[aria-current] { color: var(--color-deep); font-weight: 500; }
.sidenav li a[aria-current] svg { color: var(--color-gold-line); }

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem;
  padding: 0 var(--space-xl);
  border-radius: var(--radius-pill);
  font: 500 var(--text-sm) / 1 var(--font-body);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-accent); color: var(--color-on-accent); }
.btn-primary:hover { background: var(--color-accent-hover); }

.text-link {
  display: inline-block;
  line-height: 2.75rem;
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-decoration-color: var(--color-gold-line);
  text-underline-offset: 0.35em;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.text-link:hover { color: var(--color-accent); }

/* ---------- Main ---------- */

/* One edge for the whole site: top bar, hero, sections and footer all start and end on --edge */
main { padding: 0 var(--edge); }

/* Hero: focus list and name on the left, vertical role, tall portrait, statement on the right */

.hero {
  --hero-h: clamp(26rem, 68vh, 40rem);
  display: grid;
  /* Wider left column puts the role word and photo just right of centre, as in the reference */
  grid-template-columns: minmax(0, 1.3fr) auto auto minmax(0, 1fr);
  column-gap: var(--space-md);
  padding-block: 8rem var(--section-space);
}

.hero-left, .hero-right {
  display: flex; flex-direction: column; justify-content: space-between;
  gap: var(--space-2xl);
  padding-top: var(--space-3xl);
}
.hero-left { padding-right: var(--space-xl); }
.hero-right { padding-left: var(--space-lg); }

.hero-links { font-size: var(--text-base); font-weight: 500; line-height: 1.8; white-space: nowrap; }
.hero-links a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.3em; transition: text-decoration-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.hero-links a:hover { color: var(--color-accent); text-decoration-color: var(--color-gold-line); }

.hero-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-xl);
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-deep);
}

/* Reads bottom to top, starting at the photo's bottom edge */
.hero-role {
  display: flex;
  flex-direction: column;
  height: var(--hero-h);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--hero-h) / 4.1);
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--color-deep);
  white-space: nowrap;
}
.hero-role span { display: block; }

.hero-year { align-self: flex-end; font-weight: 500; }

/* Three set lines of near-equal length, like a caption */
.hero-statement {
  width: fit-content;
  margin-left: auto;
  font-size: clamp(1.25rem, 0.6rem + 1vw, 1.625rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.hero-statement span { display: block; white-space: nowrap; }

.portrait {
  width: calc(var(--hero-h) * 0.6);
  height: var(--hero-h);
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-paper-3);
}
.portrait { position: relative; }


.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }

/* Figures */


/* Sections: heading above, content below, all on the shared page edge */

.section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xl) var(--space-3xl);
  --section-pad: var(--section-space);
  padding-top: var(--section-pad);
  /* Jumping here from the menu lands on the heading, not on the empty space above it */
  scroll-margin-top: calc(var(--section-pad) * -1 + 0.5rem);
}
#tools.section, #languages.section { --section-pad: var(--space-2xl); }

.section h2, .page-head h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-3xl);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--color-deep);
}

/* About: a scattered editorial panel, name top left, small portrait top right, CTA bottom right */

.about {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  gap: var(--space-2xl) var(--space-lg);
  margin-top: 0;
  padding: var(--space-2xl) var(--space-2xl) var(--space-3xl);
  border-radius: var(--radius-md);
  background: var(--color-panel);
}
.about img { display: block; width: 100%; height: auto; object-fit: cover; filter: grayscale(1) contrast(1.05); }

.about-name {
  grid-column: 1 / 8;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.5rem, 1rem + 7vw, 8rem);
  line-height: 0.92;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--color-deep);
}
.about-name span { display: block; }
.about-name span + span { padding-left: 0.6em; }

.about-head { grid-column: 8 / 13; display: flex; justify-content: flex-end; gap: var(--space-lg); }
.about-head-text { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; max-width: 15rem; }
.about-head-text p:last-child { font-weight: 500; line-height: 1.25; }
.about-label { font-family: var(--font-display); font-weight: 500; font-size: var(--text-xl); text-transform: uppercase; color: var(--color-deep); }
.about .about-face { width: 12rem; aspect-ratio: 7 / 8; }

.about-small { grid-column: 1 / 5; grid-row: 2; display: flex; align-items: flex-start; gap: var(--space-xl); }
.about-small p { max-width: 11rem; font-weight: 500; line-height: 1.2; }
.about .about-small img { width: 9.5rem; }
/* The three About photos each slide in once from their own side; site.js only arms this when motion is allowed */
.about-reveal .about img { opacity: 0; transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.about-reveal .about .about-face { transform: translateX(2.5rem); }
.about-reveal .about .about-small img { transform: translateX(-2.5rem); transition-delay: 120ms; }
.about-reveal .about .about-wide { transform: translateY(2.5rem); transition-delay: 240ms; }
.about-reveal .about img.is-in { opacity: 1; transform: none; }

.about-story { grid-column: 4 / 7; grid-row: 3; align-self: end; max-width: 20rem; font-weight: 500; line-height: 1.2; }
.about-wide { grid-column: 7 / 10; grid-row: 2 / 4; aspect-ratio: 4 / 5; }

.about-cta {
  grid-column: 10 / 13; grid-row: 3; align-self: end; justify-self: end;
  display: inline-flex; align-items: center; gap: var(--space-sm);
  min-height: 2.75rem;
  padding-bottom: var(--space-xs);
  border-bottom: 3px solid currentColor;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-deep);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.about-cta span { transition: transform var(--dur-base) var(--ease-out); }
.about-cta:hover { color: var(--color-accent); }
.about-cta:hover span { transform: translate(2px, -2px); }

@media (max-width: 1000px) {
  .about { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: var(--space-xl); }
  .about-name { grid-column: 1 / -1; }
  .about-head { grid-column: 1 / -1; justify-content: space-between; }
  .about-head-text { align-items: flex-start; }
  .about-small { grid-column: 1 / -1; grid-row: auto; }
  .about-wide { grid-column: 1 / -1; grid-row: auto; }
  .about-story { grid-column: 1 / -1; grid-row: auto; }
  .about-cta { grid-column: 1 / -1; grid-row: auto; justify-self: start; }
}

@media (max-width: 480px) {
  .about .about-face { width: 8rem; }
  .about .about-small img { width: 7rem; }
}

/* Experience: company names on the left; on the right a queue of logo tiles.
 * The selected role's tile is large; the others wait in line, small, to its right.
 * Choosing a name (not a tile) moves that tile to the front and pushes the previous one to the back of the line. */

.roles-panel {
  scroll-margin-top: 5.5rem;
  display: grid;
  /* Names take the left third, pushing the stage right as in the reference */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr);
  gap: var(--space-2xl);
}

.role-nav { display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-2xl); }
.role-names button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-ink-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-3xl);
  line-height: 1.1;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}
.role-names button:hover { color: var(--color-ink-2); }
.role-names button[aria-selected="true"] { color: var(--color-deep); }
.role-count { font-family: var(--font-display); font-weight: 500; font-size: var(--text-sm); color: var(--color-ink-3); white-space: nowrap; }
.role-current { font-size: var(--text-2xl); color: var(--color-deep); }

/* Large tile on the left runs the full height; info on top right; the waiting tiles sit in a row under it */
.role-stage {
  --stage-info-h: 25rem;
  display: grid;
  /* The waiting tiles share the space to the right edge, so no empty strip is left there */
  grid-template-columns: minmax(0, 16rem) repeat(3, minmax(0, 1fr));
  /* Same height for every role, so switching never resizes the tiles */
  grid-template-rows: minmax(var(--stage-info-h), auto) auto;
  column-gap: var(--space-md);
}

.role-tile {
  display: grid; place-items: center;
  padding: var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-card);
  /* No grey panel behind Experience any more, so the white tiles need their own edge */
  box-shadow: var(--shadow-card);
}
/* Logos as one-colour navy marks: the logo file is used as a mask, filled with the page navy */
.role-mark {
  display: block;
  width: 100%;
  height: 60%;
  background: var(--color-deep);
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}
.role-mark-sloyd { width: 72%; height: 72%; }

/* The front tile shows the logo in its own colours; the waiting tiles keep the navy mark */
.role-logo-color { display: none; width: 92%; max-height: 40%; object-fit: contain; }
.role-logo-color.role-logo-sloyd { width: 58%; max-height: 58%; }
.role-logo-link { display: none; width: 100%; height: 100%; place-items: center; border-radius: var(--radius-sm); }
.role-tile[data-slot="0"] .role-logo-link { display: grid; }
.role-tile[data-slot="0"] .role-logo-color { display: block; transition: transform var(--dur-base) var(--ease-out); }
.role-logo-link:hover .role-logo-color { transform: scale(1.04); }
/* Timo and Techcombank logos are split into parts. Opening that role's details glides them into a stacked,
 * near-square block; closing snaps straight back (the transition lives only on the open state).
 * Timo: "timo" on top, "Digital Bank" and "by BVBank" scaled so the grey block spans the width of "timo".
 * Techcombank: the diamond mark grows and moves on top, the wordmark sits centred below. */
.role-tile[data-slot="0"] .timo-logo { width: 92%; height: auto; max-height: none; aspect-ratio: 500 / 166; }
.role-tile[data-slot="0"] .tcb-logo { width: 92%; height: auto; max-height: none; aspect-ratio: 406 / 166; }
.timo-logo, .tcb-logo { overflow: visible; stroke: none; }
.timo-logo g, .tcb-logo g { transform-box: view-box; transform-origin: 0 0; }
.timo-word, .timo-digital, .timo-by { transform: translate(0, 43px); }
.tcb-mark, .tcb-word { transform: translate(0, 55.3px); }

.roles-panel:has(#role-2 details[open]) .role-tile[data-slot="0"] :is(.timo-logo, .timo-logo g),
.roles-panel:has(#role-4 details[open]) .role-tile[data-slot="0"] :is(.tcb-logo, .tcb-logo g) { transition: transform var(--dur-slow) var(--ease-in-out); }

.roles-panel:has(#role-2 details[open]) .role-tile[data-slot="0"] .timo-logo { transform: scale(1.5); }
.roles-panel:has(#role-2 details[open]) .role-tile[data-slot="0"] .timo-word { transform: translate(114px, 0); }
.roles-panel:has(#role-2 details[open]) .role-tile[data-slot="0"] .timo-digital { transform: translate(-293.3px, 65px) scale(1.358); }
.roles-panel:has(#role-2 details[open]) .role-tile[data-slot="0"] .timo-by { transform: translate(-243.3px, 65.1px) scale(1.358); }
.roles-panel:has(#role-4 details[open]) .role-tile[data-slot="0"] .tcb-logo { transform: scale(1.3); }
.roles-panel:has(#role-4 details[open]) .role-tile[data-slot="0"] .tcb-mark { transform: translate(-453.08px, 4px) scale(1.8); }
.roles-panel:has(#role-4 details[open]) .role-tile[data-slot="0"] .tcb-word { transform: translate(45.55px, 101.75px); }
.role-tile[data-slot="0"] .role-mark { display: none; }

/* Slot 0 is the front of the queue: the large tile */
.role-tile[data-slot="0"] { grid-column: 1; grid-row: 1 / 3; margin-right: var(--space-md); padding: var(--space-xl); }
.role-tile[data-slot="0"] .role-mark { width: 92%; height: 40%; }
.role-tile[data-slot="0"] .role-mark-sloyd { width: 58%; height: 58%; }
.role-tile:not([data-slot="0"]) { grid-row: 2; aspect-ratio: 16 / 9; min-height: 0; overflow: hidden; margin-top: var(--space-lg); padding: var(--space-lg) var(--space-xl); }
.role-tile:not([data-slot="0"]) .role-mark { width: 70%; height: 45%; }
.role-tile:not([data-slot="0"]) .role-mark-sloyd { width: 30%; height: 60%; }
.role-tile[data-slot="1"] { grid-column: 2; }
.role-tile[data-slot="2"] { grid-column: 3; }
.role-tile[data-slot="3"] { grid-column: 4; }

.role-panel { grid-column: 2 / -1; grid-row: 1; }
.role-panel[hidden] { display: none; }
.role-panel h3 { font-weight: 600; font-size: var(--text-2xl); line-height: 1.2; letter-spacing: -0.01em; color: var(--color-deep); }
.role-info { display: flex; flex-direction: column; gap: var(--space-xs); }
/* Left: dates, then the role title. Right: city, then the company under it */
.role-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: var(--space-xs) var(--space-lg); }
.role-head .card-when { grid-column: 1; grid-row: 1; }
.role-head h3 { grid-column: 1; grid-row: 2; }
.role-head .card-city { grid-column: 2; grid-row: 1; justify-self: end; color: var(--color-ink-3); font-size: var(--text-sm); }
.role-company { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; padding-top: 0.2rem; line-height: 1.2; color: var(--color-deep); font-weight: 600; text-align: right; white-space: nowrap; }
.role-info .card-body { margin-top: var(--space-sm); }
/* Experience text runs to the right edge of the panel, level with the city and company */
.role-info .card-body > p, .role-info details ul { max-width: none; }

.role-figures { display: flex; gap: var(--space-2xl); margin-top: var(--space-sm); }
.role-figures div { display: flex; flex-direction: column; align-items: center; text-align: center; }
.role-figures dd { order: -1; font-family: var(--font-display); font-weight: 500; font-size: clamp(2.5rem, 1.7rem + 2.2vw, 3.25rem); line-height: 1; color: var(--color-deep); font-variant-numeric: tabular-nums; }
.role-figures dt { color: var(--color-ink-3); font-size: var(--text-sm); }

/* Opening Sloyd's details spins its logo like a wheel that slows to a stop */
.role-logo-sloyd.is-spinning { animation: wheel 2s cubic-bezier(0.15, 0.6, 0.25, 1) both; }
@keyframes wheel { to { transform: rotate(720deg); } }

/* Each tile keeps its own name so the browser can morph it between slots */
.role-tile[data-role="1"] { view-transition-name: role-tile-1; }
.role-tile[data-role="2"] { view-transition-name: role-tile-2; }
.role-tile[data-role="3"] { view-transition-name: role-tile-3; }
.role-tile[data-role="4"] { view-transition-name: role-tile-4; }
::view-transition-group(*) { animation-duration: var(--dur-slow); animation-timing-function: var(--ease-out); }

@media (max-width: 1000px) {
  .roles-panel { grid-template-columns: minmax(0, 1fr); }
  .role-nav { flex-direction: row; align-items: end; justify-content: space-between; }
  .role-names { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); }
  .role-names button { font-size: var(--text-xl); }
  .role-stage { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto; }
  .role-tile[data-slot="0"] { grid-column: 1 / -1; grid-row: 1; margin-right: 0; aspect-ratio: 3 / 1; padding: var(--space-lg); }
  .role-tile[data-slot="0"] .role-logo-color { width: 70%; max-height: 60%; }
  .role-tile[data-slot="0"] .role-logo-color.role-logo-sloyd { width: auto; height: 70%; max-height: 70%; }
  .role-tile:not([data-slot="0"]) { grid-row: 2; aspect-ratio: 5 / 2; margin-top: var(--space-md); }
  .role-tile[data-slot="1"] { grid-column: 1; }
  .role-tile[data-slot="2"] { grid-column: 2; }
  .role-tile[data-slot="3"] { grid-column: 3; }
  .role-panel { grid-column: 1 / -1; grid-row: 3; margin-top: var(--space-lg); }
}

/* Experience, Education, Voluntary and Projects: headed card lists */

.section.block { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }

.block-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-lg) var(--space-2xl);
}
.block-head h2, .block-head h1 { max-width: none; font-size: var(--text-4xl); line-height: 1.05; }
.back-link { margin-bottom: var(--space-xl); }
.block-count { max-width: 18rem; text-align: right; color: var(--color-ink-3); font-size: var(--text-sm); }
/* Projects: a heading, one wide photo, then four logo tiles. Choosing a tile colours it and opens that
 * project's facts and note below. Without JS the tiles stay hidden and every project shows. */
.projects, .gallery { --section-pad: calc(var(--space-4xl) + var(--space-md)); }
.projects .back-link, .gallery .back-link { justify-self: start; margin-bottom: 0; }
/* The 404 page is short; keep its footer at the bottom of the screen */
main:has(#notfound-h) { min-height: 70dvh; }
.projects-hero { aspect-ratio: 16 / 7; margin: 0; overflow: hidden; background: var(--color-panel); }
.projects-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.project-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-lg); }
.project-tiles[hidden], .project[hidden] { display: none; }
.project-tiles button { display: grid; place-items: center; aspect-ratio: 1; padding: var(--space-xl); border: 0; background: var(--color-panel); cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color var(--dur-fast) var(--ease-out); }
.project-tiles img { width: 100%; max-width: 10rem; height: auto; filter: grayscale(1); opacity: 0.55; transition: filter var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out); }
.project-tile-word { color: var(--color-ink-3); font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; line-height: 1.1; text-align: center; text-transform: uppercase; transition: color var(--dur-fast) var(--ease-out); }
.project-tiles button:hover img { opacity: 0.85; }
.project-tiles button:hover .project-tile-word { color: var(--color-ink-2); }
.project-tiles button[aria-selected="true"] { outline-color: var(--color-gold-line); }
.project-tiles button[aria-selected="true"] img { filter: none; opacity: 1; }
.project-tiles button[aria-selected="true"] .project-tile-word { color: var(--color-deep); }
.project-tiles button:focus-visible { outline-color: var(--color-accent); }
/* Each project has its own composition. Pieces sit in rows where every image shares one height:
 * a figure grows by its aspect ratio (--r), so wide spreads and tall covers line up without cropping. */
.project { display: grid; gap: var(--space-2xl); margin-top: var(--space-3xl); scroll-margin-top: 6rem; }
.project-name { color: var(--color-deep); font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 500; line-height: 1.05; text-transform: uppercase; }
.pj-info { display: grid; align-content: start; gap: var(--space-lg); }
.pj-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md) var(--space-xl); margin: 0; padding-top: var(--space-md); border-top: 1px solid var(--color-gold-line); }
.pj-facts dt { color: var(--color-ink-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.pj-facts dd { margin: var(--space-2xs) 0 0; color: var(--color-deep); font-size: var(--text-sm); }
.pj-note { display: grid; justify-items: start; gap: var(--space-xs); max-width: 60ch; }
.pj-sub { margin-top: var(--space-xl); color: var(--color-deep); font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; text-transform: uppercase; }
.pj-sub + .pj-row { margin-top: calc(var(--space-lg) * -1); }
.pj-row { display: flex; gap: var(--space-lg); align-items: flex-start; }
.pj-row figure { flex: var(--r) 1 0; min-width: 0; margin: 0; }
.pj-row img { display: block; width: 100%; height: auto; box-shadow: 0 0 0 1px var(--color-rule); }
.pj-row img.device { box-shadow: none; }

/* Gallery: personal photos in equal-height rows, using the project row */
/* A short introduction under a page heading */
.page-intro { display: grid; gap: var(--space-sm); max-width: 64ch; color: var(--color-ink-2); }
/* Spans the full width of the page, edges flush on both sides */
.page-intro-full { max-width: none; text-align: justify; hyphens: auto; }
.gallery-rows { display: grid; gap: var(--space-lg); }
/* Gallery: one twelve-column grid. Each photo takes its own number of columns (--w) but every photo in a row
 * shares that row's height and fills it edge to edge (--p keeps the subject in frame), so rows stay square.
 * Choosing a photo opens it whole in a light viewer with previous and next; there is no motion. */
.mosaic { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: min(21vw, 19rem); gap: var(--space-lg); }
.mosaic-tall { grid-auto-rows: min(29vw, 26rem); }
.mosaic figure { grid-column: span var(--w); margin: 0; overflow: hidden; }
.gallery-open { display: block; height: 100%; cursor: zoom-in; }
.gallery-open:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.mosaic img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--p, 50% 50%); }
/* Each photo fades up once as it scrolls into view; site.js only arms this when motion is allowed */
.gallery-reveal .mosaic figure { opacity: 0; transform: translateY(1.5rem); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); transition-delay: calc(var(--i, 0) * 90ms); }
.gallery-reveal .mosaic figure.is-in { opacity: 1; transform: none; }
.gallery-rule { margin: var(--space-xl) 0; border: 0; border-top: 1px solid var(--color-gold-line); }
.lightbox { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: var(--space-3xl) var(--space-4xl); border: 0; background: var(--color-paper); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: var(--color-paper); }
.lightbox img { max-width: 100%; max-height: calc(100dvh - var(--space-3xl) * 2); width: auto; height: auto; }
.lightbox-btn { position: fixed; display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 0; background: none; color: var(--color-deep); font-size: 2.5rem; font-weight: 300; line-height: 1; cursor: pointer; }
.lightbox-btn:hover { color: var(--color-accent); }
.lightbox-btn:focus-visible { outline: 2px solid var(--color-accent); }
.lightbox-prev { top: 50%; left: var(--space-md); transform: translateY(-50%); }
.lightbox-next { top: 50%; right: var(--space-md); transform: translateY(-50%); }
.lightbox-close { top: var(--space-md); right: var(--space-md); font-size: 2rem; }

/* Lime & Leaf: a narrow column of facts beside one large MacBook */
.project-lime-leaf { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: center; gap: var(--space-3xl); }
/* HAO: the website on the left with the story on the right, then the poster wall across */
.project-hao { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: center; gap: var(--space-2xl) var(--space-3xl); }
/* UMI and the club: name and facts on the left, the note on the right, pieces below */
.pj-wide { grid-column: 1 / -1; }
.pj-info-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--space-3xl); }
.pj-info-split .project-name, .pj-info-split .pj-facts { grid-column: 1; }
.pj-info-split .pj-note { grid-column: 2; grid-row: 1 / span 2; align-self: end; }


.count { font-size: var(--text-lg); font-weight: 600; color: var(--color-deep); }

.cards { display: grid; gap: var(--space-md); }
.card {
  display: grid;
  /* Dates, title and overview share one baseline across the row */
  grid-template-columns: minmax(0, 8rem) minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--space-md) var(--space-2xl);
  align-items: first baseline;
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

.card-when {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2xs) var(--space-xs);
  color: var(--color-ink-3);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.now { display: inline-flex; align-items: center; align-self: center; gap: var(--space-xs); color: var(--color-live); font-weight: 500; }
/* A green "live" dot that pulses like a status light */
.now-dot { position: relative; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-live); }
@media (prefers-reduced-motion: no-preference) {
  .now-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--color-live); animation: live 1.6s var(--ease-out) infinite; }
}
@keyframes live { from { transform: scale(1); opacity: 0.6; } to { transform: scale(2.6); opacity: 0; } }

.card-title h3, .card-v h3 {
  font-weight: 600;
  font-size: var(--text-xl);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-deep);
}
.card-org { margin-top: var(--space-2xs); font-size: var(--text-base); font-weight: 500; color: var(--color-ink-2); }
.card-org a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.2em; transition: text-decoration-color var(--dur-fast) var(--ease-out); }
.card-org a:hover { text-decoration-color: var(--color-gold-line); }
.card-place { font-weight: 400; font-size: var(--text-sm); color: var(--color-ink-3); white-space: nowrap; }

.card-body > p { max-width: 56ch; color: var(--color-ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-md); }
details + .tags { margin-top: var(--space-xs); }
.tags li {
  padding: 0.2em 0.8em;
  border: var(--rule-hair);
  border-radius: var(--radius-pill);
  color: var(--color-ink-3);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Details disclosure */

details { margin-top: var(--space-sm); }
summary {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  min-height: 2.75rem;
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  list-style: none;
  transition: color var(--dur-fast) var(--ease-out);
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: var(--text-lg); line-height: 1; transition: transform var(--dur-base) var(--ease-out); }
details[open] summary::after { transform: rotate(45deg); }
summary:hover { color: var(--color-accent-hover); }

details ul { display: grid; gap: var(--space-xs); max-width: 60ch; padding-bottom: var(--space-xs); color: var(--color-ink-2); }
details li { position: relative; padding-left: var(--space-lg); }
/* A text dash, not a 1px border: borders on fractional positions anti-alias to uneven colours */
details li::before { content: "–" / ""; position: absolute; left: 0; top: 0; color: var(--color-gold-line); }

/* Education sits on the grey panel (About and Education alternate with the plain Experience) */
.edu-panel { padding: var(--space-lg); border-radius: var(--radius-md); background: var(--color-panel); }
/* Education rows are kept short so the whole section fits on one screen.
 * Order: overview, Details, then tags on one line; an open Details pushes the tags down. */
.edu-panel .cards { gap: var(--space-sm); }
/* The right column is sized to its content, so overview, Details and tags sit against the right edge */
.edu-panel .card { padding: var(--space-lg) var(--space-xl); grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) minmax(0, 24rem); }
.edu-panel .card-body > p { max-width: none; }
.edu-panel details { margin-top: 0; }
.edu-panel summary { min-height: 2.25rem; }
.edu-panel .tags { flex-wrap: nowrap; margin-top: 0; }
.edu-panel .tags li { white-space: nowrap; padding: 0.2em 0.65em; font-size: 0.6875rem; letter-spacing: 0.04em; }

/* Vertical cards: Education and Projects */

.cards-v { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
.voluntary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.voluntary-meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md); }
.voluntary-meta .card-when { margin-bottom: 0; }
.voluntary-meta .card-place { text-align: right; }
.voluntary-cards .card-v { align-items: stretch; }
.voluntary-heading { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-content: start; align-items: baseline; min-height: 4.5rem; column-gap: var(--space-sm); row-gap: var(--space-2xs); }
.voluntary-heading h3 { min-height: 0; }
.voluntary-details { display: contents; }
.voluntary-heading .card-org { min-width: 0; margin-top: 0; color: var(--color-ink-2); font-size: var(--text-sm); font-weight: 500; text-align: right; }
.voluntary-affiliation { grid-column: 1 / -1; justify-self: end; margin-top: 0; color: var(--color-ink-3); font-size: var(--text-sm); text-align: right; }
.card-v { display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-xl); }
.card-v .card-when { padding-top: 0; margin-bottom: var(--space-sm); }
.card-v h3 { font-size: var(--text-xl); line-height: 1.25; }
.card-text { margin-top: var(--space-sm); color: var(--color-ink-2); }
.voluntary-cards .card-text { min-height: 4.5em; }
.voluntary-more { align-self: flex-end; min-height: 2.5rem; margin-top: auto; border: 1px solid var(--color-rule); background: transparent; color: var(--color-deep); }
.voluntary-more:hover { border-color: var(--color-accent); background: var(--color-accent); color: var(--color-on-accent); }
.voluntary-more:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.card-v .tags { margin-top: var(--space-md); }

/* Keep school names, overviews and tags on one line across the row: titles reserve two lines */
@media (min-width: 1001px) {
  .cards-v:not(.voluntary-cards) .card-v h3 { min-height: 2.5em; }
  .cards-v:not(.voluntary-cards) .card-text { min-height: 3.3em; }
}
details > p { max-width: 60ch; padding-bottom: var(--space-xs); color: var(--color-ink-2); }

/* Tools */

.tool-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3xl) var(--space-4xl); }
.tool-group h3 { margin-bottom: var(--space-md); color: var(--color-ink-3); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.tool-logos { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md) var(--space-lg); padding: 0; list-style: none; }
.tool-logo { position: relative; display: grid; place-items: center start; width: 2.75rem; height: 2.75rem; color: var(--color-ink-3); transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.tool-logo-grok { --tool-color: var(--color-tool-grok); }
.tool-logo-codex { --tool-color: var(--color-tool-codex); }
.tool-logo-opencode { --tool-color: var(--color-tool-opencode); }
.tool-logo-copilot { --tool-color: var(--color-tool-copilot); }
.tool-logo-word, .tool-logo-powerpoint { --tool-color: var(--color-tool-office); }
.tool-logo-photoshop, .tool-logo-illustrator, .tool-logo-indesign { --tool-color: var(--color-tool-adobe); }
.tool-logo-canva { --tool-color: var(--color-tool-canva); }
.tool-logo-excel { --tool-color: var(--color-tool-excel); }
.tool-logo-python { --tool-color: var(--color-tool-python); }
.tool-logo-rstudio { --tool-color: var(--color-tool-posit); }
.tool-logo-mixpanel { --tool-color: var(--color-tool-mixpanel); }
.tool-logo-github { --tool-color: var(--color-tool-github); }
.tool-logo-claude { --tool-color: var(--color-tool-anthropic); }
.tool-logo-api { --tool-color: var(--color-accent); }
.tool-logo svg, .tool-logo img { display: block; width: 2rem; height: 2rem; object-fit: contain; filter: grayscale(1); opacity: 0.72; transform: scale(var(--logo-scale, 1)); transition: filter var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out); }
/* Optical sizing: these marks carry built-in padding, so scale them to match the full-bleed tiles. */
.tool-logo-codex, .tool-logo-canva, .tool-logo-excel, .tool-logo-word, .tool-logo-powerpoint { --logo-scale: 1.2; }
.tool-logo-python { --logo-scale: 1.1; }
.tool-logo-app img { border-radius: 24%; }
.tool-logo-brand-tile::before { position: absolute; top: 50%; left: 0; width: 2rem; height: 2rem; border-radius: 24%; background: var(--color-paper-3); content: ""; transform: translateY(-50%); }
.tool-logo-brand-tile img { position: relative; box-sizing: border-box; padding: 0.4rem; }
.tool-logo::after { position: absolute; z-index: 2; bottom: calc(100% + 0.35rem); left: 1rem; padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); background: var(--color-deep); color: var(--color-on-deep); content: attr(aria-label); font-size: var(--text-xs); line-height: 1.2; white-space: nowrap; opacity: 0; pointer-events: none; transform: translate(-50%, 0.2rem); transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.tool-logo:hover { color: var(--tool-color, var(--color-accent)); transform: translateY(-2px); }
.tool-logo:hover svg, .tool-logo:hover img { filter: none; opacity: 1; }
.tool-logo-opencode:hover::before { background: var(--color-tool-opencode); }
.tool-logo-opencode:hover img { filter: brightness(0) invert(1); }
.tool-logo:hover::after { opacity: 1; transform: translate(-50%, 0); }
.tool-logo-codex, .tool-logo-rstudio, .tool-logo-canva { --tool-color: var(--color-accent); }
.tool-logo-concept svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-logo-generic { --tool-color: var(--color-accent); }
.language-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); margin: 0; padding: 0; list-style: none; }
.language-card { display: flex; align-items: center; gap: var(--space-md); min-width: 0; padding: var(--space-md) 0; border-block: var(--rule-hair); }
.language-flag { flex: 0 0 auto; width: 2rem; height: 1.3333rem; overflow: hidden; stroke: none; border-radius: 0.15rem; box-shadow: 0 0 0 1px var(--color-rule); filter: grayscale(1); opacity: 0.72; transition: filter var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out); }
.language-card:hover .language-flag { filter: none; opacity: 1; }
.language-card h3 { color: var(--color-deep); font-size: var(--text-base); font-weight: 600; }
.language-card p { margin-top: var(--space-2xs); color: var(--color-ink-3); font-size: var(--text-sm); }

/* FAQ: a short prompt with a contact link, then questions on light panels that open one by one */

.faq { gap: var(--space-2xl); }
.faq-head { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xl); }
.faq-title.faq-title { font-family: var(--font-body); font-weight: 600; font-size: var(--text-2xl); line-height: 1.2; letter-spacing: -0.02em; text-transform: none; color: var(--color-ink-2); }
.faq-cta { grid-column: auto; grid-row: auto; align-self: flex-start; }

.faq-list { display: grid; gap: var(--space-sm); }
.faq-item { margin: 0; border-radius: var(--radius-sm); background: var(--color-panel); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg);
  min-height: 3.5rem;
  padding: var(--space-md) var(--space-lg);
  color: var(--color-deep);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.faq-item summary::after {
  content: "";
  flex: none;
  width: 0.55rem; height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--dur-base) var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--color-accent); }
.faq-item p { max-width: none; padding: 0 var(--space-lg) var(--space-lg); color: var(--color-ink-2); }
.faq-item p a { color: var(--color-accent); text-decoration: underline; text-decoration-color: var(--color-gold-line); text-underline-offset: 0.2em; }
.faq-item p a:hover { color: var(--color-accent-hover); }

/* Contact: one quiet line on the navy band */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.closing {
  margin-top: var(--section-space);
  background: var(--color-deep);
  color: var(--color-on-deep);
}
.closing-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-md) var(--space-xl); padding: var(--space-xl) var(--edge); font-size: var(--text-sm); }

.contact { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-xl); margin: 0; padding: 0; list-style: none; }
.contact li { overflow-wrap: anywhere; }
.contact a { text-decoration: underline; text-decoration-color: var(--color-rule-deep); text-underline-offset: 0.25em; transition: text-decoration-color var(--dur-fast) var(--ease-out); }
.contact a:hover { text-decoration-color: var(--color-gold); }

/* Social icons sit on the right; the copyright drops to its own line */
.social { display: flex; gap: var(--space-xs); margin: 0 -0.75rem; padding: 0; list-style: none; }
.social a { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; color: var(--color-on-deep); transition: color var(--dur-fast) var(--ease-out); }
.social a:hover { color: var(--color-gold); }
.social svg { width: 1.25rem; height: 1.25rem; fill: currentColor; stroke: none; }
.social .social-line { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.foot { flex-basis: 100%; color: var(--color-on-deep-2); }
.consent-open { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-decoration-color: var(--color-rule-deep); text-underline-offset: 0.25em; cursor: pointer; }
.consent-open:hover { text-decoration-color: var(--color-gold); }

/* Cookie consent: a full-width bar at the bottom, shown until the visitor chooses; it stacks on phones */
.consent { position: fixed; z-index: 50; inset: auto 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-md) var(--space-2xl); padding: var(--space-lg) var(--edge); border-top: 1px solid var(--color-rule); background: var(--color-card); box-shadow: var(--shadow-bar); font-size: var(--text-sm); color: var(--color-ink-2); }
.consent p { flex: 1 1 32rem; max-width: 72ch; }
.consent[hidden] { display: none; }
.consent strong { color: var(--color-deep); font-weight: 600; }
.consent-actions { display: flex; flex: 0 0 auto; gap: var(--space-sm); }
.consent .btn { min-height: 2.5rem; }
.consent .btn-secondary { border: 1px solid var(--color-rule); background: transparent; color: var(--color-deep); }
.consent .btn-secondary:hover { border-color: var(--color-deep); }
@media (max-width: 720px) {
  .consent { padding: var(--space-md) var(--edge); }
  .consent-actions { flex-basis: 100%; }
  .consent-actions .btn { flex: 1; }
}

/* Entrance: one quiet fade for the hero */

@media (prefers-reduced-motion: no-preference) {
  .hero-left, .hero-role, .portrait, .hero-right { animation: rise var(--dur-slow) var(--ease-out) both; }
  .hero-role { animation-name: rise-role; }
  .portrait { animation-delay: 80ms; }
  .hero-right { animation-delay: 160ms; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes rise-role { from { opacity: 0; transform: rotate(180deg) translateY(-12px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
  :root { --edge: var(--gutter); }
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "links year" "role role" "photo photo" "text text" "name name";
    row-gap: var(--space-xl);
    padding-top: 6rem;
  }
  .hero-left, .hero-right { display: contents; }
  .hero-links { grid-area: links; }
  .hero-year { grid-area: year; align-self: start; }
  .hero-role {
    grid-area: role;
    height: auto;
    line-height: 0.9;
    writing-mode: horizontal-tb;
    transform: none;
    font-size: clamp(4rem, 22vw, 9rem);
    white-space: normal;
  }
  .hero-role { animation-name: rise; }
  .portrait { grid-area: photo; width: 100%; max-width: 30rem; height: auto; aspect-ratio: 3 / 4; }
  .hero-right > div { grid-area: text; }
  .hero-statement { margin-left: 0; font-size: clamp(1.5rem, 6.4vw, 2rem); }
  .hero-name { grid-area: name; }
}

@media (max-width: 1000px) {
  .cards-v { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voluntary-heading { min-height: 0; }
  .card, .edu-panel .card { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); padding: var(--space-xl); }
  .card-when { grid-column: 1 / -1; padding-top: 0; }
  :root { --section-space: 5rem; }
  .section { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .voluntary-cards { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  :root { --section-space: 4rem; }
  .cards-v { grid-template-columns: minmax(0, 1fr); }
  .card-v { padding: var(--space-lg); }
  .card, .edu-panel .card { grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); padding: var(--space-lg); }
  .block-count { text-align: left; }
  .skills { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  .tool-groups { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
  .language-list { grid-template-columns: minmax(0, 1fr); }
  .voluntary-cards .card-text { min-height: 0; }
  .voluntary-heading { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); min-height: 0; }
  .voluntary-heading h3 { overflow-wrap: normal; }
  .voluntary-heading .card-org { overflow-wrap: anywhere; }
  .tool-logos { gap: var(--space-md); }
  .closing { margin-top: var(--section-space); }
  .projects-hero { aspect-ratio: 4 / 3; }
  .project-lime-leaf, .project-hao, .pj-info-split { grid-template-columns: minmax(0, 1fr); }
  .project-hao .pj-info { order: -1; }
  .pj-info-split .pj-note { grid-column: 1; grid-row: auto; }
  /* Phones: pieces come in pairs that share one height (--m is each one's share of the line);
   * wide pieces, and any piece left alone, take the full line. Photos show whole, not cropped. */
  .pj-row, .mosaic, .mosaic-tall { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: flex-start; }
  .pj-row figure, .mosaic figure { flex: 0 0 calc((100% - var(--space-md)) * var(--m, 1)); min-width: 0; margin: 0; }
  .pj-row .m-full, .mosaic .m-full { flex-basis: 100%; }
  /* The badge keeps its wide, cropped strip on phones */
  .mosaic .m-strip img { aspect-ratio: 16 / 9; object-fit: cover; }
  .mosaic img { height: auto; }
  .gallery-open { height: auto; }
  .gallery-rule { margin: var(--space-md) 0; }
  .lightbox { padding: var(--space-3xl) var(--space-md); }
  .project-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
  }

/* Phones: the names already switch roles, so drop the waiting tiles and keep the logo strip short */
@media (max-width: 720px) {
  .role-tile:not([data-slot="0"]) { display: none; }
  .role-tile[data-slot="0"] { aspect-ratio: 5 / 2; }
  .role-panel { grid-row: 2; }
  .role-names button { font-size: var(--text-lg); }
}

/* Phones: a little less padding around the education panel */
@media (max-width: 720px) {
  .edu-panel { padding: var(--space-lg); }
}

@media (max-width: 480px) {
  /* Narrow phones: tighter panel so the three education tags still fit on one line */
  .edu-panel { padding: var(--space-sm); }
  .edu-panel .card { padding: var(--space-lg) var(--space-md); }
  .edu-panel .tags li { padding: 0.2em 0.5em; letter-spacing: 0.02em; }
  .voluntary-heading { column-gap: var(--space-xs); }
}

@media (max-width: 360px) {
  .voluntary-heading { grid-template-columns: minmax(0, 1fr); }
  .voluntary-heading .card-org { text-align: left; }
  .voluntary-affiliation { justify-self: end; }
}
