/* ==========================================================================
   Andrew Denty — site styles
   A deliberately small system: one typeface (the platform's own), a handful
   of greys, one size for almost everything, and a lot of empty space.
   Every page is framed the same way: the name and two pages along the top,
   Copenhagen's time (its sky dot is the light/dark switch) and the ways to
   get in touch along the bottom. Used by
   index.html (About), work.html, the case studies and 404.html.
   (Legacy pages still use style.css + Bootstrap.)
   ========================================================================== */

:root {
  color-scheme: light;
  --color-text-primary: #1f1f29;
  --color-text-secondary: #5d5c71;
  --color-text-muted: #a6a5b5;
  --color-background: #fdfdfd;
  --color-background-hover: #f3f3f6;
  --color-accent: #22bee3;
  --color-selection: color-mix(in srgb, var(--color-accent) 18%, transparent);
  --color-bezel: #1f1f29;
  --color-sky-ring: rgba(31, 31, 41, 0.08);
  --focus-ring: 2px solid color-mix(in srgb, var(--color-accent) 45%, transparent);

  /* Glass: the header's frosted band, as a material. The header is the
     page colour at 75% over this blur; the small things that float or light
     up under the pointer (the pointer badge, the reader you point at on
     About) are grey glass: the hover grey, slightly see-through, flat, with
     no edge or shadow. */
  --glass-blur: blur(12px);
  --glass-grey: color-mix(in srgb, var(--color-background-hover) 85%, transparent);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --text-header-1-size: 17px;
  --text-header-1-line-height: 28px;
  --text-header-2-size: 15px;
  --text-header-2-line-height: 25px;
  --text-body-size: 14px;
  --text-body-line-height: 24px;
  --text-label-size: 13px;
  --text-label-line-height: 20px;

  /* From the edge of the window: about 5.5% of its width, so the page keeps
     its proportions as screens get bigger (about 80px at 1440, 20px on a
     phone). */
  --margin: clamp(16px, 5.5vw, 240px);
  /* Between grid columns: grows with the margin, to about 40px at 1440, and
     never below 16px so twelve columns still fit on a phone. */
  --gutter: clamp(16px, 2.75vw, 64px);
  --article-width: 640px;
  --media-width: 1000px;
}

/* Dark appearance. Follows the system unless the visitor has picked light,
   and is forced on when they pick dark. The two blocks must match.
   Contrast mirrors the light theme: text 15.6:1, secondary 6.5:1, meta 2.75:1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-text-primary: #ebebf0;
    --color-text-secondary: #9897ab;
    --color-text-muted: #5b5a6b;
    --color-background: #131316;
    --color-background-hover: #1e1e23;
    --color-selection: color-mix(in srgb, var(--color-accent) 32%, transparent);
    --color-sky-ring: rgba(235, 235, 240, 0.16);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-text-primary: #ebebf0;
  --color-text-secondary: #9897ab;
  --color-text-muted: #5b5a6b;
  --color-background: #131316;
  --color-background-hover: #1e1e23;
  --color-selection: color-mix(in srgb, var(--color-accent) 32%, transparent);
  --color-sky-ring: rgba(235, 235, 240, 0.16);
}

/* Switching appearance cross-fades the whole page (where supported)... */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ...and otherwise switches instantly, without per-element transitions. */
[data-theme-switching] *,
[data-theme-switching] *::before,
[data-theme-switching] *::after {
  transition: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  text-wrap: pretty; /* inherited: no paragraph ends on a word on its own */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Header, page and footer stack down the window; the page in between takes
   whatever height is left, so the footer always sits on the bottom edge. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--color-background);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--color-selection);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Small grey headings: "About", "Personal projects", "More work"... */
.label,
.group-title {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
}

/* The page grid: 12 columns with 16px gutters, edge to edge. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  width: 100%;
}

/* --------------------------------------------------------------------------
   Links: plain text that turns grey when you point at it. The current page
   in the nav stays grey; the other page is lighter still (see the header).
   -------------------------------------------------------------------------- */

.brand,
.site-nav a,
.about-bio a,
.item {
  transition: color 0.125s ease-out;
}

@media (hover: hover) {
  .brand:hover,
  .site-nav a:hover,
  .about-bio a:hover,
  .item:hover,
  .item:hover + .item-icon {
    color: var(--color-text-secondary);
  }
}

.site-nav a[aria-current] {
  color: var(--color-text-secondary);
}

.brand:focus-visible,
.site-nav a:focus-visible,
.about-bio a:focus-visible,
.item:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Header: the name, and the nav (About, Work, and Writing, which goes to
   the blog). It stays at the top as you scroll,
   on a band of the page colour that's slightly see-through, so pictures
   scrolling beneath it show through softly (after muroscents.com). The blur
   keeps text passing under it from reading as words beside the nav.
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding: 16px var(--margin);
  background: var(--color-background); /* where color-mix isn't supported */
  background: color-mix(in srgb, var(--color-background) 75%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
}

.site-nav {
  display: flex;
  gap: 16px;
}

/* Like the reader choices on About: the current page is grey, a shade
   darker than the others, which are lighter still and darken when you point
   at them. */
.site-nav a {
  position: relative;
  isolation: isolate; /* keeps the pill behind this word only */
  color: var(--color-text-muted);
}

/* And like those choices, the page you point at (or tab to) sits on a pill
   of grey glass: 4px above and below the word and 10px either side. The page
   you're on gets none, as there's nowhere to go. From the keyboard the focus
   ring goes round the pill. Phones get no pill. */
.site-nav a::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -4px -10px;
  border-radius: 14px;
  background: var(--glass-grey);
  opacity: 0;
  transition: opacity 0.18s ease-in-out;
}

@media (hover: hover) {
  .site-nav a:not([aria-current="page"]):hover::before {
    opacity: 1;
  }
}

.site-nav a:focus-visible {
  outline: none;
}

.site-nav a:focus-visible::before {
  opacity: 1;
  outline: var(--focus-ring);
}

/* --------------------------------------------------------------------------
   Footer: one line along the bottom. Copenhagen on the left, with a dot the
   colour of its sky (it's also the light/dark switch) and the time there;
   the ways to get in touch on the right.
   -------------------------------------------------------------------------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
  padding: 16px var(--margin);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
}

/* The sky dot, "Copenhagen", then the time there in a lighter grey, the way
   years follow a title. Pointing at the line, the dot included (or tapping
   the words on a phone), swaps the time for the name of that sky, the way
   "About me" turns into the reader choices: once the pointer settles
   (site.js adds is-showing-sky), the time
   fades out and the name steps in as it goes, a part at a time from the
   left: the sky, the moon, how far ahead of you it is. Leaving, the name
   fades out together, then the time comes back. The name is laid over the
   time rather than beside it, so nothing shifts. */
.location {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--color-text-primary);
  -webkit-tap-highlight-color: transparent;
}

/* "Copenhagen" and the time. On a phone a tap here shows the sky's name (a
   tap on the dot switches light and dark). It sits beside the dot rather
   than around it, so a tap near the dot isn't pulled onto it. */
.location-text {
  display: flex;
  gap: 6px;
}

html:not(.js) .location-sky,
html:not(.js) .location-detail {
  display: none; /* the sky and the time need JavaScript; "Copenhagen" stays */
}

/* The sky dot is also the light/dark switch: click (or tap) it and the page
   turns dark, or light again. Nothing says so: pointing at it shows the
   sky's name like the rest of the line, and the pointer becomes a hand. It's
   a quiet extra for whoever finds it. It needs JavaScript; without it the
   system setting still applies. */
.location-sky {
  position: relative;
  flex: none;
  width: 10px;
  height: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--color-text-primary); /* until site.js knows the sky */
  background-size: 100% 100%; /* after dark site.js draws the moon here */
  box-shadow: inset 0 0 0 1px var(--color-sky-ring); /* keeps a night sky visible on dark */
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Easier to hit than it looks: the target reaches into the margin and fills
   the line's height, stopping short of "Copenhagen". */
.location-sky::after {
  content: "";
  position: absolute;
  inset: -5px -3px -5px -8px;
}

.location-sky:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.location-detail {
  position: relative;
  color: var(--color-text-muted);
}

.location-time,
.location-sky-name,
.location-sky-measure {
  white-space: nowrap;
}

.location-sky-name,
.location-sky-measure {
  position: absolute;
  top: 0;
  left: 0;
}

/* Closed, the space where the name goes takes no pointing, so passing
   beside the time doesn't open it. */
.location-sky-name {
  pointer-events: none;
}

/* A hidden copy site.js measures the name with. */
.location-sky-measure {
  visibility: hidden;
  pointer-events: none;
}

/* Closing: the name fades out together, then the time comes back. */
.location-time {
  transition: opacity 0.4s ease-in-out 0.2s;
}

.location-sky-name > * {
  opacity: 0;
  transition: opacity 0.28s ease-in-out;
}

/* Opening: the time fades out, and the name steps in as it goes, each part
   120ms after the last. */
.location.is-showing-sky .location-time {
  opacity: 0;
  transition: opacity 0.24s ease-in-out;
}

.location.is-showing-sky .location-sky-name {
  pointer-events: auto;
}

.location.is-showing-sky .location-sky-name > * {
  opacity: 1;
  transition: opacity 0.3s ease-in-out calc(0.16s + var(--step, 0) * 0.12s);
}

.location-sky-name > :nth-child(2) { --step: 1; }
.location-sky-name > :nth-child(3) { --step: 2; }

@media (hover: none) {
  .location-text {
    cursor: pointer;
  }

  /* A fingertip's worth, still short of "Copenhagen", so a tap on the words
     shows the sky's name and a tap on the dot switches light and dark. */
  .location-sky::after {
    inset: -12px -3px -12px -20px;
  }
}

/* Contact, on the right: LinkedIn, Email and Instagram in a row, the same
   gap apart as the pages in the nav. Plain links, like every other. */
.contact {
  display: flex;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Email: with a mouse the badge says "Copy", then "Copied" (see Pointer
   badge). Without it (touch screens), tapping Email copies the address and
   "Copied" takes the word's place for 2 seconds, the way the sky's name
   takes the time's: "Email" fades out as "Copied" fades in over it, then
   back. Nothing moves. */
.contact .item-row--text {
  position: relative;
}

.contact .item-trailing {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0; /* centred on "Email", a little wider either side */
  pointer-events: none;
  transition: opacity 0.28s ease-in-out;
}

.contact .item-title {
  transition: opacity 0.4s ease-in-out 0.2s;
}

html:not(.has-pointer-badge) .contact .is-copied .item-trailing {
  opacity: 1;
  transition: opacity 0.3s ease-in-out 0.16s;
}

html:not(.has-pointer-badge) .contact .is-copied .item-title {
  opacity: 0;
  transition: opacity 0.24s ease-in-out;
}

/* --------------------------------------------------------------------------
   About (the homepage): a single row in the middle of the window, each
   column a grey heading with its content below. About (the bio) on the
   left, then space, then Currently working on and Personal projects
   together.
   -------------------------------------------------------------------------- */

.about {
  display: flex;
  flex: 1 0 auto;
  align-items: center;
  /* The exact middle looks low, so the row sits at the optical centre: 7% of
     the window's height more room below than above lifts it 3.5% (about
     30px on a laptop). */
  padding: 120px var(--margin) calc(120px + 7vh);
}

.about-grid {
  align-items: start;
  row-gap: 32px;
}

.about-intro {
  grid-column: 1 / span 4;
}

/* Who's reading? Pointing at the About column (keyboard focus, or a tap on
   a phone, does the same) turns its "About" label into "For everyone,
   designers, product managers, engineers", and picking one swaps the bio
   for a version written for that reader. The reader chosen is grey like a
   label; "For" and the other readers are lighter still (the readers darken
   under the pointer), so the choices stay quiet. The label and the choices
   share one spot, and every version of the bio shares another, sized to the
   longest, so nothing on the page moves.

   Motion: nothing slides; things only fade, one after the other, so two
   words never show in one spot at once. Opening, "About" fades out and the
   choices step in as it goes, one at a time from the left, so the eye reads
   along the row rather than taking it in at once; closing, they fade out
   together and "About" comes back. When to open
   and close is site.js's job: it waits for the pointer to settle on the
   column, so sweeping past does nothing, and keeps the choices a moment
   after it leaves, so straying off the edge doesn't snap them shut. A new
   bio fades in as the old one fades out. */
.about-intro {
  /* A little give around the column, so the pointer can drift just past the
     text (above the choices, say) without leaving it. The margin takes the
     padding back, so nothing moves. */
  margin: -12px -16px;
  padding: 12px 16px;
}

.about-heading {
  display: grid;
  margin-bottom: 12px;
}

/* Closing: the choices fade out, then "About" fades back in. */
.about-intro .about-heading .label {
  margin: 0;
  transition: opacity 0.4s ease-in-out 0.2s;
}

.about-heading > *,
.about-bios > * {
  grid-area: 1 / 1;
}

.audience {
  position: relative;
  z-index: 1; /* above the faded "About", which would otherwise take the clicks */
  display: flex;
  /* Grows with the window, like the gutters: 8px on phones, about 16px at
     1024 (so the row stays well clear of Currently working on), 22px on
     wide screens.
     That leaves room for the glass behind the reader you point at. */
  gap: clamp(8px, 1.6vw, 22px);
  white-space: nowrap; /* one line; it may run into the empty column beside */
  pointer-events: none; /* closed: a tap lands on the column, not a hidden choice */
}

.audience > * {
  opacity: 0;
  transition:
    opacity 0.28s ease-in-out,
    color 0.2s ease;
}

.audience-for,
.audience-option {
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
}

/* The short name for a reader, shown on smaller phones only (see the end). */
.audience-short {
  display: none;
}

/* "For" sits in the row like another choice, the same gap apart. */
.audience-for {
  color: var(--color-text-muted);
}

.audience-option {
  position: relative;
  isolation: isolate; /* keeps its glass (below) behind its word */
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-muted);
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* The reader you point at (or tab to) sits on a pill of grey glass, 4px
   above and below the word and 10px either side. It fades in and out like
   everything else in the row. */
.audience-option::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -4px -10px;
  border-radius: 14px;
  background: var(--glass-grey);
  opacity: 0;
  transition: opacity 0.18s ease-in-out;
}

@media (hover: hover) {
  .audience-option:hover::before {
    opacity: 1;
  }
}

/* The reader chosen stands out a shade darker than the rest. It can still
   be clicked: its bio nudges up into place, to show it's the one loaded. */
.audience-option[aria-pressed="true"] {
  color: var(--color-text-secondary);
}

/* From the keyboard the focus ring goes round the pill. */
.audience-option:focus-visible {
  outline: none;
}

.audience-option:focus-visible::before {
  opacity: 1;
  outline: var(--focus-ring);
}

/* Open: while pointing at the column or after a tap on a phone (site.js
   adds is-open for both), or while tabbing through the choices. "About"
   fades out, and the choices step in as it goes: "For" in its place, then
   each reader a beat after the last. */
.about-intro.is-open .about-heading .label,
.about-intro:has(.audience-option:focus-visible) .about-heading .label {
  opacity: 0;
  transition: opacity 0.24s ease-in-out;
}

.about-intro.is-open .audience,
.about-intro:has(.audience-option:focus-visible) .audience {
  pointer-events: auto;
}

.about-intro.is-open .audience > *,
.about-intro:has(.audience-option:focus-visible) .audience > * {
  opacity: 1;
  transition:
    opacity 0.3s ease-in-out calc(0.16s + var(--step, 0) * 0.12s),
    color 0.2s ease;
}

/* Each one's place in the order: "For" first, then the readers. */
.audience > :nth-child(2) { --step: 1; }
.audience > :nth-child(3) { --step: 2; }
.audience > :nth-child(4) { --step: 3; }
.audience > :nth-child(5) { --step: 4; }

@media (hover: hover) {
  .audience-option:not([aria-pressed="true"]):hover {
    color: var(--color-text-secondary);
  }
}

html:not(.js) .audience {
  display: none; /* choosing needs JavaScript; the bio for everyone shows */
}

.about-bios {
  display: grid;
}

/* About 430px at most, so on wide screens a bio keeps the shape it has on a
   laptop: two lines, the everyone version one sentence per line. */
.about-bio {
  max-width: 33em;
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
  opacity: 0;
  visibility: hidden; /* hidden versions stay out of the way of screen readers */
  transition:
    opacity 0.28s ease-in-out,
    visibility 0s linear 0.28s;
}

/* The new bio fades in once the old one has all but gone. */
.about-bio.is-active {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.45s ease-in-out 0.2s,
    visibility 0s linear 0s;
}

/* The two lists sit together as one group across the right half (from
   column 7, where the pictures start on Work), with Personal projects in
   columns 10 to 12. The space from column 7 up to it is shared evenly: before
   Currently working on, and between the two. So the bio has three or four
   times the gap between the lists after it: the row reads as two parts,
   the bio and its links. Each list arrives a beat after the last. */
.about-links {
  grid-column: 7 / -1;
  display: flex;
  align-items: flex-start;
}

.about-links > * {
  flex: none;
  margin-left: auto; /* auto margins share the free space equally */
}

.about-currently {
  --enter-delay: 0.06s;
}

/* The last three of the group's six columns, so Personal projects stays in
   column 10 (a column is the group's width, less its five gutters, over
   six). Three, not two, so "The Part-Time Backpacker" fits at 1024. */
.about-projects {
  width: calc((100% - 5 * var(--gutter)) / 6 * 3 + 2 * var(--gutter));
  --enter-delay: 0.12s;
}

/* An outside link's arrow hangs into the gap rather than widening its list,
   so the gaps between the lists measure the same from the words. */
.about-links .item-icon {
  margin-right: -18px; /* the arrow's 16px and the 2px before it */
}

.about-list .label {
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Lists of links (About, and "More work" at the end of a case study)
   -------------------------------------------------------------------------- */

.group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 8px between rows, and 12px under a list's label, so lists can breathe. */
.item-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A row holds the link plus anything that sits beside it (an arrow, or
   "Copied" in the footer). */
.item-row {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}

.item-row--text {
  gap: 6px;
}

.item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  color: var(--color-text-primary);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
}

.item-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.item-meta {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* The arrow after an outside link shows on hover. It's always the link's
   colour, greying with it (see Links above), and its 1.25px stroke matches
   the weight of the letters, so it reads as the same grey rather than a
   darker one. As it appears it eases 2px toward where it points. */
.item-icon {
  display: block;
  flex: none;
  width: 16px;
  height: 16px;
  opacity: 0;
  transform: translate(-2px, 2px);
  transition:
    opacity 0.125s ease-out,
    color 0.125s ease-out,
    transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

/* "Copied" is light grey, the way years follow a title. */
.item-trailing {
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.125s ease-out;
}

.item:hover + .item-icon,
.item:focus-visible + .item-icon {
  opacity: 1;
}

.item:hover + .item-icon,
.item:focus-visible + .item-icon {
  transform: none;
}

/* A link on to more (a company's page from Work, a case study from a
   company's page) ends in the pointer badge's twin: the same 24px circle of
   grey glass with the arrow in it in grey, but fixed in place, 6px after
   the words, and always showing, so the link reads as a way in. The arrow
   points right, the way the link goes. The circle eases 2px further on when
   you point at the link. Its 24px takes no more room in the line than a
   bare arrow's 16px would. */
.item-icon--next {
  box-sizing: content-box;
  margin: -2px 0 -2px 4px; /* 6px after the words, with the row's 2px */
  padding: 4px;
  border-radius: 50%;
  background: var(--glass-grey);
  color: var(--color-text-secondary);
  opacity: 1;
  transform: none;
  pointer-events: none; /* a click on it lands on the link, which reaches under it */
}

/* The circle is part of the link: the link's own area carries on under it,
   so a click or tap on the circle follows the link, and pointing at it
   greys the words and eases the circle on, as pointing at the words does. */
.item-row:has(> .item-icon--next) > .item {
  position: relative;
}

.item-row:has(> .item-icon--next) > .item::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 100%;
  width: 32px; /* the 6px gap, the circle's 24px and its 2px of travel */
}

.item:hover + .item-icon--next,
.item:focus-visible + .item-icon--next {
  transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
  .item:hover + .item-icon--next,
  .item:focus-visible + .item-icon--next {
    transform: none;
  }
}

/* Copying the email rewrites the badge's "Copy" (below) as "Copied" in
   place: "Cop" stays put and only the ending changes, the new letters
   sweeping in from the left behind a soft edge (site.js adds is-writing).
   Nothing moves, so the word never leaves its line. The ending is its own
   box only while it's being written, so at rest "Copy" keeps its usual
   spacing. */
.pointer-badge-end.is-writing {
  display: inline-block;
  -webkit-mask-image: linear-gradient(to right, #000 33.3%, transparent 66.7%);
  mask-image: linear-gradient(to right, #000 33.3%, transparent 66.7%);
  -webkit-mask-size: 300% 100%;
  mask-size: 300% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: write-in 0.45s cubic-bezier(0.33, 1, 0.68, 1);
}

@keyframes write-in {
  from {
    -webkit-mask-position: 100% 0;
    mask-position: 100% 0;
  }

  to {
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
  }
}

@keyframes write-in-fade {
  from { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Pointer badge (after philipreadman.com). With a mouse or trackpad,
   pointing at an outside link brings up a small circle of grey glass with
   the arrow in it, just above and to the right of the pointer, and it
   follows the pointer on a light spring (site.js). Words passing under it
   blur, as they do under the header. Over Email it stretches to read
   "Copy", then "Copied" once clicked. It stands in for the arrows beside
   the links, which stay for touch screens and without JavaScript.
   The outer box moves and grows; the body inside is what you see, and it
   does the fading (fading the outer box would stop the glass seeing through).
   -------------------------------------------------------------------------- */

.pointer-badge {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20; /* above the header */
  pointer-events: none;
  scale: 0.85;
  transform-origin: 0 100%; /* grows from the corner nearest the pointer */
  transition: scale 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pointer-badge.is-visible {
  scale: 1;
}

.pointer-badge-body {
  display: flex;
  align-items: center;
  gap: 2px;
  box-sizing: border-box;
  width: 24px; /* site.js sets it to fit what's inside */
  height: 24px;
  padding-left: 4px; /* centres the arrow's 16px in the circle */
  overflow: hidden;
  border-radius: 12px;
  background: var(--glass-grey);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--color-text-secondary);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.18s ease-in-out;
}

/* Only a badge in view changes width smoothly, so one that's appearing is
   already the right size. */
.pointer-badge.is-visible .pointer-badge-body {
  opacity: 1;
  transition:
    opacity 0.18s ease-in-out,
    width 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.pointer-badge[data-mode="copy"] .pointer-badge-body {
  padding-left: 9px;
}

/* It holds the arrow and the word, and shows one. Both keep to its left
   edge as it changes width, so "Cop" stays put. */
.pointer-badge svg,
.pointer-badge-text {
  display: none;
  flex: none;
}

.pointer-badge[data-mode="arrow"] svg {
  display: block;
  width: 16px;
  height: 16px;
}

.pointer-badge[data-mode="copy"] .pointer-badge-text {
  display: block;
}

.has-pointer-badge .item-icon:not(.item-icon--next),
.has-pointer-badge .item-trailing {
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Entrance: a page's content fades in and rises a little as it opens.
   -------------------------------------------------------------------------- */

@keyframes enter-fade {
  from { opacity: 0; }
}

@keyframes enter-rise {
  from { transform: translateY(var(--enter-rise, 32px)); }
}

.enter {
  animation:
    enter-fade 0.9s cubic-bezier(0.33, 1, 0.68, 1) var(--enter-delay, 0s) backwards,
    enter-rise 1.4s cubic-bezier(0.22, 1, 0.36, 1) var(--enter-delay, 0s) backwards;
}

/* --------------------------------------------------------------------------
   Nudge: the site's small "done" signal. Something just confirmed dims a
   little and rises 6px back into place, a small version of the entrance
   (site.js's nudge() adds is-nudged). Used when the chosen reader on About
   is clicked again. Keep it for things that stand on their own: on a word
   that shares a line with other text, the drop reads as misaligned type.
   -------------------------------------------------------------------------- */

@keyframes nudge {
  from {
    opacity: 0.4;
    transform: translateY(6px);
  }
}

@keyframes nudge-fade {
  from { opacity: 0.4; }
}

.is-nudged {
  animation: nudge 0.8s cubic-bezier(0.33, 1, 0.68, 1);
}

/* --------------------------------------------------------------------------
   Case studies (and other article-style pages)
   -------------------------------------------------------------------------- */

.article-page {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 120px var(--margin);
}

.article {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.article-hero,
.article-copy {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--article-width);
  margin: 0 auto;
}

.article-hero {
  margin-bottom: 40px;
}

.article-hero h1 {
  margin: 0 0 8px;
  font-size: var(--text-header-1-size);
  font-weight: 600;
  line-height: var(--text-header-1-line-height);
}

.article-subtitle {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-body-size);
  font-weight: 400;
  line-height: var(--text-body-line-height);
}

.article-copy h2 {
  margin: 32px 0 10px;
  color: var(--color-text-primary);
  font-size: var(--text-header-2-size);
  font-weight: 600;
  line-height: var(--text-header-2-line-height);
  scroll-margin-top: 80px; /* clear of the sticky header */
}

.article-copy h3 {
  margin: 0 0 10px;
  color: var(--color-text-secondary);
  font-size: var(--text-body-size);
  font-weight: 400;
  line-height: var(--text-body-line-height);
}

.article-copy h4 {
  margin: 0 0 10px;
  color: var(--color-text-primary);
  font-size: var(--text-body-size);
  font-weight: 600;
  line-height: var(--text-body-line-height);
}

.article-copy p,
.article-copy ul,
.article-copy ol {
  margin: 0 0 10px;
  color: var(--color-text-primary);
  font-size: var(--text-body-size);
  font-weight: 400;
  line-height: var(--text-body-line-height);
}

.article-copy ul,
.article-copy ol {
  padding-left: 20px;
}

.article-copy li {
  margin-bottom: 4px;
}

.article-copy li:last-child {
  margin-bottom: 0;
}

.article-copy strong {
  font-weight: 600;
}

.article-copy a {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-text-secondary);
  text-underline-offset: 3px;
  transition: color 0.125s ease-out, text-decoration-color 0.125s ease-out;
}

.article-copy a:hover {
  color: var(--color-accent);
  text-decoration-color: currentColor;
}

.article-copy a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

.article-media {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--media-width);
  margin: 40px auto;
}

.article-media--narrow {
  max-width: var(--article-width);
}

.article-media img {
  width: 100%;
  height: auto;
}

/* Bare screenshots of a TV screen get a thin bezel so their edges read. */
.article-media img.is-screen {
  border: 3px solid var(--color-bezel);
}

.article-caption {
  margin: 10px 0 0;
  color: var(--color-text-secondary);
  font-size: var(--text-label-size);
  font-weight: 500;
  line-height: var(--text-label-line-height);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.media-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Closing links at the end of an article ("More work") */
.article-end {
  width: 100%;
  max-width: var(--article-width);
  margin: 48px auto 0;
}

/* --------------------------------------------------------------------------
   Responsive. Below 1024px the About row stacks in one column: About, then
   Currently working on and Personal projects, from the top of the page
   rather than its middle.
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  .about {
    align-items: flex-start;
    padding: 64px var(--margin) 96px;
  }

  .about-intro {
    grid-column: 1 / -1;
  }

  /* The group lets go, and its lists join the page grid in one column under
     the bio, in reading order: Currently working on, Personal projects. */
  .about-links {
    display: contents;
  }

  .about-links > * {
    grid-column: 1 / -1;
    width: auto; /* Personal projects' three columns are for the row above 1024px */
    margin-left: 0;
  }
}

/* A phone has no room for Copenhagen and Contact on one line, so the footer
   takes two: Contact on a line of its own above, and Copenhagen in the
   corner below, where the sky's name has the whole line. */
@media (max-width: 640px) {
  .site-footer {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .contact {
    order: -1;
    flex-basis: 100%;
  }
}

@media (max-width: 640px) {
  /* No hover on phones: drop the hidden arrows and let long titles wrap
     rather than truncate. The circle after a link on to more stays. */
  .item-icon:not(.item-icon--next) {
    display: none;
  }

  .item {
    display: block;
  }

  .item-title {
    overflow: visible;
    white-space: normal;
  }

  .item-meta {
    white-space: nowrap;
  }

  .item-meta::before {
    content: " ";
  }

  .article-page {
    padding: 64px var(--margin) 96px;
  }

  .media-grid,
  .media-grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Smaller phones say "PMs" rather than "product managers", so the row fits.
   (Not "product": followed by "engineers" it reads as one job.) */
@media (max-width: 389px) {
  .audience-long {
    display: none;
  }

  .audience-short {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  .enter {
    animation-name: enter-fade, none; /* fade in, but don't move */
  }

  .is-nudged {
    animation-name: nudge-fade; /* dim and come back, but don't move */
  }

  .item-icon {
    transform: none; /* the arrow only fades */
  }

  .pointer-badge-end.is-writing {
    -webkit-mask-image: none;
    mask-image: none;
    animation-name: write-in-fade; /* the new ending fades in, no sweep */
  }

  /* The badge keeps up with the pointer exactly (site.js), only fades in
     and out, and changes width at once. */
  .pointer-badge,
  .pointer-badge.is-visible {
    scale: none;
  }

  .pointer-badge.is-visible .pointer-badge-body {
    transition: opacity 0.18s ease-in-out;
  }
}
