/* Carl Chen. One typeface, two inks (apricot and periwinkle) on warm paper. */

@font-face { font-family: "Fraunces"; src: url("../assets/fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
/* Only the legends on the 3D keycaps are drawn in this one. Nothing on the page is set in it. */
@font-face { font-family: "Routed Gothic"; src: url("../assets/fonts/routed-gothic.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --paper: #FBF1E3;
  --paper-2: #FFF9EF;
  --paper-3: #F3E4CF;
  --ink: #2A2646;
  --ink-2: #57526F;
  --ink-3: #6F6A89;
  --apricot: #FFB27D;
  --peach: #FFD2B0;
  --peach-2: #FFE7D3;
  --orange: #F2622E;
  --ember: #B4441A;
  --peri-2: #DDDBFA;
  --line: rgba(42, 38, 70, 0.14);
  --line-2: rgba(42, 38, 70, 0.32);
  --font: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --g: clamp(20px, 4vw, 64px);
  --bar: 56px;
  --wide: 76rem;                              /* the widest a block of content runs */
  --gap: clamp(40px, 6vh, 64px);              /* a section's header to its content */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.16  0 0 0 0 0.15  0 0 0 0 0.27  0 0 0 0.5 -0.17'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 24px); }
body {
  margin: 0;
  background: var(--paper) var(--grain);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1.0625rem, 0.99rem + 0.28vw, 1.1875rem);
  line-height: 1.5;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 80, "WONK" 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--apricot); color: var(--ink); }
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; transition: color 0.16s var(--ease); }
a:hover { color: var(--ember); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 300; text-wrap: balance; }
ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; }

.skip { position: fixed; left: 16px; top: -64px; z-index: 20; padding: 8px 16px; background: var(--ink); color: var(--paper); font-size: 0.9375rem; border-radius: 8px; }
.skip:focus { top: 16px; color: var(--paper); }

/* ---------------------------------------------------------------- type */

h1 { font-size: clamp(4.5rem, 2.2rem + 12.4vw, 15.5rem); line-height: 0.82; letter-spacing: -0.05em; font-weight: 250; }
h2 { font-size: clamp(2.25rem, 1.5rem + 3.2vw, 4rem); line-height: 1.04; letter-spacing: -0.03em; font-weight: 300; }
h3 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem); line-height: 1.1; letter-spacing: -0.02em; }
h4 { font-size: 1.125rem; line-height: 1.3; font-weight: 500; }
.lede { font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem); line-height: 1.25; letter-spacing: -0.012em; }

/* the one recurring detail: buttons are keycaps */
.key {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px 10px;
  border: 1px solid var(--ink); border-radius: 10px; background: var(--paper-2); box-shadow: 0 4px 0 var(--ink);
  font-size: 1rem; line-height: 1.2; color: var(--ink); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), background-color 0.16s var(--ease);
}
.key.primary { background: var(--apricot); }
.key:hover { background: var(--peach); color: var(--ink); }
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* ---------------------------------------------------------------- header and footer */

#gl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; mix-blend-mode: multiply; }
.no-gl #gl { display: none; }

.bar {
  position: fixed; z-index: 7; top: 0; left: 0; right: 0; height: var(--bar);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 var(--g);
  background: var(--paper) var(--grain); border-bottom: 1px solid var(--line);
}
.mark { font-size: 1.125rem; font-weight: 500; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.bar nav { display: flex; gap: clamp(14px, 2.2vw, 32px); }
.bar nav a { padding: 8px 0; font-size: 0.9375rem; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.bar nav a:hover { color: var(--ink); }
.menu { display: none; min-height: 36px; padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: none; font-size: 0.9375rem; cursor: pointer; }

.foot { position: relative; z-index: 4; display: flex; justify-content: space-between; gap: 24px; margin-top: clamp(72px, 12vh, 128px); padding: 24px var(--g) 32px; border-top: 1px solid var(--line); font-size: 0.9375rem; color: var(--ink-2); }

/* ---------------------------------------------------------------- sections */

main > section + section { margin-top: clamp(88px, 15vh, 160px); }
/* the keyboard leaves the lower part of its last screen empty; the next header moves up into it a little */
main > .kb + section { margin-top: clamp(-72px, -7vh, -32px); }
.head { position: relative; z-index: 4; max-width: 56rem; margin: 0 auto; padding: 0 var(--g); text-align: center; }

/* ---------------------------------------------------------------- the keyboard */

.kb { position: relative; height: 430vh; }
.kb-pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.stage { position: absolute; inset: 0; touch-action: pan-y; }
.ov { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.ov .cut { fill: none; stroke: var(--orange); stroke-width: 1.6; stroke-dasharray: 14 5 2 5; vector-effect: non-scaling-stroke; }

.panel { position: absolute; z-index: 4; opacity: var(--o, 0); pointer-events: none; }
.panel.on { pointer-events: auto; }
.panel.cover { left: var(--g); top: calc(var(--bar) + clamp(24px, 7vh, 72px)); width: min(72rem, 100% - 2 * var(--g)); transform: translate3d(0, calc((1 - var(--o, 0)) * 16px), 0); }
.panel.cover h1 { margin: 0 0 0.2em -0.045em; }
/* the opening lines wait for the keyboard's opening: the name comes in as it starts, the rest as it settles */
.panel.cover h1, .panel.cover .lede, .panel.cover .sub { transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.panel.cover .sub { transition-delay: 0.12s; }
.intro-name .panel.cover h1 { opacity: 0; transform: translate3d(0, 16px, 0); }
.intro .panel.cover .lede, .intro .panel.cover .sub { opacity: 0; transform: translate3d(0, 12px, 0); }
.panel.cover .lede { max-width: 21em; }
.panel.cover .sub { max-width: 31em; margin-top: 16px; color: var(--ink-2); font-size: 0.9375rem; }
.panel.keys { left: 0; right: 0; top: calc(var(--bar) + clamp(24px, 6vh, 72px)); width: min(40rem, 100% - 2 * var(--g)); margin: 0 auto; text-align: center; }
.swap { display: grid; margin-top: 24px; }
.swap > div { grid-area: 1 / 1; opacity: var(--o, 0); pointer-events: none; color: var(--ink-2); }
.swap > div.on { pointer-events: auto; }
.swap .key { margin-top: 8px; }

/* ---------------------------------------------------------------- a small stage of its own for each scan and prototype */

.view { position: relative; touch-action: pan-y; cursor: grab; }
.view.drag { cursor: grabbing; }

/* ---------------------------------------------------------------- scanning: three scans side by side, then the story */

.scans { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr) minmax(0, 1.1fr); gap: 0 clamp(8px, 2vw, 24px); max-width: var(--wide); margin: clamp(24px, 4vh, 48px) auto 0; padding: 0 var(--g); }
.scans .view { height: clamp(260px, 46vh, 460px); }
.scans p { position: relative; z-index: 4; margin-top: 4px; text-align: center; font-size: 0.9375rem; color: var(--ink-2); }
.story { position: relative; z-index: 4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px clamp(32px, 6vw, 96px); max-width: 68rem; margin: var(--gap) auto 0; padding: 0 var(--g); }
.story h3 { margin-bottom: 16px; }
.story p { color: var(--ink-2); }

/* ---------------------------------------------------------------- prototypes: the object, and beside it what it is */

.protos { max-width: var(--wide); margin: clamp(24px, 4vh, 48px) auto 0; padding: 0 var(--g); }
.proto { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 64px); align-items: center; }
.proto + .proto { margin-top: clamp(32px, 6vh, 64px); }
.proto .view { height: clamp(240px, 42vh, 420px); }
.proto-text { position: relative; z-index: 4; max-width: 30rem; }
.proto h3 { margin-bottom: 12px; }
.proto p { color: var(--ink-2); }

/* ---------------------------------------------------------------- cinematography and photography */

/* two rows, each the pictures on the left and the words on the right, wider than the text sections so the pictures are large */
.media { position: relative; z-index: 4; display: grid; grid-template-columns: minmax(0, 16fr) minmax(0, 9fr); gap: 24px clamp(24px, 4vw, 64px); align-items: center; max-width: 92rem; margin: var(--gap) auto 0; padding: 0 var(--g); }
.media + .media { margin-top: clamp(32px, 6vh, 64px); }
.media video, .media img { width: 100%; border: 1px solid var(--ink); background: var(--paper-3); object-fit: cover; }
.media video { aspect-ratio: 16 / 9; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px); }
.pair img { aspect-ratio: 3 / 4; }
.media-text h3 { margin-bottom: 12px; }
.media-text p { max-width: 30rem; color: var(--ink-2); }
.key-row { display: flex; flex-wrap: wrap; gap: 14px 16px; margin-top: 24px; }

/* ---------------------------------------------------------------- about */

.about-grid { position: relative; z-index: 4; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px clamp(32px, 6vw, 96px); max-width: var(--wide); margin: var(--gap) auto 0; padding: 0 var(--g); align-items: center; }
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border: 1px solid var(--ink); background: var(--paper-3); }
.bio > p:not(.lede) { margin-top: 16px; color: var(--ink-2); }
.now { margin-top: 32px; border-top: 1px solid var(--line-2); }
.now > div { display: grid; grid-template-columns: 6rem 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.now dt { color: var(--ink-3); font-size: 0.9375rem; padding-top: 0.1em; }

/* ---------------------------------------------------------------- experience: each group runs across in columns, to keep it short */

.cv { position: relative; z-index: 4; max-width: var(--wide); margin: var(--gap) auto 0; padding: 0 var(--g); }
.cv-group { padding: 28px 0 32px; border-top: 1px solid var(--line-2); }
.cv-group h3 { margin-bottom: 20px; font-size: 1.375rem; line-height: 1.2; letter-spacing: -0.015em; font-weight: 400; }
.cv-group h3 small { margin-left: 12px; font-size: 0.9375rem; letter-spacing: 0; font-weight: 300; color: var(--ink-2); }
.cols { display: grid; gap: 28px clamp(20px, 2.6vw, 40px); }
.cols.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols h4 { font-size: 1.0625rem; }
.cols p { margin-top: 6px; font-size: 0.9375rem; color: var(--ink-2); }
.cols .org { margin-top: 2px; color: var(--ink-3); }
/* this year's roles are marked with keycaps */
.cap { display: grid; place-items: center; height: 52px; margin-bottom: 20px; padding: 0 8px 2px; border: 1px solid var(--ink); border-radius: 10px; background: var(--paper-2); box-shadow: 0 5px 0 var(--ink); font-size: 1.0625rem; letter-spacing: -0.01em; white-space: nowrap; transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease); }
.role:nth-child(2) .cap, .role:nth-child(4) .cap { background: var(--peach); }
.role:nth-child(3) .cap { background: var(--peri-2); }
.role:hover .cap { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
/* and the skills are a handful of small ones */
.caps { display: flex; flex-wrap: wrap; gap: 14px 10px; padding-bottom: 4px; }
.caps li { padding: 7px 14px 9px; border: 1px solid var(--ink); border-radius: 8px; background: var(--paper-2); box-shadow: 0 3px 0 var(--ink); font-size: 0.9375rem; line-height: 1.3; white-space: nowrap; }
.caps li:nth-child(3n + 2) { background: var(--peach-2); }
/* a square picture, two upright ones and one lying down, in columns that cut them all to one height */
.shots { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 3fr) minmax(0, 3fr) minmax(0, 5.333fr); gap: 12px clamp(12px, 1.6vw, 20px); margin-top: 40px; }
.shots img { width: 100%; aspect-ratio: 3 / 4; border: 1px solid var(--ink); background: var(--paper-3); object-fit: cover; }
.shots img:first-child { aspect-ratio: 1; object-fit: contain; background: var(--peri-2); }
.shots img:nth-child(4) { aspect-ratio: 4 / 3; }
.shots p { font-size: 0.9375rem; color: var(--ink-2); }
.shots p + p { grid-column: 2 / -1; margin-top: 0; }

/* ---------------------------------------------------------------- contact */

.note-stage { position: relative; height: clamp(232px, 38vw, 480px); margin-top: 16px; }
.contact-in { position: relative; z-index: 4; max-width: calc(46rem + 2 * var(--g)); margin: 0 auto; padding: 0 var(--g); }
.note label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.note textarea {
  display: block; width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; background: none; resize: none; color: var(--ink);
  font: 300 clamp(1.375rem, 1.1rem + 1.6vw, 2.25rem)/1.25 var(--font); letter-spacing: -0.015em; caret-color: var(--orange);
}
.note textarea::placeholder { color: var(--ink-3); opacity: 0.75; }
.note textarea:focus { outline: none; border-bottom-color: var(--orange); box-shadow: 0 1px 0 var(--orange); }
.note-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; }
.links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(20px, 3.4vw, 56px); margin-top: clamp(40px, 7vh, 72px); border-top: 1px solid var(--line-2); }
.links a { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.links a span { font-size: 1.25rem; letter-spacing: -0.01em; }
.links a i { font-style: normal; font-size: 0.9375rem; color: var(--ink-3); overflow-wrap: anywhere; text-align: right; }
.links a:hover i { color: var(--ember); }

/* ---------------------------------------------------------------- arriving: one short fade and rise */

.js .rise { opacity: 0; transform: translate3d(0, 12px, 0); transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); transition-delay: var(--d, 0s); }
.js .rise.in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- without script, or without WebGL */

html:not(.js) .kb, .no-gl .kb { height: auto; }
html:not(.js) .kb-pin, .no-gl .kb-pin { position: static; height: auto; padding: calc(var(--bar) + 48px) 0 0; overflow: visible; }
html:not(.js) .panel, .no-gl .panel { position: static; width: auto; max-width: 44rem; opacity: 1; transform: none; margin: 0 auto 72px; padding: 0 var(--g); pointer-events: auto; }
html:not(.js) .swap, .no-gl .swap { display: block; }
html:not(.js) .swap > div, .no-gl .swap > div { opacity: 1; pointer-events: auto; margin-top: 16px; }
html:not(.js) .scans, html:not(.js) .view, html:not(.js) .note-stage, html:not(.js) .kb-pin .stage, html:not(.js) .ov,
.no-gl .scans, .no-gl .view, .no-gl .note-stage, .no-gl .kb-pin .stage, .no-gl .ov { display: none; }
html:not(.js) .proto, .no-gl .proto { display: block; max-width: 30rem; margin: 40px auto 0; }
html:not(.js) main > .kb + section, .no-gl main > .kb + section { margin-top: 0; }

/* ---------------------------------------------------------------- wide but short windows */

@media (min-width: 761px) {
  h1 { font-size: min(clamp(4.5rem, 2.2rem + 12.4vw, 15.5rem), 29vh); }
  .panel.cover .lede { max-width: min(21em, 30vw); }
  .panel.cover .sub { max-width: min(31em, 26vw); }
}
@media (min-width: 761px) and (max-height: 760px) {
  .panel.keys { top: calc(var(--bar) + 24px); }
  .panel.keys h2 { font-size: clamp(2rem, 1.2rem + 2.4vw, 3rem); }
  .swap { margin-top: 16px; }
}
/* between a phone and a full desktop the portrait is a little narrower, and only a narrow window loses résumé columns */
@media (min-width: 761px) and (max-width: 1040px) {
  .about-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr); }
  .cols { column-gap: 20px; }
}
@media (min-width: 761px) and (max-width: 860px) {
  .cols.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 760px) {
  :root { --bar: 52px; }
  .menu { display: block; }
  .bar nav { position: absolute; top: var(--bar); left: 0; right: 0; display: none; flex-direction: column; gap: 0; padding: 4px var(--g) 16px; background: var(--paper) var(--grain); border-bottom: 1px solid var(--line-2); }
  .bar nav.open { display: flex; }
  .bar nav a { padding: 12px 0; font-size: 1.0625rem; color: var(--ink); border-bottom: 1px solid var(--line); }

  .kb { height: 400vh; }
  .panel.cover { top: calc(var(--bar) + 16px); }
  .panel.keys { top: calc(var(--bar) + 24px); }
  .swap { margin-top: 16px; }
  main > .kb + section { margin-top: clamp(-96px, -10vh, -48px); }

  /* the drill across the top, the other two beneath it */
  .scans { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 8px; }
  .scans li[data-obj="drill"] { grid-column: 1 / -1; order: -1; }
  .scans .view { height: 46vw; }
  .scans li[data-obj="drill"] .view { height: 64vw; }
  .story { grid-template-columns: minmax(0, 1fr); gap: 32px; }

  .proto { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .proto + .proto { margin-top: 40px; }
  .proto .view { height: 62vw; }

  /* pictures first, then their words */
  .media { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .media + .media { margin-top: 48px; }

  .about-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .portrait { width: 100%; max-width: 26rem; margin: 0 auto; }

  .cv-group h3 small { display: block; margin: 6px 0 0; }
  .cols.five, .cols.four, .cols.three { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  /* a role's keycap sits beside its text */
  .role { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); column-gap: 16px; }
  .role .cap { grid-row: 1 / span 3; height: 48px; margin-bottom: 0; font-size: 0.9375rem; }
  .role > :not(.cap) { grid-column: 2; }
  .shots { gap: 8px; }

  .links { grid-template-columns: minmax(0, 1fr); }
  .foot { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rise { transition: none; opacity: 1; transform: none; }
  .key, .cap, a, .panel.cover h1, .panel.cover .lede, .panel.cover .sub { transition: none; }
  .panel.cover { transform: none; }
}
