/* ==========================================================================
   Belhart Rajesky Pasaribu: portfolio
   Concept: "Decision boundary". An ultramarine field of data points that a
   pointer classifies (k-nearest neighbours), then calm light sections for
   reading. Class colours (Code / AI / Design) are shared with js/field.js.
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('../fonts/bricolage-grotesque-latin-wdth.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  src: url('../fonts/newsreader-latin-wght.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --ultra: #2335e8;      /* hero, contact, nav */
  --frost: #eef0f8;      /* reading sections */
  --frost-2: #e1e5f4;
  --ink: #0d1038;        /* text on frost, certificates section */
  --ink-soft: #4a4f7a;   /* secondary text on frost (7:1) */
  --chalk: #f6f6fb;      /* text on ultra / ink */
  --chalk-soft: rgba(246, 246, 251, .84);
  --amber: #ffb340;      /* AI class, highlights, progress */
  --coral: #ff8f7a;      /* Design class */
  --line: rgba(13, 16, 56, .16);
  --line-chalk: rgba(246, 246, 251, .28);

  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text: 'Newsreader', Georgia, 'Times New Roman', serif;

  --pad: clamp(20px, 4.2vw, 72px);
  --nav-h: 68px;
  --ease: cubic-bezier(.16, .84, .32, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ultra);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.0625rem, .98rem + .3vw, 1.25rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
section, footer { position: relative; z-index: 1; }
[tabindex='-1']:focus { outline: none; }
::selection { background: var(--amber); color: var(--ink); }

.wrap { padding-inline: var(--pad); max-width: 1680px; margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  background: var(--chalk); color: var(--ink);
  font: 600 .95rem var(--display); padding: .7em 1em; border-radius: 3px;
  transition: top .2s var(--ease);
}
.skip:focus { top: 12px; }

/* Lenis (required rules) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
html.menu-open { overflow: hidden; }

/* Focus: one visible, high-contrast ring everywhere */
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 2px; }
.about :focus-visible, .work :focus-visible, .journey :focus-visible { outline-color: var(--ultra); }

/* ---------- Shared type ---------- */
.h2 {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 88%;
  font-size: clamp(2.5rem, 1.4rem + 5.2vw, 6rem);
  line-height: .96;
  letter-spacing: -.028em;
  text-wrap: balance;
}
.mask { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.mask > span { display: block; }

.btn {
  display: inline-block;
  background: var(--chalk); color: var(--ultra);
  font: 600 1rem/1 var(--display);
  padding: 1.05em 1.5em;
  border-radius: 3px;
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { background: var(--amber); color: var(--ink); transform: translateY(-2px); }

.textlink {
  font: 600 1rem/1.2 var(--display);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 2px; background-repeat: no-repeat; background-position: 0 100%;
  padding-bottom: 3px;
  transition: background-size .3s var(--ease);
}
.textlink:hover { background-size: 100% 100%; color: var(--chalk); }
.hero .textlink:hover, .certs .textlink:hover, .lightbox .textlink:hover { background-image: linear-gradient(var(--amber), var(--amber)); color: var(--ink); }

/* Larger invisible hit area for text links and link-buttons (touch targets), layout unchanged */
.textlink, .project__links a { position: relative; }
.textlink::after, .project__links a::after { content: ''; position: absolute; inset: -13px -8px; }

/* ---------- Progress + canvas + tag ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--amber); transform-origin: 0 50%; transform: scaleX(0); }

#field {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
  opacity: 0; transition: opacity .8s var(--ease);
}
html.field-live #field { opacity: 1; }

.knn__tag {
  position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none;
  font: 600 .8125rem/1 var(--display);
  background: var(--chalk); color: var(--ink);
  padding: .42em .65em; border-radius: 2px;
  white-space: nowrap; opacity: 0; transition: opacity .3s;
  will-change: transform;
}
.knn__tag.is-on { opacity: 1; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--pad);
  background: var(--ultra); color: var(--chalk);
  transition: transform .5s var(--ease), background-color .3s;
}
.nav.is-top { background: transparent; }
.nav.is-hidden { transform: translateY(-100%); }
html.menu-open .nav { background: transparent; transform: none; }
.nav__mark { font: 800 1.5rem/1 var(--display); font-stretch: 75%; letter-spacing: -.02em; }
.nav__links { display: flex; gap: clamp(1.2rem, 2.4vw, 2.6rem); }
.nav__links a {
  font: 500 1rem/1 var(--display);
  padding: .5em 0;
  background-image: linear-gradient(var(--amber), var(--amber));
  background-size: 0 2px; background-repeat: no-repeat; background-position: 0 85%;
  transition: background-size .3s var(--ease);
}
.nav__links a:hover, .nav__links a[aria-current='true'] { background-size: 100% 2px; }

.nav__toggle { display: none; width: 48px; height: 48px; position: relative; margin-right: -10px; }
.nav__toggle span {
  position: absolute; left: 12px; right: 12px; height: 2px; background: currentColor;
  transition: transform .4s var(--ease), top .4s var(--ease);
}
.nav__toggle span:first-child { top: 19px; }
.nav__toggle span:last-child { top: 27px; }
.nav__toggle[aria-expanded='true'] span:first-child { top: 23px; transform: rotate(45deg); }
.nav__toggle[aria-expanded='true'] span:last-child { top: 23px; transform: rotate(-45deg); }

.menu {
  position: fixed; inset: 0; z-index: 45;
  background: var(--ultra); color: var(--chalk);
  display: flex; align-items: flex-end;
  padding: calc(var(--nav-h) + 24px) var(--pad) clamp(32px, 8vh, 72px);
  visibility: hidden; opacity: 0;
  transition: opacity .4s var(--ease), visibility 0s .4s;
}
html.menu-open .menu { visibility: visible; opacity: 1; transition: opacity .4s var(--ease), visibility 0s; }
.menu nav { display: flex; flex-direction: column; width: 100%; }
.menu a {
  font: 700 clamp(2.4rem, 11vw, 4.2rem)/1.08 var(--display); font-stretch: 80%; letter-spacing: -.025em;
  padding: .12em 0;
  border-bottom: 1px solid var(--line-chalk);
}
.menu a:hover { color: var(--amber); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; min-height: 100svh;
  color: var(--chalk);
  padding: calc(var(--nav-h) + 20px) var(--pad) clamp(22px, 4vh, 44px);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  column-gap: clamp(12px, 1.6vw, 24px);
  overflow: hidden;
  touch-action: pan-y;
}
/* Static fallback when the field is not running: a plain dot matrix */
html:not(.field-live) .hero,
html:not(.field-live) .contact {
  background-image: radial-gradient(circle, rgba(246, 246, 251, .3) 1.3px, transparent 1.6px);
  background-size: 30px 30px;
}

.hero__hint {
  grid-column: 1 / span 5; grid-row: 1;
  align-self: start;
  max-width: 30rem;
  font: 400 .95rem/1.45 var(--display);
  color: var(--chalk-soft);
}
.hint-touch { display: none; }
/* The hint explains the 3D interaction, so it only shows while the field is running */
html:not(.field-live) .hero__hint { visibility: hidden; }
.hero__legend { display: flex; gap: 1.1rem; margin-top: .7rem; color: var(--chalk); font-weight: 600; }
.hero__legend span, .about__classes dt { display: inline-flex; align-items: center; gap: .5em; }
.hero__legend span::before, .about__classes dt::before {
  content: ''; width: .62em; height: .62em; border-radius: 50%; background: var(--dot);
}
[data-class='code'] { --dot: var(--chalk); }
[data-class='ai'] { --dot: var(--amber); }
[data-class='design'] { --dot: var(--coral); }
.about [data-class='code'] { --dot: var(--ink); }

.hero__name {
  grid-column: 1 / span 9; grid-row: 2; align-self: end;
  position: relative; z-index: 2;
  font-family: var(--display);
  font-weight: 800; font-stretch: 75%;
  font-size: min(13.4vw, 23.5svh);
  line-height: .84;
  letter-spacing: -.035em;
  color: var(--chalk);
}
.ln { display: block; overflow: hidden; padding: .07em 0 .12em; margin: -.07em 0 -.12em; }
.ln > span { display: block; }

.hero__portrait {
  grid-column: 9 / span 4; grid-row: 1 / span 2;
  justify-self: end; align-self: start;
  position: relative; z-index: 1;
}
.hero__portrait-frame {
  height: clamp(250px, 47svh, 520px);
  aspect-ratio: 736 / 977;
  overflow: hidden;
  background: #8a5a52;
}
.hero__portrait-frame img { width: 100%; height: 100%; object-fit: cover; }

.hero__side {
  grid-column: 9 / span 4; grid-row: 2; align-self: end;
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: 1.3rem;
}
.hero__intro { font-size: clamp(1.1rem, .95rem + .55vw, 1.45rem); line-height: 1.4; max-width: 24rem; }
.hero__cta { display: flex; align-items: center; gap: 1.6rem; }

/* ---------- Marquee ---------- */
.marquee { background: var(--amber); color: var(--ink); overflow: hidden; padding: clamp(14px, 1.8vw, 24px) 0; }
.marquee__track { display: flex; width: max-content; animation: marquee 46s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__set { display: flex; flex-shrink: 0; }
.marquee__set li {
  font: 700 clamp(1.5rem, 3vw, 3rem)/1 var(--display); font-stretch: 85%; letter-spacing: -.02em;
  white-space: nowrap;
  display: flex; align-items: center;
}
.marquee__set li::after {
  content: ''; width: .3em; height: .3em; border-radius: 50%; background: var(--ink);
  margin-inline: clamp(1.2rem, 2.4vw, 2.6rem);
}
@keyframes marquee { to { transform: translateX(-33.3333%); } }

/* ---------- About ---------- */
.about { background: var(--frost); padding-block: clamp(88px, 13vw, 200px) clamp(72px, 10vw, 160px); }
.about__lead {
  font-family: var(--display); font-weight: 600; font-stretch: 92%;
  font-size: clamp(2rem, 1rem + 4.3vw, 5rem);
  line-height: 1.04; letter-spacing: -.025em;
  max-width: 17ch;
  text-wrap: balance;
}
.about__lead .w { display: inline-block; white-space: pre; }
.about__body {
  margin-top: clamp(40px, 6vw, 88px);
  margin-left: auto;
  max-width: 36rem;
  display: grid; gap: 1.1em;
}
.about__classes {
  margin-top: clamp(56px, 8vw, 120px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 64px);
  border-top: 1px solid var(--line);
  padding-top: clamp(24px, 3vw, 40px);
}
.about__classes dt { font: 700 1.25rem/1 var(--display); margin-bottom: .6em; }
.about__classes dd { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.5; }

/* ---------- Work ---------- */
.work { background: var(--frost); padding-bottom: clamp(72px, 10vw, 160px); }
.work__head { padding-top: clamp(8px, 2vw, 24px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(12px, 1.6vw, 24px); row-gap: 1.2rem; align-items: end; }
.work__head .h2 { grid-column: 1 / span 7; }
.work__intro { grid-column: 9 / span 4; color: var(--ink-soft); }

.project {
  max-width: 1680px; margin-inline: auto;
  padding-inline: var(--pad);
  margin-top: clamp(64px, 10vw, 160px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(12px, 1.6vw, 24px);
  align-items: center;
}
.project__plate {
  position: relative; overflow: hidden;
  grid-column: 1 / span 8; grid-row: 1;
  aspect-ratio: 5 / 4;
  background: var(--tint);
  display: grid; align-items: center;
}
.project[data-side='left'] .project__plate { grid-column: 5 / span 8; }
.project__tint { position: absolute; inset: -7% 0; background: var(--tint); }
.project__shot {
  position: relative; z-index: 1;
  width: 86%; margin-left: 7%;
  box-shadow: 0 40px 70px -28px rgba(13, 16, 56, .5);
  background: #fff;
}
.project[data-side='left'] .project__shot { margin-left: auto; margin-right: 7%; }
.project__shot img { width: 100%; }

.project__text { grid-column: 9 / span 4; grid-row: 1; position: relative; z-index: 2; }
.project[data-side='left'] .project__text { grid-column: 1 / span 4; }
.project__kind { font: 500 .95rem/1.2 var(--display); color: var(--ink-soft); margin-bottom: 1rem; }
.project__title {
  font: 800 clamp(2.4rem, 1.1rem + 4.2vw, 5rem)/.92 var(--display);
  font-stretch: 80%; letter-spacing: -.03em;
  margin-bottom: 1.2rem; text-wrap: balance;
}
.project__desc { font-size: 1.1rem; line-height: 1.55; }
.project__tech { margin-top: 1rem; font: 500 .95rem/1.5 var(--display); color: var(--ink-soft); }
.project__links { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; }
.project__links a {
  font: 600 1rem/1.2 var(--display);
  background-image: linear-gradient(var(--ultra), var(--ultra));
  background-size: 100% 2px; background-repeat: no-repeat; background-position: 0 100%;
  padding-bottom: 3px;
  transition: background-size .3s var(--ease), color .3s var(--ease);
}
.project__links a:hover { background-size: 100% 100%; color: var(--chalk); }

/* ---------- Education & experience ---------- */
.journey { background: var(--frost); padding-block: clamp(24px, 4vw, 64px) clamp(88px, 12vw, 190px); }
.tl-wrap { position: relative; margin-top: clamp(48px, 7vw, 104px); }
.tl__rail { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--line); }
.tl__fill { position: absolute; inset: 0; background: var(--ultra); transform-origin: 50% 0; transform: scaleY(1); }
html.js:not(.no-anim) .tl__fill { transform: scaleY(0); }

.tl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(56px, 7vw, 104px) minmax(0, 1fr);
  grid-template-rows: repeat(6, auto);
  row-gap: clamp(32px, 4.5vw, 64px);
}
.tl__item { position: relative; grid-column: var(--col); grid-row: var(--row); max-width: 34rem; }
.tl__item--edu { justify-self: end; padding-right: clamp(8px, 2vw, 32px); }
.tl__item--exp { padding-left: clamp(8px, 2vw, 32px); }
.tl__item--span { grid-row: 1 / span 3; }
.tl__item::before {
  content: ''; position: absolute; top: .45rem; width: 14px; height: 14px; border-radius: 50%;
  background: var(--frost); border: 2px solid var(--ink);
  transition: background-color .4s, border-color .4s, transform .4s var(--ease);
}
.tl__item--edu::before { right: calc(clamp(56px, 7vw, 104px) / -2 - 7px); }
.tl__item--exp::before { left: calc(clamp(56px, 7vw, 104px) / -2 - 7px); }
/* Degree runs alongside the three experiences: draw its span */
.tl__item--span::after {
  content: ''; position: absolute; top: .45rem; bottom: 0; width: 6px; border-radius: 3px;
  right: calc(clamp(56px, 7vw, 104px) / -2 - 3px - 22px);
  background: var(--ultra); opacity: .85;
}
.tl__item.is-reached::before { background: var(--ultra); border-color: var(--ultra); transform: scale(1.15); }

.tl__type { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tl__time { font: 600 1rem/1.2 var(--display); color: var(--ultra); margin-bottom: .55rem; }
.tl__title { font: 700 clamp(1.5rem, 1.1rem + 1.4vw, 2.4rem)/1.05 var(--display); font-stretch: 90%; letter-spacing: -.02em; text-wrap: balance; }
.tl__place { font: 500 1rem/1.3 var(--display); color: var(--ink-soft); margin-top: .5rem; }
.tl__desc { margin-top: .8rem; font-size: 1.05rem; line-height: 1.55; }

/* ---------- Certificates ---------- */
.certs { background: var(--ink); color: var(--chalk); padding-block: clamp(80px, 11vw, 170px) clamp(88px, 12vw, 190px); overflow: hidden; }
.certs__layout {
  margin-top: clamp(48px, 7vw, 104px);
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(12px, 1.6vw, 24px);
  row-gap: clamp(48px, 7vw, 112px);
  align-items: start;
}
.cert { position: relative; }
.cert--feature {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(12px, 1.6vw, 24px); align-items: end;
}
.cert--feature .cert__sheet { grid-column: 1 / span 7; }
.cert--feature figcaption { grid-column: 9 / span 4; margin-top: 0; max-width: none; }
.cert--feature h3 { font-size: clamp(1.8rem, 1.1rem + 2.4vw, 3.4rem); line-height: 1; font-weight: 700; font-stretch: 85%; letter-spacing: -.025em; }
.cert--feature figcaption p { font-size: 1.1rem; margin-top: .8rem; }
.cert--a { grid-column: 1 / span 5; grid-row: 2; }
.cert--b { grid-column: 6 / span 4; grid-row: 2; margin-top: clamp(40px, 6vw, 96px); }
.cert--c { grid-column: 10 / span 3; grid-row: 2; margin-top: clamp(16px, 2vw, 32px); }
.cert__sheet { background: #fff; cursor: zoom-in; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); }
.cert__sheet img { width: 100%; transition: transform .8s var(--ease); }
.cert:hover .cert__sheet img { transform: scale(1.035); }
.cert figcaption { margin-top: 1.1rem; max-width: 30rem; }
.cert h3 { font: 600 clamp(1.15rem, 1rem + .6vw, 1.5rem)/1.15 var(--display); letter-spacing: -.01em; text-wrap: balance; }
.cert figcaption p { margin-top: .4rem; color: var(--chalk-soft); font-size: 1rem; line-height: 1.4; }
.cert .textlink { margin-top: 1rem; }

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0; padding: 0; margin: auto;
  width: min(1180px, 94vw); max-height: 94svh;
  background: var(--ink); color: var(--chalk);
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(7, 9, 36, .82); }
.lightbox[open] { animation: lb-in .35s var(--ease); }
@keyframes lb-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.lightbox__inner { display: flex; flex-direction: column; max-height: 94svh; }
.lightbox__bar { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem .8rem; }
.lightbox__title { font: 700 1.15rem/1.2 var(--display); }
.lightbox__meta { font: 400 .95rem/1.3 var(--display); color: var(--chalk-soft); margin-top: .25rem; }
.lightbox__close { position: relative; flex: none; width: 44px; height: 44px; margin: -6px -8px 0 0; }
.lightbox__close span { position: absolute; left: 11px; right: 11px; top: 21px; height: 2px; background: var(--chalk); }
.lightbox__close span:first-child { transform: rotate(45deg); }
.lightbox__close span:last-child { transform: rotate(-45deg); }
.lightbox__stage { flex: 1 1 auto; min-height: 0; overflow: auto; background: #fff; display: grid; place-items: center; }
.lightbox__stage img { max-width: 100%; max-height: calc(94svh - 9.5rem); width: auto; height: auto; object-fit: contain; }
.lightbox__foot { display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; padding: .9rem 1.2rem 1.1rem; }

/* ---------- Contact ---------- */
.contact {
  min-height: 100vh; min-height: 100svh;
  color: var(--chalk);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-block: clamp(72px, 9vw, 130px) 24px;
}
.contact > .wrap { width: 100%; }
.contact__title {
  font-family: var(--display); font-weight: 800; font-stretch: 75%;
  font-size: min(17vw, 19svh, 13rem);
  line-height: .85; letter-spacing: -.035em;
  padding-top: .06em;
}
.contact__lead { margin-top: clamp(16px, 2vw, 28px); font-size: clamp(1.1rem, 1rem + .5vw, 1.4rem); max-width: 30rem; color: var(--chalk-soft); }
.contact__list { margin-top: clamp(28px, 4vw, 56px); border-bottom: 1px solid var(--line-chalk); }
.contact__list a {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem;
  padding: clamp(.55rem, 1vw, .9rem) 0;
  border-top: 1px solid var(--line-chalk);
  transition: color .35s var(--ease), padding .35s var(--ease);
}
.contact__list a::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: var(--chalk);
  transform: translateY(101%);
  transition: transform .45s var(--ease);
}
.contact__list a > * { position: relative; z-index: 1; }
.contact__list a:hover, .contact__list a:focus-visible { color: var(--ultra); padding-inline: 1rem; }
.contact__list a:hover::before, .contact__list a:focus-visible::before { transform: none; }
.c-name { font: 700 clamp(1.7rem, 1rem + 3.6vw, 3.6rem)/1 var(--display); font-stretch: 85%; letter-spacing: -.025em; }
.c-handle { font: 500 clamp(.95rem, .9rem + .3vw, 1.15rem)/1.2 var(--display); text-align: right; overflow-wrap: anywhere; }
.contact__foot { margin-top: clamp(28px, 4vw, 56px); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; font: 400 .95rem/1.4 var(--display); color: var(--chalk-soft); }

/* ---------- Intro states (JS present, motion allowed) ----------
   Everything here is undone by `.no-anim`, which JS adds on failure
   or the inline timer adds if main.js never starts. */
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.no-anim) .hero__name .ln > span { visibility: hidden; }
  html.js:not(.no-anim) .hero__portrait-frame { clip-path: inset(100% 0 0 0); }
  html.js:not(.no-anim) .hero__hint,
  html.js:not(.no-anim) .hero__intro,
  html.js:not(.no-anim) .hero__cta { opacity: 0; }
  html.js:not(.no-anim) .nav { opacity: 0; }
  /* Timeline: upcoming items stay dim until scrolled to (decorative, so motion-preference only) */
  html.js:not(.no-anim) .tl__item > * { opacity: .45; transition: opacity .5s var(--ease); }
  html.js:not(.no-anim) .tl__item.is-reached > * { opacity: 1; }
  html.js:not(.no-anim) .mask > span { visibility: hidden; }
  html.js:not(.no-anim) .project__shot { clip-path: inset(0 0 100% 0); }
  html.js:not(.no-anim) .project__text > *,
  html.js:not(.no-anim) .cert,
  html.js:not(.no-anim) .contact__lead,
  html.js:not(.no-anim) .contact__list li,
  html.js:not(.no-anim) .contact__foot { opacity: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee__track { animation: none; width: auto; flex-wrap: wrap; }
  .marquee__set[aria-hidden='true'] { display: none; }
  .marquee__set { flex-wrap: wrap; }
  .marquee__set li { padding-block: .1em; }
  .lightbox[open] { animation: none; }
  .tl__item::before, .tl__item > *, .cert__sheet img, .btn, .textlink, .contact__list a, .contact__list a::before, .nav, .nav__links a { transition: none !important; }
  #field { transition: none; }
}

/* ---------- Touch devices: no hover affordances that need a pointer ---------- */
@media (hover: none) {
  .hint-fine { display: none; }
  .hint-touch { display: inline; }
  .cert:hover .cert__sheet img { transform: none; }
}

/* ---------- Tablet and below ---------- */
@media (max-width: 1023px) {
  .work__head .h2 { grid-column: 1 / -1; }
  .work__intro { grid-column: 1 / span 8; }
  .project__plate, .project[data-side='left'] .project__plate { grid-column: 1 / -1; grid-row: 1; }
  .project__text, .project[data-side='left'] .project__text { grid-column: 1 / -1; grid-row: 2; margin-top: 1.8rem; max-width: 40rem; }
  .project { align-items: start; }
  .project__plate { aspect-ratio: auto; padding-block: clamp(20px, 6vw, 56px); }
  .project__shot, .project[data-side='left'] .project__shot { width: 92%; margin-inline: auto; }
  .about__classes { grid-template-columns: 1fr; gap: 1.8rem; }
  .about__body { margin-left: 0; }
}

/* ---------- Mobile navigation + stacked layouts ---------- */
@media (max-width: 819px) {
  :root { --nav-h: 60px; }
  .nav__links { display: none; }
  .nav__toggle { display: block; }

  .hero { display: flex; flex-direction: column; justify-content: flex-end; gap: 1.4rem; padding-top: calc(var(--nav-h) + 12px); }
  .hero__hint { order: 5; max-width: none; font-size: .9rem; }
  .hero__portrait { order: 1; align-self: flex-end; }
  .hero__portrait-frame { height: auto; width: min(44vw, 230px); }
  .hero__name { order: 2; align-self: flex-start; font-size: min(22.5vw, 19svh); }
  .hero__side { order: 3; align-self: stretch; }
  .hero__intro { max-width: 30rem; }

  .tl-wrap { padding-left: 0; }
  .tl__rail { left: 6px; margin-left: 0; }
  .tl { grid-template-columns: 32px minmax(0, 1fr); grid-template-rows: none; row-gap: 40px; }
  .tl__item, .tl__item--edu, .tl__item--exp, .tl__item--span {
    grid-column: 2; grid-row: auto; justify-self: stretch; max-width: none; padding: 0;
  }
  .tl__item::before, .tl__item--edu::before, .tl__item--exp::before { left: -32px; right: auto; }
  .tl__item--span::after { display: none; }
  .tl__type { position: static; width: auto; height: auto; overflow: visible; clip-path: none; font: 500 .9rem/1.2 var(--display); color: var(--ink-soft); margin-bottom: .2rem; }

  .certs__layout { grid-template-columns: 1fr; }
  .cert--feature, .cert--a, .cert--b, .cert--c { grid-column: 1; grid-row: auto; margin-top: 0; }
  .cert--feature { display: block; }
  .cert--feature figcaption { margin-top: 1.1rem; max-width: 30rem; }
  .cert--feature h3 { font-size: clamp(1.4rem, 1rem + 2vw, 2rem); }
  .cert--c { width: min(78%, 360px); }

  .lightbox { width: 100vw; max-width: 100vw; max-height: 100svh; height: 100svh; }
  .lightbox__inner { max-height: 100svh; height: 100%; }
  .lightbox__stage img { max-height: calc(100svh - 10.5rem); }
}

@media (max-width: 480px) {
  .c-handle { font-size: .9rem; max-width: 52%; }
  .contact__foot { flex-direction: column; }
  .hero__cta { gap: 1.2rem; }
}

@media (max-height: 560px) and (min-width: 820px) {
  .hero__intro { font-size: 1rem; }
  .hero__portrait-frame { height: clamp(200px, 40svh, 520px); }
}
