/* Normal mode: a calm, single-column portfolio page. Dark only.
   The landing page shares this file and sets its own light tokens in index.html. */
:root {
  color-scheme: dark;
  --bg: #090909;
  --surface: #131315;
  --placeholder: #1a1a1d;              /* behind images and videos while they load */
  --ink: #f2f2f3;
  --text: #b6b8be;
  --muted: #8d9097;
  --faint: #797c84;
  --line: #242428;
  --label: #8d9097;
  --accent: #f2f2f3;
  --head: 'Manrope', 'Inter', system-ui, sans-serif;
  --pixel-head: 'Pixelify Sans', 'Silkscreen', monospace; /* the game's heading font */
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --radius: 14px;
  --rule: rgba(255, 255, 255, .10);       /* ruler + guide lines */
  --tick: rgba(255, 255, 255, .20);
  --tick-soft: rgba(255, 255, 255, .09);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  overflow-x: clip; /* 100vw strips include the scrollbar; don't let them scroll sideways */
  font-family: var(--body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: #ffe58a; color: #111214; }

.page { max-width: 680px; margin: 0 auto; padding: 20px 20px 64px; position: relative; }

/* ── design canvas: rulers framing the column (desktop) ── */
.page::before, .page::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 12px; pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 120px, #000 calc(100% - 120px), transparent);
  mask-image: linear-gradient(transparent, #000 120px, #000 calc(100% - 120px), transparent);
}
/* left ruler: line on its right edge, ticks pointing out (long every 40px, short every 8px) */
.page::before {
  left: -12px;
  background:
    linear-gradient(var(--rule), var(--rule)) right top / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--tick) 0 1px, transparent 1px 40px) right top / 10px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--tick-soft) 0 1px, transparent 1px 8px) right top / 5px 100% no-repeat;
}
.page::after {
  right: -12px;
  background:
    linear-gradient(var(--rule), var(--rule)) left top / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--tick) 0 1px, transparent 1px 40px) left top / 10px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--tick-soft) 0 1px, transparent 1px 8px) left top / 5px 100% no-repeat;
}
/* where a section starts: crosshairs on both guides + a section number */
main { counter-reset: sec; }
section { position: relative; counter-increment: sec; }
section::before, section::after {
  content: ''; position: absolute; top: -1px; width: 11px; height: 11px; pointer-events: none;
  background: linear-gradient(var(--tick), var(--tick)) center / 11px 1px no-repeat, linear-gradient(var(--tick), var(--tick)) center / 1px 11px no-repeat;
}
section::before { left: -26px; }
section::after { right: -26px; }
section .label::before {
  content: counter(sec, decimal-leading-zero); position: absolute; left: -68px; top: 0;
  font: 400 10px var(--px-font-head); color: var(--faint); letter-spacing: .04em;
}
@media (max-width: 860px) { section .label::before { display: none; } }
@media (max-width: 760px) { .page::before, .page::after, section::before, section::after { display: none; } }

/* header + mode switch */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  /* sticky glass bar */
  position: sticky; top: 12px; z-index: 5; margin: 0 -14px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: rgba(20, 20, 22, .55); border: 1px solid rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(16px) saturate(170%); backdrop-filter: blur(16px) saturate(170%);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
  transition: background .25s, box-shadow .25s, border-color .25s;
}
.top.scrolled {
  background: rgba(20, 20, 22, .72); border-color: rgba(255, 255, 255, .11);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 10px 30px rgba(0,0,0,.45);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .top { background: rgba(20, 20, 22, .96); }
}
.brand { font-family: var(--mono); font-size: 13px; letter-spacing: .02em; color: var(--muted); text-decoration: none; }
.brand:hover { color: var(--ink); }
/* mode switch: built from the game's HUD pieces (pixel buttons, gold "on" state, hero sprite) */
.modes {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 8px;
  background: var(--px-deep); border: 3px solid var(--px-deep); box-shadow: 0 3px 0 var(--px-deep), 0 0 0 2px var(--px-wood);
  font-family: var(--px-font-head); font-size: 11px; letter-spacing: .5px;
}
.modes > * {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 5px; white-space: nowrap;
  text-decoration: none; color: var(--px-muted); background: var(--px-panel-2);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.08);
  transition: transform .08s, background .15s, color .15s;
}
.modes a { cursor: var(--px-cursor); }
.modes a:hover { background: #2e3a5e; color: var(--px-ink); }
.modes a:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0,0,0,.35); }
.modes .on { background: #3a3a1f; color: var(--px-gold); }
.modes i { font-style: normal; flex: none; }
.ico-page { font-size: 12px; }
/* the hero's head, cropped from the game's sprite sheet */
.ico-hero {
  width: 18px; height: 18px; border-radius: 3px; image-rendering: pixelated;
  background: url('../assets/media/normal/hero-head.png') center / 18px 18px no-repeat; /* cut from the sprite sheet: 3 KB instead of 2.5 MB */
}
.modes a:focus-visible { outline: 3px solid var(--px-gold); outline-offset: 2px; }

/* hero */
.hero { padding-top: 0; }
/* ASCII video as a profile-style cover banner; the photo overlaps its bottom edge */
.hero-ascii { width: calc(100% + 40px); max-width: none; margin: 0 -20px; height: auto; aspect-ratio: 2 / 1; object-fit: cover; object-position: 50% 40%; background: #000; }
.avatar { width: 116px; height: 116px; border-radius: 20px; object-fit: cover; background: var(--placeholder); }
.hero .avatar { border: 4px solid var(--bg); flex: none; }
.hero h1 { font-family: var(--head); font-weight: 700; font-size: 18px; line-height: 1.3; letter-spacing: -.02em; color: var(--ink); margin: 40px 0 0; }
.hero h1 span { display: block; }
.intro { margin-top: 32px; }
.intro p { margin: 0 0 18px; }
/* game-mode pieces on the calm page */
.hello { display: flex; align-items: flex-start; gap: 14px; position: relative; margin-top: -58px; padding-left: 20px; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.more-btn { margin-top: 20px; font-size: 12px; }
.foot .pixel-btn { border-bottom: 3px solid var(--px-deep); color: var(--px-ink); font-size: 12px; }
.card[data-open] { cursor: var(--px-cursor); transition: transform .25s ease, box-shadow .25s ease; }
.card[data-open]:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.5); }
.card[data-open]:focus-visible { outline: 3px solid var(--px-gold); outline-offset: 3px; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.card-meta span { color: var(--muted); font-size: 14px; }
.card-meta .pixel-btn { font-size: 11px; padding: 6px 10px; flex: none; }
/* a near-black scrim so the pop-up's sheet lifts off the dark page */
#panel.modal { background: rgba(0,0,0,.72); backdrop-filter: blur(2px); }

/* sections */
/* hatched ruler strip between sections, the full width of the screen */
.sep {
  height: 28px; margin: 64px calc(50% - 50vw);
  border-block: 1px solid var(--line);
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .07) 0 1px, transparent 1px 6px);
}
.label { font-family: var(--px-font-head); font-size: 12px; letter-spacing: .06em; color: var(--label); margin: 0 0 22px; font-weight: 400; }
.lede { margin: 0 0 22px; }

/* list rows (experience, contact) */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 1.6fr auto; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row .who { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; }
.row .who b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .what { color: var(--muted); }
.row .when { color: var(--muted); font-variant-numeric: tabular-nums; }
a.row { text-decoration: none; transition: background .2s; }
a.row:hover .who b { text-decoration: underline; text-underline-offset: 3px; }
a.row .when { color: var(--faint); }
.logo { width: 20px; height: 20px; border-radius: 5px; flex: none; object-fit: contain; }
/* Framer's mark is pure black: flip it so it shows on the dark page */
img[src*="framer.com"] { filter: invert(1); }
.badge { width: 20px; height: 20px; border-radius: 5px; flex: none; display: grid; place-items: center; font: 600 10px var(--body); color: #fff; background: #4b4f58; }

/* recent work */
.work { display: grid; gap: 44px; }
.card { border-radius: var(--radius); overflow: hidden; background: var(--surface); display: grid; place-items: center; padding: 26px; }
.card video { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.45); background: var(--placeholder); }
.card.screens { aspect-ratio: 16 / 10; }
.card.screens { padding: 22px 0; place-items: stretch; }
.strip { display: flex; gap: 14px; overflow-x: auto; padding: 0 22px; scroll-snap-type: x mandatory; scrollbar-width: none; align-items: center; }
.strip::-webkit-scrollbar { display: none; }
.strip img { height: 100%; max-height: 100%; width: auto; border-radius: 12px; scroll-snap-align: center; box-shadow: 0 10px 24px rgba(0,0,0,.45); flex: none; background: var(--placeholder); }
.caption { margin: 12px 0 0; color: var(--ink); font-family: var(--pixel-head); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: .03em; }

/* stats row (running, case studies) */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 4px 0 0; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stat b { display: block; color: var(--ink); font-weight: 500; font-size: 16px; }
.stat b i { font-style: normal; margin-right: 6px; }
.stat small { color: var(--muted); font-size: 14px; }

/* GitHub calendar (GitHub's dark-theme greens) */
.gh .stats { margin-bottom: 26px; }
.gh-note { color: var(--muted); margin: 0; padding: 26px 0; }
.gh-cal { overflow-x: auto; padding: 14px 14px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.gh-months, .gh-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(9px, 1fr); gap: 3px; min-width: 560px; }
.gh-months { grid-template-rows: auto; margin-bottom: 6px; }
.gh-months span { font: 400 10px var(--px-font-head); color: var(--faint); white-space: nowrap; grid-row: 1; }
.gh-grid { grid-template-rows: repeat(7, auto); }
.gh-grid i { aspect-ratio: 1; border-radius: 2px; background: #1b1f24; outline: 1px solid rgba(255,255,255,.04); outline-offset: -1px; }
.gh-grid i.pad { background: transparent; outline: 0; }
.gh-grid .l1, .gh-legend .l1 { background: #0e4429; }
.gh-grid .l2, .gh-legend .l2 { background: #006d32; }
.gh-grid .l3, .gh-legend .l3 { background: #26a641; }
.gh-grid .l4, .gh-legend .l4 { background: #39d353; }
.gh-grid i:not(.pad):hover { outline: 2px solid var(--ink); outline-offset: 0; }
.gh-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.gh-legend i { width: 10px; height: 10px; border-radius: 2px; background: #1b1f24; }
.gh-legend i:first-of-type { margin-left: 4px; } .gh-legend i:last-of-type { margin-right: 4px; }

/* photos pair */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--placeholder); }
.photos figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* motion grid (masonry) */
.motion { columns: 2; column-gap: 14px; }
.motion video { width: 100%; border-radius: 12px; margin-bottom: 14px; break-inside: avoid; background: var(--placeholder); }

/* kind words */
.quotes { columns: 2; column-gap: 14px; }
.quote { break-inside: avoid; margin: 0 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 14px; }
.quote header { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.quote .initials { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--body); color: #fff; flex: none; }
.quote b { display: block; color: var(--ink); font-family: var(--pixel-head); font-weight: 600; font-size: 14px; line-height: 1.3; text-transform: uppercase; letter-spacing: .03em; }
.quote small { color: var(--muted); font-size: 13px; line-height: 1.3; display: block; }
.quote p { margin: 0 0 10px; font-size: 14.5px; white-space: pre-line; }
.quote p:last-child { margin-bottom: 0; }

/* tools grid (like a brands wall) */
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tool { height: 64px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--ink); font-size: 14px; font-weight: 500; transition: border-color .2s, transform .2s; }
.tool:hover { border-color: #3d3d43; transform: translateY(-1px); }
.tool img { width: 20px; height: 20px; border-radius: 4px; }
.practice { margin-top: 18px; color: var(--muted); font-size: 15px; }

/* footer */
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.foot p { margin: 0; }
.foot a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--faint); }

/* swarm build: named cursors draw each section as it scrolls in (js/swarm.js) */
.swarm main :is(section, .hero).reveal:not(.sw-go):not(.built) > * { opacity: 0; }
.swarm main :is(section, .hero).reveal:not(.built) .sw-t:not(.sw-on) { opacity: 0; }
.sw-on { animation: sw-in .45s ease backwards; }
@keyframes sw-in { from { opacity: 0; } }
.sw-layer { position: absolute; top: 0; left: 0; width: 0; height: 0; z-index: 4; pointer-events: none; }
.sw-cur { position: absolute; top: 0; left: 0; will-change: transform; transition: opacity .5s; }
.sw-cur svg { display: block; margin: -1px 0 0 -1px; fill: var(--c); stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); transform-origin: 1px 1px; transition: transform .1s; }
.sw-cur.down svg { transform: scale(.85); }
.sw-cur span { position: absolute; left: 14px; top: 18px; background: var(--c); color: #fff; font: 600 11px/1 var(--body); padding: 4px 7px; border-radius: 3px 9px 9px 9px; white-space: nowrap; }
.sw-cur.gone { opacity: 0; }
.sw-sel { position: absolute; top: 0; left: 0; border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); transition: opacity .45s; }
.sw-sel i { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); background: var(--c); color: #fff; font: 500 10px/1 var(--mono); font-style: normal; padding: 3px 5px; border-radius: 3px; white-space: nowrap; }
.sw-sel.done { opacity: 0; }
.sw-caret { display: inline-block; width: 1.5px; height: 1em; background: var(--ink); vertical-align: -2px; margin-left: 1px; animation: sw-blink .8s steps(1) infinite; }
@keyframes sw-blink { 50% { opacity: 0; } }

/* gentle reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

a:focus-visible, .strip:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

@media (max-width: 600px) {
  .page { padding: 12px 16px 48px; }
  .top { top: 8px; margin: 0 -8px; padding: 8px 8px 8px 10px; gap: 8px; }
  .brand { font-size: 11px; }
  .hero { padding-top: 0; }
  .hero-ascii { width: calc(100% + 32px); margin: 0 -16px; }
  .avatar { width: 96px; height: 96px; }
  .hero h1 { margin-top: 30px; }
  .sep { margin-block: 48px; }
  .row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .row .what { grid-column: 1 / -1; grid-row: 2; padding-left: 32px; font-size: 14px; }
  .row .when { grid-row: 1; grid-column: 2; }
  .card { padding: 14px; }
  .card.screens { aspect-ratio: 4 / 3; }
  .card.screens { padding: 14px 0; }
  .strip { padding: 0 14px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 16px; }
  .stats.three { grid-template-columns: 1fr 1fr 1fr; }
  .motion, .quotes { columns: 1; }
  .tools { grid-template-columns: repeat(2, 1fr); }
  .modes > * { padding: 6px 8px; }
  .hello { margin-top: -42px; padding-left: 14px; }
  .hello .avatar { width: 84px; height: 84px; }
  .card-meta span { display: none; }
}
