/*
 * Apple-Store-style design in the colours of the NK logo:
 * crimson for actions and highlights, charcoal for text and the dark block.
 * Light by default; <html data-palette="dark"> gives the charcoal version.
 */
:root,
[data-palette="light"] {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --fill: #f5f5f7;
  --accent: #c41b37;
  --accent-hover: #a8142f;
  --accent-ink: #ffffff;
  --link: #b3152f;
  --eyebrow: #c41b37;
  --shadow: 2px 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 2px 4px 16px rgba(0, 0, 0, 0.16);
  --nav-bg: rgba(250, 250, 252, 0.8);
  --nav-line: rgba(0, 0, 0, 0.08);
  --paddle: rgba(210, 210, 215, 0.64);
  --paddle-ink: rgba(0, 0, 0, 0.56);
  /* Before → after bars: a grey for "before", the accent for "after" (checked for contrast and colour blindness) */
  --bar-before: #8e8e93;
  --bar-after: #c41b37;
  /* The charcoal block (contact) */
  --ink-bg: #1c1d20;
  --ink-text: #f5f5f7;
  --ink-muted: #a1a1a6;
  --ink-fill: rgba(255, 255, 255, 0.08);
  --ink-line: rgba(255, 255, 255, 0.24);
  --glow: rgba(196, 27, 55, 0.1);
  color-scheme: light;
}
[data-palette="dark"] {
  --bg: #1c1d20;
  --card: #26272b;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --line: #3a3b40;
  --fill: rgba(255, 255, 255, 0.07);
  --accent: #c41b37;
  --accent-hover: #d42f4a;
  --accent-ink: #ffffff;
  --link: #ff5c77;
  --eyebrow: #ff5c77;
  --shadow: none;
  --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.12);
  --nav-bg: rgba(28, 29, 32, 0.8);
  --nav-line: rgba(255, 255, 255, 0.08);
  --paddle: rgba(70, 70, 75, 0.72);
  --paddle-ink: rgba(255, 255, 255, 0.82);
  --bar-before: #626267;
  --bar-after: #ff5c77;
  --ink-bg: #111214;
  --glow: rgba(255, 92, 119, 0.12);
  color-scheme: dark;
}

:root {
  --max: 1120px;
  --radius: 18px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1); /* long, soft deceleration for every move */
  --ease-out: cubic-bezier(0, 0, 0.5, 1);
}

* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.016em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: background-color 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip {
  position: absolute; left: 16px; top: -64px; z-index: 30; padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; transition: top 0.3s var(--ease);
}
.skip:focus { top: 12px; }
p, li, dd { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.contain { max-width: var(--max); margin-inline: auto; padding-inline: 24px; }

/* Nav: thin and translucent, like Apple's */
.nav {
  position: sticky; top: 0; z-index: 10; height: 52px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s;
}
.nav.is-scrolled { border-bottom-color: var(--nav-line); }
.nav-inner { max-width: var(--max); height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { width: 31px; height: 26px; fill: currentColor; flex: none; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 13px; letter-spacing: -0.01em; }
.nav-links a:not(.btn) { position: relative; opacity: 0.8; transition: opacity 0.3s; }
.nav-links a:not(.btn):hover, .nav-links a[aria-current] { opacity: 1; }
.nav-links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: right; transition: transform 0.6s var(--ease);
}
.nav-links a:not(.btn):hover::after,
.nav-links a[aria-current]:not(.btn)::after { transform: scaleX(1); transform-origin: left; }
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: var(--accent); transform: scaleX(var(--progress, 0)); transform-origin: left;
}

/* Buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 22px; border-radius: 980px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 400; letter-spacing: -0.016em;
  cursor: pointer; transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
.btn:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--link); border-color: currentColor; }
.btn-ghost:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-small { min-height: 28px; padding: 0 12px; font-size: 12px; letter-spacing: -0.01em; }
.text-link { display: inline-flex; align-items: center; gap: 4px; color: var(--link); }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.arrow { display: inline-block; transition: transform 0.5s var(--ease); }
a:hover > .arrow { transform: translateX(3px); }
a:hover > .arrow.down { transform: translateY(3px); }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 30px; }

/* Hero: a crimson panel with the glossy NK faded in behind the name */
.hero { max-width: calc(var(--max) + 80px); margin: 0 auto; padding: 20px 24px 0; }
.hero-panel {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; min-height: 560px; padding: 72px 64px;
  border-radius: 32px; color: #fff;
  background: radial-gradient(120% 130% at 80% 30%, #c8203c 0%, #a3122e 46%, #6e0818 100%);
  box-shadow: 0 40px 80px -50px rgba(110, 8, 24, 0.65);
}
.hero-bg {
  position: absolute; z-index: -1; right: 2%; top: 50%; width: min(62%, 715px); height: auto; pointer-events: none;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(90deg, transparent 2%, #000 42%); mask-image: linear-gradient(90deg, transparent 2%, #000 42%);
  transform: translate3d(0, calc(-50% + var(--hp, 0) * 70px), 0) scale(calc(1 + var(--hp, 0) * 0.05));
}
.hero-copy { position: relative; max-width: 640px; transform: translate3d(0, calc(var(--hp, 0) * -40px), 0); opacity: calc(1 - var(--hp, 0) * 0.55); }
.eyebrow { margin: 0 0 14px; font-size: 17px; font-weight: 600; letter-spacing: -0.016em; color: var(--eyebrow); }
.hero .eyebrow { color: #ffd6dd; }
h1 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(42px, 4.8vw, 64px); line-height: 1.06; letter-spacing: -0.018em; }
.hero-name, .hero-title { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hero-title { color: rgba(255, 255, 255, 0.74); }
.hero .line { display: inline-block; }
.lead { margin: 22px 0 0; max-width: 600px; font-size: 21px; line-height: 1.4; letter-spacing: -0.01em; }
.hero .lead { color: rgba(255, 255, 255, 0.92); }
.btn-light { background: #fff; color: #a8142f; }
.btn-light:hover { background: #f5f5f7; }
.hero .text-link { color: #fff; }

/* At a glance: a row of small cards, like Apple's category row */
.glance { max-width: var(--max); margin: 0 auto; padding: 24px 24px 0; }
.glance dl { margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.glance dl > div { padding: 18px 18px 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.glance dt { display: flex; flex-direction: column; gap: 12px; font-size: 12px; color: var(--muted); letter-spacing: -0.01em; }
.glance dt svg { width: 28px; height: 28px; color: var(--accent); }
[data-palette="dark"] .glance dt svg { color: var(--link); }
.glance dd { margin: 3px 0 0; font-size: 15px; font-weight: 600; line-height: 1.33; letter-spacing: -0.012em; }

/* Tools: a band of big type that slides sideways as you scroll */
.ticker { overflow: hidden; padding: 64px 0 12px; }
.ticker-track {
  display: flex; width: max-content; padding-left: max(24px, calc((100% - var(--max)) / 2 + 24px));
  transform: translate3d(var(--shift, 0px), 0, 0); will-change: transform;
}
.ticker ul { display: flex; margin: 0; padding: 0; list-style: none; }
.ticker li {
  display: flex; align-items: center; white-space: nowrap;
  font-family: var(--display); font-size: clamp(34px, 5vw, 68px); font-weight: 600; line-height: 1.15; letter-spacing: -0.025em; color: var(--muted);
}
.ticker li::after { content: "·"; margin: 0 0.32em; color: var(--accent); }
[data-palette="dark"] .ticker li::after { color: var(--link); }

/* Sections */
.section { padding-top: 88px; }
.section-head { max-width: var(--max); margin: 0 auto 28px; padding: 0 24px; }
h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -0.014em; }
h2 .sub { color: var(--muted); }
.section-note { margin: 12px 0 0; max-width: 640px; color: var(--muted); font-size: 15px; }

/* Shelf: cards in a row that scrolls sideways, with arrow buttons */
.shelf-track {
  --inset: max(24px, calc((100% - var(--max)) / 2 + 24px));
  display: flex; gap: 20px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-behavior: smooth; scroll-padding-inline: var(--inset);
  padding: 8px var(--inset) 36px; scrollbar-width: none;
}
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-track:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 22px; }
.shelf-track > * { flex: none; scroll-snap-align: start; }
.paddles { max-width: var(--max); margin: -14px auto 0; padding: 0 24px; display: flex; justify-content: flex-end; gap: 14px; }
.paddle {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--paddle); color: var(--paddle-ink); font: 400 26px/1 var(--display); cursor: pointer; transition: opacity 0.3s, background-color 0.3s;
}
.paddle span { margin-top: -3px; }
.paddle:disabled { opacity: 0.42; cursor: default; }
.shelf.is-static .paddles { display: none; }

/* Achievement cards */
.achievement {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  width: 340px; min-height: 340px; padding: 30px 30px 28px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.achievement:hover { transform: scale(1.012); box-shadow: var(--shadow-hover); }
.achievement.is-featured {
  width: 700px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  grid-template-rows: auto auto auto 1fr; gap: 10px 36px;
}
.achievement.is-featured > * { grid-column: 1; }
.achievement.is-featured > .fig { grid-column: 2; grid-row: 1 / -1; align-self: center; margin-top: 0; }
.ach-kind, .project-kind, .job-kind { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: -0.01em; color: var(--eyebrow); }
.achievement h3 { margin: 0; font-family: var(--display); font-size: 24px; line-height: 1.17; font-weight: 600; letter-spacing: -0.01em; }
.achievement.is-featured h3 { font-size: 28px; }
.ach-text { margin: 0; color: var(--muted); font-size: 15px; }
.ach-link { margin-top: auto; padding-top: 10px; align-self: flex-start; color: var(--link); font-size: 15px; }
.ach-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.is-featured .ach-link { align-self: end; justify-self: start; }

/* Before → after figure: one headline number, two bars on one baseline (emphasis on "after") */
.fig { margin-top: 18px; }
.fig-num {
  display: flex; align-items: baseline; gap: 0.12em; margin: 0;
  font-family: var(--display); font-weight: 600; font-size: clamp(56px, 6vw, 84px); line-height: 1; letter-spacing: -0.045em;
}
.fig-arrow { font-weight: 400; color: var(--muted); padding: 0 0.04em; }
.fig-unit { margin-left: 0.12em; font-size: 0.3em; font-weight: 600; letter-spacing: -0.01em; color: var(--muted); }
.digit { position: relative; display: inline-block; height: 1em; overflow: hidden; }
.digit-final { visibility: hidden; }
.digit-strip { position: absolute; left: 50%; top: 0; display: flex; flex-direction: column; transform: translate(-50%, calc(var(--d) * -1em)); }
.digit-strip span { height: 1em; line-height: 1; text-align: center; }
.bars { display: grid; gap: 8px; margin-top: 20px; }
.bar-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 12px; }
.bar-name { font-size: 12px; color: var(--muted); }
.bar { display: block; height: 10px; width: calc(var(--f) * 100%); border-radius: 0 4px 4px 0; background: var(--bar-before); transform-origin: left; }
.bar-row.is-after .bar { background: var(--bar-after); }
.fig-caption { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

/* Awards and certifications (shown only when the profile lists some) */
.recognition { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 8px; }
.recog { padding: 24px 28px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.recog h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--eyebrow); }
.recog ul { list-style: none; margin: 0; padding: 0; }
.recog li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.recog li:first-child { border-top: 0; }
.recog strong { font-weight: 600; }
.recog li span { font-size: 13px; color: var(--muted); }

/* Experience and education */
.timeline { list-style: none; margin-top: 0; margin-bottom: 0; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.job { padding: 32px 34px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.job-head { display: flex; flex-direction: column; gap: 6px; }
.job h3 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.17; letter-spacing: -0.01em; }
.job .org { color: var(--muted); }
.job .when { font-size: 14px; color: var(--muted); }
.job ul { margin: 16px 0 20px; padding-left: 20px; font-size: 15px; line-height: 1.6; }
.job li { margin-bottom: 6px; }
.job li::marker { color: var(--accent); }
.edu { display: flex; flex-direction: column; }
.edu h3 { font-size: 21px; line-height: 1.2; }
.edu-year { margin: auto 0 0; padding-top: 28px; font-family: var(--display); font-size: 72px; font-weight: 600; line-height: 1; letter-spacing: -0.045em; color: var(--accent); }
[data-palette="dark"] .edu-year { color: var(--link); }
.edu-school { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 980px; background: var(--fill); font-size: 12px; line-height: 1.33; letter-spacing: -0.01em; }

/* Projects */
.projects { list-style: none; margin-top: 0; margin-bottom: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.project {
  display: flex; flex-direction: column; gap: 10px; padding: 30px; scroll-margin-top: 84px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.project:hover { transform: scale(1.01); box-shadow: var(--shadow-hover); }
.project:target { box-shadow: 0 0 0 2px var(--accent), var(--shadow-hover); }
.project h3 { margin: 0; font-family: var(--display); font-size: 24px; line-height: 1.17; font-weight: 600; letter-spacing: -0.01em; }
.project-summary { margin: 0; color: var(--muted); font-size: 15px; }
.project .chips { margin-top: auto; padding-top: 10px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.skill-group { padding: 26px 28px 28px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.skill-group h3 { margin: 0 0 14px; font-size: 17px; font-weight: 600; letter-spacing: -0.016em; }

/* AI: one wide card with a soft crimson glow */
.ai-card {
  padding: 64px 48px; border-radius: 28px; text-align: center; box-shadow: var(--shadow);
  background: radial-gradient(70% 90% at 50% 115%, var(--glow), transparent 70%), var(--card);
}
.ai-card .eyebrow { margin-bottom: 12px; }
.ai-card h2 { max-width: 760px; margin: 0 auto; font-size: clamp(30px, 4vw, 48px); }
.ai-card p:not(.eyebrow) { max-width: 640px; margin: 18px auto 0; color: var(--muted); }
.ai-card em { font-style: normal; font-weight: 600; color: var(--text); }
.ai-card .text-link { margin-top: 22px; }

/* Contact: the charcoal block, signed with the charcoal logo */
.contact { padding-bottom: 88px; }
.contact-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 40px; align-items: center;
  padding: 56px; border-radius: 28px; background: var(--ink-bg); color: var(--ink-text); overflow: hidden;
}
.contact .section-head { max-width: none; margin: 0; padding: 0; }
.contact h2 { font-size: clamp(30px, 4vw, 48px); }
.contact .lead { margin: 16px 0 0; color: var(--ink-muted); font-size: 17px; }
.roles { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.roles li { padding: 7px 14px; border-radius: 980px; background: var(--ink-fill); font-size: 14px; }
.contact-where { margin: 18px 0 0; font-size: 14px; color: var(--ink-muted); }
.contact .btn-ghost { color: var(--ink-text); border-color: var(--ink-line); }
.contact .btn-ghost:hover { background: var(--ink-text); border-color: var(--ink-text); color: var(--ink-bg); }
.contact-art {
  display: block; width: 100%; height: auto;
  -webkit-mask-image: radial-gradient(closest-side, #000 64%, transparent); mask-image: radial-gradient(closest-side, #000 64%, transparent);
}

/* Footer */
.footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: var(--max); margin: 0 auto; padding: 18px 24px 32px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; font-size: 12px; color: var(--muted);
}
.footer a:hover { color: var(--text); }

/* Palette picker (preview only, see main.js) */
.palette-picker {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 4px; padding: 4px; border-radius: 980px;
  background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.palette-picker button {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; border: 0; border-radius: 980px;
  background: transparent; color: var(--text); font: 500 13px var(--sans); cursor: pointer;
}
.palette-picker button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14); }
.palette-picker i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }

/* Load-in: the nav fades, the headline rises line by line, then the rest follows */
@keyframes rise { from { transform: translateY(105%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(22px); } }
@keyframes fade-in { from { opacity: 0; } }
.nav { animation: fade-in 1s var(--ease) both; }
.hero .eyebrow { animation: fade-up 1s var(--ease) 0.05s both; }
.hero-name .line { animation: rise 1.3s var(--ease) 0.12s both; }
.hero-title .line { animation: rise 1.3s var(--ease) 0.26s both; }
.hero .lead { animation: fade-up 1.2s var(--ease) 0.42s both; }
.hero .cta-row { animation: fade-up 1.2s var(--ease) 0.54s both; }
.hero-panel { animation: fade-up 1.2s var(--ease) both; }
.hero-bg { animation: fade-in 2.2s var(--ease) 0.35s both; }
.glance dl > div { animation: fade-up 1s var(--ease) both; animation-delay: calc(0.6s + var(--i, 0) * 80ms); }
.ticker { animation: fade-in 1.6s var(--ease) 0.9s both; }

/* Reveal on scroll (main.js adds .reveal only when motion is allowed) */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease) var(--delay, 0ms), transform 1.3s var(--ease) var(--delay, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.section-head.reveal, .shelf.reveal { opacity: 1; transform: none; }
.section-head.reveal > :not(h2) { opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.section-head.reveal > .section-note { transition-delay: 0.35s; }
.section-head.reveal.in > :not(h2) { opacity: 1; transform: none; }
/* Shelf cards slide in from the right, one after another */
.shelf.reveal .shelf-track > * {
  opacity: 0; transform: translateX(96px);
  transition: opacity 1s var(--ease) calc(var(--i, 0) * 90ms + 100ms), transform 1.3s var(--ease) calc(var(--i, 0) * 90ms + 100ms);
}
.shelf.reveal.in .shelf-track > * { opacity: 1; transform: none; }
.shelf.reveal .paddles { opacity: 0; transition: opacity 0.8s var(--ease) 0.6s; }
.shelf.reveal.in .paddles { opacity: 1; }
.words .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.words .w > span { display: inline-block; }
.reveal .words .w > span { transform: translateY(110%); transition: transform 1.2s var(--ease) calc(var(--delay, 0ms) + 80ms + var(--i, 0) * 55ms); }
.reveal.in .words .w > span { transform: none; }
.reveal .digit-strip { transform: translate(-50%, 0); transition: transform 1.8s var(--ease) calc(var(--delay, 0ms) + 300ms + var(--k, 0) * 140ms); }
.reveal.in .digit-strip { transform: translate(-50%, calc(var(--d) * -1em)); }
.reveal .fig-arrow, .reveal .fig-unit { opacity: 0; transition: opacity 0.8s var(--ease) calc(var(--delay, 0ms) + 500ms); }
.reveal.in .fig-arrow, .reveal.in .fig-unit { opacity: 1; }
.reveal .bar { transform: scaleX(0); transition: transform 1.4s var(--ease) calc(var(--delay, 0ms) + 650ms); }
.reveal .is-after .bar { transition-delay: calc(var(--delay, 0ms) + 850ms); }
.reveal.in .bar { transform: none; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-copy { transform: none; opacity: 1; }
  .hero-bg { transform: translate3d(0, -50%, 0); }
  .ticker-track { width: auto; transform: none; }
  .ticker ul { flex-wrap: wrap; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
  .ticker li { font-size: 24px; }
  .ticker ul[aria-hidden] { display: none; }
}

/* Tablet */
@media (max-width: 1068px) {
  .hero-panel { padding: 64px 48px; }
  .hero-bg { width: 66%; right: -4%; opacity: 0.5; }
  .glance dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 834px) {
  .hero-panel { min-height: 0; padding: 64px 40px; }
  /* Behind the text on narrow screens, fainter so the words stay easy to read */
  .hero-bg {
    width: 112%; max-width: 760px; right: -22%; opacity: 0.3;
    -webkit-mask-image: none; mask-image: none;
    transform: translate3d(0, calc(-50% + var(--hp, 0) * 40px), 0);
  }
  .timeline, .projects { grid-template-columns: minmax(0, 1fr); }
  .contact-card { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 40px 28px 44px; }
  .contact-art { order: -1; width: min(100%, 240px); margin: -12px auto 0; }
}

/* Phone */
@media (max-width: 734px) {
  body { font-size: 16px; }
  .nav-links a:not(.btn) { display: none; }
  .brand-text { font-size: 14px; }
  h1 { font-size: 40px; }
  .lead { font-size: 19px; }
  .glance dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .glance dl > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ticker { padding-top: 56px; }
  .section { padding-top: 80px; }
  .achievement { width: min(80vw, 320px); min-height: 300px; padding: 26px; }
  .hero { padding: 12px 12px 0; }
  .hero-panel { padding: 48px 24px; border-radius: 26px; }
  .hero-bg { width: 128%; right: -30%; }
  .achievement.is-featured { width: min(86vw, 420px); display: flex; }
  .achievement.is-featured > .fig { margin-top: 12px; }
  .is-featured .ach-link { align-self: flex-start; }
  .edu-year { font-size: 56px; padding-top: 20px; }
  .achievement.is-featured h3 { font-size: 24px; }
  .job { padding: 26px 24px; }
  .project { padding: 26px; }
  .skills { grid-template-columns: minmax(0, 1fr); }
  .ai-card { padding: 44px 24px; }
  .contact { padding-bottom: 72px; }
  .palette-picker { bottom: 12px; }
}
