/* Swiss grid portfolio.
   Layout: strict 12-column grid; one signal-red block per screen (hero name, contact);
   everything else is black type on off-white paper, separated by heavy rules.
   Motion grammar: "grid snap" — rows slide out from the left grid line as they enter
   (CSS view() timelines), the red block grows with page scroll, numerals count up once. */
:root {
  --paper: #f4f4f0;
  --ink: #111111;
  --grey: #5c5c5c;
  --rule: #111111;
  --hair: #d2d2cc;
  --red: #e3120b;
  --red-ink: #ffffff;
  --display: "Archivo Black", "Arial Black", Arial, sans-serif;
  --text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  --col-gap: clamp(12px, 1.6vw, 24px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.5 var(--text); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

/* 12-col frame used everywhere */
.hero, .numbers, .sec, .contact, .foot, .nav {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* grid overlay (press G) */
.grid-overlay { position: fixed; inset: 0; z-index: 90; pointer-events: none; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); opacity: 0; transition: opacity .3s; }
.grid-overlay i { background: rgba(227, 18, 11, .08); border-inline: 1px solid rgba(227, 18, 11, .25); }
body.show-grid .grid-overlay { opacity: 1; }

/* progress rule */
.progress { position: fixed; top: 0; left: 0; height: 4px; width: 100%; background: var(--red); transform-origin: 0 50%; transform: scaleX(0); z-index: 60; }
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
}
@keyframes grow { to { transform: scaleX(1); } }

/* NAV */
.nav { position: sticky; top: 0; z-index: 50; background: var(--paper); align-items: center; padding-block: 12px; border-bottom: 3px solid var(--rule); }
.mark { grid-column: 1 / 2; font: 400 22px/1 var(--display); text-decoration: none; background: var(--red); color: var(--red-ink); padding: 8px 9px 6px; justify-self: start; letter-spacing: -.02em; }
.nav nav { grid-column: 3 / 11; display: flex; gap: clamp(14px, 2.4vw, 34px); font-weight: 700; font-size: 15px; }
.nav nav a { text-decoration: none; position: relative; padding-block: 4px; }
.nav nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--red); transform: scaleX(0); transform-origin: 0 50%; transition: transform .25s; }
.nav nav a:hover::after, .nav nav a.on::after { transform: scaleX(1); }
.nav .btn-red { grid-column: 11 / 13; justify-self: end; }

.btn-red { display: inline-block; background: var(--red); color: var(--red-ink); font: 700 15px/1 var(--text); text-decoration: none; padding: 12px 16px; border: 0; cursor: pointer; transition: background .2s; }
.btn-red:hover { background: var(--ink); }
.link { font: 700 16px/1.2 var(--text); color: var(--ink); background: none; border: 0; padding: 0 0 2px; border-bottom: 3px solid var(--red); text-decoration: none; cursor: pointer; }
.link:hover { color: var(--red); }

/* HERO */
.hero { padding-block: 0; min-height: min(82vh, 760px); }
.hero-red { grid-column: 1 / 6; background: var(--red); color: var(--red-ink); margin-left: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: clamp(24px, 3vw, 40px) clamp(20px, 2.4vw, 32px) clamp(24px, 3vw, 40px) max(var(--gutter), env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px; transform-origin: 0 0; }
.hero-name { font: 400 clamp(60px, 10.4vw, 168px)/.84 var(--display); letter-spacing: -.045em; display: flex; flex-direction: column; }
.hero-name span:last-child { padding-left: .06em; }
.hero-meta { font-weight: 700; font-size: 17px; line-height: 1.45; }
.hero-main { grid-column: 7 / 13; display: flex; flex-direction: column; justify-content: flex-end; gap: 28px; padding-block: 40px; }
.status { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; }
.status i { width: 12px; height: 12px; background: var(--red); border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }
.kick { font: 800 clamp(28px, 3.5vw, 50px)/1.06 var(--text); font-stretch: 92%; letter-spacing: -.02em; max-width: 18ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; }

/* NUMBERS */
.numbers { border-top: 3px solid var(--rule); border-bottom: 3px solid var(--rule); padding-block: 0; }
.numbers > div { grid-column: span 3; padding: 26px 16px 24px 0; border-right: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: baseline; align-content: flex-start; }
.numbers > div:last-child { border-right: 0; }
.numbers > div + div { padding-left: 16px; }
.numbers b { font: 400 clamp(38px, 4.6vw, 70px)/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.numbers b.u { color: var(--red); }
.numbers span { flex-basis: 100%; margin-top: 10px; font-size: 14.5px; color: var(--grey); max-width: 26ch; }

/* SECTIONS */
.sec { padding-block: clamp(56px, 8vw, 110px) 0; row-gap: 0; }
.sec-head { grid-column: 1 / 13; display: grid; grid-template-columns: subgrid; align-items: end; padding-bottom: 14px; border-bottom: 3px solid var(--rule); }
.sec-no { grid-column: 1 / 3; font: 400 clamp(44px, 5vw, 76px)/.8 var(--display); color: var(--red); letter-spacing: -.04em; }
.sec-head h2 { grid-column: 3 / 13; font: 800 clamp(30px, 3.6vw, 52px)/1 var(--text); font-stretch: 88%; letter-spacing: -.02em; }

/* PROJECT ROWS */
.proj { grid-column: 1 / 13; display: grid; grid-template-columns: subgrid; row-gap: 24px; padding-block: 34px 40px; border-bottom: 1px solid var(--rule); align-items: start; }
.proj-no { grid-column: 1 / 3; font: 400 clamp(28px, 2.6vw, 40px)/1 var(--display); color: var(--red); }
.proj-body { grid-column: 3 / 8; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.proj h3 { font: 400 clamp(30px, 3.2vw, 46px)/1 var(--display); letter-spacing: -.03em; }
.proj-tag { font-weight: 700; color: var(--grey); }
.facts { margin: 4px 0 0; border-top: 1px solid var(--hair); }
.facts div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 15px; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: #2a2a2a; }
.proj-links { display: flex; flex-wrap: wrap; gap: 8px 22px; font-weight: 700; }
.proj-links a { text-decoration: none; border-bottom: 3px solid var(--red); padding-bottom: 1px; }
.proj-links a:hover { color: var(--red); }
.proj-result { grid-column: 8 / 10; display: flex; flex-direction: column; gap: 6px; border-left: 3px solid var(--red); padding-left: 14px; }
.proj-result b { font: 400 clamp(34px, 3.6vw, 54px)/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.proj-result span { font-size: 14px; color: var(--grey); }
.proj-shot { grid-column: 10 / 13; margin: 0; border: 1px solid var(--rule); background: #fff; overflow: hidden; }
.proj-shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.proj:hover .proj-shot img { transform: scale(1.04); }
.proj-shot.dark { background: #0d1117; }
.proj-shot.dark img { object-fit: contain; }
.proj-shot.type { background: var(--ink); color: var(--paper); aspect-ratio: 16 / 10; display: flex; align-items: center; padding: 16px; }
.qf { width: 100%; font: 500 13px/1.6 var(--text); font-stretch: 80%; }
.qf span { display: block; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: #9a9a9a; border-bottom: 1px solid #444; padding-bottom: 4px; margin-bottom: 4px; }
.qf p { display: flex; justify-content: space-between; border-bottom: 1px dotted #444; }
.qf em { font-style: normal; font-weight: 700; text-transform: uppercase; color: #8fd18f; }
.qf p.x, .qf p.x em { color: #ff5a4f; }
.qf strong { display: block; margin-top: 8px; font: 400 22px/1 var(--display); color: var(--red); text-transform: uppercase; letter-spacing: .02em; }

/* gates list */
.gates { border-top: 1px solid var(--hair); padding-top: 10px; }
.gates summary { cursor: pointer; font-weight: 700; list-style: none; display: inline-flex; gap: 8px; align-items: center; }
.gates summary::-webkit-details-marker { display: none; }
.gates summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; background: var(--ink); color: var(--paper); font-weight: 800; transition: transform .25s; }
.gates[open] summary::before { transform: rotate(45deg); background: var(--red); }
.gates ol { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: g; columns: 2; column-gap: 24px; font-size: 15px; }
.gates li { counter-increment: g; break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--hair); display: flex; flex-wrap: wrap; gap: 0 8px; }
.gates li::before { content: counter(g, decimal-leading-zero); font-weight: 800; color: var(--grey); min-width: 22px; }
.gates li.fail { color: var(--red); font-weight: 700; }
.gates li.fail::before { color: var(--red); }
.gates li em { flex-basis: 100%; padding-left: 30px; font-style: normal; font-weight: 400; font-size: 13px; color: var(--grey); }

/* APPS */
.apps { grid-column: 1 / 13; display: grid; grid-template-columns: subgrid; padding-top: 34px; row-gap: 40px; }
.app { grid-column: span 6; display: flex; flex-direction: column; gap: 12px; }
.app figure { margin: 0 0 6px; border: 1px solid var(--rule); overflow: hidden; }
.app figure img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top; width: 100%; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.app:hover figure img { transform: scale(1.03); }
.app h3 { font: 400 clamp(28px, 2.8vw, 40px)/1 var(--display); letter-spacing: -.03em; }
.app p { max-width: 54ch; }
.stack { font-size: 14px; font-weight: 700; color: var(--grey); }

/* EXPERIENCE ROWS */
.rows { grid-column: 1 / 13; display: grid; grid-template-columns: subgrid; }
.row { grid-column: 1 / 13; display: grid; grid-template-columns: subgrid; padding-block: 26px; border-bottom: 1px solid var(--rule); align-items: start; row-gap: 14px; }
.row .when { grid-column: 1 / 3; font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--red); padding-top: 6px; }
.row > div { grid-column: 3 / 9; display: flex; flex-direction: column; gap: 8px; }
.row h3 { font: 800 clamp(21px, 2vw, 27px)/1.15 var(--text); }
.row p { color: #2a2a2a; max-width: 60ch; }
.row-shot { grid-column: 10 / 13; margin: 0; border: 1px solid var(--rule); overflow: hidden; }
.row-shot img { aspect-ratio: 16 / 10; object-fit: cover; object-position: top; width: 100%; }

/* SKILLS */
.skills { grid-column: 1 / 13; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-left: 1px solid var(--rule); margin-top: 34px; }
.skills > div { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 20px 18px 18px; display: flex; flex-direction: column; gap: 8px; transition: background .2s, color .2s; }
.skills > div:nth-child(-n + 4) { border-top: 1px solid var(--rule); }
.skills h3 { font: 400 22px/1 var(--display); letter-spacing: -.02em; }
.skills p { font-size: 15px; color: var(--grey); flex: 1; }
.skills a { font-weight: 700; font-size: 14px; text-decoration: none; border-bottom: 2px solid var(--red); align-self: flex-start; }
.skills > div:hover { background: var(--ink); color: var(--paper); }
.skills > div:hover p { color: #c9c9c9; }

/* CONTACT */
.contact { margin-top: clamp(70px, 9vw, 120px); padding-block: 0; border-top: 3px solid var(--rule); }
.contact-red { grid-column: 1 / 6; background: var(--red); color: var(--red-ink); margin-left: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: 34px 28px 40px max(var(--gutter), env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
.contact-red .sec-no { color: var(--red-ink); opacity: .5; }
.contact-red h2 { font: 400 clamp(52px, 7vw, 108px)/.88 var(--display); letter-spacing: -.045em; }
.contact-red p { font-weight: 700; max-width: 30ch; }
.contact-main { grid-column: 7 / 13; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding-block: 40px; }
.big-mail { font: 800 clamp(24px, 3.2vw, 46px)/1.05 var(--text); font-stretch: 85%; letter-spacing: -.02em; color: var(--ink); background: none; border: 0; padding: 0 0 6px; border-bottom: 4px solid var(--red); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.big-mail small { display: block; font: 700 13px/1.4 var(--text); letter-spacing: .1em; text-transform: uppercase; color: var(--grey); margin-top: 6px; }
.big-mail:hover { color: var(--red); }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px 28px; font-weight: 700; }
.contact-links a { text-decoration: none; border-bottom: 3px solid var(--ink); }
.contact-links a:hover { border-color: var(--red); color: var(--red); }

/* FOOTER */
.foot { padding-block: 22px 30px; border-top: 3px solid var(--rule); margin-top: 0; font-size: 14px; color: var(--grey); align-items: center; row-gap: 10px; }
.foot span:first-child { grid-column: 1 / 4; }
.foot span:nth-child(2) { grid-column: 4 / 10; }
.foot kbd { font: 700 12px var(--text); border: 1px solid var(--grey); padding: 1px 5px; }
.egg { grid-column: 10 / 13; justify-self: end; font: 700 14px var(--text); background: none; border: 0; border-bottom: 2px solid var(--grey); color: var(--grey); cursor: pointer; padding: 0; }
.egg:hover { color: var(--red); border-color: var(--red); }

/* GAME DIALOG */
.game { border: 3px solid var(--ink); padding: 0; width: min(760px, 94vw); background: #02030a; color: #e8ecff; }
.game::backdrop { background: rgba(17, 17, 17, .7); }
.game-bar { display: flex; justify-content: space-between; align-items: center; background: var(--red); color: #fff; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.game-bar button { background: none; border: 0; color: #fff; font: 800 24px/1 var(--text); cursor: pointer; }
.game-wrap { position: relative; }
#game { display: block; width: 100%; height: auto; aspect-ratio: 720 / 440; touch-action: none; }
.game-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; background: rgba(2, 3, 10, .82); padding: 20px; transition: opacity .3s; }
.game-overlay.off { opacity: 0; pointer-events: none; }
.game-overlay h3 { font: 400 clamp(28px, 4vw, 40px)/1 var(--display); }
.game-overlay p { color: #b8bfdc; }

/* TOAST */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 140%); background: var(--ink); color: var(--paper); font-weight: 700; padding: 12px 18px; z-index: 80; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.toast.on { transform: translate(-50%, 0); }

/* MOTION: rows slide out from the left grid line as they enter (complete at rest without support) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .proj, .row, .app, .skills > div, .numbers > div {
      animation: from-line linear both; animation-timeline: view(); animation-range: entry 0% entry 55%;
    }
    .sec-head { animation: rule-in linear both; animation-timeline: view(); animation-range: entry 10% entry 70%; }
  }
}
@keyframes from-line { from { clip-path: inset(0 100% 0 0); transform: translateX(-24px); } to { clip-path: inset(0 0 0 0); transform: none; } }
@keyframes rule-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* RESPONSIVE */
@media (max-width: 1080px) {
  .proj-body { grid-column: 3 / 10; }
  .proj-result { grid-column: 10 / 13; }
  .proj-shot { grid-column: 3 / 13; }
  .row > div { grid-column: 3 / 13; }
  .row-shot { grid-column: 3 / 9; }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills > div:nth-child(-n + 4) { border-top: 0; }
  .skills > div:nth-child(-n + 2) { border-top: 1px solid var(--rule); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav nav { display: none; }
  .mark { grid-column: 1 / 4; }
  .nav .btn-red { grid-column: 7 / 13; }
  .hero { min-height: 0; }
  .hero-red, .hero-main, .contact-red, .contact-main { grid-column: 1 / 13; }
  .hero-red, .contact-red { margin-right: calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px))); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
  .hero-red { gap: 26px; }
  .hero-name { font-size: clamp(64px, 21vw, 120px); }
  .hero-main { padding-block: 28px 34px; gap: 22px; }
  .numbers > div { grid-column: span 6; border-right: 0; border-bottom: 1px solid var(--rule); padding: 18px 10px 18px 0; }
  .numbers > div + div { padding-left: 0; }
  .numbers > div:nth-child(odd) { border-right: 1px solid var(--rule); }
  .numbers > div:nth-child(even) { padding-left: 14px; }
  .numbers > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .sec-no { grid-column: 1 / 4; }
  .sec-head h2 { grid-column: 4 / 13; }
  .proj-no { grid-column: 1 / 13; }
  .proj-body, .proj-result, .proj-shot { grid-column: 1 / 13; }
  .gates ol { columns: 1; }
  .app { grid-column: 1 / 13; }
  .row .when, .row > div, .row-shot { grid-column: 1 / 13; }
  .skills { grid-template-columns: minmax(0, 1fr); }
  .skills > div:nth-child(2) { border-top: 0; }
  .facts div { grid-template-columns: 92px minmax(0, 1fr); }
  .foot span:first-child, .foot span:nth-child(2), .egg { grid-column: 1 / 13; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
