/* ---------- Tokens ---------- */
:root {
  --bg: #fafafa;
  --card: #ffffff;
  --soft: #f1f2f4;
  --fg: #111318;
  --muted: #6b7079;
  --line: #e6e7ea;
  --line-2: #d2d4d9;
  --shadow: 0 10px 30px -12px rgba(17, 19, 24, .18), 0 2px 6px -2px rgba(17, 19, 24, .06);
  --dot: 17, 19, 24;
  --glow: rgba(17, 19, 24, .05);
  --ok: #22c55e;
  --font: "Poppins", system-ui, sans-serif;
  --wrap: 1180px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b0c0e;
  --card: #141518;
  --soft: #1b1d21;
  --fg: #f3f4f6;
  --muted: #9a9ea8;
  --line: #24262b;
  --line-2: #33363c;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .4);
  --dot: 243, 244, 246;
  --glow: rgba(255, 255, 255, .05);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
/* slide-ins start off-screen; clip on html too, or iOS Safari lets the page pan sideways */
html, body { overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 1rem/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { list-style: none; padding: 0; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 4px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.skip { position: fixed; left: 1rem; top: -4rem; z-index: 200; background: var(--fg); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; }
.skip:focus { top: 1rem; }
.label { font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.center { display: flex; justify-content: center; margin-top: 3rem; }
.u-link { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: background-size .4s var(--ease); }
.u-link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 150; display: grid; place-content: center; justify-items: center; gap: .3rem;
  background: var(--bg); animation: loader-out .6s 1.3s var(--ease) forwards;
}
.loader__name { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; letter-spacing: -.03em; animation: up .7s var(--ease) both; }
.loader__sub { font-size: .7rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); animation: up .7s .1s var(--ease) both; }
.loader__bar { width: 8rem; height: 2px; margin-top: 1.25rem; background: var(--line); overflow: hidden; border-radius: 2px; }
.loader__bar i { display: block; height: 100%; background: var(--fg); transform-origin: left; animation: bar 1.1s .15s var(--ease) both; }
.no-loader .loader { display: none; }
@keyframes bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes loader-out { to { opacity: 0; visibility: hidden; } }

/* ---------- Background ---------- */
.bg-grid, .bg-glow { position: fixed; pointer-events: none; z-index: -1; }
.bg-grid { inset: 0; width: 100%; height: 100%; }
.bg-glow {
  left: 0; top: 0; width: 560px; height: 560px; margin: -280px 0 0 -280px;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  transform: translate3d(-999px, -999px, 0); will-change: transform;
}

/* ---------- Nav (floating pill) ---------- */
.nav-wrap { position: fixed; inset: 1rem 0 auto; z-index: 60; padding: 0 var(--pad); }
.nav {
  position: relative; max-width: 820px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 3.6rem; padding: 0 .6rem 0 1.5rem;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  transition: max-width .5s var(--ease), background-color .4s;
}
.nav__logo { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.nav__logo span { color: var(--muted); }
.nav__links { display: flex; gap: .1rem; }
.nav__links a { display: block; padding: .4rem .75rem; font-size: .9rem; color: var(--muted); border-radius: 999px; transition: color .3s, background-color .3s; }
.nav__links a:hover { color: var(--fg); }
.nav__links a.is-active { color: var(--fg); font-weight: 600; }
.nav__tools { display: flex; gap: .3rem; }
.icon-btn { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; transition: background-color .3s; }
.icon-btn:hover { background: var(--soft); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; transition: transform .6s var(--ease); }
[data-theme-toggle]:hover svg { transform: rotate(45deg); }
[data-theme="light"] .i-moon, [data-theme="dark"] .i-sun { display: none; }
.nav__menu { display: none; position: relative; }
.nav__menu span { position: absolute; left: calc(50% - 8px); top: 50%; width: 16px; height: 1.6px; background: currentColor; transform: translateY(-3px); transition: transform .4s var(--ease); }
.nav__menu span + span { transform: translateY(3px); }
.nav.is-open .nav__menu span { transform: rotate(45deg); }
.nav.is-open .nav__menu span + span { transform: rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  height: 3.1rem; padding: 0 1.5rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600; white-space: nowrap;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background-color .3s, border-color .3s, color .3s;
}
.btn svg { width: 1.05rem; height: 1.05rem; transition: transform .4s var(--ease); }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn--solid { background: var(--fg); color: var(--bg); }
.btn--line { border: 1.5px solid var(--line-2); background: var(--card); }
.btn--line:hover { border-color: var(--fg); }
.btn--block { width: 100%; }
.btn--sm { height: 2.2rem; padding: 0 1rem; font-size: .8rem; border-radius: 8px; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; padding: 8rem 0 6rem; }
.hero__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: .55rem; padding: .35rem .9rem;
  font-size: .78rem; font-weight: 500; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  margin-bottom: 1.5rem;
}
.pill i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: ping 2.2s var(--ease) infinite; }
@keyframes ping { 80%, 100% { transform: scale(2.8); opacity: 0; } }
.hero__title { font-size: clamp(3rem, 7vw, 5.25rem); font-weight: 700; line-height: 1.02; letter-spacing: -.045em; }
.hero__title span {
  background: linear-gradient(100deg, var(--fg) 30%, var(--muted) 50%, var(--fg) 70%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite;
}
@keyframes shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.hero__role { display: flex; align-items: center; min-height: 2.2em; margin: .6rem 0 1.25rem; font-size: clamp(1.25rem, 2.4vw, 1.75rem); font-weight: 600; letter-spacing: -.02em; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; background: var(--fg); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__lede { color: var(--muted); max-width: 34rem; font-size: 1.02rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.connect { margin-top: 2.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: 30rem; }
.connect .label { margin-bottom: .8rem; }
.socials-sq { display: flex; gap: .6rem; }
.socials-sq a {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  transition: transform .35s var(--ease), border-color .3s, background-color .3s, color .3s;
}
.socials-sq svg { width: 1.15rem; height: 1.15rem; }
.socials-sq a:hover { transform: translateY(-3px); background: var(--fg); color: var(--bg); border-color: var(--fg); }

.hero__visual { position: relative; justify-self: center; width: min(100%, 26rem); }
.avatar {
  aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  border: 8px solid var(--card); box-shadow: var(--shadow), 0 0 0 1px var(--line);
  transition: transform .6s var(--ease);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.avatar:hover img { transform: scale(1.04); }
.badges { position: absolute; left: -18%; bottom: 2%; display: grid; gap: .65rem; }
.badges li {
  display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem .55rem .55rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  font-size: .8rem; font-weight: 600; white-space: nowrap;
  animation: float 6s ease-in-out infinite;
}
.badges li:nth-child(2) { animation-delay: -2s; margin-left: 1.5rem; }
.badges li:nth-child(3) { animation-delay: -4s; }
.badge__ico { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: var(--fg); color: var(--bg); flex: none; }
.badge__ico svg { width: 1rem; height: 1rem; }
@keyframes float { 50% { transform: translateY(-6px); } }

.discover { position: absolute; left: 50%; bottom: 1.75rem; transform: translateX(-50%); display: grid; justify-items: center; gap: .5rem; font-size: .65rem; font-weight: 600; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.discover i { position: relative; width: 1.35rem; height: 2.1rem; border: 1.5px solid var(--line-2); border-radius: 999px; }
.discover i::after { content: ""; position: absolute; left: 50%; top: .4rem; width: 3px; height: 6px; margin-left: -1.5px; border-radius: 2px; background: var(--fg); animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }

/* ---------- Sections ---------- */
.section { padding: clamp(5rem, 11vw, 8rem) 0; }
.sec-head { text-align: center; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.sec-head .label { margin-bottom: .5rem; }
.sec-head h2 { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.1; }

/* blur-in reveal */
/* slide-in reveal: up by default, sideways with .from-left / .from-right; --d staggers siblings */
.reveal {
  opacity: 0; filter: blur(8px); transform: translate3d(var(--x, 0), var(--y, 48px), 0);
  transition: opacity 1s var(--ease), filter 1s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.from-left { --x: -80px; --y: 0; }
.reveal.from-right { --x: 80px; --y: 0; }
.tl:nth-child(odd).reveal { --x: 80px; --y: 0; }
.tl:nth-child(even).reveal { --x: -80px; --y: 0; }
.reveal.in { opacity: 1; filter: none; transform: none; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: .85fr 1.4fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.about__photo { border-radius: 18px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); padding: .6rem; }
.about__photo { overflow: hidden; }
.about__photo img { border-radius: 12px; width: 100%; transition: transform 1.2s var(--ease); }
.about__photo:hover img { transform: scale(1.03); }
.about__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.about__cols h3 { font-size: 1.15rem; font-weight: 600; padding-bottom: .8rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line); }
.about__cols p { color: var(--muted); font-size: .95rem; }
.details { margin-top: 2.75rem; }
.details__title { font-size: 1.15rem; font-weight: 600; padding: .1rem 0 .9rem 1rem; border-left: 3px solid var(--fg); border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.details dl { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 2rem; }
.details dt { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.details dd { font-weight: 600; font-size: .95rem; word-break: break-word; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; padding: 1rem 0; border-block: 1px solid var(--line); -webkit-mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee__track { display: flex; width: max-content; will-change: transform; animation: marquee 40s linear infinite; }
@keyframes marquee { from { transform: translateX(-50%); } to { transform: translateX(0); } } /* two copies => seamless loop */
.marquee span { padding-right: .4em; font-size: clamp(2.75rem, 7vw, 5.5rem); font-weight: 700; letter-spacing: -.04em; white-space: nowrap; color: transparent; -webkit-text-stroke: 1.2px color-mix(in srgb, var(--fg) 30%, transparent); }
.marquee b { color: var(--muted); -webkit-text-stroke: 0; font-weight: 700; }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; gap: 2.5rem; padding: 1rem 0; }
.timeline::before, .timeline::after { content: ""; position: absolute; left: 50%; top: 0; width: 2px; margin-left: -1px; border-radius: 2px; }
.timeline::before { bottom: 0; background: var(--line); }
.timeline::after { height: calc(var(--p, 0) * 100%); background: var(--fg); }
.tl { position: relative; display: grid; grid-template-columns: 1fr 1fr; }
.tl + .tl { margin-top: -6rem; } /* stagger alternating cards so they interlock */
.tl::before { content: ""; position: absolute; left: 50%; top: 2.2rem; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--bg); border: 3px solid var(--fg); z-index: 1; }
.tl__card {
  grid-column: 2; margin-left: 3rem; padding: 1.75rem; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line-2);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.tl:nth-child(even) .tl__card { grid-column: 1; margin: 0 3rem 0 0; text-align: right; }
.tl:nth-child(even) .tags { justify-content: flex-end; }
.tl__card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.tl__date { font-size: .75rem; font-weight: 600; letter-spacing: .1em; color: var(--muted); }
.tl__card h3 { font-size: 1.35rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin-top: .4rem; }
.tl__org { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: .25rem 0 1rem; }
.tl__card > p:not([class]) { color: var(--muted); font-size: .93rem; }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1.1rem; }
.tags li { padding: .3rem .7rem; border-radius: 6px; background: var(--soft); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Works ---------- */
.works { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.5rem; }
.work { grid-column: span 2; display: flex; flex-direction: column; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .3s; }
.work--text .work__cover { aspect-ratio: 16 / 10; }
.work:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--line-2); }
.work__thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--soft); border-bottom: 1px solid var(--line); }
.work__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1s var(--ease); }
.work__thumb img.contain { object-fit: contain; object-position: center; padding: 1rem; }
.work__thumb--tint { background: #f3f4f6; }
.work:hover .work__thumb img { transform: scale(1.05); }
.work__body { display: flex; flex-direction: column; flex: 1; padding: 1.5rem; }
.work__cat { font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.work h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; margin: .35rem 0 .6rem; }
.work__body > p:not(.work__cat) { color: var(--muted); font-size: .9rem; margin-bottom: 1.4rem; flex: 1; }
.work__body .tags { margin-top: auto; }
.work__cover { display: grid; place-content: center; text-align: center; background: var(--fg); color: var(--bg); padding: 1.5rem; }
.work__cover span { font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1; transition: transform .6s var(--ease); }
.work__cover small { font-size: .65rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .6; margin-top: .6rem; }
.work:hover .work__cover span { transform: scale(1.08); }

/* ---------- Skills ---------- */
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.75rem; margin: -1.75rem 0 2.75rem; font-size: .8rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .5rem; }
.lv { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--fg); flex: none; }
.lv--3 { background: var(--fg); }
.lv--2 { background: linear-gradient(90deg, var(--fg) 50%, transparent 50%); }
.stack { display: grid; }
.stack__row { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem 3rem; align-items: center; padding: 2rem 0; border-bottom: 1px solid var(--line); }
.stack__row:first-child { border-top: 1px solid var(--line); }
.stack__head h3 { font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.stack__head p { color: var(--muted); font-size: .88rem; margin-top: .35rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .9rem; }
.tiles li {
  position: relative; display: grid; justify-items: center; gap: .65rem; padding: 1.3rem .75rem 1.1rem;
  border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  font-size: .85rem; font-weight: 600; text-align: center;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .3s;
}
.tiles li:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }
.tiles .lv { position: absolute; top: .7rem; right: .7rem; width: 7px; height: 7px; }
.ico { width: 1.85rem; height: 1.85rem; opacity: .9; transition: transform .5s var(--ease); }
.ico--line { stroke-width: 1.6; }
img.ico { filter: brightness(0) saturate(0); opacity: .85; }
[data-theme="dark"] img.ico { filter: brightness(0) invert(1); }
.tiles li:hover .ico { transform: scale(1.12) rotate(-4deg); }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.contact__info h3 { font-size: clamp(1.75rem, 3.2vw, 2.4rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.15; }
.contact__info > p { color: var(--muted); margin: 1rem 0 2rem; max-width: 28rem; }
.mail { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-bottom: 1.75rem; font-weight: 600; font-size: 1.05rem; }
.toast { font-size: .78rem; color: var(--muted); opacity: 0; transition: opacity .3s; }
.toast.show { opacity: 1; }
.form { display: grid; gap: 1.1rem; padding: clamp(1.5rem, 3vw, 2.25rem); border-radius: 18px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.form h3 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .25rem; }
.form label { display: grid; gap: .4rem; font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.form input, .form textarea {
  width: 100%; padding: .8rem 1rem; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg);
  font-size: .92rem; letter-spacing: 0; text-transform: none; color: var(--fg); resize: vertical;
  transition: border-color .3s, box-shadow .3s;
}
.form input::placeholder, .form textarea::placeholder { color: var(--muted); opacity: .7; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 12%, transparent); }
.form__note { font-size: .75rem; color: var(--muted); text-align: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 1.75rem 0; font-size: .82rem; color: var(--muted); }
.footer .wrap { display: flex; flex-wrap: wrap; gap: .6rem 2rem; justify-content: space-between; }
.footer a:hover { color: var(--fg); }

/* ---------- Project modal ---------- */
.modal {
  width: min(56rem, calc(100% - 2rem)); max-height: calc(100svh - 2rem); padding: 0; overflow: auto;
  border: 1px solid var(--line-2); border-radius: 20px; background: var(--card); color: var(--fg); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(10, 11, 13, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { animation: pop .45s var(--ease); }
.modal[open]::backdrop { animation: fadein .35s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); filter: blur(6px); } }
@keyframes fadein { from { opacity: 0; } }
.modal__x { position: absolute; top: .9rem; right: .9rem; z-index: 3; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--card); border: 1px solid var(--line); font-size: 1.4rem; line-height: 1; box-shadow: var(--shadow); transition: transform .4s var(--ease); }
.modal__x:hover { transform: rotate(90deg); }
.modal__body { padding: 1.75rem clamp(1.25rem, 3vw, 2.25rem) 2.25rem; }
.modal__body h3 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; margin: .3rem 0 .8rem; }
.modal__body > p:not(.work__cat) { color: var(--muted); }
.modal__body > p + p { margin-top: .8rem; }
.modal__body strong { color: var(--fg); }
.modal__body .tags { margin: 1.25rem 0 1.75rem; }
.modal__links { display: flex; flex-wrap: wrap; gap: .75rem; }
.stage { padding: 1rem 1rem 0; }
.stage__frames { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); }
.stage--tint .stage__frames { background: #f3f4f6; }
.stage__frames img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; clip-path: inset(0 0 0 100%); transition: clip-path .8s var(--ease); }
.stage__frames img.contain { object-fit: contain; object-position: center; padding: 1rem; }
.stage__frames img.is-active { clip-path: inset(0); z-index: 1; }
.stage__frames img.is-leaving { clip-path: inset(0); z-index: 0; }
.stage__tabs { display: flex; gap: .4rem; margin-top: .8rem; }
.stage__tabs button { padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line-2); font-size: .78rem; font-weight: 500; color: var(--muted); transition: all .3s; }
.stage__tabs button:hover { color: var(--fg); }
.stage__tabs button[aria-selected="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { width: min(80%, 22rem); margin-top: 1rem; }
  .badges { left: auto; right: -12%; bottom: -4%; }
  .about, .contact { grid-template-columns: 1fr; }
  .about__photo { max-width: 24rem; }
  .works { grid-template-columns: 1fr 1fr; }
  .work { grid-column: span 1; }
  .stack__row { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .nav__menu { display: grid; }
  .nav__links {
    position: absolute; top: calc(100% + .6rem); left: 0; right: 0; flex-direction: column; gap: .15rem; padding: .6rem;
    background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .35s var(--ease), transform .35s var(--ease), visibility .35s;
  }
  .nav.is-open .nav__links { opacity: 1; visibility: visible; transform: none; }
  .nav__links a { padding: .75rem 1rem; font-size: 1rem; }
  .nav__links a:hover { background: var(--soft); }
}
@media (max-width: 680px) {
  .about__cols, .details dl { grid-template-columns: 1fr; }
  .works { grid-template-columns: 1fr; }
  .timeline::before, .timeline::after, .tl::before { left: 7px; }
  .tl { grid-template-columns: 1fr; }
  .tl + .tl { margin-top: 0; }
  .tl:nth-child(even).reveal { --x: 80px; }
  .tl__card, .tl:nth-child(even) .tl__card { grid-column: 1; margin: 0 0 0 2.25rem; text-align: left; }
  .tl:nth-child(even) .tags { justify-content: flex-start; }
  .badges { position: static; margin-top: 1.25rem; justify-items: center; }
  .badges li:nth-child(2) { margin-left: 0; }
  .hero__visual { width: 100%; }
  .avatar { width: min(78%, 18rem); margin: 0 auto; }
  .discover { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  /* owner's choice: the marquee keeps moving even with reduced motion */
  .marquee__track { animation-duration: 40s !important; animation-iteration-count: infinite !important; }
  .caret { animation-duration: 1s !important; animation-iteration-count: infinite !important; }
  /* keep a gentle fade, drop the sliding */
  .reveal { transform: none !important; filter: none !important; transition: opacity .6s ease !important; transition-delay: var(--d, 0s) !important; }
  .loader { display: none; }
}
