/* ==========================================================================
   Ruben Dougall — portfolio
   1. Tokens   2. Base   3. Primitives   4. Navigation   5. Hero
   6. Sections 7. Work   8. Skills / Education
   9. Contact / Footer   10. Motion  11. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --black: #101010;
  --black-alt: #181818;
  --white: #F5F2EB;
  --orange: #FF5A1F;
  --orange-soft: #FF8A42;
  --gray: #A7A39D;
  --line: #35332F;

  --bg: var(--black);
  --bg-alt: var(--black-alt);
  --fg: var(--white);
  --muted: var(--gray);
  --rule: var(--line);
  --accent: var(--orange);
  --panel: var(--black-alt);

  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 4vw, 56px);
  --nav-h: 68px;
  --section: clamp(88px, 11vw, 168px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--orange); color: var(--black); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 1px;
}

h1, h2, h3 { font-weight: 500; text-wrap: balance; }
p { text-wrap: pretty; }

/* 3. Primitives ------------------------------------------------------------ */
.wrap {
  width: min(100% - 2 * var(--gutter), 1320px);
  margin-inline: auto;
}

/* Full-width band on the alternative background */
.band { background: var(--bg-alt); }

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

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  padding: 10px 16px; background: var(--orange); color: var(--black);
  font-size: .9rem; font-weight: 500;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

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

.mono-label,
.sec-label,
.proj-meta,
.hero-meta,
.fig figcaption,
dt {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 24px;
  background: linear-gradient(var(--white), var(--white)) 0 100% / 100% 0 no-repeat var(--orange);
  color: var(--black);
  font-size: .95rem; font-weight: 500; line-height: 1;
  border-radius: 2px;
  transition: background-size .55s var(--ease-out);
}
.btn span { transition: transform .55s var(--ease-out); }
.btn:hover { background-size: 100% 100%; }
.btn:hover span { transform: translateY(3px); }

.link-arrow {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding-bottom: 4px;
  font-size: .95rem; font-weight: 500; line-height: 1.3;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 1px no-repeat border-box;
  transition: background-size .6s var(--ease-out), color .4s var(--ease-out);
}
.link-arrow span[aria-hidden] { display: inline-block; color: var(--accent); transition: transform .5s var(--ease-out); }
.link-arrow:hover { background-size: 100% 1px; color: var(--orange-soft); }
.link-arrow:hover span[aria-hidden] { transform: translate(2px, -2px); }

/* 4. Navigation ------------------------------------------------------------ */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  color: var(--white);
}
/* Blur lives on a pseudo-element so the fixed mobile menu is not trapped by it */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--black) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  opacity: 0; transition: opacity .5s var(--ease);
}
.site-header.is-scrolled::before { opacity: 1; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h);
}

.brand {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 500; letter-spacing: -.01em;
}
.brand-mark { width: 9px; height: 9px; background: var(--orange); transition: transform .6s var(--ease-out); }
.brand:hover .brand-mark { transform: rotate(90deg); }

.nav-menu { display: flex; align-items: center; gap: 40px; }
.nav-links { display: flex; gap: 30px; }
.nav-links a {
  position: relative;
  padding: 6px 0;
  font-size: .9rem; color: var(--gray);
  transition: color .45s var(--ease-out);
}
/* The underline wipes in from the left and leaves to the right */
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--orange);
  transform: scaleX(0); transform-origin: right;
  transition: transform .6s var(--ease-out);
}
.nav-links a:hover { color: var(--orange-soft); }
.nav-links a.is-active { color: var(--orange); }
.nav-links a.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav-no, .nav-menu-foot, .nav-toggle { display: none; }

.nav-cta {
  padding: 9px 18px;
  font-size: .9rem; font-weight: 500;
  border: 1px solid var(--orange); border-radius: 2px;
  transition: background-color .45s var(--ease-out), color .45s var(--ease-out);
}
.nav-cta:hover, .nav-cta.is-active { background: var(--orange); color: var(--black); }

/* 5. Hero ------------------------------------------------------------------ */
.hero {
  padding-top: calc(var(--nav-h) + clamp(40px, 6.5vw, 96px));
  padding-bottom: clamp(56px, 7vw, 96px);
}

/* Entrance order (used by the motion rules in section 10) */
.hero-meta { --i: 0; }
h1 .line:nth-child(1) .enter-line { --i: 1; }
h1 .line:nth-child(2) .enter-line { --i: 2; }
.hero-intro { --i: 3; }
.hero-facts { --i: 5; }

.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.hero-status { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); }
.hero-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }

h1 {
  margin: clamp(28px, 3.5vw, 48px) 0 clamp(32px, 4vw, 56px);
  font-size: clamp(2.75rem, 7.2vw, 6.6rem);
  line-height: 1;
  letter-spacing: -.038em;
}
h1 span { display: block; }
.line { overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; }
h1 .hl { display: inline; }
.h1-quiet { color: var(--muted); }

.hero-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px; align-items: start;
}
.hero-intro { grid-column: 1 / span 6; }
.hero-lede { font-size: clamp(1.05rem, 1.35vw, 1.2rem); line-height: 1.6; color: var(--gray); max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; margin-top: 36px; }

/* Signature accent: one hairline under the headline. It draws in once, then a
   short neon highlight travels along it, slowly. Static without motion. */
.hero-line {
  position: relative; height: 1px; overflow: hidden;
  margin-bottom: clamp(32px, 4vw, 56px);
  background: var(--rule);
  transform-origin: left;
}
.hero-line i {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--orange) 0 14%, transparent 14%);
}

.hero-facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px;
  margin-top: clamp(56px, 7vw, 104px); padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.hero-facts dd { margin-top: 8px; font-size: 1rem; line-height: 1.4; }

/* 6. Sections -------------------------------------------------------------- */
.section { padding-block: 0 var(--section); }
.band > .section, .band > .contact, .band + .section { padding-top: var(--section); }

.sec-head {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px;
  padding-top: 22px; margin-bottom: clamp(48px, 6vw, 88px);
  position: relative;
}
/* Divider: a hairline with a short neon lead */
.sec-head::before, .sec-head::after {
  content: ""; position: absolute; top: 0; left: 0; height: 1px; transform-origin: left;
}
.sec-head::before { right: 0; background: var(--rule); }
.sec-head::after { width: clamp(40px, 6vw, 88px); background: var(--orange); }
.sec-label { grid-column: span 3; display: flex; gap: 14px; padding-top: 8px; color: var(--accent); }
.sec-head > :last-child { grid-column: 4 / -1; }

h2 {
  font-size: clamp(2rem, 4.3vw, 3.75rem);
  line-height: 1.04; letter-spacing: -.03em;
  max-width: 17ch;
}
.sec-intro { margin-top: 24px; max-width: 58ch; color: var(--muted); }

/* About */
.about-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 48px 24px;
}
.about-lead {
  grid-column: 4 / -1;
  font-size: clamp(1.35rem, 2.3vw, 2rem); line-height: 1.32; letter-spacing: -.015em;
  max-width: 34ch;
}
.about-body { grid-column: 4 / span 4; color: var(--muted); }
.about-note {
  grid-column: 9 / span 4;
  padding-left: 24px; border-left: 1px solid var(--accent);
  color: var(--muted);
}
.about-note .mono-label { margin-bottom: 12px; color: var(--accent); }

.plate { margin-top: clamp(56px, 7vw, 104px); }
.plate img { width: 100%; height: auto; aspect-ratio: 21 / 9; object-fit: cover; }

/* 7. Work ------------------------------------------------------------------ */
.feature {
  position: relative;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px;
  align-items: start;
  padding-block: clamp(40px, 5vw, 72px);
}
/* Top divider, with a neon line that draws across on hover */
.feature::before, .feature::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; transform-origin: left;
}
.feature::before { background: var(--rule); }
.feature::after { background: var(--orange); transform: scaleX(0); transition: transform .9s var(--ease-out); }
.feature:hover::after, .feature:focus-within::after { transform: scaleX(1); }

.feature-copy { grid-column: 1 / span 6; }
.feature .fig { grid-column: 8 / span 5; }
.feature--flip .feature-copy { grid-column: 7 / span 6; grid-row: 1; }
.feature--flip .fig { grid-column: 1 / span 5; grid-row: 1; }

.proj-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 22px; }
.proj-meta span:nth-child(2) { color: var(--accent); }
.proj-no { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; color: var(--accent); }

.feature h3 {
  font-size: clamp(1.75rem, 3.1vw, 2.75rem);
  line-height: 1.08; letter-spacing: -.025em;
  max-width: 16ch;
}
.proj-summary { margin-top: 20px; max-width: 52ch; color: var(--muted); }

.proj-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px;
  margin-top: 36px;
}
.proj-facts > div { padding-top: 14px; border-top: 1px solid var(--rule); }
.proj-facts dd { margin-top: 8px; font-size: .95rem; line-height: 1.45; }

.fig {
  padding: 22px 24px 28px;
  background: var(--panel);
  border: 1px solid var(--rule);
  transition: border-color .6s var(--ease-out);
}
.feature:hover .fig { border-color: color-mix(in srgb, var(--orange) 45%, var(--rule)); }
.fig figcaption { margin-bottom: 28px; }

/* Figure step order */
.steps li, .seq-msg { --n: 0; }
.steps li:nth-child(2), .seq-msg:nth-of-type(2) { --n: 1; }
.steps li:nth-child(3), .seq-msg:nth-of-type(3) { --n: 2; }
.steps li:nth-child(4), .seq-msg:nth-of-type(4) { --n: 3; }
.steps li:nth-child(5) { --n: 4; }

/* Fig. 01 — stepped process */
.steps li {
  display: flex; align-items: baseline; gap: 16px;
  margin-left: calc(var(--n) * 7.5%);
  padding: 13px 0;
  border-top: 1px solid var(--rule);
  font-size: .95rem;
  transition: transform .7s var(--ease-out);
  transition-delay: calc(var(--n) * 45ms);
}
.steps li span { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.steps li.is-end { color: var(--accent); border-top-color: var(--accent); }
.steps li.is-end span { color: inherit; }
.feature:hover .steps li { transform: translateX(calc(var(--n) * 3px)); }

/* Fig. 02 — sequence diagram */
.seq { width: 100%; height: auto; }
.seq text { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; fill: var(--muted); }
.seq-life { fill: none; stroke: var(--rule); stroke-dasharray: 2 5; }
.seq-msg path { fill: none; stroke: var(--fg); stroke-width: 1.1; }
.seq-msg text { fill: var(--fg); }
.seq-msg--data path { stroke: var(--accent); }
.seq-msg--data text { fill: var(--accent); }

/* 03–05 index */
.index { margin-top: clamp(40px, 5vw, 72px); }
.index-label { padding-bottom: 18px; }
.row { border-top: 1px solid var(--rule); transition: border-color .5s var(--ease-out); }
.row:last-child { border-bottom: 1px solid var(--rule); }
.row[open] { border-top-color: var(--accent); }
.row summary {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto 20px; align-items: baseline; column-gap: 24px;
  padding: 26px 0;
  cursor: pointer; list-style: none;
}
.row summary::-webkit-details-marker { display: none; }
.row-title {
  font-size: clamp(1.25rem, 2.1vw, 1.75rem); font-weight: 500; line-height: 1.2; letter-spacing: -.02em;
  transition: transform .7s var(--ease-out), color .45s var(--ease-out);
}
.row summary:hover .row-title { transform: translateX(10px); }
.row summary:hover .row-title, .row[open] .row-title { color: var(--accent); }
.row-type { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row-icon { position: relative; width: 13px; height: 13px; align-self: center; }
.row-icon::before, .row-icon::after {
  content: ""; position: absolute; left: 0; top: 6px; width: 13px; height: 1px; background: var(--fg);
  transition: transform .5s var(--ease-out), background-color .3s;
}
.row-icon::after { transform: rotate(90deg); }
.row[open] .row-icon::after { transform: rotate(0deg); }
.row[open] .row-icon::before, .row[open] .row-icon::after,
.row summary:hover .row-icon::before, .row summary:hover .row-icon::after { background: var(--accent); }

.row-body {
  display: grid; grid-template-columns: 72px minmax(0, 5fr) minmax(0, 7fr); column-gap: 24px;
  padding: 4px 0 40px;
}
.row-body .proj-summary { grid-column: 2; margin-top: 0; padding-right: 24px; }
.row-body .proj-facts { grid-column: 3; margin-top: 0; }
.row[open] .row-body { animation: row-open .7s var(--ease-out); }
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  .row::details-content { block-size: 0; overflow: clip; transition: block-size .6s var(--ease-out), content-visibility .6s allow-discrete; }
  .row[open]::details-content { block-size: auto; }
}
@keyframes row-open { from { opacity: 0; transform: translateY(-6px); } }

/* 8. Skills / Education ---------------------------------------------------- */
.skill {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: baseline;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
}
.skill:last-child { border-bottom: 1px solid var(--rule); }
.skill h3 {
  grid-column: span 3; font-size: 1.25rem; letter-spacing: -.015em;
  transition: color .45s var(--ease-out), transform .7s var(--ease-out);
}
.skill:hover h3 { color: var(--accent); transform: translateX(6px); }
.skill ul { grid-column: span 5; display: flex; flex-wrap: wrap; row-gap: 4px; }
.skill li { font-family: var(--mono); font-size: .875rem; }
.skill li + li::before { content: "/"; margin: 0 10px; color: var(--accent); }
.skill p { grid-column: span 4; font-size: .95rem; line-height: 1.5; color: var(--muted); }

.edu { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(40px, 5vw, 64px) 24px; }
.edu-head { grid-column: 4 / span 6; }
.edu-head .mono-label { color: var(--accent); }
.edu-head h3 {
  margin-top: 18px;
  font-size: clamp(2.1rem, 4.4vw, 3.75rem); line-height: 1.02; letter-spacing: -.035em;
}
.edu-degree { margin-top: 16px; font-size: 1.2rem; font-weight: 500; }
.edu-place { margin-top: 2px; color: var(--muted); }
.edu-grade { grid-column: 10 / span 3; text-align: right; line-height: 1; }
.edu-grade b {
  display: block;
  font-size: clamp(3.5rem, 7vw, 6rem); font-weight: 500; letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.edu-grade span {
  display: block; margin-top: 12px;
  font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.edu-facts {
  grid-column: 4 / -1;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
  padding-top: 20px; border-top: 1px solid var(--rule);
}
.edu-facts dd { margin-top: 8px; line-height: 1.4; }
.edu-courses { grid-column: 4 / -1; }
.edu-courses ol { margin-top: 14px; columns: 2; column-gap: 24px; counter-reset: course; }
.edu-courses li {
  display: flex; align-items: baseline; gap: 18px;
  padding: 12px 0; border-top: 1px solid var(--rule);
  break-inside: avoid; counter-increment: course;
}
.edu-courses li::before {
  content: counter(course, decimal-leading-zero);
  font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; color: var(--accent);
}

/* 9. Contact / Footer ------------------------------------------------------ */
.contact { padding-bottom: clamp(72px, 9vw, 136px); }
.contact .sec-head { margin-bottom: clamp(40px, 5vw, 64px); }
.contact-main { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
.contact-main > * { grid-column: 4 / -1; }

.contact-email {
  justify-self: start;
  font-size: clamp(1.3rem, 4.6vw, 4rem); font-weight: 500; line-height: 1.15; letter-spacing: -.035em;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 2px no-repeat;
  padding-bottom: .08em;
  transition: color .45s var(--ease-out);
}
.contact-email:hover, .contact-email:focus-visible { color: var(--orange); }
.contact-links { display: flex; flex-wrap: wrap; gap: 18px 36px; margin-top: 40px; }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px;
  padding-block: 28px 36px;
  font-size: .85rem; color: var(--muted);
}
.footer .link-arrow { font-size: .85rem; color: var(--fg); }

/* 10. Motion ---------------------------------------------------------------
   Everything that starts hidden lives inside this media query and behind the
   .js class, so the page is complete with reduced motion, without JavaScript,
   and if the script fails to load (boot.js removes .js again in that case).
   Only opacity, transform and clip-path are animated. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Reading progress: a hairline along the header, driven by scroll position */
  @supports (animation-timeline: scroll()) {
    .site-header::after {
      content: ""; position: absolute; inset: auto 0 0 0; height: 1px;
      background: var(--orange);
      transform: scaleX(0); transform-origin: left;
      animation: progress linear both;
      animation-timeline: scroll(root);
    }
    @keyframes progress { to { transform: scaleX(1); } }
  }

  /* Hero: headline lines rise out of a mask, the rest follows in sequence */
  .js .enter {
    opacity: 0;
    animation: enter 1.3s var(--ease-out) forwards;
    animation-delay: calc(var(--i) * 120ms + 120ms);
  }
  @keyframes enter {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }
  .js .enter-line {
    transform: translateY(112%);
    animation: line-up 1.4s var(--ease-out) forwards;
    animation-delay: calc(var(--i) * 120ms + 120ms);
  }
  @keyframes line-up { to { transform: none; } }

  .js .hero-line { transform: scaleX(0); animation: rule-in 1.6s var(--ease-out) .55s forwards; }
  @keyframes rule-in { to { transform: scaleX(1); } }
  .js .hero-line i { animation: hero-travel 11s cubic-bezier(.65, 0, .35, 1) 2.6s infinite backwards; }
  @keyframes hero-travel {
    0% { transform: translateX(-14%); }
    50%, 100% { transform: translateX(100%); }
  }

  /* Single blocks */
  .js [data-reveal] {
    opacity: 0; transform: translateY(24px);
    transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }

  /* Section headers: rule draws in, neon lead follows, then the label, the
     heading rising out of a mask, and the intro line */
  .js .sec-head[data-reveal] { opacity: 1; transform: none; }
  .js .sec-head[data-reveal]::before { transform: scaleX(0); transition: transform 1.5s var(--ease-out); }
  .js .sec-head[data-reveal]::after { transform: scaleX(0); transition: transform 1.1s var(--ease-out) .5s; }
  .js .sec-head[data-reveal].is-in::before,
  .js .sec-head[data-reveal].is-in::after { transform: scaleX(1); }

  .js .sec-head[data-reveal] .sec-label {
    opacity: 0; transform: translateY(10px);
    transition: opacity .9s var(--ease-out) .2s, transform .9s var(--ease-out) .2s;
  }
  .js .sec-head[data-reveal] h2 {
    clip-path: inset(0 -5% 100% -5%); transform: translateY(.45em);
    transition: clip-path 1.3s var(--ease-out) .25s, transform 1.3s var(--ease-out) .25s;
  }
  .js .sec-head[data-reveal] .sec-intro {
    opacity: 0; transform: translateY(14px);
    transition: opacity 1s var(--ease-out) .55s, transform 1s var(--ease-out) .55s;
  }
  .js .sec-head[data-reveal].is-in .sec-label,
  .js .sec-head[data-reveal].is-in .sec-intro { opacity: 1; transform: none; }
  .js .sec-head[data-reveal].is-in h2 { clip-path: inset(-10% -5% -25% -5%); transform: none; }

  /* Sequenced containers: direct children follow one another (--s set in script.js) */
  .js [data-reveal="seq"] { opacity: 1; transform: none; }
  .js [data-reveal="seq"] > * {
    opacity: 0; transform: translateY(24px);
    transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out);
    transition-delay: calc(var(--s, 0) * 130ms);
  }
  .js [data-reveal="seq"].is-in > * { opacity: 1; transform: none; }
  /* The figure keeps its hover transition alongside the reveal */
  .js .feature[data-reveal] > .fig {
    transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out), border-color .6s var(--ease-out);
    transition-delay: calc(var(--s, 0) * 130ms), calc(var(--s, 0) * 130ms), 0s;
  }
  .js .feature[data-reveal]::before { transform: scaleX(0); transition: transform 1.5s var(--ease-out); }
  .js .feature[data-reveal].is-in::before { transform: scaleX(1); }

  /* Staggered lists and fact grids */
  .js [data-reveal][data-stagger] { opacity: 1; transform: none; }
  .js [data-stagger] > * {
    opacity: 0; transform: translateY(14px);
    transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
    transition-delay: calc(var(--s, 0) * 70ms + 180ms);
  }
  .js .is-in[data-stagger] > *,
  .js .is-in [data-stagger] > * { opacity: 1; transform: none; }

  /* Figures */
  .js [data-reveal] .seq-msg,
  .js [data-reveal] .steps li { opacity: 0; transition: opacity .8s var(--ease-out), transform .7s var(--ease-out); }
  .js [data-reveal].is-in .seq-msg,
  .js [data-reveal].is-in .steps li { opacity: 1; transition-delay: calc(var(--n) * 170ms + 450ms); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 11. Responsive ----------------------------------------------------------- */
@media (max-width: 1080px) {
  .about-body { grid-column: 4 / span 5; }
  .about-note { grid-column: 9 / span 4; }
  .feature-copy { grid-column: 1 / span 7; }
  .feature .fig { grid-column: 8 / span 5; }
  .feature--flip .feature-copy { grid-column: 6 / span 7; }
  .feature--flip .fig { grid-column: 1 / span 5; }
}

@media (max-width: 900px) {
  /* Mobile navigation */
  .nav-toggle {
    position: relative; z-index: 2;
    display: inline-flex; align-items: center;
    min-height: 44px; padding: 0 2px;
    font-family: var(--mono); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  }
  .nav-menu {
    position: fixed; inset: 0; z-index: 1;
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
    padding: calc(var(--nav-h) + 24px) var(--gutter) 32px;
    background: var(--black);
    overflow-y: auto;
    opacity: 0; visibility: hidden;
    transition: opacity .35s var(--ease), visibility 0s linear .35s;
  }
  .nav-open .nav-menu { opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav-links { flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
  .nav-links li { border-bottom: 1px solid var(--line); }
  .nav-links a, .nav-cta {
    display: flex; align-items: baseline; gap: 20px;
    padding: 16px 0;
    font-size: clamp(1.75rem, 8vw, 2.5rem); font-weight: 500; letter-spacing: -.03em; line-height: 1.1;
    color: var(--white);
  }
  .nav-links a::after { display: none; }
  .nav-links a.is-active { color: var(--orange); }
  .nav-no { display: inline; font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; color: var(--orange); }
  .nav-cta { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-cta:hover, .nav-cta.is-active { background: none; color: var(--orange); }
  .nav-cta::before { content: "05"; font-family: var(--mono); font-size: .75rem; font-weight: 400; letter-spacing: .08em; color: var(--orange); }
  .nav-menu-foot {
    display: flex; flex-direction: column; gap: 10px;
    margin-top: auto; padding-top: 40px;
    font-family: var(--mono); font-size: .8rem; color: var(--gray);
  }
  .nav-links li, .nav-cta, .nav-menu-foot { opacity: 0; transform: translateY(12px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
  .nav-open .nav-links li, .nav-open .nav-cta, .nav-open .nav-menu-foot { opacity: 1; transform: none; }
  .nav-open .nav-links li:nth-child(1) { transition-delay: .06s; }
  .nav-open .nav-links li:nth-child(2) { transition-delay: .10s; }
  .nav-open .nav-links li:nth-child(3) { transition-delay: .14s; }
  .nav-open .nav-links li:nth-child(4) { transition-delay: .18s; }
  .nav-open .nav-cta { transition-delay: .22s; }
  .nav-open .nav-menu-foot { transition-delay: .28s; }
  body.nav-open { overflow: hidden; }

  /* Layout collapses to a single reading column */
  .hero-intro { grid-column: 1 / -1; }
  .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }

  .sec-label { grid-column: 1 / -1; padding: 0 0 20px; }
  .sec-head > :last-child,
  .about-lead, .about-body, .about-note,
  .contact-main > *,
  .edu-head, .edu-grade, .edu-facts, .edu-courses { grid-column: 1 / -1; }
  .edu-grade { text-align: left; }

  .feature-copy, .feature .fig,
  .feature--flip .feature-copy, .feature--flip .fig { grid-column: 1 / -1; grid-row: auto; }
  .feature .fig { margin-top: 40px; }

  .row summary { grid-template-columns: 40px minmax(0, 1fr) 20px; column-gap: 12px; }
  .row-type { grid-column: 2; grid-row: 2; margin-top: 8px; }
  .row-icon { grid-column: 3; grid-row: 1; }
  .row-body { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .row-body .proj-summary, .row-body .proj-facts { grid-column: 1 / -1; }

  .skill { row-gap: 10px; }
  .skill h3, .skill ul, .skill p { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .hero-meta span:nth-child(2) { display: none; }
  .proj-facts { grid-template-columns: 1fr; gap: 18px; }
  .edu-facts { grid-template-columns: 1fr; gap: 18px; }
  .edu-courses ol { columns: 1; }
  .steps li { margin-left: calc(var(--n) * 5%); }
  .footer-mid { display: none; }
}

@media print {
  .site-header, .hero-line, .skip-link { display: none; }
  body, .band { background: #fff; color: #000; }
}
