/* ============================================
   RESET & BASE
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
  -webkit-font-smoothing: antialiased;
}

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

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

/* Line breaks. Headings are balanced, running text avoids a lone word on
   the last line; words are never hyphenated automatically. Non-breaking
   spaces after prepositions, before dashes etc. come from typograph()
   in js/i18n.js; <html lang> follows the page language. */
h1, h2, h3, h4,
.hero__title,
.section-title,
.about__title,
.about__lead,
.case-title,
.project-card__title {
  text-wrap: balance;
  hyphens: manual;
  overflow-wrap: normal;
}

p, li, dd, dt, figcaption {
  text-wrap: pretty;
  hyphens: manual;
}

/* short labels: even lines instead of a long line and a short one */
.skills__item,
.stat__label,
.education__meta,
.case-facts__value {
  text-wrap: balance;
}

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-left: var(--content-pad);
  padding-right: var(--content-pad);
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* ============================================
   LIGHT THEME GOLD
   Large accent text is flat gold (--color-accent); small text and
   links stay in the text colour. The dark theme keeps pale gold,
   so every rule here skips it.
   ============================================ */
/* small accent text → text colour */
html:not([data-theme="dark"]) .timeline__duration { color: var(--color-text); }

/* small links: text colour, no underline, hover dims */
html:not([data-theme="dark"]) .text-link::after { display: none; }
html:not([data-theme="dark"]) .text-link { transition: opacity 0.2s var(--ease); }
html:not([data-theme="dark"]) .text-link:hover { opacity: 0.7; }

/* Hero mock-up (decoration, not real buttons): the "button" is a clean
   pink-to-lavender glass pill — fully opaque, no dark edges, a lavender shadow */
html:not([data-theme="dark"]) .hg__button {
  background: linear-gradient(110deg, var(--mock-btn-from) 0%, var(--mock-btn-to) 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 6px 16px var(--mock-btn-shadow);
  opacity: 1;
}

/* the bar on it is light again, as before (--color-on-media at 0.85) */
html:not([data-theme="dark"]) .hg__button::after { background: var(--color-on-media); }

html:not([data-theme="dark"]) .hg__dot--accent {
  background: linear-gradient(180deg, var(--mock-dot-top) 0%, var(--mock-dot-bottom) 100%);
  box-shadow: inset 0 1px 0 var(--mock-dot-highlight);
}

/* pink glow around the mock-up a little weaker (the orb behind the cards and
   the hero's right-hand glow); sizes, blur and positions as before */
html:not([data-theme="dark"]) .hg__orb.hg--pink { background: var(--glow-pink-halo); }
html:not([data-theme="dark"]) .hero {
  background:
    radial-gradient(ellipse 60% 55% at 22% 40%, var(--glow-lilac), transparent 60%),
    radial-gradient(ellipse 55% 55% at 82% 62%, var(--glow-pink-halo), transparent 62%),
    radial-gradient(ellipse 50% 50% at 55% 30%, var(--glow-peach), transparent 60%);
}

/* focus: gold is too pale on the light page, use the text colour */
html:not([data-theme="dark"]) :is(a, button):focus-visible { outline-color: var(--color-text); }

html:not([data-theme="dark"]) ::selection {
  background: var(--color-accent-selection);
  color: var(--color-text);
}

/* Scroll reveal (js/reveal.js): only blocks the script marks, only while
   html has .js-reveal; transform and opacity only, the block keeps its place */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-distance));
  transition:
    opacity var(--reveal-duration) var(--reveal-ease),
    transform var(--reveal-duration) var(--reveal-ease);
  transition-delay: calc(var(--reveal-step, 0) * var(--reveal-stagger));
}

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

@media print {
  .js-reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .js-reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============================================
   SHARED UI
   ============================================ */
.pill,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.pill {
  gap: var(--space-2);
  padding: 10px var(--space-5);
}

.icon-btn {
  width: var(--control-size);
  height: var(--control-size);
  padding: 0;
}

.pill:hover,
.icon-btn:hover {
  border-color: var(--color-text);
}

.label {
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
/* ============================================
   NAV
   ============================================ */
.nav {
  /* Follows the user while scrolling; once the page has scrolled
     (.is-scrolled, js/main.js) it gets a glass bar and looks 16px shorter.
     Its box never changes size — the compact look is a transform plus a
     ::before bar inset by the same 8px — so nothing below it moves and the
     scroll position can't bounce the state back and forth. */
  --nav-shrink: calc(var(--space-5) - var(--space-3)); /* 8px less padding top and bottom */
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--content-pad);
  border-bottom: 1px solid transparent;
  pointer-events: none;                 /* the empty edges don't block the page */
  transition: transform 0.2s ease-out;
}

.nav > * { pointer-events: auto; }

.nav::before {
  content: '';
  position: absolute;
  inset: var(--nav-shrink) 0;
  z-index: -1;
  background: var(--color-surface-glass);
  border-bottom: 1px solid var(--color-divider);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.nav.is-scrolled { transform: translateY(calc(-1 * var(--nav-shrink))); }
.nav.is-scrolled::before { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .nav,
  .nav::before { transition: none; }
}

/* In-page anchors: sections start with a --space-section top padding, so
   scroll past it and land the section label 40px under the sticky header
   (≈72px tall once scrolled). The previous block then stays out of view. */
[id] { scroll-margin-top: calc(72px + var(--space-10) - var(--space-section)); }
#home { scroll-margin-top: 0; }

/* Loading: the page is hidden until the scripts have finished it (inline
   script in <head>, js/main.js); the header takes its state without animating */
html.is-booting body { visibility: hidden; }
html.is-booting .nav,
html.is-booting .nav::before { transition: none; }
/* opened at an anchor: placed there at once, no smooth scroll on the way */
html.is-anchoring { scroll-behavior: auto; }
/* Contact fills the screen: show it whole, from its top */
#contact { scroll-margin-top: 0; }

@media (max-width: 860px) {
  /* header isn't pinned here */
  [id] { scroll-margin-top: calc(var(--space-6) - var(--space-section)); }
}

.nav__name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-size);
  font-family: var(--font-display);
  font-size: var(--fs-brand);
  font-weight: var(--fw-bold);
  line-height: 28px;
  letter-spacing: var(--ls-display);
}

.nav__mark {
  flex: none;
  width: var(--nav-mark-size);
  height: var(--nav-mark-size);
  color: var(--color-accent);
  transform: translateY(1px); /* centred on the lowercase letters, not on the line */
}

/* next to the full menu pill there is no room for it */
@media (min-width: 861px) and (max-width: 899px) {
  .nav__mark { display: none; }
}

@media (max-width: 560px) {
  .nav__name { gap: calc(var(--space-1) * 1.5); }
  .nav__mark { --nav-mark-size: var(--space-4); }
}

/* narrower, next to the menu pill, the name needs its two lines */
@media (min-width: 960px) {
  .nav__name { white-space: nowrap; }
}

.nav__links {
  position: relative;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  list-style: none;
  background: var(--color-surface-glass);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(12px);
}

.nav__links a {
  display: block;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text-muted);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav__links a:hover {
  color: var(--color-text);
}

/* Active item follows the section in view (js/main.js). A single dark
   pill (.nav__indicator) slides under it; without JS the active link
   simply gets the same background. */
.nav__links li { position: relative; z-index: 1; }

.nav__links a[aria-current] {
  background: var(--color-inverse-bg);
  color: var(--color-inverse-text);
}

.nav__links.has-indicator a[aria-current] { background: transparent; }

.nav__links .nav__indicator {
  position: absolute;
  z-index: 0;
  top: var(--space-1);
  bottom: var(--space-1);
  left: 0;
  width: var(--ind-w, 0);
  transform: translateX(var(--ind-x, 0));
  border-radius: var(--radius-pill);
  background: var(--color-inverse-bg);
  opacity: 0;
  pointer-events: none;
}

.nav__links.has-indicator .nav__indicator { opacity: 1; }

/* animate only after the first placement, so it doesn't fly in on load */
.nav__links.is-ready .nav__indicator {
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
}

.nav__links a { transition: color 0.3s var(--ease), background-color 0.2s var(--ease); }

.nav__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Text link with an underline that draws in from the left on hover
   and leaves to the right (used by Resume) */
.text-link {
  position: relative;
}

.text-link {
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text);
  padding: 0 var(--space-2);
}

.text-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}

.text-link::after { left: var(--space-2); right: var(--space-2); }

.text-link:hover::after,
.text-link:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Language: EN | RU — no underline, highlight only: the active one is
   solid and semibold, the other one quiet (muted colour at 60%) and
   brightens on hover */
.lang-switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-2);
}

.lang-switch__opt {
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  opacity: 0.6;
  transition: color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.lang-switch__opt:hover,
.lang-switch__opt:focus-visible { opacity: 1; color: var(--color-text); }

.lang-switch__opt[aria-current="true"] {
  color: var(--color-text);
  font-weight: var(--fw-semibold);
  opacity: 1;
}

.lang-switch__sep {
  width: 1px;
  height: 16px;
  background: var(--color-border-strong);
}

/* Theme toggle shows a moon in light mode, a sun in dark mode */
.theme-toggle__sun { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: none; }
[data-theme="dark"] .theme-toggle__sun { display: block; }

@media (max-width: 860px) {
  /* three rows here — too tall to keep pinned on a phone, so it scrolls
     away until the compact mobile header is done */
  .nav { flex-wrap: wrap; position: relative; }
  /* not pinned here, so no compact shift: the bar just fades in over the whole header */
  .nav.is-scrolled { transform: none; }
  .nav::before { inset: 0; }
  .nav__menu { order: 3; width: 100%; }
  .nav__links { justify-content: space-between; }
  .nav__links a { padding: var(--space-2) var(--space-3); white-space: nowrap; }
}

/* five items don't fit a phone: the pill scrolls sideways inside itself
   instead of pushing the page wider (until the compact mobile header) */
@media (max-width: 480px) {
  .nav__links {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav__links::-webkit-scrollbar { display: none; }
}

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  overflow: hidden;
  /* three soft glows, positions taken from the Figma frame */
  background:
    radial-gradient(ellipse 60% 55% at 22% 40%, var(--glow-lilac), transparent 60%),
    radial-gradient(ellipse 55% 55% at 82% 62%, var(--glow-pink), transparent 62%),
    radial-gradient(ellipse 50% 50% at 55% 30%, var(--glow-peach), transparent 60%);
}

.hero__inner {
  position: relative;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 57px var(--content-pad) 0;
}

.hero__name {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-display);
  color: var(--color-accent);
  /* Visual gap name → "Product" must beat "Product" → "Designer" (~0.18em
     of the title). Margin scales with the title so the ratio holds. */
  margin-bottom: calc(var(--fs-display-xl) * 0.24);
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--fs-display-xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  font-variation-settings: "opsz" 96;
}

.hero__line { display: block; }

/* Mask Hover Reveal layer (see js/hero-reveal.js).
   Same box as Figma blocks 2/3: 649 x 316.5 px at a 171.45px title,
   i.e. 3.7854em x 1.846em of the title font size, anchored at the
   title's top-left corner so it sits exactly on block 1. */
.hero__reveal {
  position: absolute;
  top: 0;
  left: 0;
  font-size: var(--fs-display-xl);
  width: 3.7854em;
  height: 1.846em;
  pointer-events: none;
}

/* Dark theme: second line becomes an outline, as in Figma */
[data-theme="dark"] .hero__line--outline {
  color: transparent;
  -webkit-text-stroke: 1px var(--color-text-muted);
}

.hero__headline {
  position: relative;
}

/* ---------- Glass composition (right side of the hero) ----------
   Frosted UI pieces over soft colour orbs. Pieces are placed in a
   400×300 box (left/top in %, sizes in cqw) and assemble once on load
   (js/main.js). Only shown where there is room next to the title. */
.hero-glass {
  display: none;
  position: absolute;
  /* may bleed a little into the page margin: the outer edge of the box
     only holds soft orbs */
  right: calc(var(--content-pad) * -0.5);
  /* vertically centred on the whole left block (name + title + badge) */
  top: calc(var(--fs-display-xl) * -0.8);
  width: calc(var(--fs-display-xl) * 2.45);
  aspect-ratio: 2 / 3;
  container-type: inline-size;
  pointer-events: none;
}

@media (min-width: 1024px) {
  .hero-glass { display: block; }
}

.hg__p {
  position: absolute;
  width: var(--w);
  height: var(--h);
  border-radius: var(--rad);
  transform: translate(-50%, -50%);
}

/* Colour orbs — blurred, so the glass above has something to frost */
.hg__orb {
  filter: blur(18px);
}
.hg__orb.hg--pink  { background: var(--glow-pink); }
.hg__orb.hg--lilac { background: var(--glow-lilac); }
.hg__orb.hg--peach { background: var(--glow-peach); }

/* Frosted glass: page-tinted top-left fading into a clear sheen */
.hg__glass {
  background: linear-gradient(135deg, var(--color-surface-glass), var(--color-media-glass));
  border: 1px solid var(--color-media-glass-border);
  box-shadow: 0 1.5cqw 5cqw -1.5cqw var(--color-border-strong);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.hg__avatar {
  background: linear-gradient(135deg, var(--glow-lilac), var(--glow-pink));
  border: 1px solid var(--color-media-glass-border);
}
.hg__avatar--peach {
  background: linear-gradient(135deg, var(--glow-peach), var(--glow-pink));
}

.hg__bar {
  background: var(--color-text);
  opacity: 0.22;
}
.hg__bar--soft { opacity: 0.12; }

/* Mini chart columns: tinted glass */
.hg__col {
  border: 1px solid var(--color-media-glass-border);
}
.hg__col.hg--lilac { background: linear-gradient(180deg, var(--glow-lilac), var(--color-media-glass)); }
.hg__col.hg--pink  { background: linear-gradient(180deg, var(--glow-pink), var(--color-media-glass)); }
.hg__col.hg--peach { background: linear-gradient(180deg, var(--glow-peach), var(--color-media-glass)); }

.hg__chip {
  border: 1px solid var(--color-media-glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hg__chip.hg--pink  { background: var(--glow-pink); }
.hg__chip.hg--peach { background: var(--glow-peach); }

/* Toggle: glass track with a white knob on the "on" side.
   .is-off is only set by js/main.js during the load animation, so the
   final state (and the no-JS / reduced-motion state) is "on". */
.hg__toggle {
  background: linear-gradient(90deg, var(--glow-lilac), var(--glow-pink));
  border: 1px solid var(--color-media-glass-border);
}
/* "off" track: a neutral glass layer that fades out when switching on */
.hg__toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--color-surface-glass);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.hg__toggle::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0.75cqw;
  width: 5.5cqw;
  height: 5.5cqw;
  border-radius: 50%;
  background: var(--color-on-media);
  transform: translateY(-50%);
  transition: transform 0.55s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.hg__toggle.is-off::before { opacity: 1; }
.hg__toggle.is-off::after {
  transform: translate(calc(-1 * (var(--w) - 7cqw)), -50%);
}

/* The one solid accent: a call-to-action button */
.hg__button {
  background: var(--color-accent-fill);
  opacity: 0.9;
}
.hg__button::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20cqw;
  height: 2cqw;
  border-radius: 1cqw;
  background: var(--color-on-media);
  opacity: 0.85;
}

.hg__dot {
  background: var(--glow-pink);
}
.hg__dot--accent {
  background: var(--color-accent-fill);
}

/* Badge sits under the title, on the same left edge — where Figma
   places the scroll-down recording (x 48, ~32px below "Designer") */
.hero__aside {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-4);
}

/* beside the badge, so the block keeps its height */
.hero__level {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  color: var(--color-text-muted);
  text-wrap: balance;
}

/* the ring text starts ~10% inside the badge box; nudge it so the
   circle lines up optically with the stem of "D" */
.hero__aside .scroll-badge {
  translate: -6% 0;
}

/* Rotating "Scroll down" badge */
.scroll-badge {
  position: relative;
  flex: none;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  color: var(--color-text);
}

.scroll-badge__ring {
  position: absolute;
  inset: 0;
  animation: badge-spin 14s linear infinite;
}

.scroll-badge__ring text {
  font-family: var(--font-body);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  fill: var(--color-text-muted);
}

@keyframes badge-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .hero__inner { min-height: 0; padding-top: var(--space-12); }
  .scroll-badge { width: 88px; height: 88px; }
}

@media (max-width: 420px) {
  .scroll-badge { width: 64px; height: 64px; }
}

/* ============================================
   ABOUT
   ============================================ */
.about {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-section) var(--content-pad) 0;
}

.about__grid {
  display: grid;
  /* Figma columns: 290 / 322 / 355 */
  grid-template-columns: 0.9fr 1fr 1.1fr;
  gap: var(--space-10);
  align-items: start;
}

/* Two columns: the photo takes the height of the text next to it, so both end on one line */
.about__grid > .about__photo { align-self: stretch; }

.about__title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: var(--fw-bold);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  color: var(--color-accent);
  max-width: 4ch; /* breaks "About me" onto two lines like Figma */
}

.about__sub {
  margin-top: var(--space-6);
  max-width: 52ch;
  color: var(--color-text-muted);
}

.about__photo {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--color-surface); /* shows while the photo loads */
  overflow: hidden;
}

/* Cropped mostly at the bottom, so the figure stays in frame */
.about__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
}

.about__lead {
  margin-top: var(--space-5);
  max-width: 64ch;
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  line-height: var(--lh-lead);
  letter-spacing: var(--ls-display);
}

.about__text {
  margin-top: var(--space-6);
  max-width: 64ch;
  color: var(--color-text-muted);
}

.skills {
  margin-top: var(--space-8);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  list-style: none;
}

.skills__item {
  min-height: 74px;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
}

@media (max-width: 1024px) {
  .about__grid { grid-template-columns: 1fr 1fr; }
  .about__intro { grid-column: 1 / -1; }
}

/* one column: heading, photo, text */
@media (max-width: 860px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__title { max-width: none; }
  .about__grid > .about__photo { align-self: start; }
  .about__photo {
    max-width: var(--about-photo-max);
    aspect-ratio: 818 / 1178;
  }
}

/* ============================================
   SECTION HEADINGS (shared by Experience and later sections)
   ============================================ */
.section-title {
  margin-top: var(--space-6);
  max-width: 25ch; /* 3 even lines for the Experience heading at 1280 */
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-display);
}

.section-title .accent { color: var(--color-accent); }
.section-title .accent-soft { color: var(--color-accent-soft); }

/* ============================================
   STATS
   ============================================ */
.stats {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-section) var(--content-pad) 0;
}

/* one row of equal cards, however many are shown (the case count card is
   hidden while there are fewer than 3 cases, js/projects.js) */
.stats__grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-4);
  list-style: none;
}

.stat[hidden] { display: none; }

.stat {
  display: flex;
  flex-direction: column;
  padding: var(--space-7);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.stat__index {
  font-size: var(--fs-caption);
  line-height: 24px;
  color: var(--color-text-muted);
}

.stat__value {
  margin-top: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  line-height: var(--lh-solid);
  letter-spacing: var(--ls-display);
}

.stat__label {
  margin-top: var(--space-3);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text-muted);
}

@media (max-width: 1024px) {
  .stats__grid { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* three cards: the last one takes the whole second row */
  .stats__grid[data-count="3"] > .stat:last-child { grid-column: 1 / -1; }
}

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

/* ============================================
   EXPERIENCE — timeline
   ============================================ */
.experience {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-section) var(--content-pad) 0;
}

.timeline {
  margin-top: var(--space-content);
  list-style: none;
}

.timeline__row {
  display: grid;
  /* Figma: 48 / 418 / 501 with 40px gaps */
  grid-template-columns: 48px minmax(0, 0.83fr) minmax(0, 1fr);
  gap: var(--space-10);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-divider);
}

.timeline__index,
.timeline__role {
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text-muted);
}

.timeline__company {
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-display);
}

.timeline__role {
  margin-top: var(--space-2);
}

/* lines only *between* jobs: none above the first one (nothing to separate),
   and no row padding there, so intro → first job is the usual content gap */
.timeline__row:first-child {
  border-top: 0;
  padding-top: 0;
}

.timeline__row:last-child { padding-bottom: 0; }

/* duration sits tight under role/dates: same group, accent colour */
.timeline__duration {
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-accent);
}

/* first lines of the three columns share one axis: the index and the
   description are centred on the company name's line (36px line box) */
.timeline__index {
  padding-top: calc((var(--fs-h4) * var(--lh-snug) - var(--fs-small) * var(--lh-ui)) / 2);
}

.timeline__text {
  padding-top: calc((var(--fs-h4) * var(--lh-snug) - var(--fs-body-lg) * var(--lh-body)) / 2);
}

.timeline__text {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .timeline__row {
    grid-template-columns: 32px 1fr;
    gap: var(--space-3) var(--space-6);
  }
  .timeline__text { grid-column: 2; }
}

@media (max-width: 480px) {
  .timeline__row { grid-template-columns: 1fr; }
  .timeline__text { grid-column: auto; }
}

/* ============================================
   SHARED — inline icons, accent spans, wide headings
   ============================================ */
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.section-title--wide { max-width: 25ch; }

/* Two-part heading (Experience): from 1024px the plain part takes the first
   line and the coloured part the second; narrower, the lines are balanced */
.br-desktop { display: none; }

@media (min-width: 1024px) {
  .br-desktop { display: inline; }
  .section-title--split { max-width: none; }
}

/* ============================================
   EDUCATION
   ============================================ */
.education {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-section) var(--content-pad) 0;
}

.education__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.education__title {
  margin-top: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  line-height: var(--lh-solid);
  letter-spacing: var(--ls-display);
}

.education__meta {
  margin-top: var(--space-3);
  color: var(--color-text-muted);
}

.work__head .section-title { margin-top: 0; }

/* ============================================
   TOOLKIT
   ============================================ */
.tools {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-section) var(--content-pad) 0;
}

.tools > .section-title { margin-top: 0; }

/* Rows are spaced by the chips' own margins, so the zero-height line breaks
   js/main.js puts in add nothing. Until then the right edge is kept free for
   one opened icon: rows wrap as if a chip were already open. */
.tools__chips {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-3);
  margin-top: calc(var(--space-content) - var(--space-3) / 2);
  margin-bottom: calc(var(--space-3) / -2);
  list-style: none;
}

.tools__break {
  flex-basis: 100%;
  height: 0;
}

.tool {
  display: flex;
  align-items: center;
  min-height: var(--control-size);
  margin-block: calc(var(--space-3) / 2);
  padding: 0 var(--space-5);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  white-space: nowrap;
  cursor: default;
  transition: border-color var(--tool-transition), background-color var(--tool-transition);
}

.tool__slot {
  flex: none;
  display: flex;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width var(--tool-transition), opacity var(--tool-transition);
}

.tool__icon {
  flex: none;
  width: var(--tool-icon-size);
  height: var(--tool-icon-size);
  background-color: var(--color-accent);
  -webkit-mask: var(--tool-icon) center / contain no-repeat;
  mask: var(--tool-icon) center / contain no-repeat;
}

.tool__icon--figma { --tool-icon: url(../images/icons/tools/figma.svg); }
.tool__icon--figma_make { --tool-icon: url(../images/icons/tools/figma_make.svg); }
.tool__icon--claude { --tool-icon: url(../images/icons/tools/claude.svg); }
.tool__icon--claude_code { --tool-icon: url(../images/icons/tools/claude_code.svg); }
.tool__icon--cursor { --tool-icon: url(../images/icons/tools/cursor.svg); }
.tool__icon--codex { --tool-icon: url(../images/icons/tools/codex.svg); }
.tool__icon--miro { --tool-icon: url(../images/icons/tools/miro.svg); }
.tool__icon--procreate { --tool-icon: url(../images/icons/tools/procreate.svg); }
.tool__icon--adobe_photoshop { --tool-icon: url(../images/icons/tools/adobe_photoshop.svg); }
.tool__icon--adobe_illustrator { --tool-icon: url(../images/icons/tools/adobe_illustrator.svg); }
.tool__icon--adobe_after_effects { --tool-icon: url(../images/icons/tools/adobe_after_effects.svg); }
.tool__icon--supabase { --tool-icon: url(../images/icons/tools/supabase.svg); }
.tool__icon--git { --tool-icon: url(../images/icons/tools/git.svg); }
.tool__icon--jira { --tool-icon: url(../images/icons/tools/jira.svg); }
.tool__icon--confluence { --tool-icon: url(../images/icons/tools/confluence.svg); }

@media (hover: hover) {
  .tools__chips { padding-right: var(--tool-slot); }
  .tools__chips.is-set { padding-right: 0; }

  .tool:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface);
  }

  .tool:hover .tool__slot {
    width: var(--tool-slot);
    opacity: 1;
  }
}

@media (hover: none) {
  .tool__slot {
    width: var(--tool-slot);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool,
  .tool__slot { transition: none; }
}

.tag {
  padding: 10px var(--space-5);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
}

/* ============================================
   SELECTED WORK
   ============================================ */
.work {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-section) var(--content-pad) 0;
}

/* heading on the left, "view all" on its baseline on the right;
   when there is no room the link wraps under the heading, on the left */
.work__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 var(--space-6);
}

.work__all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-size);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text-muted);
  transition: color 0.2s var(--ease);
}

/* a two-line heading keeps the link on its first line; on a phone it goes below */
@media (min-width: 561px) {
  .work__head { flex-wrap: nowrap; }
  .work__head .section-title { min-width: 0; }
  .work__all { flex: none; }
}

.work__all .icon { transition: transform 0.2s var(--ease); }

.work__all:hover,
.work__all:focus-visible { color: var(--color-text); }

.work__all:hover .icon,
.work__all:focus-visible .icon { transform: translateX(var(--space-1)); }

/* Project cards: home (featured), projects.html (all) and "Next project"
   on case pages. Built by js/projects.js from data/projects.js.
   Two columns; a card left alone in the last row (1, 3, 5… cards) takes
   the whole row and lays out sideways, so a short list never looks empty. */
/* the cards are drawn by a script: until then the footer stays below the screen */
.projects-grid:empty { min-height: 100svh; }

.projects-grid {
  margin-top: var(--space-content);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-14) var(--space-8);
  list-style: none;
}

.project-item:last-child:nth-child(odd) { grid-column: 1 / -1; }

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  height: 100%;
}

.project-card__media {
  aspect-ratio: 507 / 381;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  transition: transform 0.5s var(--ease);
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.project-card:hover .project-card__media { transform: translateY(-4px); }

.project-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-divider);
}

.project-card__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.project-card__year {
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text-muted);
}

.project-card__title {
  margin-top: var(--space-1);
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-display);
}

.project-card__head .icon {
  flex: none;
  width: 24px;
  height: 24px;
  transition: transform 0.3s var(--ease);
}

.project-card:hover .project-card__head .icon { transform: translate(2px, -2px); }

.project-card__summary {
  max-width: 44ch;
  color: var(--color-text-muted);
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
}

.project-card__tags .tag { padding: 6px var(--space-4); }

/* the wide card: picture on the left, text on the right */
@media (min-width: 900px) {
  .project-item:last-child:nth-child(odd) .project-card {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-12);
    align-items: center;
  }

  .project-item:last-child:nth-child(odd) .project-card__body {
    padding-top: 0;
    padding-left: var(--space-12);
    border-top: 0;
    border-left: 1px solid var(--color-divider);
  }
}

@media (max-width: 720px) {
  .projects-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); }
}

/* ============================================
   ALL PROJECTS PAGE (projects.html)
   ============================================ */
.projects-page {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-16) var(--content-pad) var(--space-section);
}

@media (max-width: 720px) {
  .projects-page { padding-top: var(--space-10); }
}

/* ============================================
   CONTACT
   ============================================ */
/* Contact is the closing screen: full width, at least one viewport tall
   (below the sticky header), content centred, glow spread across it */
/* With the footer the block fills the screen, so the last scroll shows nothing
   of the section above. Title and links are centred on what is visible: the
   space between the pinned header and the footer. */
.contact {
  --contact-nav: 72px;
  --contact-glow-half: calc(50svh - 36px);
  position: relative;
  min-height: calc(100vh - var(--site-footer-h));
  min-height: calc(100svh - var(--site-footer-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-section) var(--content-pad) calc(var(--space-section) - var(--contact-nav));
  text-align: center;
}

@media (max-width: 860px) {
  .contact { --contact-nav: 0px; } /* header isn't pinned here */
}

/* the footer's two texts are on two lines from here in both languages */
@media (max-width: 400px) {
  .contact { --site-footer-h: calc(2 * var(--space-8) + 1px + 2 * var(--fs-small) * var(--lh-ui) + var(--space-2)); }
}

/* the glow is centred on the title and links */
.contact::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  top: calc(50% + var(--contact-nav) / 2 - var(--contact-glow-half));
  height: calc(2 * var(--contact-glow-half));
  background: radial-gradient(ellipse 55% 50% at 50% 50%, var(--glow-contact), transparent 70%);
  pointer-events: none;
}

.contact__title {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-display-2);
  letter-spacing: var(--ls-display);
  font-variation-settings: "opsz" 96;
}

.contact__links .pill { min-height: var(--control-size); }

.contact__links {
  margin-top: var(--space-10);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  list-style: none;
}

/* ============================================
   FOOTER
   ============================================ */

/* separator line spans exactly the text width (page gutters stay outside) */
.site-footer {
  padding: 0 var(--content-pad);
}

.site-footer__inner {
  max-width: calc(var(--content-width) - 2 * var(--content-pad));
  margin: 0 auto;
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  font-size: var(--fs-small);
  line-height: var(--lh-ui);
  color: var(--color-text-muted);
}

.site-footer__built {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.icon--heart {
  width: 15px;
  height: 15px;
  transform-origin: 50% 60%;
  animation: heartbeat 1.6s var(--ease) infinite;
}

/* lub-dub: two soft pulses, then rest (reduced-motion stops it, see top) */
@keyframes heartbeat {
  0%, 40%, 100% { transform: scale(1); }
  12%           { transform: scale(1.18); }
  24%           { transform: scale(1.04); }
  32%           { transform: scale(1.12); }
}
