:root {
  /* These were set against a near-black page with an invented landscape on
     it. The page is a photograph of a city now: measured background
     luminance across the reading area runs from 0.11 to 0.32, a threefold
     spread, and forty per cent white over the bright end of that is not
     text, it is a suggestion of text. Raised until the body copy clears
     4.5:1 against the worst of it. */
  --ink: #f2efe9;
  --ink-dim: rgba(242, 239, 233, 0.93);
  --ink-faint: rgba(242, 239, 233, 0.82);
  --rule: rgba(242, 239, 233, 0.18);
  --measure: 34rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  /* Roughly the outer stop of the canvas gradient, so the moment before the
     diagram paints — and the whole experience for a no-JS visitor — is the same
     colour as the finished page rather than a darker hole. */
  background: #1b222e;
}

body {
  color: var(--ink);
  font: 400 clamp(1.05rem, 0.98rem + 0.42vw, 1.22rem)/1.6
        ui-serif, Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The generated landscape. Fixed and behind everything; the text never has to
   compete with it because the renderer keeps its contrast low by design. */
#scenery {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Legibility over the city.
 *
 * The text sits on a photograph of a metro area: forty thousand buildings,
 * roads, water, all mid-tone and all busy. Two approaches were tried and
 * thrown away before this one — a feathered scrim behind each column, which
 * overlapped into lozenges, and blurred rectangles, which read as boxes.
 * Both failed the same way. A box is the wrong shape for the problem: what
 * needs separating from the background is letters, and letters are not
 * rectangular.
 *
 * So the contrast goes on the letterforms. Two shadows doing two jobs: a
 * tight one that puts a dark edge immediately around each stroke, which is
 * what carries the small type over fine detail, and a wide soft one that
 * pushes the whole background down in a halo the shape of the word. Together
 * they cost nothing anywhere there is no text, which is the entire point —
 * the city keeps its contrast and the page keeps its reading.
 *
 * Colour is deliberately not the lever. The ink is already near-white; going
 * brighter has nowhere to go against a pale sky, and going darker fails
 * against the ground. Luminance contrast has to come from behind the glyph,
 * not from the glyph.
 */
.col,
main > footer,
.noscript {
  /* One tight shadow, not two. The wide halo that was here made the type
     look smudged rather than legible — at this size a fourteen-pixel glow
     is bigger than the letters it is meant to separate, so it fills the
     counters and reads as blur. A two-pixel edge does the whole job. */
  text-shadow: 0 1px 2px rgba(6, 9, 16, 0.9);
}

main {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: min(22vh, 9rem) 1.5rem 5rem;
}

.noscript {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 2rem auto 0;
  padding: 0 1.5rem;
  color: var(--ink-dim);
}

/* --- weather contrast table -------------------------------------------- */

.weather {
  margin: 4.5rem 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.weather table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.84rem;
}

.weather th,
.weather td {
  padding: 0.3rem 0.6rem 0.3rem 0;
  text-align: left;
  font-weight: 400;
  vertical-align: baseline;
  white-space: nowrap;
}

.weather th {
  width: 5.5rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.weather tr.you td { color: var(--ink); }
.weather tr:not(.you) td { color: var(--ink-dim); }
.weather .temp { text-align: right; width: 4rem; }
.weather .desc { white-space: normal; }

.aside {
  margin: 1.25rem 0 0;
  font-size: 0.94rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-faint);
  max-width: 26rem;
}

/* --- footer ------------------------------------------------------------- */

footer {
  margin: 4.5rem 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-faint);
}

footer .who { margin: 0; }

footer a { color: var(--ink-dim); text-decoration-thickness: 1px; text-underline-offset: 2px; }
footer a:hover { color: var(--ink); }

.btc {
  margin: 1.1rem 0 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  line-height: 1.9;
}

.btc-label {
  display: block;
  font-family: ui-serif, Georgia, serif;
  font-style: italic;
  font-size: 0.8rem;
}

.btc code { color: var(--ink-dim); word-break: break-all; }

/* --- motion and contrast preferences ----------------------------------- */

@media (prefers-reduced-motion: reduce) {
  /* The renderer also checks this and draws a single static frame; this is the
     belt-and-braces half in case anything else animates. */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ink-dim: rgba(242, 239, 233, 0.85);
    --ink-faint: rgba(242, 239, 233, 0.65);
    --rule: rgba(242, 239, 233, 0.35);
  }
  main { background: rgba(8, 10, 14, 0.72); }
}

@media (max-width: 30rem) {
  main { padding-top: 12vh; }
  .weather th { width: 4.5rem; }
}

/* --- the view ----------------------------------------------------------- */
/* Says what the canvas is drawing. The lede is at full ink because it is a
   claim about the visitor's own city; the detail sits back, because it is
   evidence for the claim rather than the claim itself. */

.the-view {
  margin: 4rem 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.view-lede {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.view-detail {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-faint);
  max-width: 26rem;
  text-wrap: pretty;
}

/* --- thinking out loud -------------------------------------------------- */

.thinking-out-loud {
  margin: 4rem 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.label {
  margin: 0 0 0.7rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

#thought {
  margin: 0;
  min-height: 3.2em;
  font-size: 1.14rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--ink-dim);
  text-wrap: pretty;
}

/* A cursor that only blinks while there is something to blink after. */
#thought::after {
  content: "";
  display: inline-block;
  width: 0.5ch;
  height: 1em;
  margin-left: 0.15ch;
  vertical-align: -0.12em;
  background: var(--ink-faint);
  animation: blink 1.1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  #thought::after { animation: none; opacity: 0.5; }
}

.attribution {
  margin: 0.9rem 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-faint);
  max-width: 24rem;
}

/* --- live clocks in the conditions table -------------------------------- */

.weather .clock {
  /* Tabular figures so the seconds ticking doesn't shift the columns. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
  width: 5.5rem;
  color: var(--ink-faint);
}

.weather tr.you .clock { color: var(--ink-dim); }

@media (max-width: 34rem) {
  .weather .desc { display: none; }
  .weather th { width: 4rem; }
}

/* --- fitting one screen ------------------------------------------------- */
/*
 * Target: no scrolling at common desktop sizes. Deliberately NOT achieved with
 * overflow:hidden — if a visitor raises their font size or uses a short window,
 * a hard-locked viewport clips content with no way to reach it. This just makes
 * the content short enough that scrolling usually isn't needed, and degrades to
 * ordinary scrolling when it is.
 *
 * Phones still scroll, and should: eight expertise areas and seven clocks
 * cannot share a phone screen at a readable size, and shrinking type until
 * they do would be the wrong trade.
 *
 * The columns are split by what the reader does with them, not by size. The
 * left is one thing read once — the expertise list. The right is everything
 * that changes while you sit there: the thought stream, what the canvas is
 * drawing, and the clocks. That split is also what balances them, now that
 * the ask box and the booking section are both gone and the clocks alone
 * left the right-hand side two-thirds empty.
 */

@media (min-width: 62rem) and (min-height: 34rem) {
  main {
    /* Two columns: the thing to read on the left, everything that moves on
       the right. This is what removes most of the height. */
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas:
      "primary secondary"
      "footer  footer";
    column-gap: 3.25rem;
    align-items: start;
    /* Wider than the reading measure on purpose: the expertise details wrap
       less, which is worth more height than the extra width costs. */
    max-width: 76rem;
    padding-top: min(9vh, 4.5rem);
    padding-bottom: 2rem;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .col-primary { grid-area: primary; }
  .col-secondary { grid-area: secondary; }
  main > footer { grid-area: footer; }

  /* Sections no longer stack, so the first in each column needs no rule above
     it and the vertical rhythm tightens. */
  .col > *:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .col-secondary .the-view,
  .col-secondary .weather { margin-top: 2.5rem; padding-top: 1.5rem; }

  .weather table { font-size: 0.82rem; }
  .weather th, .weather td { padding-top: 0.22rem; padding-bottom: 0.22rem; }

  main > footer { margin-top: 2.5rem; padding-top: 1.25rem; }
}

/* In two columns the right-hand side is too narrow for the condition text, which
   wrapped raggedly ("partly / cloudy"). Drop it: the temperature is the
   information, and the landscape behind the page already shows the weather. */
@media (min-width: 62rem) and (min-height: 34rem) {
  .col-secondary .weather .desc { display: none; }
  .col-secondary .weather .temp { width: auto; padding-right: 0; }
}

/* Shorter desktop viewports (a 1280x800 laptop) were overflowing by ~64px.
   Tighten the vertical rhythm rather than cutting anything. */
@media (min-width: 62rem) and (max-height: 64rem) {
  main {
    padding-top: min(5vh, 2rem);
    padding-bottom: 1.25rem;
  }
  .col-secondary .the-view,
  .col-secondary .weather { margin-top: 1.6rem; padding-top: 1.1rem; }
  main > footer { margin-top: 1.3rem; padding-top: 0.9rem; }
  .expertise dt { margin-top: 0.65rem; }
  .expertise h1 { margin-bottom: 0.8rem; }

  #thought { min-height: 2.9em; }
}

/* --- what I actually know ----------------------------------------------- */
/* Scannable, not readable start-to-finish. The term carries the claim, the
   detail earns it, and both sit tight because eight of these have to share one
   screen with everything else. */

.expertise h1 {
  margin: 0 0 1rem;
  font-size: 1.02rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-dim);
}

.expertise dl { margin: 0; }

.expertise dt {
  margin-top: 0.85rem;
  font-size: 1.08rem;
  line-height: 1.3;
  color: var(--ink);
}

.expertise dt:first-of-type { margin-top: 0; }

.expertise dd {
  margin: 0.15rem 0 0;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--ink-faint);
  text-wrap: pretty;
}


/* --- the page settling in ----------------------------------------------- */
/*
 * Everything used to be finished on the first frame, which is what made a page
 * this quiet read as a screenshot. Nothing here changes where anything ends up;
 * it only lets the eye see it arrive.
 *
 * The three sections that JavaScript reveals need no delay of their own — they
 * are already staggered by the requests that fill them, and each animates at
 * the moment its `hidden` comes off. Only the two that are in the served HTML
 * are timed by hand.
 *
 * `backwards` matters: without it a delayed section is painted in full, then
 * blinks out to start its animation.
 */

@media (prefers-reduced-motion: no-preference) {
  .expertise,
  .thinking-out-loud,
  .the-view,
  .weather,
  main > footer {
    animation: settle 620ms cubic-bezier(0.16, 0.84, 0.36, 1) backwards;
  }

  .expertise { animation-delay: 120ms; }
  main > footer { animation-delay: 300ms; }
}

@keyframes settle {
  from { opacity: 0; transform: translateY(10px); }
}

/* --- mobile ------------------------------------------------------------- */
/* One column, and it scrolls — eight expertise areas and seven clocks cannot
   share a phone screen at a readable size, and shrinking type until they do
   would be the wrong trade. What matters here instead: nothing overflows
   sideways, and the reading order is the source order. */

@media (max-width: 62rem) {
  /* Flex, not block: `order` below needs a flex container to do anything, and
     `display: contents` on the wrappers lets the sections themselves be the
     flex items so they can be reordered independently. */
  main {
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem 3rem;
    max-width: 34rem;
  }

  .col { display: contents; }

  .expertise { order: 1; }
  .thinking-out-loud { order: 2; }
  /* After the writing, not before it: on a phone the canvas is behind a long
     scroll, so the line explaining it is worth more once it has been seen. */
  .the-view { order: 3; }
  .weather { order: 4; }
  main > footer { order: 5; }

  .expertise, .thinking-out-loud, .the-view, .weather {
    margin-top: 2.25rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
  }

  /* Expertise now leads the page, so it carries no rule above it. Declared
     after the rule that adds one, not before, or it loses. */
  .expertise { margin-top: 0; padding-top: 0; border-top: 0; }

  .expertise dt { font-size: 1rem; margin-top: 1rem; }
  .expertise dd { font-size: 0.88rem; }

  /* The clock table was the one thing forcing the page wider than the screen:
     every cell was nowrap, so seven rows of city + time + temperature could not
     shrink. Fixed layout lets it fit the column instead. */
  .weather table { table-layout: fixed; width: 100%; font-size: 0.72rem; }
  .weather th { width: 4.2rem; }
  .weather td { white-space: normal; overflow-wrap: anywhere; }
  .weather .clock { width: 4.6rem; }
  .weather .temp { width: 3rem; }
  .weather .desc { display: none; }
  .aside, .attribution { max-width: none; }
}

@media (max-width: 26rem) {
  main { padding: 1.75rem 1rem 2.5rem; }
  .weather th { display: none; }
  .weather table { font-size: 0.7rem; }
}

/* Belt and braces: nothing on this page should ever scroll sideways. If some
   future element overflows, clip it rather than shipping a horizontal
   scrollbar on a phone. */
html, body { overflow-x: hidden; }

/* Shorter laptops again (1280x800 and similar). The expertise list is the
   tallest thing on the page, so this trims its leading rather than cutting
   entries — the content survives, the whitespace gives. */
@media (min-width: 62rem) and (max-height: 51rem) {
  main { padding-top: min(3vh, 1.1rem); padding-bottom: 0.7rem; }
  .expertise h1 { margin-bottom: 0.65rem; font-size: 0.98rem; }
  .expertise dt { margin-top: 0.55rem; font-size: 1.02rem; }
  .expertise dd { font-size: 0.87rem; line-height: 1.36; }
  #thought { min-height: 2.5em; font-size: 1.06rem; }
  .attribution { margin-top: 0.7rem; }
  .aside { margin-top: 0.85rem; }
  .col-secondary .the-view,
  .col-secondary .weather { margin-top: 1.5rem; padding-top: 1.1rem; }
  main > footer { margin-top: 0.9rem; padding-top: 0.7rem; font-size: 0.86rem; }
}

/* --- map attribution ----------------------------------------------------- */
/* Added by live.js only when the map loaded. ODbL requires the credit
   to be visible where the data is used, so it is DOM text in the footer rather
   than a string painted into the canvas. */
.credit {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

.credit a { color: var(--ink-dim); }
