:root {
  /* Previous warm palette: bg #f3efe8, surface #ebe6dc, text #2a2622, muted #8a8278, line #d9d2c5 */
  --bg: #fafafa;
  --surface: #f0f0f3;
  --text: #2e2e37;
  --muted: #7b7b86;
  --line: #e2e2e7;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --accent: #3b4fe0;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --bg: #111114;
  --surface: #1a1a1f;
  --text: #ececf0;
  --muted: #8b8b96;
  --line: #27272e;
  --accent: #8f9bff;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

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

.link {
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 1px;
  transition: background-size 0.4s var(--ease), color 0.2s;
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; color: var(--accent); }

.eyebrow, .section__head h2, .edu span, .slider__count {
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Nav */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter);
  font-size: 14px;
  background: linear-gradient(var(--bg) 40%, transparent);
}
.nav__name { font-family: var(--serif); font-size: 25px; letter-spacing: -0.01em; line-height: 1; }
.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__links a { color: var(--muted); transition: color 0.2s; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); }
.nav__links a[aria-current="page"] { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px; }
.nav__theme {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--text);
  background: linear-gradient(90deg, var(--text) 50%, transparent 50%);
  cursor: pointer; padding: 0;
  transition: transform 0.5s var(--ease);
}
.nav__theme:hover { transform: rotate(180deg); }

/* Hero */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px var(--gutter) 80px;
  position: relative;
}
.hero__title {
  font: 400 clamp(44px, 8.5vw, 112px)/1.02 var(--serif);
  letter-spacing: -0.03em;
  margin: 24px 0 28px;
}
.hero__title em { color: var(--muted); font-style: italic; }
.hero__meta { color: var(--muted); font-size: 17px; max-width: 46ch; }
.hero__meta .link { color: var(--text); }
.hero__list { list-style: none; padding: 0; margin: 56px 0 0; max-width: 520px; border-top: 1px solid var(--line); }
.hero__list a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 0; border-bottom: 1px solid var(--line);
  font: 400 24px/1 var(--serif); transition: padding 0.4s var(--ease), color 0.2s;
}
.hero__list a i { font-style: normal; color: var(--muted); transition: transform 0.4s var(--ease), color 0.2s; }
.hero__list a:hover { padding-left: 12px; color: var(--accent); }
.hero__list a:hover i { transform: translateX(-12px); color: var(--accent); }
.hero__scroll {
  position: absolute; left: var(--gutter); bottom: 40px;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.hero__scroll::after {
  content: ""; display: block; width: 1px; height: 36px; margin-top: 10px;
  background: var(--muted); transform-origin: top;
  animation: drip 2.4s var(--ease) infinite;
}
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Pages */
.page { padding-top: 120px; min-height: 80svh; }
.page .section:first-child { padding-top: 24px; }
.page__title { font: 400 clamp(44px, 8vw, 96px)/1 var(--serif); letter-spacing: -0.03em; padding-inline: var(--gutter); margin-bottom: 48px; }
.cta { padding-bottom: 100px; font: 400 clamp(22px, 3vw, 32px)/1.3 var(--serif); padding-inline: var(--gutter); color: var(--muted); }
.cta .link { color: var(--text); }
.rows { list-style: none; padding: 0 var(--gutter); margin: 0; border-top: 1px solid var(--text); }
.rows li { display: flex; justify-content: space-between; gap: 32px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.rows b { display: block; font: 400 22px/1.3 var(--serif); }
.rows span { color: var(--muted); max-width: 60ch; display: block; margin-top: 4px; }
.rows em { font-style: normal; color: var(--muted); font-size: 13px; white-space: nowrap; }
.section > .tags, .section > .langs { margin-inline: var(--gutter); }
.langs { margin-top: 20px; }

/* Form */
.form { display: grid; gap: 22px; width: min(100%, 640px); margin-top: 48px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.form label { display: grid; gap: 6px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.form input, .form textarea {
  font: 400 17px/1.5 var(--sans); color: var(--text); background: none;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 0; resize: vertical;
  transition: border-color 0.25s;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--text); }
.form__foot { display: flex; align-items: center; gap: 20px; }
.btn {
  font: 500 14px/1 var(--sans); padding: 14px 26px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--text); background: var(--text); color: var(--bg);
  transition: background 0.25s, color 0.25s, transform 0.25s var(--ease);
}
.btn:hover { background: none; color: var(--text); }
.btn:active { transform: scale(0.97); }
#form-status { font-size: 14px; color: var(--muted); }

/* Sections */
.section { padding: 120px 0 0; }
.section > h2, .section__head, .edu, .about__grid { padding-inline: var(--gutter); }
.section__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }

/* Sliders */
.slider {
  display: flex; gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 var(--gutter) 8px; scroll-padding-inline: var(--gutter);
  scrollbar-width: none; cursor: grab;
}
.slider::-webkit-scrollbar { display: none; }
.slider.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
.slider.is-dragging * { pointer-events: none; user-select: none; }

.slider__controls { display: flex; align-items: center; gap: 12px; }
.slider__count { margin-right: 8px; font-variant-numeric: tabular-nums; }
.slider__btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: none; color: var(--text);
  font-size: 16px; cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.slider__btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.slider__btn:active { transform: scale(0.94); }

.card {
  flex: 0 0 min(82vw, 520px);
  scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 16px;
}
.card__img {
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: 6px; background: var(--surface);
}
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.card:hover .card__img img { transform: scale(1.04); }
.card__title { font: 400 26px/1.2 var(--serif); letter-spacing: -0.01em; }
.card__desc { color: var(--muted); max-width: 46ch; }
.card__stack { font-size: 13px; color: var(--muted); }
.card__links { display: flex; gap: 20px; font-size: 14px; }

.slider--text .card {
  flex-basis: min(80vw, 360px);
  padding-top: 20px; border-top: 1px solid var(--text);
  min-height: 240px;
}
.card__date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.edu { margin-top: 56px; color: var(--muted); max-width: 70ch; }
.edu span { display: block; margin-bottom: 10px; }

/* About */
.about > .eyebrow { padding-inline: var(--gutter); margin-bottom: 32px; }
.about > h2 { font: 500 12px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding-inline: var(--gutter); margin-bottom: 32px; }
.about__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.about__text { display: grid; gap: 20px; max-width: 58ch; color: var(--muted); }
.about__text .lead { font: 400 clamp(26px, 3.4vw, 40px)/1.2 var(--serif); letter-spacing: -0.02em; color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tags span { font-size: 13px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--text); }
.langs { font-size: 14px; }
.about__photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.about__photos img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; width: 100%; height: auto; }
.about__photos img:nth-child(2) { margin-top: 40px; }

/* Contact */
.contact { padding: 0 var(--gutter) 120px; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 7vw, 120px); align-items: start; }
.contact__info { display: grid; gap: 20px; justify-items: start; }
.contact .form { margin-top: 36px; width: 100%; }
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; gap: 24px; } .contact .form { margin-top: 20px; } }
.contact__title { font: 400 clamp(44px, 8.5vw, 112px)/1 var(--serif); letter-spacing: -0.03em; }
.contact p { color: var(--muted); max-width: 46ch; }
.contact__mail {
  overflow-wrap: anywhere;
  font: 400 clamp(22px, 3.6vw, 40px)/1.2 var(--serif);
  border-bottom: 1px solid var(--text); transition: color 0.2s, border-color 0.2s;
}
.contact__mail:hover { color: var(--accent); border-color: var(--accent); }
.contact__links { list-style: none; display: flex; gap: 24px; padding: 0; margin: 8px 0 0; font-size: 14px; }

.footer {
  display: flex; justify-content: space-between; padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.hero .reveal:nth-child(2) { transition-delay: 0.08s; }
.hero .reveal:nth-child(3) { transition-delay: 0.16s; }
.hero .reveal:nth-child(4) { transition-delay: 0.24s; }

@media (max-width: 720px) {
  .nav__links { gap: 12px; font-size: 13px; }
  .nav__name { font-size: 21px; }
    .about__grid { grid-template-columns: 1fr; }
  .form__row { grid-template-columns: 1fr; }
  .rows li { flex-direction: column; gap: 8px; }
  .slider__btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Headline word reveal */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.w > span { display: inline-block; transform: translateY(112%); animation: rise 1.1s var(--ease) both; animation-delay: calc(var(--i) * 80ms + 80ms); animation-play-state: paused; }
html.ready .w > span { animation-play-state: running; }
@keyframes rise { to { transform: none; } }

/* Page wipe */
.wipe {
  position: fixed; inset: 0; z-index: 200; background: var(--surface);
  display: grid; place-items: center; pointer-events: none;
  transform: translateY(0); transition: transform 0.7s cubic-bezier(0.76, 0, 0.24, 1);
}
.wipe.is-out { transform: translateY(-100%); }
.wipe.is-in { transform: translateY(0); pointer-events: all; }
.wipe:not(.is-out):not(.is-in):not(.wipe--intro) { transition: none; }
.wipe__name { font: 400 clamp(28px, 4vw, 44px)/1 var(--serif); letter-spacing: -0.02em; opacity: 0; transition: opacity 0.5s; }
.wipe--intro .wipe__name { opacity: 1; }

/* Slider progress */
.slider__bar { height: 1px; background: var(--line); margin: 24px var(--gutter) 0; position: relative; }
.slider__bar i { position: absolute; inset: 0; background: var(--text); transform-origin: left; transform: scaleX(var(--p, 0.2)); transition: transform 0.25s var(--ease); }

/* Card link + tilt */
.card__img { transition: transform 0.4s var(--ease); will-change: transform; }
.card__img a { display: block; width: 100%; height: 100%; }

/* Footer clock */
.footer__clock { font-variant-numeric: tabular-nums; }

/* Cursor */
.cursor { position: fixed; inset: 0; z-index: 300; pointer-events: none; display: none; }
.has-cursor .cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor label { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }
.cursor__dot, .cursor__ring { position: fixed; top: 0; left: 0; opacity: 0; transition: opacity 0.3s; }
.cursor-on .cursor__dot, .cursor-on .cursor__ring { opacity: 1; }
.cursor__dot::before { content: ""; display: block; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--text); transition: transform 0.3s var(--ease); }
.cursor__ring::before {
  content: ""; display: grid; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 1px solid var(--text); transition: transform 0.4s var(--ease), background 0.3s, border-color 0.3s;
}
.cursor-link .cursor__ring::before { transform: scale(1.6); border-color: var(--accent); }
.cursor-link .cursor__dot::before { transform: scale(0); }
.cursor-label .cursor__ring::before { transform: scale(2.2); background: var(--text); }
.cursor-label .cursor__dot::before { transform: scale(0); }
.cursor__label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  font: 500 11px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bg);
  opacity: 0; transition: opacity 0.25s; white-space: nowrap;
}
.cursor-label .cursor__label { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .wipe, .cursor { display: none; }
  .w > span { transform: none; animation: none; }
}

/* Cursor v3: glowing head + fading ribbon trail (canvas) */
.cursor__dot::before { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--accent); transition: transform 0.35s var(--ease); }
.cursor-link .cursor__dot::before { transform: scale(1.8); }
.cursor__ring::before { opacity: 0; border: 0; background: var(--text); transition: transform 0.45s var(--ease), opacity 0.25s; }
.cursor-link .cursor__ring::before { transform: none; opacity: 0; }
.cursor-label .cursor__ring::before { opacity: 1; transform: scale(2.4); }
.cursor-label .cursor__dot::before { transform: scale(0); }
.trail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 299; pointer-events: none; }

/* Hero portrait */
.hero > :not(.portrait):not(.hero__scroll) { position: relative; z-index: 1; }
.hero .hero__title { font-size: clamp(40px, 6.8vw, 104px); }
.portrait {
  position: absolute; right: max(var(--gutter), 3vw); bottom: 0; z-index: 0;
  height: min(84svh, 820px); aspect-ratio: 3 / 4; pointer-events: none;
}
.portrait__disc {
  position: absolute; left: 50%; top: 24%; width: 80%; aspect-ratio: 1; border-radius: 50%;
  background: var(--accent); transform: translateX(-50%) scale(0);
  animation: disc 1.3s var(--ease) 0.15s forwards; animation-play-state: paused;
}
.portrait img {
  position: relative; display: block; width: 100%; height: 100%; object-fit: contain; object-position: bottom;
  clip-path: inset(100% 0 0 0); transform: translateY(5%);
  animation: portrait-in 1.4s var(--ease) 0.45s forwards; animation-play-state: paused;
}
html.ready .portrait__disc, html.ready .portrait img { animation-play-state: running; }
@keyframes disc { to { transform: translateX(-50%) scale(1); } }
@keyframes portrait-in { to { clip-path: inset(0 0 0 0); transform: none; } }

@media (max-width: 720px) {
  .hero { justify-content: flex-start; padding-top: 110px; }
  .portrait { height: 40svh; right: -6vw; }
  .hero__list { margin-top: 32px; max-width: 60%; }
  .hero__list a { font-size: 20px; padding: 14px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .portrait__disc { transform: translateX(-50%); animation: none; }
  .portrait img { clip-path: none; transform: none; animation: none; }
}

/* Portfolio list */
.work { list-style: none; margin: 0; padding: 0 var(--gutter); border-top: 1px solid var(--text); }
.work__row {
  display: grid; grid-template-columns: 56px 1.6fr 1fr 190px; gap: 24px; align-items: baseline;
  padding: 28px 0; border-bottom: 1px solid var(--line);
  transition: padding 0.5s var(--ease), border-color 0.3s;
}
.work__row:hover { padding-left: 14px; border-bottom-color: var(--text); }
.work__num { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.work__main h3 { font: 400 clamp(24px, 3vw, 36px)/1.15 var(--serif); letter-spacing: -0.02em; transition: color 0.25s; }
.work__row:hover h3 { color: var(--accent); }
.work__main p { color: var(--muted); max-width: 52ch; margin-top: 6px; }
.work__stack { font-size: 13px; color: var(--muted); }
.work__links { display: flex; gap: 18px; font-size: 14px; white-space: nowrap; justify-content: flex-end; }

@media (max-width: 860px) {
  .work__row { grid-template-columns: 1fr; gap: 10px; padding: 26px 0; }
  .work__num { display: none; }
  .work__row:hover { padding-left: 0; }
}

/* Home CTA + monospace labels */
.hero__cta { align-self: flex-start; margin-top: 28px; font-size: 17px; }
.eyebrow, .section__head h2, .edu span, .slider__count, .card__date, .card__stack,
.work__num, .work__stack, .footer, .rows em, .langs, .tags span, .work__group, .form label {
  font-family: var(--mono); letter-spacing: 0.04em;
}
.eyebrow, .section__head h2, .edu span, .work__group, .form label { text-transform: uppercase; letter-spacing: 0.1em; font-size: 11.5px; }
.card__stack, .work__stack, .langs, .tags span, .rows em, .card__date { font-size: 12px; }
.work__group { display: block; padding: 44px 0 14px; color: var(--accent); font-weight: 500; }
.work__group:first-child { padding-top: 28px; }

/* Scroll progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 250; pointer-events: none; }
.progress i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

.section__head .link { font-size: 14px; }
.section.contact { padding-top: 140px; }


/* Home: compact lists */
.mini { list-style: none; margin: 0; padding: 0 var(--gutter); border-top: 1px solid var(--text); }
.mini a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
  padding: 20px 0; border-bottom: 1px solid var(--line); transition: padding 0.45s var(--ease), border-color 0.3s;
}
.mini b { font: 400 clamp(22px, 2.6vw, 30px)/1.2 var(--serif); letter-spacing: -0.02em; transition: color 0.25s; }
.mini span { font: 400 12px/1 var(--mono); letter-spacing: 0.04em; color: var(--muted); text-align: right; }
.mini a:hover { padding-left: 12px; border-bottom-color: var(--text); }
.mini a:hover b { color: var(--accent); }
.statement { padding-inline: 0; }
.blurb { padding-inline: var(--gutter); font: 400 clamp(22px, 2.8vw, 32px)/1.35 var(--serif); letter-spacing: -0.015em; max-width: 32em; }
.blurb .link { font-size: 0.7em; white-space: nowrap; }
.social { padding-bottom: 120px; }
.social__links { list-style: none; display: flex; gap: 28px; margin: 0; padding: 0 var(--gutter); font-size: 15px; }

/* Easter egg hint + mini game */
.portrait__hint {
  position: absolute; left: -4%; top: 6%; margin: 0; z-index: 2;
  font: 400 11.5px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  opacity: 0; transform: translateY(6px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); white-space: nowrap;
}
.portrait__hint.is-on { opacity: 1; transform: none; transition-delay: 0.9s; }
.portrait__hint span { display: inline-block; color: var(--accent); animation: spin 3.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.game { position: fixed; inset: 0; z-index: 280; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); animation: game-in 0.4s var(--ease); }
.game[hidden] { display: none; }
@keyframes game-in { from { opacity: 0; } }
.game__box { width: min(760px, 100%); background: var(--bg); border: 1px solid var(--text); border-radius: 10px; padding: 18px 20px 14px; }
.game__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; font: 400 12px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.game__title { color: var(--accent); }
.game__stats { color: var(--muted); }
.game__stats b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.game__close { background: none; border: 0; color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.game__stage { position: relative; display: grid; place-items: center; border-radius: 6px; background: var(--surface); overflow: hidden; touch-action: none; }
.game canvas { display: block; touch-action: none; }
.game__panel { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.game__panel[hidden] { display: none; }
.game__panel h3 { font: 400 clamp(28px, 5vw, 44px)/1.1 var(--serif); letter-spacing: -0.02em; }
.game__panel p { color: var(--muted); max-width: 40ch; }
.game__foot { margin: 12px 0 0; font: 400 11px/1.4 var(--mono); color: var(--muted); letter-spacing: 0.04em; }
html.game-open { overflow: hidden; }
@media (max-width: 720px) { .portrait__hint { left: 0; top: auto; bottom: 100%; } }

.btn:disabled { opacity: 0.5; cursor: default; }

/* Text selection: a soft neutral highlight instead of the browser's blue (plain rgba so every browser accepts it) */
::selection { background: rgba(59, 79, 224, 0.16); color: inherit; }
::-moz-selection { background: rgba(59, 79, 224, 0.16); color: inherit; }
:root[data-theme="dark"] ::selection { background: rgba(143, 155, 255, 0.28); }
:root[data-theme="dark"] ::-moz-selection { background: rgba(143, 155, 255, 0.28); }
img::selection { background: transparent; }
a, button { -webkit-tap-highlight-color: transparent; }

/* No selection boxes over images and interface chrome */
img, canvas, button, .portrait, .portrait__hint, .nav, .footer, .cursor, .wipe, .progress, .slider, .card__img, .game__bar {
  -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
img { -webkit-touch-callout: none; }
.card__img img, .portrait img, .about__photos img { pointer-events: none; }

/* Rounded selection: hide the native box (except inside form fields) and draw our own */
html.has-sel ::selection { background: transparent; }
html.has-sel ::-moz-selection { background: transparent; }
html.has-sel input::selection, html.has-sel textarea::selection { background: rgba(59, 79, 224, 0.16); }
:root[data-theme="dark"].has-sel input::selection, :root[data-theme="dark"].has-sel textarea::selection { background: rgba(143, 155, 255, 0.28); }
.sel-layer { position: fixed; inset: 0; z-index: 40; pointer-events: none; -webkit-user-select: none; user-select: none; }
.sel-layer i { position: absolute; background: rgba(59, 79, 224, 0.16); }
:root[data-theme="dark"] .sel-layer i { background: rgba(143, 155, 255, 0.28); }

/* Contact: fix-the-bug */
.bug { margin-top: 28px; width: min(100%, 440px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 16px 18px 14px; }
.bug__label { display: flex; justify-content: space-between; gap: 12px; font: 500 11px/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.bug__label b { font-weight: 500; color: var(--accent); white-space: nowrap; }
.bug__code { margin: 0; font: 400 13.5px/1.8 var(--mono); color: var(--text); white-space: pre-wrap; }
.bug__code code { font: inherit; }
.bug .k { color: var(--accent); }
.bug .s { color: var(--muted); }
.bug__input {
  font: inherit; color: var(--text); background: var(--bg); padding: 1px 6px; margin: 0 1px;
  border: 1px dashed var(--accent); border-radius: 4px; outline: none; transition: border-color 0.2s, background 0.2s;
}
.bug__input:focus { border-style: solid; }
.bug__row { display: flex; align-items: center; gap: 14px; margin-top: 12px; min-height: 36px; flex-wrap: wrap; }
.bug__run {
  font: 500 12px/1 var(--mono); letter-spacing: 0.06em; padding: 9px 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--text); background: none; color: var(--text); transition: background 0.2s, color 0.2s;
}
.bug__run:hover:not(:disabled) { background: var(--text); color: var(--bg); }
.bug__run:disabled { opacity: 0.4; cursor: default; }
.bug__out { font: 400 12.5px/1.6 var(--mono); color: var(--muted); margin: 0; min-height: 20px; }
.bug__out .err { color: #c2452d; }
:root[data-theme="dark"] .bug__out .err { color: #ff8a73; }
.bug__out .ok { color: var(--accent); }
.bug.is-solved { border-color: var(--accent); }
.bug.is-solved .bug__input { border-style: solid; background: transparent; color: var(--accent); }
.bug.is-shaking { animation: bug-shake 0.35s var(--ease); }
@keyframes bug-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .bug.is-shaking { animation: none; } }

.bug__pop { position: fixed; z-index: 290; pointer-events: none; font-size: 20px; line-height: 1; color: var(--accent); }

/* "Say hi" ping: the form lights up so you can see where to type */
.form.is-ping { animation: form-ping 1.6s var(--ease); }
.form.is-ping input[name="name"] { border-color: var(--accent); }
.form.is-ping label:first-child { color: var(--accent); }
@keyframes form-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); } 20% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 12%, transparent); } 100% { box-shadow: 0 0 0 28px transparent; } }
.form { border-radius: 10px; }

/* The bug game is for desktop: hide it on tablets, phones and any touch-only device */
@media (max-width: 1024px), (hover: none) {
  .bug { display: none; }
}

/* Nav: short name on small screens so five tabs fit */
.nav__short { display: none; }
@media (max-width: 600px) { .nav__full { display: none; } .nav__short { display: inline; } .nav__links { gap: 11px; font-size: 12.5px; } }

/* Photography */
.photos { padding: 0 var(--gutter) 100px; columns: 3; column-gap: 20px; }
@media (max-width: 900px) { .photos { columns: 2; } }
@media (max-width: 560px) { .photos { columns: 1; } }
.photo { margin: 0 0 20px; break-inside: avoid; position: relative; cursor: pointer; overflow: hidden; border-radius: 6px; background: var(--surface); }
.photo img { width: 100%; height: auto; display: block; transition: transform 0.9s var(--ease); }
.photo:hover img { transform: scale(1.03); }
.photo figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 12px; color: #fff;
  font: 400 11.5px/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.45)); opacity: 0; transition: opacity 0.4s var(--ease);
}
.photo:hover figcaption, .photo:focus-visible figcaption { opacity: 1; }
.photos__empty { column-span: all; color: var(--muted); font: 400 clamp(22px, 3vw, 32px)/1.3 var(--serif); padding: 20px 0 80px; }

.lightbox { position: fixed; inset: 0; z-index: 280; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 96%, transparent); animation: game-in 0.35s var(--ease); }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: grid; gap: 12px; justify-items: center; max-width: 92vw; }
.lightbox img { max-width: 92vw; max-height: 82vh; width: auto; height: auto; border-radius: 4px; }
.lightbox figcaption { font: 400 12px/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.lightbox__btn { position: absolute; background: none; border: 1px solid var(--line); color: var(--text); width: 44px; height: 44px; border-radius: 50%; font-size: 18px; cursor: pointer; transition: background 0.25s, color 0.25s; }
.lightbox__btn:hover { background: var(--text); color: var(--bg); }
.lightbox__close { top: 20px; right: 20px; font-size: 24px; }
.lightbox__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 20px; top: 50%; transform: translateY(-50%); }

/* Experience: interactive hover */
.slider--text .card {
  position: relative; border-top: 1px solid var(--line); min-height: 180px; padding-top: 22px; gap: 10px;
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}
.slider--text .card::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease);
}
.slider--text .card:hover::before, .slider--text .card:focus-visible::before { transform: scaleX(1); }
.slider--text .card:hover, .slider--text .card:focus-visible { outline: none; }
.slider--text .card__title { transition: color 0.3s; }
.slider--text .card:hover .card__title, .slider--text .card:focus-visible .card__title { color: var(--accent); }
.slider--text .card__date { transition: color 0.3s; }
.slider--text .card:hover .card__date { color: var(--text); }


/* Experience: descriptions are always visible */
.slider--text { padding-top: 16px; }
.slider--text .card { min-height: 190px; }
.card__more p { margin: 0; }

/* Word reveal: leave room around each word so italic overhangs and ascenders aren't clipped */
.w { padding: 0.18em 0.16em 0.2em; margin: -0.18em -0.16em -0.2em; }

/* Photo labels with arrows */
.shot { margin: 0; position: relative; }
.shot:nth-child(2) { margin-top: 40px; }
.shot img { aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; width: 100%; height: auto; margin: 0 !important; }
.tag { position: absolute; left: var(--x); top: var(--y); width: 0; height: 0; pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity 0.6s var(--ease) 0.9s, transform 0.6s var(--ease) 0.9s; }
.about__photos.is-in .tag { opacity: 1; transform: none; }
.tag i {
  position: absolute; left: 0; bottom: 46px; transform: translateX(-50%); white-space: nowrap; font-style: normal;
  font: 500 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 99px; background: var(--text); color: var(--bg);
}
.tag svg { position: absolute; left: -15px; top: -43px; width: 30px; height: 46px; overflow: visible; fill: none; stroke: #1b1b21; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 2px rgba(255, 255, 255, 0.8)); }
.tag svg path { stroke-dasharray: 70; stroke-dashoffset: 70; transition: stroke-dashoffset 0.8s var(--ease) 1.1s; }
.about__photos.is-in .tag svg path { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) { .tag { opacity: 1; transform: none; transition: none; } .tag svg path { stroke-dashoffset: 0; transition: none; } }

/* Section separators (match the Education rule) */
.block { border-top: 1px solid var(--text); padding: 24px var(--gutter) 0; }
.block .tags { margin: 0; }
.page > .section:last-child { padding-bottom: 100px; }

/* Spacing fixes */
.section.cta { padding-inline: var(--gutter); }
.blurb .link { display: inline-block; margin-top: 20px; }

/* Photo labels, minimal version: small frosted label, hairline and a dot */
.tag svg { display: none; }
.tag i {
  bottom: 36px; padding: 5px 9px; border-radius: 4px; font-size: 10.5px; letter-spacing: 0.12em;
  background: rgba(250, 250, 250, 0.82); color: #1b1b21;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.tag::before {
  content: ""; position: absolute; left: -0.5px; bottom: 0; width: 1px; height: 32px; background: #1b1b21;
  transform: scaleY(0); transform-origin: bottom; transition: transform 0.7s var(--ease) 1.0s;
}
.tag::after {
  content: ""; position: absolute; left: -4.5px; top: -4.5px; width: 6px; height: 6px; border-radius: 50%;
  background: #1b1b21; border: 1.5px solid #fff; transform: scale(0); transition: transform 0.5s var(--ease) 0.9s;
}
.about__photos.is-in .tag::before { transform: scaleY(1); }
.about__photos.is-in .tag::after { transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .tag::before, .tag::after { transform: none; transition: none; } }

/* Photo labels: the label sits outside the photo and a hairline runs in to the target */
.tag { top: -24px; height: calc(var(--y) + 24px); }
.tag i { bottom: 100%; }
.tag::before { top: 0; bottom: auto; height: 100%; transform-origin: top; }
.tag::after { top: auto; bottom: -4.5px; }

/* Labels live on the page now: plain text, and the line inverts so it shows on photo and page alike */
.tag i { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--text); padding: 0 0 6px; }
.tag::before { background: #fff; mix-blend-mode: difference; }
.tag::after { background: #fff; border: 0; width: 7px; height: 7px; left: -3.5px; bottom: -3.5px; mix-blend-mode: difference; }
.tag::after { mix-blend-mode: normal; background: #1b1b21; border: 1.5px solid #fff; width: 6px; height: 6px; left: -4.5px; bottom: -4.5px; box-sizing: content-box; }

/* Variant: label below the photo, line rises from the bottom edge */
.tag--below { top: var(--y); height: calc(100% - var(--y) + 24px); }
.tag--below i { bottom: auto; top: 100%; padding: 6px 0 0; }
.tag--below::before { top: 0; height: 100%; transform-origin: bottom; }
.tag--below::after { bottom: auto; top: -4.5px; }
.about__photos { align-items: start; }

/* Arrowhead tips instead of dots */
.tag::after {
  top: auto; bottom: 1.7px; left: -4px; width: 8px; height: 8px; box-sizing: border-box;
  background: none; border: solid #fff; border-width: 0 1.5px 1.5px 0; border-radius: 0;
  mix-blend-mode: difference; transform: rotate(45deg) scale(0);
}
.about__photos.is-in .tag::after { transform: rotate(45deg) scale(1); }
.tag--below::after { top: 1.7px; bottom: auto; transform: rotate(225deg) scale(0); }
.about__photos.is-in .tag--below::after { transform: rotate(225deg) scale(1); }
@media (prefers-reduced-motion: reduce) { .tag::after { transform: rotate(45deg); } .tag--below::after { transform: rotate(225deg); } }

/* Make the line and arrowhead clearly visible on photos and on the page (dark core, light edge) */
.tag::before { background: #1b1b21; mix-blend-mode: normal; width: 1.5px; left: -0.75px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85); }
.tag::after { border-color: #1b1b21; mix-blend-mode: normal; border-width: 0 2px 2px 0; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }

/* Thinner line and arrowhead */
.tag::before { width: 1px; left: -0.5px; box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.75); }
.tag::after { width: 7px; height: 7px; left: -3.5px; bottom: 1.45px; border-width: 0 1.2px 1.2px 0; filter: drop-shadow(0 0 0.6px #fff) drop-shadow(0 0 0.6px #fff); }
.tag--below::after { top: 1.45px; bottom: auto; }

/* Photo filters */
.filters { display: flex; gap: 22px; padding: 0 var(--gutter) 32px; font: 400 12px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.filters button { background: none; border: 0; padding: 0 0 5px; color: var(--muted); cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; border-bottom: 1px solid transparent; transition: color 0.25s, border-color 0.25s; }
.filters button:hover { color: var(--text); }
.filters button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--text); }
.photos.is-swap { animation: photos-swap 0.5s var(--ease); }
@keyframes photos-swap { from { opacity: 0; transform: translateY(8px); } }
.photo img { background: var(--surface); }

/* Smaller "View" / "Drag" bubble */
.cursor-label .cursor__ring::before { transform: scale(1.65); }
.cursor__label { font-size: 9.5px; letter-spacing: 0.06em; }

/* Photos: even columns (built in script.js) */
.photos { columns: auto; display: flex; gap: 20px; align-items: flex-start; }
.photos__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.photos .photo { margin: 0; }
.photos__empty { width: 100%; }

/* Leaderboard */
.game__lb { margin-top: 14px; }
.game__lb h4 { margin: 0 0 8px; font: 500 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.game__lbl { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 28px; font: 400 12.5px/1.9 var(--mono); }
.game__lbl li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; border-bottom: 1px solid var(--line); }
.game__lbl li span { color: var(--muted); }
.game__lbl li b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game__lbl li em { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; }
.game__lbl li.is-empty { grid-column: 1 / -1; display: block; border: 0; color: var(--muted); }
@media (max-width: 640px) { .game__lbl { grid-template-columns: 1fr; } }
.game__save { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.game__save input { font: 400 14px/1 var(--mono); padding: 11px 14px; border-radius: 99px; border: 1px solid var(--text); background: var(--bg); color: var(--text); width: 170px; text-align: center; }
.game__save input:focus { outline: none; border-color: var(--accent); }
.game__save[hidden] { display: none; }

/* Phones: keep the hint fully on screen (right-aligned to the page margin, wraps if needed) */
@media (max-width: 720px) {
  .portrait__hint {
    left: auto; right: calc(6vw + var(--gutter)); top: auto; bottom: 100%;
    white-space: normal; text-align: right; max-width: calc(100vw - 2 * var(--gutter)); margin-bottom: 8px;
  }
}

/* Touch: stop the browser zooming on double tap, so double-tapping my face opens the game instead */
html { touch-action: manipulation; }
@media (max-width: 720px) { .portrait__hint { width: max-content; max-width: calc(100vw - 2 * var(--gutter)); } }
