/* Jack Shen portfolio. Flat, ruled and square, after Harvard Innovation Labs and YC,
   with one 3-D chessboard as the centerpiece. Order: tokens, base, type, pieces, nav,
   stage (board + hero + timeline), sections, resume, contact, responsive. */

:root {
  --paper: #f7f6f2;
  --white: #ffffff;
  --cloud: #efede7;
  --ink: #0e1013;
  --ink-hi: #272b33;
  --slate: #5d6370;
  --line: #dcd9d0;
  --accent: #eb5a26;
  --accent-hi: #f2753f;

  --f-head: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --f-label: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, sans-serif;

  --max: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --sec: clamp(72px, 9vw, 128px);
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); overflow-x: clip; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 1.0625rem/1.6 var(--f-body); -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3, p, dl, dd, dt, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #fff; }
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--slate); }
.small { font-size: .875rem; }

/* ---------- type ---------- */
.h1 { font-family: var(--f-head); font-weight: 600; font-size: clamp(2.5rem, 4.6vw, 4.5rem); line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.h2 { font-family: var(--f-head); font-weight: 600; font-size: clamp(1.9rem, 3.2vw, 3rem); line-height: 1.06; letter-spacing: -0.03em; text-wrap: balance; }
.h3 { font-family: var(--f-head); font-weight: 600; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.02em; }
.h3.big { font-size: clamp(1.6rem, 2.4vw, 2.1rem); letter-spacing: -0.03em; }
.meta { font-family: var(--f-label); font-weight: 800; font-size: .9rem; line-height: 1.3; letter-spacing: .07em; text-transform: uppercase; color: var(--slate); }
.lead { font-size: 1.1875rem; line-height: 1.55; color: var(--slate); max-width: 36rem; text-wrap: pretty; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.eyebrow::before { content: ""; width: 9px; height: 9px; background: var(--accent); flex: none; }
.fine { font-size: .875rem; color: var(--slate); margin-top: 14px; }

/* ---------- pieces ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 22px; border: 1px solid transparent;
  font-family: var(--f-body); font-weight: 600; font-size: 1rem; text-decoration: none;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn-sm { min-height: 42px; padding: 0 16px; font-size: .9375rem; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-hi); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hi); }
.btn-line { border-color: var(--ink); color: var(--ink); }
.btn-line:hover { background: var(--ink); color: #fff; }
.btn[aria-disabled="true"] { background: var(--cloud); color: var(--slate); border-color: transparent; pointer-events: none; }
.arr { display: inline-block; transition: transform .2s ease-out; }
:is(.btn, .link, .op-feature, .contact-mail):hover .arr { transform: translateX(3px); }
.link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.link:hover { color: var(--accent); text-decoration-thickness: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tag { display: inline-flex; padding: 2px 8px; background: var(--cloud); color: var(--ink-hi); font-family: var(--f-label); font-weight: 700; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.tag.ink { background: var(--ink); color: #fff; margin-left: 6px; vertical-align: 1px; }

/* ---------- nav ---------- */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; height: var(--nav-h); background: rgba(247, 246, 242, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.nav.scrolled { border-color: var(--line); }
.nav-in { height: 100%; max-width: none; padding-inline: var(--gutter); display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--f-head); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.02em; }
.avatar { display: block; width: 40px; height: 40px; object-fit: cover; background: var(--cloud); box-shadow: 0 0 0 1px var(--line); }
.avatar-sm { width: 32px; height: 32px; }
.nav-links { display: flex; gap: 28px; margin-left: auto; font-weight: 500; font-size: .9375rem; }
.nav-links a { text-decoration: none; color: var(--ink-hi); padding-block: 6px; border-bottom: 2px solid transparent; }
.nav-links a:hover { border-color: var(--accent); }

/* ---------- stage: pinned 3-D board beside the hero and timeline ---------- */
.stage { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); padding-top: var(--nav-h); border-bottom: 1px solid var(--line); }
.stage-text { grid-column: 1; grid-row: 1; padding-left: var(--gutter); padding-right: clamp(24px, 4vw, 56px); }
.stage-board { grid-column: 2; grid-row: 1; border-left: 1px solid var(--line); background: linear-gradient(180deg, var(--paper), var(--cloud)); }
.board-pin { position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); height: calc(100svh - var(--nav-h)); display: flex; flex-direction: column; }
.board-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 24px 0; flex-wrap: wrap; }
.board-head .meta:first-child { color: var(--ink); }
.board-3d { position: relative; flex: 1; min-height: 0; }
.board-3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; }
.board-3d.no-webgl { display: grid; place-items: center; padding: 24px; color: var(--slate); text-align: center; }
.board-hud { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 0 24px 10px; }
.ctl { width: 42px; height: 42px; border: 1px solid var(--ink); font-size: 1.1rem; transition: background-color .2s, color .2s; }
.ctl:hover { background: var(--ink); color: #fff; }
.hud-status { min-width: 9ch; text-align: center; font-family: var(--f-label); font-weight: 800; font-size: 1.6rem; letter-spacing: .02em; }
.movelist { display: flex; gap: 2px; overflow-x: auto; padding: 10px 24px 16px; border-top: 1px solid var(--line); scrollbar-width: none; font-size: .875rem; font-variant-numeric: tabular-nums; }
.movelist::-webkit-scrollbar { display: none; }
.movelist li { display: flex; align-items: baseline; flex: none; }
.movelist .num { color: var(--slate); padding: 4px 2px 4px 8px; font-family: var(--f-label); font-weight: 700; }
.movelist button { padding: 4px 6px; color: var(--slate); }
.movelist button.career { color: var(--ink); font-weight: 600; }
.movelist button.played { color: var(--ink-hi); }
.movelist button.current { background: var(--ink); color: #fff; }
.movelist button:hover:not(.current) { color: var(--accent); }
.mate { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; background: rgba(247, 246, 242, .82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .6s ease-out; }
.mate .meta { color: var(--accent); }
.mate-title { font-family: var(--f-head); font-weight: 600; font-size: clamp(2.6rem, 5vw, 4.5rem); letter-spacing: -0.04em; line-height: 1; margin-bottom: 10px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.hero { min-height: calc(100vh - var(--nav-h)); min-height: calc(100svh - var(--nav-h)); display: flex; flex-direction: column; justify-content: center; gap: 26px; padding-block: 48px; }
.hero .h1 { max-width: 13ch; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); margin-top: 18px; }
.facts div { padding: 16px 16px 0 0; }
.facts div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.facts dt { font-family: var(--f-label); font-weight: 800; font-size: 2.4rem; line-height: 1; }
.facts dd { color: var(--slate); font-size: .875rem; margin-top: 6px; }

.timeline { padding-bottom: 30vh; }
.tl-intro { padding: 64px 0 24px; border-top: 1px solid var(--ink); display: grid; gap: 14px; }
.move-card { min-height: 82vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0 40px 28px; border-left: 2px solid var(--line); opacity: .28; transition: opacity .5s ease-out, border-color .5s; }
.move-card.active { opacity: 1; border-color: var(--accent); }
.mc-san { font-family: var(--f-label); font-weight: 800; font-size: clamp(4rem, 7vw, 6.5rem); line-height: .9; letter-spacing: -0.01em; }
.mc-san span { color: var(--accent); margin-right: .12em; }
.mc-note { color: var(--slate); font-size: 1.0625rem; margin: 10px 0 28px; font-style: italic; }
.move-card .h3 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); letter-spacing: -0.03em; margin-top: 8px; }
.mc-org { font-weight: 600; margin-top: 4px; }
.mc-body { color: var(--ink-hi); margin-top: 16px; max-width: 34rem; }
.points { margin-top: 16px; max-width: 34rem; display: grid; gap: 8px; }
.points li { position: relative; padding-left: 20px; color: var(--ink-hi); }
.points li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; background: var(--accent); }
.move-card .actions { margin-top: 26px; }

/* ---------- sections ---------- */
.sec { padding-block: var(--sec); border-bottom: 1px solid var(--line); }
.sec-head { display: grid; gap: 16px; max-width: 46rem; margin-bottom: 48px; }

.op { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); padding: 32px; text-decoration: none; }
.op-feature { display: grid; grid-template-columns: 1.2fr 1fr; padding: 0; transition: border-color .2s; }
.op-feature:hover { border-color: var(--ink); }
.op-shot { display: flex; align-items: center; background: var(--cloud); padding: 32px; border-right: 1px solid var(--line); }
.op-shot img { width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
.op-body { padding: 36px; display: flex; flex-direction: column; gap: 12px; }
.op-body .link { margin-top: auto; padding-top: 16px; }
.op-moves { font-family: var(--f-label); font-weight: 700; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.op-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.op .h3 { margin-top: 10px; }
.op .op-moves { margin-top: 6px; }
.op > p:not([class]) { color: var(--ink-hi); margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); margin-top: 22px; }
.stats div { padding: 14px 12px 0 0; }
.stats div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.stats dt { font-family: var(--f-label); font-weight: 800; font-size: 2.2rem; line-height: 1; }
.stats dd { color: var(--slate); font-size: .8125rem; margin-top: 6px; }

.chess-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.chess-grid > div:first-child { display: grid; gap: 18px; }
.ratings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-left: 1px solid var(--line); }
.ratings div { padding: 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); }
.ratings .wide { grid-column: 1 / -1; background: var(--ink); color: #fff; border-color: var(--ink); }
.ratings dt { font-family: var(--f-label); font-weight: 800; font-size: 3rem; line-height: 1; }
.ratings dd { font-family: var(--f-label); font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin-top: 8px; }
.ratings .wide dd { color: #b9bec8; }

/* ---------- resume ---------- */
.resume .sec-head .actions { margin-top: 8px; }
.paper-stage { perspective: 1600px; overflow-x: clip; padding-bottom: 60px; margin-bottom: -60px; }
.paper {
  --tilt: 0;
  max-width: 816px; margin: 0 auto; background: #fff; color: #111;
  padding: 56px 64px 64px; border: 1px solid var(--line);
  font: 13.5px/1.42 Tinos, "Times New Roman", serif;
  box-shadow: 0 40px 80px -40px rgba(14, 16, 19, .35);
  transform-origin: 50% 0;
  transform: rotateX(calc(var(--tilt) * 24deg)) translateY(calc(var(--tilt) * 40px));
}
.paper a { color: #1a4fb4; }
.p-head { text-align: center; }
.p-head h1 { font-size: 22px; letter-spacing: .02em; }
.p-head p { color: #333; margin-top: 2px; }
.paper h2 { font-size: 14px; text-transform: uppercase; border-bottom: 1px solid #555; margin: 14px 0 6px; padding-bottom: 1px; }
.paper ul { list-style: disc; padding-left: 22px; margin: 2px 0 6px; }
.paper li { margin-top: 1px; }
.p-role { display: grid; grid-template-columns: 1fr auto; margin-top: 6px; }
.p-role span { text-align: right; }
.p-sub { font-style: italic; }

/* ---------- contact ---------- */
.contact .wrap { display: grid; gap: 18px; }
.contact-title { font-family: var(--f-head); font-weight: 600; font-size: clamp(4rem, 12vw, 10rem); line-height: .9; letter-spacing: -0.05em; }
.contact-mail { display: inline-flex; align-items: center; gap: 14px; width: max-content; max-width: 100%; font-family: var(--f-head); font-weight: 600; font-size: clamp(1.5rem, 3.6vw, 2.75rem); letter-spacing: -0.03em; text-decoration: none; border-bottom: 3px solid var(--accent); padding-bottom: 4px; }
.contact-mail:hover { color: var(--accent); }
.contact-links { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 8px; }
.footer { padding-block: 28px; }
.footer-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --nav-h: 60px; }
  .nav-in { gap: 16px; }
  .nav-links { display: none; }
  .nav .btn { margin-left: auto; }
  .nav .avatar { width: 36px; height: 36px; }
  .stage { grid-template-columns: 1fr; }
  .stage-board { grid-column: 1; grid-row: 1; position: sticky; top: var(--nav-h); z-index: 5; border-left: 0; border-bottom: 1px solid var(--line); background: var(--cloud); height: 46svh; }
  .board-pin { position: static; height: 100%; }
  .board-head { padding: 10px 16px 0; }
  .board-head .muted { display: none; }
  .board-hud { padding-bottom: 8px; gap: 14px; }
  .ctl { width: 36px; height: 36px; }
  .hud-status { font-size: 1.3rem; }
  .movelist { display: none; }
  .stage-text { grid-column: 1; grid-row: 2; padding-inline: var(--gutter); }
  .hero { min-height: 0; padding-block: 40px 56px; }
  .facts dt { font-size: 1.9rem; }
  .move-card { min-height: 60svh; justify-content: flex-start; padding: 28px 0 28px 18px; }
  .mc-san { font-size: 3.6rem; }
  .mc-note { margin-bottom: 18px; }
  .op-feature { grid-template-columns: 1fr; }
  .op-shot { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; }
  .op-body, .op { padding: 24px; }
  .op-row { grid-template-columns: 1fr; }
  .chess-grid { grid-template-columns: 1fr; gap: 36px; }
  .paper { padding: 30px 20px 36px; font-size: 12.5px; }
  .p-role { grid-template-columns: 1fr; }
  .p-role span { text-align: left; color: #444; }
}
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; }
  .facts div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
  .facts div { padding-right: 0; }
  .stats dt { font-size: 1.7rem; }
  .ratings dt { font-size: 2.4rem; }
}

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

@media print {
  body { background: #fff; }
  body > *:not(#resume) { display: none !important; }
  #resume { padding: 0; border: 0; }
  #resume .sec-head { display: none; }
  .paper { box-shadow: none; border: 0; padding: 0; max-width: none; transform: none !important; }
}
