/* ══════════════════════════════════════════════════════════════════════
   Taewoo Park — design system

   TYPE     Times Roman and Bold for Latin; Noto Serif KR for Hangul.

   INK      #000 on #fff. Monotone throughout — images are desaturated
            so a photograph cannot introduce a colour the system lacks.

   STROKE   One weight, everywhere: --hair. It is the measured stroke of
            the nav words themselves (0.083em in Times Roman, taken off a
            raster of the actual row), snapped to whole pixels so a block
            background and a background-image bar land on the same integer.
            Every rule, every border, every hover box is that one value.

   MEASURE  The nav row sets the page width. Nothing is wider than it.
   ══════════════════════════════════════════════════════════════════════ */

/* Match Hangul to the optical size of Times. */
@font-face {
  font-family: "Noto Serif KR";
  src: url("fonts/NotoSerifKR-Hangul.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  size-adjust: 96%;
  unicode-range: U+1100-11FF, U+3130-318F, U+A960-A97F, U+AC00-D7FF, U+FFA0-FFDC;
}

/* one-stroke box: four animatable edge lengths */
@property --e1 { syntax: "<percentage>"; inherits: false; initial-value: 0%; } /* top    ▸ */
@property --e2 { syntax: "<percentage>"; inherits: false; initial-value: 0%; } /* right  ▾ */
@property --e3 { syntax: "<percentage>"; inherits: false; initial-value: 0%; } /* bottom ◂ */
@property --e4 { syntax: "<percentage>"; inherits: false; initial-value: 0%; } /* left   ▴ */

:root {
  --ink:  #000;
  --page: #fff;

  /* the nav row is 36.02 × this, so it never wraps */
  --nav:   clamp(15px, 2.35vw, 32px);
  --name:  calc(var(--nav) * 1.4375);
  --head:  max(21px, calc(var(--nav) * 0.92));
  --body:  max(16px, calc(var(--nav) * 0.70));
  --meta:  max(13px, calc(var(--nav) * 0.50));
  --brief-copy: calc(var(--body) * 0.875);

  --track: 0em;
  --hair:  round(calc(var(--nav) * 0.083), 1px);

  --pad-x: 0.46em;
  --pad-y: 0.34em;

  --gap:   calc(var(--nav) * 1.25);
  --col:   calc(var(--nav) * 8.9);   /* meta column */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-family: "Noto Serif KR", Times, "Times New Roman", serif;
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
}
code, kbd, samp, pre { font: inherit; }

body {
  background: var(--page);
  color: var(--ink);
}

/* Centring lives on its own wrapper, not on <body>: anything a browser
   extension injects into <body> would otherwise become a grid item. */
.stage {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
}
.stage--doc {
  align-items: start;
  padding: calc(var(--nav) * 2.2) 0 calc(var(--nav) * 5);
}

.sheet,
.masthead {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

/* ─── masthead ─────────────────────────────────────────────────────── */
.name {
  font-size: var(--name);
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--track);
  margin-right: calc(-1 * var(--track));  /* cancel trailing track */
  color: inherit;
  text-decoration: none;
}

.rule {
  width: 100%;
  height: var(--hair);
  margin-top: calc(var(--nav) * 0.50);
  background: var(--ink);
}

nav {
  display: flex;
  gap: calc(var(--nav) * 0.50);
  margin-top: calc(var(--nav) * 0.30);
}

.item {
  position: relative;
  padding: var(--pad-y) var(--pad-x);
  padding-right: calc(var(--pad-x) - var(--track));
  font-size: var(--nav);
  font-weight: 400;
  line-height: 1;
  letter-spacing: var(--track);
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* Four bars anchored to four corners. Grown in sequence they trace one
   continuous stroke: TL ▸ TR ▾ BR ◂ BL ▴ TL */
.item::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink)),
    linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-position: left top, right top, right bottom, left bottom;
  background-size:
    var(--e1) var(--hair),
    var(--hair) var(--e2),
    var(--e3) var(--hair),
    var(--hair) var(--e4);

  /* retract — same stroke, run backwards */
  transition:
    --e4 0.035s linear 0s,
    --e3 0.090s linear 0.035s,
    --e2 0.035s linear 0.125s,
    --e1 0.090s linear 0.160s;
}

.item:hover::before,
.item:focus-visible::before {
  --e1: 100%; --e2: 100%; --e3: 100%; --e4: 100%;
  /* draw — 0.25s per lap, edge durations proportional to edge length
     so the pen speed stays constant */
  transition:
    --e1 0.090s linear 0s,
    --e2 0.035s linear 0.090s,
    --e3 0.090s linear 0.125s,
    --e4 0.035s linear 0.215s;
}

/* the box doubles as the you-are-here mark: already drawn, no animation */
.item[aria-current]::before {
  --e1: 100%; --e2: 100%; --e3: 100%; --e4: 100%;
  transition: none;
}

.item:focus-visible { outline: none; }

/* ─── document ─────────────────────────────────────────────────────── */
.doc {
  align-self: stretch;
  /* contribute nothing to the sheet's intrinsic width, then fill it:
     the nav row alone sets the measure, and nothing may exceed it */
  width: 0;
  min-width: 100%;
  margin-top: calc(var(--nav) * 2.6);
}

.lede {
  font-size: var(--head);
  line-height: 1.34;
  max-width: 30em;
  padding-bottom: calc(var(--nav) * 2.1);
}
.about-intro {
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr);
  gap: var(--gap);
  align-items: center;
  margin-bottom: calc(var(--nav) * 2.1);
}
.about-intro img {
  display: block;
  width: min(100%, 10rem);
  height: auto;
  border: var(--hair) solid var(--ink);
  filter: grayscale(1);
}
.about-intro .lede { padding: 0; }

.entry {
  display: grid;
  grid-template-columns: var(--col) 1fr;
  gap: var(--gap);
  padding: calc(var(--nav) * 1.7) 0;
  border-top: var(--hair) solid var(--ink);
}
.entry:last-child { border-bottom: var(--hair) solid var(--ink); }

/* The register below the essay supplies the next rule. */
.narrative > .entry:last-child { border-bottom: 0; }

/* A grid item defaults to `min-width: auto`, which is the width of its longest
   unbreakable run — a source slug, a CLI flag, a URL. One of those in a Korean
   brief was enough to push a 390px page 68px wide. Both columns are told they
   may be narrower than their content, and long runs are allowed to break. */
.entry-meta,
.entry-body,
.reg-row > * { min-width: 0; overflow-wrap: anywhere; }

.entry-meta {
  font-size: var(--meta);
  line-height: 1.45;
}
.entry-meta b { font-weight: 700; }
.entry-meta p + p { margin-top: 0.75em; }

/* The body column IS the measure. Nothing is trimmed to a narrower width
   inside it, so every line of prose starts on the same left edge and ends on
   the same right edge as the rule above it — the gutters stay constant down
   the whole page instead of the text floating within its own column. */
.entry-body > * + * { margin-top: 1.05em; }
.entry-body h2 {
  font-size: var(--head);
  font-weight: 700;
  line-height: 1.18;
  margin-bottom: 0.5em;
}
.entry-body h3 {
  font-size: var(--body);
  font-weight: 700;
  line-height: 1.3;
  margin-top: 1.6em;
}
.entry-body p {
  font-size: var(--body);
  line-height: 1.62;
}
/* Hierarchy is carried by rules, paragraphs and plates — never by bullets.
   A named item is a paragraph with a run-in lead, not a list row. */
.entry-body p > b:first-child { font-weight: 700; }


.pull {
  font-size: var(--body);
  line-height: 1.35;
  font-weight: 700;
}

/* Every link in the document, not only the ones in prose: a link left to
   the UA default would introduce the one colour this system does not have. */
.doc a,
.entry-meta a {
  color: inherit;
  text-decoration: none;
  border-bottom: var(--hair) solid var(--ink);
}

body.ko .entry-body h2,
body.ko .doc-title {
  font-weight: 620;
  line-height: 1.4;
  letter-spacing: -.015em;
}
body.ko .entry-body p {
  line-height: 1.72;
  word-break: keep-all;
}
.brief-issue .entry-body h2 { font-size: var(--body); }
.brief-issue .entry-body p { font-size: var(--brief-copy); }

/* ─── detail-page title ────────────────────────────────────────────── */
.doc-up {
  font-size: var(--meta);
  line-height: 1;
  padding-bottom: calc(var(--nav) * 0.30);
}

.doc-title {
  font-size: calc(var(--nav) * 1.15);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: var(--track);
  padding-bottom: calc(var(--nav) * 0.55);
}

/* Writing uses the same gutter and rule as the portfolio entries. */
.writing-index h1, .post-page h1 {
  font-size: clamp(26px, 2.65vw, 38px);
  line-height: 1.12;
  text-wrap: balance;
}
.post-group { margin-top: clamp(24px, 3.2vw, 48px); border-top: var(--hair) solid; }
.post-group h2 { font-size: clamp(17px, 1.7vw, 22px); padding: .65em 0; }
.doc .post-row {
  display: grid;
  grid-template-columns: clamp(6em, 17vw, 16em) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--gap);
  padding: .7em 0;
  border: 0;
  border-top: 1px solid #ccc;
  font-size: clamp(16px, 1.65vw, 22px);
  line-height: 1.3;
}
.post-row time, .post-byline { color: #555; font-size: clamp(13px, 1.15vw, 16px); }
.post-row:is(:hover, :focus-visible) span { text-decoration: underline; text-underline-offset: .2em; }
.post-page { max-width: 44rem; margin-inline: auto; }
.post-page .doc-up { margin-bottom: 1rem; }
.post-byline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .55em 1em;
  margin-top: .85rem;
  padding-bottom: .95rem;
  border-bottom: var(--hair) solid var(--ink);
}
.post-page .post-languages { display: inline-flex; align-items: baseline; gap: .9em; margin: 0; }
.post-page .post-languages a { padding: .35em 0; border: 0; }
.post-languages a:is([aria-current], :hover), .post-page .post-source a {
  color: var(--ink); text-decoration: underline; text-underline-offset: .22em;
}
.post-source { margin-top: 2rem; padding-top: .8rem; border-top: 1px solid #ccc; font-size: clamp(14px, 1.15vw, 16px); }
.post-page .post-source a { border: 0; }
.post-languages [aria-current] { font-weight: bold; }
.post-text {
  padding-top: clamp(20px, 2.1vw, 32px);
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.58;
  overflow-wrap: anywhere;
}
.post-text[lang=ko] { font-size: clamp(15px, 1.3vw, 18px); line-height: 1.85; word-break: keep-all; }
.post-text > * + * { margin-top: 1em; }
.post-text h2 { font-size: 1.22em; line-height: 1.4; margin-top: 1.65em; }
.post-text hr { border: 0; border-top: 1px solid #999; margin: 1.6em 0; }
.post-text blockquote { border-left: var(--hair) solid; padding-left: 1em; }
.post-page .post-text a { border: 0; text-decoration: underline; text-underline-offset: .16em; }
@media (max-width: 480px) {
  .doc .post-row { grid-template-columns: 5.1rem minmax(0, 1fr); gap: .7rem; }
}

/* ─── figures ──────────────────────────────────────────────────────────
   A plate is evidence. Nothing here crops it and nothing here stretches it,
   which means exactly one axis may ever be constrained at a time: constrain
   the width and the height follows, or constrain the height and the width
   follows. Setting `width: 100%` together with a `max-height` is what silently
   squashes a plate — the browser clamps the height and leaves the width alone. */
.fig { display: block; }
.fig img {
  display: block;
  width: 100%;                     /* width constrained … */
  height: auto;                    /* … height follows, ratio intact */
  border: var(--hair) solid var(--ink);
  filter: grayscale(1);            /* monotone is a rule, not a preference */
}
/* A portrait plate is capped by height instead, so the width must go auto. */
.fig--tall img {
  width: auto;
  max-width: 100%;
  max-height: 76vh;
}
.fig figcaption {
  font-size: var(--meta);
  line-height: 1.45;
  margin-top: 0.7em;
}
.fig--wide { grid-column: 1 / -1; }

/* ─── plate arrangements ───────────────────────────────────────────────
   One plate does not have to mean one full-width plate. The arrangement is
   chosen per entry from the images' real proportions, so a page of many
   screenshots does not become a column of identical rectangles.          */
.figs { display: grid; gap: calc(var(--nav) * 0.42); margin-top: 0.9em; }

.figs--wide  { grid-template-columns: 1fr; }
.figs--tall  { grid-template-columns: 1fr; }
.figs--pair  { grid-template-columns: 1fr 1fr; }
.figs--strip { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); align-items: start; }

/* Nothing here crops. A plate is evidence, and a cropped screenshot can lose
   the exact row it was placed to show — so a set is allowed to run ragged at
   the bottom rather than be trimmed to a common ratio. */
.figs--pair img,
.figs--strip img { width: 100%; }
.figs--pair,
.figs--strip { align-items: start; }
.figs--strip figcaption,
.figs--pair figcaption { font-size: calc(var(--meta) * 0.92); }

/* Keep a short work's credits, description and image on one row. */
.entry--side {
  grid-template-columns: var(--col) minmax(0, 1fr) max-content;
  align-items: start;
}
.figs--side, .figs--inset { margin: 0; }
.figs--side .fig { width: min-content; }
.figs--side img {
  width: auto;
  max-width: calc(var(--nav) * 9.5);
  max-height: calc(var(--nav) * 8);
}
.doc .fig .original { display: block; border: 0; cursor: zoom-in; }
.original:focus-visible { outline: 2px solid; outline-offset: 3px; }

/* An inset sits directly below its credits, alongside the longer essay. */
.entry--inset {
  grid-template-areas: "credits text" "image text";
  grid-template-rows: auto 1fr;
  row-gap: .8em;
}
.entry--inset .entry-meta { grid-area: credits; }
.entry--inset .entry-body { grid-area: text; }
.figs--inset { grid-area: image; align-self: start; }

@media (min-width: 761px) and (max-width: 1000px) {
  .entry--side {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-rows: auto 1fr;
    row-gap: .7em;
  }
  .entry--side .figs { grid-column: 2; grid-row: 1 / 3; }
  .entry--side .entry-meta { display: flex; flex-wrap: wrap; gap: .3em 1em; }
  .entry--side .entry-meta p { margin: 0; }
}

/* ─── plain two-column register (timeline, channels) ───────────────── */
.reg { grid-column: 1 / -1; }
.reg-row {
  display: grid;
  grid-template-columns: var(--col) 1fr;
  gap: var(--gap);
  padding: calc(var(--nav) * 0.42) 0;
  border-top: var(--hair) solid var(--ink);
  font-size: var(--body);
  line-height: 1.4;
}
.reg-row:first-child { border-top: none; }
.reg-row b { font-weight: 700; }
.reg-row span { font-size: var(--meta); }


/* A touch device needs a ≥44px target at any width — a 768px tablet sits
   above the mobile breakpoint but is still driven by a finger. */
@media (pointer: coarse) {
  :root { --pad-y: 0.88em; }
}

/* ─── mobile ───────────────────────────────────────────────────────
   Below the width where the nav row still fits on one line, the scale
   detaches from the viewport: type is set in absolute sizes tuned for
   reading at arm's length, navigation scrolls horizontally, and every
   two-column grid collapses with the meta column above its body.
   --hair stays derived from the nav word stroke, so the rule still
   matches the letters beside it.                                      */
@media (max-width: 760px) {
  :root {
    --nav:   16px;
    --name:  30px;
    --head:  clamp(21px, 5.7vw, 24px);
    --body:  clamp(16px, 4.3vw, 17px);
    --meta:  13px;

    --pad-x: 0.55em;
    --pad-y: 0.88em;              /* ≥44px tap target on the nav row */

    --gutter: clamp(22px, 6.8vw, 44px);
    --section-space: clamp(38px, 10vw, 58px);
    --gap:   18px;
    --col:   auto;
  }

  .stage { grid-template-columns: minmax(0, 1fr); padding-inline: var(--gutter); }
  .stage--doc {
    align-items: start;
    padding-block: 32px 76px;
  }
  .sheet, .masthead { width: 100%; min-width: 0; }
  .masthead > nav {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    flex-wrap: nowrap;
    justify-content: safe center;
    gap: 6px;
    margin-top: 10px;
    padding-block: 4px;
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
  }
  .masthead .item { flex: none; display: grid; place-items: center; min-height: 44px; }
  .doc { margin-top: var(--section-space); }
  .lede { max-width: none; line-height: 1.46; padding-bottom: var(--section-space); }
  .doc:has(> .about-intro) { margin-top: 0; }
  .about-intro {
    display: block;
    padding-top: clamp(52px, 9svh, 88px);
    margin-bottom: var(--section-space);
  }
  .about-intro img {
    width: clamp(100px, 28vw, 120px);
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center 35%;
    margin: 0 auto clamp(44px, 7svh, 76px);
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: var(--section-space) 0;
  }
  .entry-meta { max-width: none; }
  .entry-body { max-width: none; }
  .entry-body > h2,
  .entry-body > h3,
  .entry-body > p { max-width: none; }
  .entry-body p { line-height: 1.72; }
  .entry-body > * + * { margin-top: 1.15em; }

  .reg-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 17px 0;
  }
  .post-page .post-languages a,
  .post-page .doc-up a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
  }
  .post-page .doc-up { margin-bottom: .5rem; padding: 0; }
  .post-page .post-byline { padding-block: .3rem .8rem; }
  .post-text { padding-top: 28px; font-size: var(--body); line-height: 1.75; }
  .post-text[lang=ko] { font-size: var(--body); }
  .post-group { margin-top: var(--section-space); }
  .doc .post-row { padding-block: 1em; }

  .doc-title { font-size: clamp(24px, 6.5vw, 28px); padding-bottom: 20px; }
  .fig--tall img { max-height: none; width: 100%; }

  /* a two-up or three-up set becomes a single column, but a strip of small
     shots stays two-up so it still reads as a set rather than a stack */
  .figs { gap: 18px; }
  .figs--pair  { grid-template-columns: 1fr; }
  .figs--strip { grid-template-columns: 1fr 1fr; }
  .figs--strip .fig { margin-left: 0; margin-right: 0; }
  .figs--strip img { border: var(--hair) solid var(--ink); }

  .fig { min-width: 0; }
  .fig img { width: 100%; }
  .entry-body .fig img, .entry-body .fig--tall img { width: 100%; }
  .fig figcaption { line-height: 1.55; }
  .entry--inset {
    grid-template-areas: "credits" "text" "image";
    grid-template-rows: auto;
  }
  .entry--side { grid-template-columns: minmax(0, 1fr); }
  .entry--side .entry-meta { display: flex; flex-wrap: wrap; gap: .35em 1em; }
  .entry--side .entry-meta p { margin: 0; }
  .figs--side .fig, .figs--inset .fig {
    width: fit-content;
    max-width: 100%;
    margin: 0;
  }
  .figs--side img, .figs--inset img {
    width: auto;
    max-width: 100%;
    max-height: min(65svh, 28rem);
    border: var(--hair) solid var(--ink);
  }
  .figs--side figcaption, .figs--inset figcaption {
    width: 0;
    min-width: 100%;
    padding: 0;
  }
  .narrative .figs--inset { margin-top: 10px; }
  .narrative .figs--inset img { max-height: 20rem; }
  .figs--strip figcaption { padding: 0; }
  .figs--strip:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .item::before, .item:hover::before, .item:focus-visible::before {
    transition-duration: 0s; transition-delay: 0s;
  }
}
