/* BT Danta: its lightest cut (Medium) sits at weight 200, Bold at 300, ExtraBold at 400.
   Sizes follow Apple's type scale: 11 and 12 for captions, 13 and 15 for small text, 17 for body, 21 for an intro, 22 to 96 for titles; tighter tracking and leading as the size goes up. */
@font-face { font-family: Text; src: url(fonts/danta.woff2) format("woff2"); font-weight: 200 400; font-display: swap; }
@font-face { font-family: Data; src: url(fonts/data.woff2) format("woff2"); font-weight: 100 800; font-display: swap; }

/* ice-blue watch dial: a pale silvery blue ground, deep navy ink */
:root {
  --ice: oklch(0.87 0.04 228);
  --ink: oklch(0.23 0.045 250);
  --soft: oklch(0.38 0.045 245);
  --blue: oklch(0.42 0.12 250);
  --edge: oklch(0.5 0.06 240);
  --hair: rgb(0 0 0 / .12);
  --paper: oklch(0.985 0.004 228);
  --night: oklch(0.16 0.035 250);
  --pearl: oklch(0.955 0.01 215);
  --steel: oklch(0.47 0.06 243);
  --still-light: oklch(0.94 0.02 225);
  --still-deep: oklch(0.8 0.05 232);
  --cover-deep: oklch(0.78 0.055 235);
  --cover-light: oklch(0.9 0.03 222);
  --night-raise: oklch(0.25 0.04 250);
  --night-raise-lit: oklch(0.32 0.05 250);
  --night-edge: oklch(0.6 0.05 240);
  --night-shade: oklch(0.05 0.02 250);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(16px, 4vw, 96px);
  color-scheme: light;
}

* { box-sizing: border-box; }
/* the still version of the dial lives on the root, so the shader canvas (z-index -1) paints above it; a background on <body> would cover the canvas */
/* type grows with the window above laptop width, so a large monitor does not get tiny text; never below the reader's own setting */
html {
  font-size: max(100%, min(4px + .83vw, 28px));
  background:
    radial-gradient(90% 70svh at 30% 20%, var(--still-light), transparent 70%) fixed,
    radial-gradient(80% 60svh at 85% 80%, var(--still-deep), transparent 70%) fixed,
    var(--ice);
  scrollbar-width: none; /* no scrollbar drawn; the page still scrolls */
}
::-webkit-scrollbar { display: none; }
body {
  margin: 0;
  color: var(--ink);
  font: 200 1.0625rem/1.47 Text, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#field { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; }
::selection { background: var(--ink); color: var(--ice); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
a { color: var(--blue); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
h1, h2, p, figure { margin: 0; }

.label { white-space: nowrap; font: 300 .8125rem/1.33 Text, system-ui, sans-serif; letter-spacing: .08em; color: var(--ink); text-decoration: none; }
a.label[href] { position: relative; padding-block: 8px; border-bottom: 1px solid var(--edge); transition: border-color .3s; }
/* the tap area reaches past the small label, to about 45px high */
a.label[href]::after { content: ""; position: absolute; inset: -6px -8px; }
a.label[href]:hover { border-color: var(--ink); }
.data { font: 400 .8125rem/1.33 Data, ui-monospace, monospace; letter-spacing: .02em; color: var(--soft); font-variant-numeric: tabular-nums; }

/* first screen: the name, then the bio */
.hero { display: grid; gap: clamp(28px, 5vw, 64px); padding: 22px var(--gutter) clamp(64px, 9vw, 130px); }
.hero nav { justify-self: end; display: flex; align-items: baseline; gap: clamp(18px, 3vw, 40px); }
.hero h1 { margin: clamp(24px, 9svh, 120px) 0 0 -.02em; font-size: clamp(2.75rem, 6.6vw, 6rem); font-weight: 200; line-height: 1.05; text-wrap: balance; letter-spacing: -.015em; }
.bio { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(20px, 5vw, 80px); align-items: start; }
.bio h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 200; line-height: 1.1; letter-spacing: -.005em; text-wrap: balance; }
.bio .lede { margin-top: 14px; font-size: 1.3125rem; line-height: 1.38; color: var(--blue); }
.bio p, .more p { max-width: 52ch; color: var(--soft); text-wrap: pretty; }
.lede + p, .more p + p { margin-top: 14px; }
/* on a phone app.js moves the rest of the bio under the wall, so photographs show on the first screen */
.all .more { margin-top: clamp(40px, 10vw, 64px); }

/* gallery: a seamless wall of square tiles, newest first, as on an Instagram profile. The white frame and caption appear when a photograph is opened */
.all { padding: 0 var(--gutter) clamp(96px, 12vw, 170px); }
.all h2 { margin-bottom: 20px; }
/* keyboard only: a way past the wall's tiles, shown when it has focus, in the space above the count */
a.label.skip { position: absolute; max-width: calc(100% - 2 * var(--gutter)); translate: 0 calc(-100% - 14px); clip-path: inset(50%); white-space: normal; } /* may wrap: at very large text one line is wider than a phone; it sits 14px above the count at any height */
a.label.skip:focus-visible { clip-path: none; }
#past { outline: 0; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.frame { position: relative; display: block; overflow: hidden; background: var(--ice); }
.frame img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; opacity: 0; transition: opacity .7s, scale .6s var(--ease), filter .3s; }
.frame img.in { opacity: 1; }
.frame:hover img, .frame:focus-visible img { scale: 1.04; filter: brightness(1.06); }
/* two rings, so one always shows: ink for a pale photograph, paper inside it for a dark one */
.frame:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.frame:focus-visible::after { content: ""; position: absolute; inset: 2px; border: 2px solid var(--paper); }
/* the caption under the picture, centred like a printed photo border: on the frames and on the opened photograph */
#loupe figcaption { display: grid; justify-items: center; gap: 3px; padding: 16px 4px 18px; text-align: center; }
.shot { font-size: 1rem; line-height: 1.33; color: var(--soft); }
.shot b { font-weight: 400; color: var(--ink); }
#loupe figcaption .data { font-family: Text, system-ui, sans-serif; letter-spacing: .01em; }
.empty { padding: 40px 0; color: var(--soft); }

/* the end of the page: the dial's squares rise from the bottom edge (drawn by field.js) */
.close { display: grid; align-content: end; justify-items: start; min-height: 100vh; min-height: 100svh; padding: clamp(64px, 9vw, 120px) var(--gutter) 0; overflow: hidden; }
/* The name, printed on the dial across the whole foot of the page: lowercase, its ink reaching from the left edge of the
   screen to the right one, the letters standing on the bottom edge, which cuts off the tail of the q.
   The word's ink is 3.8209em wide (kerned), so the size is 100vw / 3.8209. The margins pull it left past the gutter and the
   q's side bearing (.04em), and drop the baseline onto the edge (it sits .08em above the line box's foot in this font).
   One colour, the steel blue of the logo's body: a deeper tone of the dial itself, as dial print is on a watch.
   The lacquer has a little thickness: a hair of light on its upper edge and a short soft shadow on the squares beneath */
.print { margin: 0 0 -.08em calc(-1 * var(--gutter) - .04em); font-size: 26.17vw; font-weight: 200; line-height: 1; white-space: nowrap; color: var(--steel); text-shadow: 0 -.004em 0 rgb(255 255 255 / .35), .008em .012em .012em rgb(11 30 49 / .3); user-select: none; }

/* the opened photograph: the dial goes to night around it */
#loupe { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 20px 16px; border: 0; background: none; color: var(--pearl); overflow: hidden; perspective: 1400px; touch-action: pan-y; } /* pan-y: a sideways swipe anywhere in the night view, not only on the frame, reaches app.js */
#loupe[open] { display: grid; place-items: center; }
#loupe::backdrop { background: var(--night); } /* opaque: at 97% the page's nav showed through beside the close button */
#loupe[open]::backdrop { opacity: 1; transition: opacity .5s; }
@starting-style { #loupe[open]::backdrop { opacity: 0; } }
/* the opened photograph keeps its white frame and caption */
#loupe figure { display: grid; justify-items: center; padding: clamp(10px, 1.2vw, 22px) clamp(10px, 1.2vw, 22px) 0; background: var(--paper); color: var(--ink); box-shadow: 0 40px 70px -30px color-mix(in oklch, var(--night-shade) 90%, transparent); }
#loupe img { display: block; width: auto; height: auto; max-width: min(100%, 1500px); max-height: calc(100dvh - 190px); background: var(--ice) center / cover no-repeat; }
#loupe figcaption { padding-block: 20px 22px; }
#loupe :focus-visible { outline-color: var(--pearl); }
.ctl { position: fixed; top: 50%; translate: 0 -50%; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--night-edge); border-radius: 50%; background: var(--night-raise); color: var(--pearl); cursor: pointer; transition: background .2s, border-color .2s; }
.ctl:hover { background: var(--night-raise-lit); border-color: var(--pearl); }
.ctl svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ctl.prev { left: 16px; }
.ctl.next { right: 16px; }
.ctl.shut { top: 16px; right: 16px; translate: none; }

/* the corner mark: the logo in one colour, small and a little transparent, where the nav was; desktop only. It sits in the
   gutter, so it never lies on a photograph. At .6 it still holds 3:1 on the dial */
.up { display: none; }
@media (min-width: 700px) and (hover: hover) {
  .up { display: block; position: fixed; z-index: 2; top: 22px; right: calc((var(--gutter) - 20px) / 2); width: 20px; aspect-ratio: 348 / 441; background: var(--ink); -webkit-mask: url(logo-still.svg?v=35) center / contain no-repeat; mask: url(logo-still.svg?v=35) center / contain no-repeat; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
  .up.on { opacity: .6; visibility: visible; }
  .up.on:hover, .up.on:focus-visible { opacity: 1; }
}

@media (min-width: 1280px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1800px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

@media (max-width: 699px) {
  .hero h1 { font-size: 11vw; }
  .bio { grid-template-columns: 1fr; }
  #loupe img { max-height: calc(100dvh - 120px - 9rem); } /* 264px at the usual text size: the frame clears the close button above and the arrows below, down to 320 x 568; in rem because the caption grows with the reader's text */
  .ctl.prev, .ctl.next { top: auto; bottom: 16px; translate: none; }
}
/* a short laptop window: less air around the bio, so the top of the wall still shows on the first screen */
@media (min-width: 700px) and (max-height: 880px) {
  .hero { gap: clamp(28px, 3vw, 40px); padding-bottom: clamp(32px, 5svh, 64px); }
  .hero h1 { margin-top: clamp(24px, 6svh, 120px); }
}

/* a phone held sideways: the caption sits beside the picture, so the picture gets the whole height */
@media (orientation: landscape) and (max-height: 500px) {
  #loupe figure { grid-template-columns: auto minmax(0, 14rem); align-items: center; padding-bottom: clamp(10px, 1.2vw, 22px); }
  #loupe img { max-height: calc(100dvh - 40px - 2 * clamp(10px, 1.2vw, 22px)); }
  #loupe figcaption { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  #loupe[open]::backdrop { transition: none; }
}

/* text pages (the blog): a head row, one large statement, a paragraph under it */
.xp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 16px; padding: 22px var(--gutter) 0; }
.xp-head nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: clamp(18px, 3vw, 40px); }
.xp { padding: clamp(56px, 11svh, 140px) var(--gutter) 0; }
.xp h1 { max-width: 18ch; font-size: clamp(2.125rem, 5vw, 5rem); font-weight: 200; line-height: 1.05; letter-spacing: -.015em; text-wrap: balance; }
.xp-about { max-width: 52ch; margin-top: clamp(24px, 3vw, 40px); font-size: 1.3125rem; line-height: 1.38; color: var(--soft); text-wrap: pretty; }

/* blog page: the newest article large, then a list of rows; every entry opens on Substack */
.posts { margin-top: clamp(48px, 7vw, 104px); }
.post { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: clamp(16px, 3vw, 40px); align-items: start; padding: clamp(20px, 2.4vw, 32px) 0; border-top: 1px solid var(--hair); color: var(--ink); text-decoration: none; }
.post .cover { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: linear-gradient(135deg, var(--cover-deep), var(--cover-light)); background: linear-gradient(135deg in oklch, var(--cover-deep), var(--cover-light)); transition: filter .3s; }
.post-text { display: block; overflow-wrap: anywhere; } /* a long word or address in a title or excerpt breaks instead of widening the page */
.post h2 { font-size: clamp(1.375rem, 2.2vw, 2rem); font-weight: 200; line-height: 1.19; letter-spacing: 0; text-wrap: balance; text-decoration: underline transparent 1px; text-underline-offset: .16em; transition: text-decoration-color .3s; }
.post p { max-width: 60ch; margin-top: 8px; color: var(--soft); text-wrap: pretty; }
.post .data { display: block; margin-top: 12px; }
.post:hover h2, .post:focus-visible h2 { text-decoration-color: var(--edge); }
.post:hover .cover { filter: brightness(1.05); }
.post.lead { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; padding-top: 0; border-top: 0; }
.post.lead .cover { aspect-ratio: 16 / 9; }
.post.lead h2 { font-size: clamp(1.75rem, 3.6vw, 3rem); font-weight: 200; line-height: 1.08; letter-spacing: -.005em; }
.post.bare { grid-template-columns: 1fr; }
.posts-more { margin-top: clamp(32px, 4vw, 56px); }

/* experience page: one row per kind of work, the claim on the left and the account on the right, in the bio's columns */
.xp-rows { margin-top: clamp(48px, 7vw, 104px); }
.xp-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(8px, 5vw, 80px); align-items: start; padding: clamp(20px, 2.4vw, 32px) 0; border-top: 1px solid var(--hair); }
.xp-row h2 { font-size: clamp(1.375rem, 2.2vw, 2rem); font-weight: 200; line-height: 1.19; text-wrap: balance; overflow-wrap: anywhere; } /* "administration" at doubled text is wider than a 320px screen */
.xp-row p { max-width: 60ch; color: var(--soft); text-wrap: pretty; }
@media (max-width: 699px) {
  .post, .post.lead, .xp-row { grid-template-columns: 1fr; }
}

/* loading screen: the small logo on plain ice, on the first page of a visit and on a reload.
   The animation is the safety net: the screen leaves by itself even if the script never runs. */
#boot { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: var(--ice); transition: opacity .45s, visibility .45s; animation: boot-out .45s 5s forwards; }
/* the logo is its own small document (object, not img): an image's animation clock is shared with the browser's cached copy and does not restart on reload */
#boot object { width: 5.5rem; aspect-ratio: 348 / 441; pointer-events: none; position: relative; transition: opacity .25s; }
/* the reveal: the screen is redrawn on a canvas with a logo-shaped hole that grows; the drawn logo fades off the hole */
#boot canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#boot.open { background: none; animation: none; pointer-events: none; }
#boot.open object { opacity: 0; }
#boot.out { opacity: 0; visibility: hidden; }
@keyframes boot-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { #boot { display: none; } }
