/* v7. A clean page with a nav in the left margin, one 624px column, and a preview
   column on the right for the work and play lists. Built from the skeleton Lay Wu and
   Rodney Shen share: small type, one accent, hairlines instead of boxes.
   The theme lives on <html data-theme>, set before paint by a script in each page's head;
   the media query is only for visitors with scripts off. */
:root {
  --bg: #fafaf7;
  --ink: #161616;
  --mute: #86857f;
  --line: #e6e4de;
  --acc: #cf3518;
  --code: #f0eee8;
  color-scheme: light;
}
:root[data-theme="dark"] { --bg: #0c0c0c; --ink: #f3f2ee; --mute: #8f8e89; --line: #242423; --acc: #ff6b42; --code: #1a1a19; color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: #0c0c0c; --ink: #f3f2ee; --mute: #8f8e89; --line: #242423; --acc: #ff6b42; --code: #1a1a19; color-scheme: dark; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.65 Figtree, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 2px; }
img { display: block; max-width: 100%; height: auto; }
.acc, .acc a { color: var(--acc); }
.small { font-size: 12px; color: var(--mute); }
.u { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.u:hover { text-decoration-color: currentColor; }

.frame { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: minmax(200px, 372px) minmax(0, 624px) 330px; column-gap: 36px; min-height: 100vh; }

/* the nav: mascot, then the pages, right-aligned against a hairline */
.side { border-right: 1px solid var(--line); }
.side-in { position: sticky; top: 0; padding: 44px 28px 0 0; text-align: right; }
/* the mascot is the theme switch: Anakin in light mode, Vader in dark */
.side-in .mascot { display: inline-block; margin-bottom: 18px; line-height: 0; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 4px; transition: transform 120ms; }
.side-in .mascot:hover { transform: translateY(-2px); }
.side-in .mascot:active { transform: scale(.94); }
.side-in .mascot:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }
.mascot img { height: 76px; width: auto; }
.mascot .m-dark, [data-theme="dark"] .mascot .m-light { display: none; }
[data-theme="dark"] .mascot .m-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .mascot .m-light { display: none; }
  :root:not([data-theme]) .mascot .m-dark { display: block; }
}
.side-in a { display: block; color: var(--mute); font: 400 12.5px/2.5 "IBM Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: .04em; transition: color 120ms; }
.side-in a:hover { color: var(--ink); }
.side-in a[aria-current] { color: var(--acc); }
.side-in a[aria-current]::after { content: ""; display: inline-block; width: 2px; height: 14px; background: var(--acc); margin-left: 8px; vertical-align: -2px; }
/* a small sun or moon for switching themes, only on phones where the mascot is small */
.theme-nav { display: none; background: none; border: 0; padding: 6px; margin: -6px -6px -6px auto; color: var(--mute); cursor: pointer; line-height: 0; border-radius: 6px; }
.theme-nav:hover { color: var(--ink); }
.theme-nav:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.theme-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-nav .i-sun, [data-theme="dark"] .theme-nav .i-moon { display: none; }
[data-theme="dark"] .theme-nav .i-sun { display: block; }

main { padding: 48px 0 64px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 30px; }
h1 { font: 400 30px/1.2 Figtree, system-ui, sans-serif; letter-spacing: -.01em; }
/* the small labels around the content, set like Emmi Wu's: mono capitals, so the words in between read as the content */
.lab, .it .t, .card .t, .post-card .t, .facts dt, .clock, .notes h2, .post-meta, .ver h2 .small, .when, .pre figcaption, .foot .r {
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.clock { font-size: 12px; color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
p + p { margin-top: 14px; }
.lede { margin-top: -14px; margin-bottom: 26px; font-size: 13px; color: var(--mute); }

/* lists: a name on the left, a small grey tag on the right, a hairline under each */
.lab { font-size: 12px; color: var(--mute); margin-top: 30px; padding-bottom: 8px; }
.list { border-top: 1px solid var(--line); }
.it { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); transition: color 120ms; }
.it .t { font-size: 12px; color: var(--mute); white-space: nowrap; }
.it:hover, .it.on { color: var(--acc); }
.it:hover .t, .it.on .t { color: var(--mute); }

.foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 56px; font-size: 12.5px; }
.foot .r { text-align: right; color: var(--mute); }
.foot a:hover, .foot button:hover { color: var(--acc); }
.foot button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* the preview column: one plate per project, shown beside the row you're on */
.pre { position: relative; }
.pre figure { position: absolute; left: 0; width: 330px; top: 54px; opacity: 0; transition: opacity 120ms; pointer-events: none; }
.pre figure.show { opacity: 1; }
.plate { display: none; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; }
.plate.show { display: block; }
.plate img { width: 100%; height: 100%; object-fit: cover; }
.pre figcaption { font-size: 12px; color: var(--mute); margin-top: 8px; }

/* the home picture */
.home-img { width: 100%; margin-top: 30px; image-rendering: pixelated; }
[data-theme="dark"] .home-img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .home-img { filter: invert(1); } }

/* the name on the home page, written out by hand on the first visit */
.top:has(.sig) { align-items: flex-end; }
.sig { position: relative; flex: 1 1 auto; min-width: 0; max-width: 380px; height: 56px; margin: -14px 0 -8px 0; }
.sig svg path { stroke: var(--ink) !important; }
.sig-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* project cards: the list as pictures, for screens without a pointer to hover with */
.cards { display: none; }
.card { display: block; margin-top: 22px; }
.card img { border-radius: 6px; aspect-ratio: 16 / 10; width: 100%; object-fit: cover; }
.card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; }
.card .t { font-size: 12px; color: var(--mute); }
.card:hover .n { color: var(--acc); }
.cards .lab { margin-top: 34px; }
/* the home page's right-now card: close to its label, and room before the words under it */
main > .lab + .card { margin-top: 4px; }
main > .card + p { margin-top: 16px; }

/* the picture at the top of a project page */
.hero { margin: -6px 0 28px; }
.hero img { border-radius: 8px; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.cap { font-size: 12px; color: var(--mute); margin-top: 8px; }

/* a project page: the text keeps to the column, the pictures use the room to its right */
main.wide { grid-column: 2 / 4; }
main.wide .text { max-width: 624px; }
.facts { margin-top: 26px; border-top: 1px solid var(--line); }
.facts div { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.facts dt { width: 96px; flex: none; color: var(--mute); }
.facts dd a { color: var(--acc); }
.facts dd a:hover { text-decoration: underline; text-underline-offset: 3px; }
.gallery { margin-top: 44px; display: grid; gap: 28px; }
.phone-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.phone-row img { border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.shot img { border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.shot .cap, .phone-row .cap { margin-top: 8px; }
/* a desktop picture and a phone, at the same height: 3.46 is a 16:10 screen beside a 9:19.5 phone */
.mix { display: grid; grid-template-columns: 3.46fr 1fr; gap: 16px; }
.shot.phone img { border-radius: 14px; }
.notes { margin-top: 44px; }
.notes h2 { font-size: 12px; font-weight: 400; color: var(--mute); margin: 26px 0 6px; }
.next { margin-top: 44px; font-size: 13.5px; color: var(--mute); }
.next a { color: var(--ink); }
.next a:hover { color: var(--acc); }

/* writing */
.post-meta { margin: -18px 0 30px; }
.post-cover { border-radius: 6px; margin: -8px 0 30px; width: 100%; }
.body { font-size: 16px; line-height: 1.7; }
.body > * + * { margin-top: 16px; }
.body h2, .body h3 { font: 600 16px/1.4 Figtree, sans-serif; margin-top: 34px; }
.body a { text-decoration: underline; text-decoration-color: var(--mute); text-underline-offset: 3px; }
.body a:hover { color: var(--acc); }
.body ul, .body ol { padding-left: 22px; }
.body li + li { margin-top: 6px; }
.body img { border-radius: 4px; margin: 8px 0; }
.body img.tweet { max-width: 420px; margin: 8px auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
.body .twitter-tweet { margin: 16px auto !important; }
/* in dark mode the browser paints the embed's frame white unless its colour scheme matches X's page */
.body iframe[id^="twitter-widget"] { color-scheme: normal; }
.body blockquote { padding-left: 14px; border-left: 2px solid var(--line); color: var(--mute); }
.body code { font: 13.5px/1.5 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--code); padding: 1px 4px; border-radius: 3px; }
.body pre { overflow-x: auto; background: var(--code); padding: 12px 14px; border-radius: 4px; }
.body pre code { background: none; padding: 0; }
.body table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; }
.body th, .body td { border-bottom: 1px solid var(--line); padding: 6px 12px 6px 0; text-align: left; }
.body hr { border: 0; border-top: 1px solid var(--line); }

/* the writing page: every post with its picture */
.post-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px 20px; }
.post-card { display: flex; flex-direction: column; gap: 8px; }
.post-card img, .post-card .no-pic { border-radius: 6px; aspect-ratio: 16 / 10; width: 100%; object-fit: cover; box-shadow: 0 0 0 1px var(--line); background: var(--code); }
.post-card .pt { line-height: 1.4; }
.post-card:hover .pt { color: var(--acc); }
.post-card .t { font-size: 12px; color: var(--mute); margin-top: -4px; }

/* patch notes and the 2029 page */
.notes-list { list-style: none; }
.notes-list li { padding-left: 14px; position: relative; }
.notes-list li::before { content: "·"; position: absolute; left: 2px; color: var(--mute); }
.notes-list li + li { margin-top: 4px; }
.ver { margin-top: 34px; }
.ver h2 { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; font-size: 15px; font-weight: 500; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.ver h2 .small { font-weight: 400; }
.ver .visit { margin-top: 8px; font-size: 13px; }
.ver .visit a { color: var(--acc); }
.when { font-size: 12px; color: var(--mute); white-space: nowrap; }
.note { margin: 26px 0; padding: 12px 14px; border-left: 2px solid var(--acc); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .side-in a, .it, .pre figure { transition: none; }
}

/* no room for the preview column: the lists still work, the pictures live on each project's page */
@media (max-width: 1260px) {
  .frame { grid-template-columns: minmax(160px, 260px) minmax(0, 1fr); padding-right: 32px; }
  .pre { display: none; }
  .lists { display: none; }
  .cards { display: block; }
  main.wide { grid-column: 2; }
  main:not(.wide) { max-width: 624px; }
}

/* a big tablet has the room but no pointer to hover with */
@media (hover: none) {
  .pre, .lists { display: none; }
  .cards { display: block; }
}

/* phones: the nav becomes a row across the top */
@media (max-width: 720px) {
  .frame { display: block; padding: 0; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  /* mascot left, links centred, theme button right: the two ends are the same width, so the middle sits at the true centre */
  .side-in { position: static; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; text-align: left; }
  .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
  .side-in .mascot { margin: 0 2px 0 0; width: 36px; display: flex; justify-content: center; }
  .mascot img { height: 36px; }
  .side-in a { font-size: 12px; line-height: 1.8; }
  .side-in a[aria-current]::after { display: none; }
  .side-in .nav-extra { display: none; }
  .theme-nav { display: flex; justify-content: center; width: 36px; padding: 6px 0; margin: -6px 0; }
  main { padding: 28px 16px 48px; }
  h1 { font-size: 24px; }
  /* all four screens visible, two by two: a sideways strip cut a phone in half at the edge */
  .phone-row { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .phone-row img { border-radius: 12px; }
  .mix { grid-template-columns: 1fr; }
  .mix .shot.phone { width: 56%; margin: 0 auto; }
  .hero { margin: 0 -16px 24px; }
  .hero img { border-radius: 0; }
  .home-img { image-rendering: auto; }
  .facts dt { width: 84px; }
  .post-grid { grid-template-columns: 1fr; gap: 26px; }
  .foot { margin-top: 44px; }
}
/* the selected work on the work page: pictures at every size, two across on a wide screen */
.feat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.feat .card { margin-top: 14px; }
@media (max-width: 720px) { .feat { grid-template-columns: minmax(0, 1fr); } .feat .card { margin-top: 22px; } }
.feat .row { flex-direction: column; gap: 2px; }
@media (max-width: 720px) { .feat .row { flex-direction: row; } }
