/* Arc Portfolio — Lê Đức Tuấn. Values follow SPEC R1, R2, D2, D5, D8. */

/* Antic Didone has no Vietnamese precomposed letters (Ấ, Ứ …); route only those code points
   to a local high-contrast serif so accents stay attached (QUESTIONS.md Q9). */
@font-face {
  font-family: "Arc VN Display";
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), local("Didot"), local("Georgia");
  unicode-range: U+0102-0103, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9;
}

/* ---------- Tokens ---------- */
:root {
  /* R2 palette */
  --light: #f3f3ec;
  --light-60: rgba(243, 243, 236, 0.6);
  --light-30: rgba(243, 243, 236, 0.3);
  --light-10: rgba(243, 243, 236, 0.1);
  --light-5: rgba(243, 243, 236, 0.05);
  --light-0: rgba(243, 243, 236, 0);
  --dark: #17233b;
  --dark-60: rgba(23, 35, 59, 0.6);
  --dark-30: rgba(23, 35, 59, 0.3);
  --dark-10: rgba(23, 35, 59, 0.1);
  --dark-5: rgba(23, 35, 59, 0.05);
  --dark-0: rgba(23, 35, 59, 0);
  --pink: #f8bbcb;
  --powder: #b5cedb;
  --plum: #340c24; /* D8 deep plum — preloader background */
  --line: var(--dark-10);

  /* D1 / D8 fonts */
  --font-display: "Arc VN Display", "Antic Didone", "Didot", "Bodoni 72", Georgia, serif;
  --font-accent: "Pinyon Script", "Sloop Script", cursive;
  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;

  /* D8 layout */
  --side: 48px;
  --gap: 16px;

  /* R1 timing */
  --dur-s: 0.4s;
  --dur-m: 0.8s;
  --dur-l: 1.2s;
  --ease-inout: cubic-bezier(0.75, 0, 0.25, 1);
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-write: cubic-bezier(0.333, 0, 0.667, 1);
  --ease-dive: cubic-bezier(0.6, 0, 0, 1);
  --ease-hor: cubic-bezier(0.25, 0, 0.75, 1);

  /* R2 type scale (px / 16 rem) */
  --h1: calc(192rem / 16);
  --h2: calc(136rem / 16);
  --h3: calc(96rem / 16);
  --h4: calc(63rem / 16);
  --h5: calc(40rem / 16);
  --h6: calc(28rem / 16);
  --p1: calc(13rem / 16);
  --p2: calc(11rem / 16);
  --l1: calc(11rem / 16);
  --l2: calc(9rem / 16);
}

/* R1 — root font size 1vw: 1rem = W / 100 */
html {
  font-size: 1vw;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--light);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: var(--p1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p, h1, h2, h3, h4, h5, h6 { margin: 0; }
::selection { background: var(--pink); color: var(--dark); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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

/* ---------- Type (R2, D8) ---------- */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
}
h1, .h1 { font-size: calc(192rem / 16); line-height: 87.5%; letter-spacing: -0.024em; }
h2, .h2 { font-size: calc(136rem / 16); line-height: 88.235%; letter-spacing: -0.024em; }
h3, .h3 { font-size: calc(96rem / 16); line-height: 91.667%; letter-spacing: -0.024em; }
h4, .h4 { font-size: calc(63rem / 16); line-height: 88.889%; }
h5, .h5 { font-size: calc(40rem / 16); line-height: 100%; }
h6, .h6 { font-size: calc(28rem / 16); line-height: 100%; }

.p1 {
  font-family: var(--font-body);
  font-size: calc(13rem / 16);
  line-height: 138.462%;
  letter-spacing: -0.024em;
}
.p2 {
  font-family: var(--font-body);
  font-size: calc(11rem / 16);
  line-height: 145.455%;
}
.l1 {
  font-family: var(--font-body);
  font-size: calc(11rem / 16);
  text-transform: uppercase;
  font-weight: 700;
  line-height: 145.455%;
  letter-spacing: 0.048em;
  font-stretch: 112.5%;
}
.l2 {
  font-family: var(--font-body);
  font-size: calc(9rem / 16);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.32em;
  font-stretch: 112.5%;
}
.extended { font-stretch: 112.5%; }
.accent {
  font-family: var(--font-accent);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1;
}

/* R8 / D8 — reveal targets stay hidden until their group is prepared. D5: visible with reduced motion. */
html.js [data-reveal] { visibility: hidden; }
html.js [data-reveal].is-ready { visibility: visible; }
.split-mask { overflow: clip; display: block; }

/* ---------- Preloader (R10) ---------- */
.preloader {
  --arch-width: 24vw;
  --arch-top: 104vh;
  position: fixed;
  inset: 0;
  z-index: 11000;
  color: var(--light);
  display: none;
  pointer-events: auto;
}
html.js .preloader { display: block; }
.preloader.is-hidden { display: none !important; }

.preloader__stage {
  position: absolute;
  inset: 0;
  background: var(--plum);
  overflow: hidden;
}
.preloader__tint {
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 100%, var(--light), var(--light-0) 70%);
  opacity: 0;
}
.preloader__decor {
  position: absolute; inset: 0 var(--side);
  display: grid; grid-template-columns: repeat(4, 1fr);
  opacity: 0;
  pointer-events: none;
}
.preloader__decor span { border-left: 1px solid var(--light-10); }
.preloader__decor span:last-child { border-right: 1px solid var(--light-10); }

.preloader__texts { position: absolute; inset: 0; }
.preloader__rule {
  position: absolute; left: 50%; top: 0;
  width: 1px; height: 22vh;
  background: var(--light-30);
}
.preloader__label {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  color: var(--light-60);
}
.preloader__label--left { left: var(--side); }
.preloader__label--right { right: var(--side); }
.preloader__title {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  text-align: center;
  perspective: 600px;
}
.preloader__script {
  color: var(--pink);
  font-size: calc(80rem / 16);
  margin-top: -0.32em;
  margin-left: 18%;
  perspective: 600px;
}
.preloader__bottom {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--side) + 96px + 24px);
  text-align: center;
  color: var(--light-60);
}

/* D8 — progress indicator: 1px × 96px line in the 10% line colour, track in dark base */
.preloader__progress {
  position: absolute;
  left: 50%;
  bottom: var(--side);
  width: 1px;
  height: 96px;
  background: var(--dark-10);
  overflow: hidden;
}
.preloader__track {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--dark);
  transform: translateY(-100%);
}

.preloader__frame { position: absolute; inset: 0; }
/* Arch: width & top are CSS variables; radii = arch width; 1px outline in 10% dark; page background fill */
.preloader__arch {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: var(--arch-width);
  height: calc(100vh - var(--arch-top));
  border: 1px solid var(--dark-10);
  border-bottom: 0;
  border-top-left-radius: var(--arch-width);
  border-top-right-radius: var(--arch-width);
  background: var(--light);
}
.preloader__arch--inner {
  width: calc(var(--arch-width) * 1.02);
  height: calc((100vh - var(--arch-top)) * 1.01);
}
.preloader__arch--outer {
  width: calc(var(--arch-width) * 1.1);
  height: calc((100vh - var(--arch-top)) * 1.03);
}

/* ---------- Header (D2, R19, R21) ---------- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(var(--side) / 2) var(--side);
  pointer-events: none;
}
.header > * { pointer-events: auto; }
.header__logo { display: block; width: 4.5rem; height: 4.5rem; min-width: 52px; min-height: 52px; }
.header__logo-bg { display: block; width: 100%; height: 100%; will-change: transform; }
.header__logo-bg img { width: 100%; height: 100%; }
.header__nav { display: flex; gap: calc(var(--gap) * 2); padding-top: 1.1rem; }

.nav-item {
  position: relative;
  display: inline-block;
  overflow: hidden;
  line-height: 1.2;
  padding: 2px 0;
}
.nav-item__copy { display: block; white-space: nowrap; }
.nav-item__copy + .nav-item__copy { position: absolute; left: 0; top: 2px; }
.nav-item__copy .char { display: inline-block; will-change: transform; }

/* R21 — scroll bar (desktop only) */
.scrollbar {
  --progress: 0;
  position: fixed;
  left: calc(var(--side) / 2);
  top: 50%;
  z-index: 100;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.scrollbar__rail {
  position: relative;
  width: 9px;
  height: 28vh;
  cursor: grab;
}
.scrollbar__rail::before {
  content: "";
  position: absolute; left: 4px; top: 0; bottom: 0;
  width: 1px;
  background: var(--dark-10);
}
.scrollbar__thumb {
  position: absolute;
  left: 2px;
  width: 5px;
  height: 18%;
  top: calc(var(--progress) * 82%);
  border-radius: 3px;
  background: var(--dark);
  cursor: grab;
}
.scrollbar.is-dragging .scrollbar__rail,
.scrollbar.is-dragging .scrollbar__thumb { cursor: grabbing; }
.scrollbar__label { writing-mode: vertical-rl; letter-spacing: 0.2em; font-variant-numeric: tabular-nums; }

.scroll-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--side) / 2);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
}
.scroll-hint__line {
  width: 1px; height: 40px;
  background: linear-gradient(var(--dark-0), var(--dark));
  animation: hint 2.4s var(--ease-inout) infinite;
  transform-origin: top;
}
@keyframes hint {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- Hero (R11) ---------- */
.hero-area {
  position: relative;
  height: calc(400vh + (50rem + 100vh));
}
.hero {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.hero__media { position: absolute; inset: 0; }
.hero__bg {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 150vh;
  will-change: transform;
}
.hero__bg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; }
.hero__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--light) 0%, var(--light-60) 26%, var(--light-0) 52%),
              linear-gradient(0deg, rgba(23, 35, 59, 0.45) 0%, var(--dark-0) 40%);
  pointer-events: none;
}
.hero__content {
  position: absolute;
  inset: 0;
  height: 100vh;
  padding: 0 var(--side);
  will-change: transform;
}
.hero__label { position: absolute; top: 15vh; display: flex; align-items: center; gap: 10px; }
.hero__label--left { left: var(--side); }
.hero__label--right { right: var(--side); }
.hero__heading {
  position: absolute;
  left: 0; right: 0;
  top: 19vh;
  text-align: center;
  perspective: 800px;
}
.hero__title { white-space: nowrap; }
.hero__script {
  font-size: calc(110rem / 16);
  margin-top: -0.38em;
  margin-left: 30%;
  color: var(--dark);
  perspective: 600px;
}
.hero__bottom {
  position: absolute;
  left: var(--side); right: var(--side);
  bottom: calc(var(--side) + 2vh);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap);
  color: var(--light);
}
.hero__text { max-width: 22rem; font-size: calc(16rem / 16); }

/* R20 — circle button */
.circle-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 10rem;
  height: 10rem;
  min-width: 96px;
  min-height: 96px;
  color: var(--light);
  border-radius: 50%;
}
.circle-btn__svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.circle-btn__ring, .circle-btn__arc { fill: none; vector-effect: non-scaling-stroke; }
.circle-btn__ring { stroke: var(--light-30); stroke-width: 1; }
.circle-btn__arc { stroke: currentColor; stroke-width: 2; stroke-dasharray: 27.118 623.19; stroke-linecap: round; }
.circle-btn__label { position: relative; text-align: center; max-width: 70%; line-height: 1.5; }

/* R20 — pins */
.pin {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  flex: none;
}
.pin__ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
}
.pin__dot {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--pink);
  display: grid; place-items: center;
}
.pin__plus { position: relative; width: 8px; height: 8px; }
.pin__plus::before, .pin__plus::after {
  content: ""; position: absolute; background: var(--dark);
}
.pin__plus::before { left: 0; right: 0; top: 50%; height: 1px; transform: translateY(-50%); }
.pin__plus::after { top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); }

/* ---------- Circle intro (R12) ---------- */
.intro {
  position: relative;
  z-index: 2;
  margin-top: calc(-1 * (50rem + 100vh));
  height: 50rem;
  background: var(--light);
  display: grid;
  place-items: center;
  border-radius: 4rem 4rem 0 0;
}
.intro__circle {
  position: relative;
  width: 44rem;
  height: 44rem;
  display: grid;
  place-items: center;
}
.intro__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.intro__circle-text {
  font-family: var(--font-display);
  font-size: calc(30rem / 16);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  fill: var(--dark);
  word-spacing: 0rem;
}
.intro__centre { position: relative; text-align: center; max-width: 22rem; display: grid; gap: 1.4rem; justify-items: center; }
.intro__since { color: var(--dark-60); }
.intro__text { font-family: var(--font-display); font-size: calc(36rem / 16); line-height: 1.05; letter-spacing: -0.01em; }

/* ---------- Slider (R17) — powder blue ---------- */
.slider-section {
  position: relative;
  z-index: 2;
  background: var(--powder);
  padding: 12rem var(--side) 10rem;
}
.slider { position: relative; }
.slider__slides { position: relative; }
.slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: calc(var(--gap) * 4);
  align-items: end;
}
.slide.is-current { position: relative; visibility: visible; }
.slide__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 22rem 22rem 0 0;
}
.slide__child { position: absolute; inset: 0; overflow: hidden; will-change: transform; }
.slide__child img {
  position: absolute; left: 0; top: -20%;
  width: 100%; height: 140%;
  object-fit: cover;
}
.slide__text { display: grid; gap: 2.4rem; padding-bottom: 2rem; perspective: 800px; }
.slide__index { color: var(--dark-60); }
.slide__para { max-width: 26rem; font-size: calc(16rem / 16); }

.slider__controls {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: calc(var(--gap) * 4);
  align-items: center;
  margin-top: 3rem;
}
.slider__pagination { display: flex; align-items: center; gap: 1rem; font-variant-numeric: tabular-nums; }
.slider__pagination.is-hidden { display: none; }
.slider__sep { width: 3rem; height: 1px; background: var(--dark-30); }
.slider__next-label { margin-left: auto; color: var(--dark-60); }
.slider__progress {
  grid-column: 1;
  grid-row: 2;
  height: 1px;
  background: var(--dark-10);
  margin-top: 1.2rem;
}
.slider__progress span { display: block; width: 0%; height: 100%; background: var(--dark); }
.slider__buttons { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: var(--gap); }
.slider__btn {
  width: 5rem; height: 5rem;
  min-width: 52px; min-height: 52px;
  border: 1px solid var(--dark-30);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px;
  transition: background-color var(--dur-s) var(--ease), color var(--dur-s) var(--ease);
}
.slider__btn:hover { background: var(--dark); color: var(--light); }
.slider__btn span { display: block; }

/* ---------- Arch window (R13) — powder blue ---------- */
.arch-section {
  position: relative;
  z-index: 2;
  height: 300vh;
  background: var(--powder);
}
.arch__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.arch__content {
  position: absolute;
  inset: 0;
  transform-origin: center top;
}
/* Full-bleed image behind the window; text in light ink over a soft veil. */
.arch__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.arch__frame img {
  position: absolute; left: 0; top: -40%;
  width: 100%; height: 140%;
  object-fit: cover;
}
.arch__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(23, 35, 59, 0.05) 30%, rgba(23, 35, 59, 0.55) 100%);
}
.arch__pin { position: absolute; left: 47%; top: 66%; color: var(--light); }
.arch__title {
  position: absolute;
  left: var(--side);
  right: var(--side);
  bottom: 14vh;
  max-width: 62vw;
  color: var(--light);
  perspective: 800px;
}
.arch__text {
  position: absolute;
  right: var(--side);
  bottom: 15vh;
  width: 22rem;
  font-size: calc(16rem / 16);
  color: var(--light);
}
.arch__intro {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
}
.arch__half { position: absolute; top: 0; bottom: 0; background: var(--light); }
.arch__half--left {
  left: 0;
  width: calc(50% + 1px);
  clip-path: polygon(0% 0%, 0% 100%, 33.333% 100%, 33.333% 36.111%, 77.778% 36.111%, 77.778% 99.074%, 33.333% 99.074%, 33.333% 100%, 100% 100%, 100% 0%);
}
.arch__half--right {
  left: 50%;
  width: 50%;
  clip-path: polygon(0% 0%, 0% 100%, 22.222% 100%, 22.222% 0.926%, 66.667% 0.926%, 66.667% 63.889%, 22.222% 63.889%, 22.222% 100%, 100% 100%, 100% 0%);
}
.arch__decor {
  position: absolute;
  top: 50%;
  width: 7vw;
  height: 7vw;
  margin-top: -3.5vw;
  border: 1px solid var(--dark-30);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.arch__decor span { width: 1px; height: 60%; background: var(--dark-30); }
.arch__decor--left { left: 4.5vw; }
.arch__decor--right { right: 4.5vw; }

/* ---------- Horizontal experience (R14) ---------- */
.horizontal { position: relative; z-index: 2; background: var(--light); overflow: clip; }
.horizontal__sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.horizontal__track {
  display: flex;
  align-items: center;
  height: 100%;
  width: max-content;
  padding: 0 var(--side);
  gap: 6rem;
  will-change: transform;
}
.horizontal__intro { display: flex; align-items: center; gap: 14rem; padding-left: 4rem; }
.horizontal__title { position: relative; z-index: 1; display: grid; gap: 0.06em; white-space: nowrap; }
.horizontal__line { display: block; }
.horizontal__line:nth-child(2) { padding-left: 1.4em; }
.horizontal__line:nth-child(3) { padding-left: 0.5em; }
.horizontal__image {
  width: 28rem;
  height: 62vh;
  overflow: hidden;
  clip-path: inset(0% 100% 0% 0%);
}
.horizontal__image img { width: 100%; height: 100%; object-fit: cover; }
.horizontal__cards { display: flex; align-items: center; gap: 3rem; }

.xp-card {
  width: 24rem;
  height: 64vh;
  padding: 2.4rem 2.4rem 2.4rem 2rem;
  border-left: 1px solid var(--dark-10);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.xp-card__years { color: var(--dark-60); }
.xp-card__role { margin-top: 1.6rem; }
.xp-card__company { margin-top: 1rem; color: var(--dark-60); }
.xp-card__text { max-width: 19rem; }
.xp-card__index { font-family: var(--font-accent); font-size: calc(72rem / 16); color: var(--dark-30); line-height: 1; }

.project-card { width: 22rem; display: grid; gap: 1.2rem; }
.project-card__media { position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.project-card__child { position: absolute; inset: 0; }
.project-card__child img { width: 100%; height: 100%; object-fit: cover; }
.project-card__meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--gap); }
.project-card__year {
  border: 1px solid var(--dark-30);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  white-space: nowrap;
}
.project-card__info { color: var(--dark-60); }
.project-card__title { line-height: 1.05; }
.project-card a.project-card__title-link::after { content: " ↗"; font-family: var(--font-body); font-size: 0.6em; }

/* ---------- Footer (R16) ---------- */
.outro { position: relative; z-index: 2; background: var(--light); }
.outro__frame {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  clip-path: inset(0% 0% 0% 0%);
}
.outro__frame img { width: 100%; height: 100%; object-fit: cover; }
.outro__frame::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(23, 35, 59, 0.6) 0%, rgba(23, 35, 59, 0.15) 45%, var(--dark-0) 70%);
}
.footer { position: relative; height: 100vh; }
.footer__content {
  position: absolute;
  inset: 0;
  padding: var(--side);
  display: grid;
  grid-template-columns: 22% 1fr 22%;
  grid-template-rows: 1fr auto;
}
.footer__title {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  margin-top: 14vh;
  color: var(--light);
  text-align: center;
  perspective: 800px;
}
.footer__col { grid-row: 1; align-self: center; display: grid; gap: 1rem; }
.footer__col--left { grid-column: 1; justify-items: start; }
.footer__col--right { grid-column: 3; justify-items: end; }
.footer__copy { grid-column: 1 / -1; grid-row: 2; text-align: center; color: var(--dark-60); }

/* R19 — links with two copies and a 0.6px underline per line */
.link {
  position: relative;
  display: inline-block;
  font-size: calc(18rem / 16);
  perspective: 400px;
  padding-bottom: 4px;
}
.link__copy { display: block; white-space: nowrap; }
.link__copy + .link__copy { position: absolute; left: 0; top: 0; }
.link__copy .char { display: inline-block; }
.link__line {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0.6px;
  background: var(--dark);
  border-radius: 2px;
  transform-origin: left center;
  transition: transform var(--dur-m) var(--ease-inout);
}
.link:hover .link__line,
.link:focus-visible .link__line { transform: scaleX(0); transform-origin: right center; }

:focus-visible { outline: 1px solid var(--dark); outline-offset: 4px; }

/* ---------- Desktop ---------- */
@media (min-width: 992px) {
  .scrollbar { display: flex; }
}

/* ---------- Mobile (W < 992) — D5 ---------- */
@media (max-width: 991.98px) {
  :root { --side: 20px; --gap: 12px; }
  h1, .h1 { font-size: 13.5rem; }
  h2, .h2 { font-size: 12rem; }
  h3, .h3 { font-size: 10.5rem; }
  h4, .h4 { font-size: 8rem; }
  h5, .h5 { font-size: 6.4rem; }
  h6, .h6 { font-size: 5.2rem; }
  .p1 { font-size: 3.7rem; }
  .p2 { font-size: 3.2rem; }
  .l1 { font-size: 2.9rem; }
  .l2 { font-size: 2.4rem; }

  .header__logo { width: 12rem; height: 12rem; }
  .header__nav { display: grid; grid-template-columns: auto auto; gap: 6px 18px; justify-items: end; padding-top: 1.6rem; }
  .scroll-hint { display: none; }

  .preloader__script { font-size: 13rem; margin-left: 12%; white-space: nowrap; }
  .preloader__label { top: 36%; }

  .hero__label { top: 14vh; }
  .hero__label--right { left: var(--side); right: auto; top: calc(14vh + 26px); }
  .hero__heading { top: 23vh; }
  .hero__title { white-space: normal; font-size: 21rem; }
  .hero__script { font-size: 14rem; margin-left: 0; margin-top: -0.1em; white-space: nowrap; }
  .hero__text { font-size: 4.2rem; max-width: 58vw; }
  .circle-btn { width: 26rem; height: 26rem; }

  .intro__circle { width: 46rem; height: 46rem; }
  .intro__circle-text { font-size: 2.3rem; }
  .intro__centre { max-width: 30rem; gap: 1.2rem; }
  .intro__since { font-size: 2.2rem; }
  .intro__text { font-size: 3.4rem; }

  .slider-section { padding: 22vw var(--side) 18vw; }
  .slide { grid-template-columns: 1fr; gap: 8vw; }
  .slide__media { border-radius: 45vw 45vw 0 0; }
  .slide__para { max-width: none; font-size: 4rem; }
  .slide__text { gap: 5vw; }
  .slider__controls { grid-template-columns: 1fr auto; margin-top: 8vw; }
  .slider__btn { width: 13rem; height: 13rem; }

  /* D5 — arch window replaced by its final state, laid out vertically */
  .arch-section { height: auto; padding: 22vw var(--side); }
  .arch__sticky { position: relative; height: auto; overflow: visible; }
  .arch__content { position: relative; inset: auto; display: grid; gap: 8vw; }
  .arch__title, .arch__frame, .arch__text { position: relative; inset: auto; width: auto; max-width: none; color: var(--dark); }
  .arch__frame { order: 2; height: 120vw; border-radius: 45vw 45vw 0 0; }
  .arch__text { order: 3; font-size: 4rem; }
  .arch__veil { display: none; }
  .arch__intro { display: none; }

  /* D5 — horizontal scroll replaced by one column */
  .horizontal { height: auto !important; padding: 22vw 0; }
  .horizontal__sticky { position: relative; height: auto; overflow: visible; }
  .horizontal__track { flex-direction: column; align-items: stretch; width: auto; height: auto; gap: 12vw; transform: none !important; }
  .horizontal__intro { flex-direction: column; align-items: stretch; padding-left: 0; gap: 8vw; }
  .horizontal__title { white-space: normal; }
  .horizontal__image { width: 100%; height: 110vw; }
  .horizontal__cards { flex-direction: column; align-items: stretch; gap: 10vw; }
  .xp-card { width: auto; height: auto; gap: 6vw; padding: 4vw 0 4vw 5vw; }
  .xp-card__text { max-width: none; }
  .project-card { width: auto; gap: 3vw; }

  .footer__content { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto auto; gap: 4vw; }
  /* Narrow clipped frame: text crosses paper and image, so invert against whatever is behind it. */
  .footer__content { color: var(--light); mix-blend-mode: difference; }
  .footer__content .link__line { background: currentColor; }
  .footer__copy { color: var(--light-60); }
  .footer__title { grid-column: 1; grid-row: 1; margin-top: 14vh; font-size: 9rem; color: var(--light); }
  .outro__frame::after { display: none; }
  .footer__col { grid-row: auto; grid-column: 1 !important; justify-items: center !important; }
  .footer__col--left { grid-row: 3; }
  .footer__col--right { grid-row: 4; grid-auto-flow: column; gap: 8vw; }
  .footer__copy { grid-row: 5; }
  .link { font-size: 4.4rem; }
}

/* ---------- D5 — reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js .preloader { display: none; }
  html.js [data-reveal] { visibility: visible; }
  .horizontal__image { clip-path: none; }
  .scroll-hint__line { animation: none; }
  .link__line { transition: none; }
}
