/* ============================================================================
   Cameron Regan-Teasdale — personal site

   Design direction: the warm, quiet system drawn in the draft — an Isabelline
   ground, a single warm taupe for everything that is chrome, and a near-black
   reserved for titles. No accent colour, no rules under headings, no
   underlines: hierarchy comes from case, weight and size alone.

     chrome   Inter 15px / 500 / uppercase / 0.2px
     title    Inter / 700 / lowercase / -0.5px
     line     Inter 13px / 400

   Night is a true mirror of the same two colours, swapped. It is opt-in from
   the footer and never follows system preference, so the site looks as drawn
   until the reader decides otherwise.
   ========================================================================== */

:root {
  --paper:  #f4f0ed;   /* Isabelline ground */
  --ink:    #8c8080;   /* body, chrome, captions — the warm taupe */
  --strong: #252422;   /* titles, the photo caption's first line */
  --muted:  #8c8080;   /* the same taupe: the system has one quiet colour */
  --hover:  #555555;
  --hair:   color-mix(in srgb, #8c8080 28%, transparent);
  --wash:   rgba(0, 0, 0, 0.04);   /* image placeholder */

  /* Inter is the reference face. The platform grotesques follow it so the
     page still sets correctly if the webfont never arrives. */
  --sans: Inter, "SF Pro Display", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shell: 64rem;
  --pad: clamp(1.25rem, 5vw, 2.5rem);
  --measure: 40rem;

  color-scheme: light;
}

/* The warm near-black becomes the ground and the Isabelline the ink. The
   chrome lifts from #8C8080 to #A89C9C, which measures 5.83:1 against
   #252422 — better than the 3.36:1 the day scheme manages. */
:root[data-theme="dark"] {
  --paper:  #252422;
  --ink:    #a89c9c;
  --strong: #f4f0ed;
  --muted:  #a89c9c;
  --hover:  #f4f0ed;
  --hair:   color-mix(in srgb, #a89c9c 28%, transparent);
  --wash:   rgba(255, 255, 255, 0.05);

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--strong); outline-offset: 3px; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--pad); top: 0.5rem; z-index: 10;
  background: var(--paper); padding: 0.5rem 0.75rem; border: 1px solid var(--hair);
}

/* Small uppercase meta — dates, labels, field names. One shared class. */
.meta {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* --- The banner ----------------------------------------------------------
   Name hard left, the three links hard right, so the bar is balanced on its
   edges rather than stacked and centred. Sticky rather than fixed: the pages
   below it are ordinary documents, and sticky needs no compensating padding.
   ------------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  /* A hairline under the bar, as the reference has, which also gives the
     sticky bar an edge to hold as content passes beneath it. */
  border-bottom: 1px solid var(--hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--pad);
  background: var(--paper);
}

.site-header a {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.0733;          /* 16.1 / 15 */
  text-transform: none;
  /* Set in the strong colour, as the reference sets its menu. The taupe
     was chosen to sit quietly behind uppercase; in sentence case at this
     size it reads as greyed-out rather than quiet. */
  color: var(--strong);
  /* The browser's own underline stays off; the rule under a menu item is
     drawn below, where it can be animated. */
  text-decoration: none;
  transition: color 240ms ease;
}
.site-header a:hover,
.site-header a:focus-visible { color: var(--hover); }

/* The page you are on is named in the strong colour as well as ruled. */
.site-header a[aria-current="page"] { color: var(--strong); }

/* space-x-8 in the component, which is 32px. */
.site-header nav { display: flex; gap: 32px; align-items: center; flex: none; }

/* --- The rule under a menu item -----------------------------------------
   A pseudo-element rather than a border or a text-decoration, because it
   has to animate: it grows from the middle on hover and on keyboard
   focus, and stays out on the page you are already on.

   Drawn below the text rather than padded into it, so the bar is exactly
   the height it was. currentColor, so it follows the text as that
   changes colour rather than arguing with it.
   ------------------------------------------------------------------------ */
.site-header nav a { position: relative; }

.site-header nav a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -6px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
.site-header nav a:hover::after,
.site-header nav a:focus-visible::after,
.site-header nav a[aria-current="page"]::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .site-header nav a::after { transition-duration: 1ms; }
}

/* The name must be allowed to shrink, or flexbox keeps it on one line and
   pushes the links off the right edge. */
/* The name in the reference's weight: bold and dark, so the mark on the
   left has the presence the menu on the right does not need. */
.wordmark {
  min-width: 0;
  font-weight: 700;
  color: var(--strong);
}

/* On a phone the name and three links do not fit on one line — measured at
   375, 390 and 430, where the links were cut off at the edge. The bar stacks
   instead, both rows centred, which keeps it symmetrical. */
@media (max-width: 700px) {
  .site-header {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px var(--pad);
  }
  .site-header a { font-size: 0.8125rem; }
  .site-header nav { gap: 22px; }
}
@media (min-width: 1921px) { .site-header a { font-size: 1rem; } }

/* --- Buttons -------------------------------------------------------------
   Not buttons in this system: the reference sets its calls to action as the
   same uppercase chrome as everything else, with no pill and no border.
   ------------------------------------------------------------------------ */
.button {
  display: inline-block;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  transition: color 240ms ease;
}
.button:hover { color: var(--hover); }

/* --- Sections ----------------------------------------------------------- */
main > section { padding-block: clamp(2rem, 5vw, 3rem); }
main > section.lead { padding-bottom: 0; }

/* No rule beneath: in this system a label is set apart by case and colour. */
.section-label {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.15;
  color: var(--ink);
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.5px;
  line-height: 1.05;
  color: var(--strong);
  text-wrap: balance;
}

.intro {
  max-width: 46ch;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
}


/* --- Posts -------------------------------------------------------------- */
.post-link { text-decoration: none; display: block; }

.media {
  overflow: hidden;
  background: var(--wash);
}
.media img { width: 100%; height: 100%; object-fit: cover; }

.post-title {
  margin: 0.6rem 0 0;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.5px;
  line-height: 1.15;
  color: var(--strong);
  text-wrap: balance;
  transition: color 240ms ease;
}
/* The colour shifts rather than an underline appearing — nothing in this
   system is underlined. */
.post-link:hover .post-title { color: var(--hover); }

.post-summary {
  margin: 0.7rem 0 0;
  max-width: var(--measure);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink);
}

/* Featured — image above a large headline */
.post.featured .media { aspect-ratio: 16 / 9; }
.post.featured .post-text { padding-top: 1.25rem; }
.post.featured .post-title { font-size: clamp(1.75rem, 4.6vw, 2.75rem); }
.post.featured .post-summary { font-size: 0.875rem; }

/* Brief — two-up beneath */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1.75rem, 4vw, 2.5rem);
}

.post.brief .media { aspect-ratio: 3 / 2; margin-bottom: 0.9rem; }
.post.brief .post-title { font-size: 1.1875rem; }
.post.brief .post-summary { font-size: 0.8125rem; margin-top: 0.5rem; }

/* --- About -------------------------------------------------------------- */
.bio { display: flex; gap: clamp(1.5rem, 4vw, 2.5rem); align-items: flex-start; }

.portrait {
  flex: none;
  width: clamp(84px, 13vw, 120px);
  height: clamp(84px, 13vw, 120px);
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
}

/* Same reasoning as the article body: this is reading, not chrome. */
.prose { max-width: var(--measure); color: var(--strong); font-size: 1rem; line-height: 1.6; }

/* Centred: the About page leads with a map, and a column of text hard
   against the left edge above it looked like the start of a different
   page. The measure stays — centring a wide block only makes it harder
   to read — so the column is centred rather than the words stretched. */
.prose.is-centred {
  margin-inline: auto;
  text-align: center;
  text-wrap: pretty;
}

/* Wider than the usual measure. A 40rem column is the comfortable one to
   read, but above the map it was making a short biography look like a
   long one. The section around it has to grow too, or .shell clamps the
   column at 64rem whatever the column asks for. */
.bio-shell { max-width: 78rem; }

/* Two columns rather than one wide one. At 70rem a single column ran to
   115 characters a line — roughly double the comfortable measure — and
   centring it compounded that, since every line began somewhere
   different and the eye had no fixed edge to return to. Split in two,
   each column measures 58, and the block keeps the width it had. */
[data-page="about"] .prose {
  max-width: 70rem;
  columns: 2;
  column-gap: 4rem;
  text-align: left;
  text-wrap: pretty;
}
/* A paragraph split across the gap reads as two, so they stay whole. */
[data-page="about"] .prose p { break-inside: avoid; margin: 0 0 1.1rem; }
[data-page="about"] .prose p:last-child { margin-bottom: 0; }

/* One column once there is no room for two: at a phone's width a 4rem
   gap and two columns would leave about twenty characters a line. */
@media (max-width: 860px) {
  [data-page="about"] .prose { columns: 1; }
}
[data-page="about"] .page-title {
  text-align: center;
  /* More air under the title than the other pages take: it sits above two
     columns rather than a single paragraph, and needs to read as a title
     over a block rather than the first line of it. */
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.prose p { margin: 0 0 1rem; }
.prose p:last-child { margin-bottom: 0; }

/* --- The expanded photo --------------------------------------------------
   Opens by growing out of the photo that was clicked: the script measures
   where that photo is, puts this one exactly over it, and then lets it
   travel to the middle. So the transform here is the script's to set, and
   only the transition belongs to CSS.

   The ground is the page's own, not a black wash. The old dialog came from
   the black-on-white design and lit a dark box in the middle of a warm
   page; this reads as the same page with one photograph brought forward.
   ------------------------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  overflow: hidden;
}
.lightbox::backdrop { background: var(--paper); }

/* No ring on the dialog. It is focused when it opens so that Escape and
   the arrow keys land somewhere useful, not because it is a control a
   reader has moved to — and the site-wide focus style was drawing a
   near-black border around the whole enlarged view. The controls inside
   keep their own rings, so nothing is lost for the keyboard. */
.lightbox:focus,
.lightbox:focus-visible { outline: none; }

/* The ground and the chrome fade; the photograph does not, so it can be
   watched all the way back to the row it came from. */
.lightbox-ground {
  position: absolute;
  inset: 0;
  background: var(--paper);
  opacity: 0;
  transition: opacity 300ms ease;
}
.lightbox.is-open .lightbox-ground { opacity: 1; }

.lightbox-caption,
.lightbox-close,
.lightbox-nav {
  opacity: 0;
  transition: opacity 240ms ease;
}
.lightbox.is-open .lightbox-caption,
.lightbox.is-open .lightbox-close,
.lightbox.is-open .lightbox-nav { opacity: 1; }

.lightbox-figure {
  position: relative;      /* above the ground */
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: clamp(3.5rem, 8vw, 5rem) clamp(1.5rem, 6vw, 4rem);
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 74vh;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: top left;
}


/* The gallery's caption, in the same two weights of the one taupe. */
.lightbox-caption {
  max-width: 46ch;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lightbox-caption .title {
  font-size: 1.1875rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.5px;
  line-height: 1.15;
  color: var(--ink);
}
.lightbox-caption .line {
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
  transition: color 240ms ease;
}
.lightbox-close,
.lightbox-nav { transition: color 240ms ease, opacity 240ms ease; }
.lightbox-close:hover,
.lightbox-nav:hover { color: var(--hover); }
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.lightbox-close { top: 22px; right: var(--pad); }
.lightbox-nav { bottom: 28px; }
.lightbox-nav.prev { left: var(--pad); }
.lightbox-nav.next { right: var(--pad); }

@media (max-width: 700px) {
  .lightbox img { max-height: 62vh; }
  .lightbox-caption .title { font-size: 1.125rem; }
  .lightbox-caption .line { font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  /* The flight itself is skipped in the script. */
  .lightbox-ground,
  .lightbox-caption,
  .lightbox-close,
  .lightbox-nav { transition-duration: 1ms; }
}

/* --- Contact ------------------------------------------------------------ */
.contact { margin: 2rem 0 0; }

.contact-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0 2rem;
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--hair);
}
.contact-row:first-child { border-top: 1px solid var(--hair); }

.contact dt { padding-top: 0.25rem; }
.contact dd { margin: 0; word-break: break-word; }
.contact dd a {
  color: var(--strong);
  text-decoration: none;
  transition: color 240ms ease;
}
.contact dd a:hover { color: var(--hover); }


/* --- Footer --------------------------------------------------------------
   The same four links and the same line of copyright the site has always
   had, set in the chrome style, with the night control alongside. Links
   hard left and the copyright and control hard right, so the foot of the
   page is balanced on its edges exactly as the banner is.
   ------------------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--hair);
  margin-top: clamp(2rem, 5vw, 3rem);
  padding: 34px var(--pad) 72px;
}

.footer-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.footer-links a,
.copyright,
.theme-toggle {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: none;
  color: var(--ink);
  text-decoration: none;        /* no underlines here either */
}
.footer-links a { transition: color 240ms ease; }
.footer-links a:hover { color: var(--hover); }

.copyright { margin: 0; }

.footer-end { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }

/* The night control — plain text in the chrome style, not a pill. */
.theme-toggle {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  transition: color 240ms ease;
}
.theme-toggle:hover { color: var(--hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

@media (max-width: 700px) {
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
  .footer-links { justify-content: center; gap: 20px; }
  .footer-end { flex-direction: column; gap: 14px; }
}

/* --- Narrow screens ----------------------------------------------------- */
@media (max-width: 40rem) {
  .row, .contact-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .row .meta, .contact dt { padding-top: 0; }
  .bio { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- Print -------------------------------------------------------------- */
@media print {
  :root {
    --paper: #fff; --ink: #000; --strong: #000; --muted: #333;
    --hair: #ccc; --wash: #fff;
  }
  @page { margin: 16mm; }
  body { font-size: 10.5pt; line-height: 1.4; }
  .shell { max-width: none; padding-inline: 0; }
  .skip, .media, .site-footer { display: none !important; }
  .site-header {
    position: static;
    display: block;
    padding: 0 0 0.75rem;
    border-bottom: 1.5px solid #000;
  }
  .site-header nav { display: none; }
  .wordmark { font-size: 16pt; letter-spacing: 0; }
  main > section { padding-block: 0.8rem; }
  .post.featured .post-title { font-size: 16pt; }
  .post.brief .post-title { font-size: 13pt; }
  .post-grid { display: block; }
  .post.brief { margin-bottom: 0.8rem; }
  .post, .row { break-inside: avoid; }
}

/* --- Homepage hero -------------------------------------------------------
   Ported from a React/framer-motion component. The moving part is the line
   under the heading: each phrase springs up into place as the one before it
   leaves upward, so the column reads as a single line that keeps changing.

   framer-motion's spring is approximated with a cubic-bezier that overshoots
   slightly and settles — close enough at this duration, and it costs nothing
   to run.

   Every phrase sits in the HTML stacked at the same spot. The first is
   visible by default, so without JavaScript the heading simply reads as one
   fixed line rather than collapsing or showing all five at once.
   --------------------------------------------------------------------- */
.hero {
  padding-block: clamp(3rem, 9vw, 6.5rem);
  text-align: center;
}

/* A label, not a pill: no border, no arrow, just the chrome style. */
.hero-eyebrow {
  display: inline-block;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: none;
  color: var(--ink);
  text-decoration: none;
  transition: color 240ms ease;
}
.hero-eyebrow:hover { color: var(--hover); }
/* The arrow came with the component; this system has no icons. */
.hero-eyebrow svg { display: none; }

.hero-title {
  margin: clamp(1.5rem, 4vw, 2.25rem) auto 0;
  max-width: 18ch;
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.5px;
  line-height: 1.05;
  color: var(--strong);
  text-wrap: balance;
}

/* The rotating line. Height comes from a zero-width spacer so the block
   never collapses, and the phrases are laid over it. */
.hero-rotator {
  position: relative;
  display: block;
  overflow: hidden;
  /* Room for the overshoot at the top and the descenders at the bottom. */
  padding-block: 0.12em;
}
.hero-rotator .spacer { visibility: hidden; }

/* Transform only, no fade. A fading phrase passes through grey values on
   its way out — caught mid-transition that is black at a third opacity,
   which reads as #acacac on white and fails contrast at 2.27:1. The box
   above clips, so sliding is all that is needed: a phrase is either in the
   line at full strength or outside it entirely. It is cheaper to animate
   too, being compositor-only. */
.hero-word {
  position: absolute;
  inset-inline: 0;
  top: 0.12em;
  /* 150%, not 110%: the box carries 0.12em of padding top and bottom,
     so a phrase parked at 110% still pokes a sliver back into the line. */
  transform: translateY(150%);
  will-change: transform;
}
/* The one on show. Without JavaScript this is simply the first phrase. */
.hero-word.is-current { transform: none; }
/* Phrases already gone leave upward, the way they arrived. */
.hero-word.is-past { transform: translateY(-150%); }

.hero.is-live .hero-word {
  transition: transform 620ms cubic-bezier(0.34, 1.42, 0.64, 1);
}

.hero-intro {
  margin: clamp(1.25rem, 3vw, 1.75rem) auto 0;
  max-width: 46ch;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

/* Both variants are the same plain chrome now — the outline had a border
   and the solid a filled pill, neither of which belongs in this system. */
.button.outline {
  background: none;
  border: 0;
  color: var(--ink);
}
.button.outline:hover { color: var(--hover); }

.button .icon-arrow { display: none; }

@media (prefers-reduced-motion: reduce) {
  /* No springing line: it settles on the first phrase and stays there. */
  .hero.is-live .hero-word { transition-duration: 1ms; }
}


/* --- The gallery ---------------------------------------------------------
   One treatment, shared by the homepage and the About page — they used to
   be a filmstrip and a cylinder, two different answers to the same
   question. Photos recede along a perspective, the centre one is sharp and
   captioned, and the caption's first line carries the strong colour.

   Real buttons in the markup, placed by CSS 3D transforms rather than drawn
   into a canvas, so the photos are in the page with the script off and the
   one in the middle opens the lightbox.
   ------------------------------------------------------------------------ */
.gallery-screen {
  /* The photos are given a z-index of up to 100 as they stack, and
     `overflow: clip` does not open a stacking context — so without this
     they would paint over the sticky banner on scrolling. Isolating keeps
     those z-indexes local to the gallery. */
  isolation: isolate;
  /* The receding photos reach well past the viewport on a narrow screen.
     The clip belongs here, not on <body>: an overflow set on body is
     propagated to the viewport while <html> is visible, so it never clips
     body's own content — the page just scrolled sideways instead.
     `clip` rather than `hidden` so no scroll container is created, and the
     perspective inside .stage is untouched. */
  overflow-x: clip;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
}

/* Only the homepage gives the gallery the whole first screen. */
[data-page="home"] .gallery-screen {
  min-height: calc(100svh - 80px);
  padding: 24px 0 48px;
}

.stage {
  position: relative;
  /* Room for the middle photo at full height plus the shadow of the ones
     stepping back from it. */
  height: calc(var(--photo-h) + 2rem);
  /* The middle photo is shown whole and the rest recede from it, which is
     what makes the row read as a carousel turning rather than a strip
     sliding. The row still runs off both edges of the page. */
  perspective: 1500px;
  cursor: grab;
  /* Vertical scrolling belongs to the page: it is how the reader reaches
     what is below. Only the horizontal gesture drives the strip. */
  touch-action: pan-y;
}
.stage.is-dragging { cursor: grabbing; }
.stage-track { position: absolute; inset: 0; transform-style: preserve-3d; }

/* A photo is sized to fit inside this box, never cropped to it, so a
   landscape frame comes out shorter than a portrait one rather than both
   being cut to the same rectangle. The box, not the photo, sets the step
   between them, which keeps the spacing even across mixed shapes. */
:root {
  /* Much larger than the row that preceded it. The step between photos is
     a multiple of this box, so fewer are on screen at once — the middle
     one is the thing being looked at, and the rest are context running off
     both edges. */
  --photo-w: clamp(15rem, 30vw, 29rem);
  --photo-h: clamp(21rem, 64vh, 40rem);
}

.stage-item {
  position: absolute; top: 50%; left: 50%;
  margin: 0; padding: 0; border: 0; background: none;
  line-height: 0;              /* no descender gap under the photo */
  cursor: pointer;
  will-change: transform;
}
/* No transition on the row: a script loop drives it every frame, and a
   transition would fight the spring rather than help it. */
/* Each photo clears as it arrives rather than the row appearing at once.
   Scoped to .is-live so that without the script nothing is ever hidden. */
.stage.is-live .stage-item img {
  opacity: 0;
  filter: blur(4px);
  transition: opacity 460ms ease, filter 460ms ease;
}
.stage.is-live .stage-item img.is-ready { opacity: 1; filter: blur(0); }

.stage-item img {
  display: block;
  /* The distortion is written to the photo, so it must not be smoothed —
     it is already recomputed every frame. */
  transition-property: opacity, filter;
  /* auto on both, capped on both: the browser scales the photo down to fit
     inside the box and keeps its own proportions. The width and height
     attributes would otherwise win and force the photo to one shape. */
  width: auto;
  height: auto;
  max-width: var(--photo-w);
  max-height: var(--photo-h);
  background: var(--wash);
  -webkit-user-drag: none;
  user-select: none;
}
/* The taupe rather than the near-black: a keyboard reader still needs to
   see which photograph they are on, but a hard black box around a
   photograph is louder than anything else on the page. */
.stage-item:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }

/* The caption drops out of a masked box, swaps, and rises back into it —
   the pop the reference gives its captions, done with a mask rather than a
   fade, so the text is never shown at a part-strength colour. */
.stage-caption { text-align: center; padding: 28px 24px 0; }

/* Pointing at a photograph opens the caption a little: the place rises,
   the line beneath it settles. Applied to the paragraphs, while the spans
   inside carry the swap, so the two movements cannot fight each other. */
.stage-caption p {
  overflow: hidden;
  transition: transform 320ms cubic-bezier(0.16, 0.84, 0.28, 1);
}
.stage-caption.is-lifted .title { transform: translateY(-3px); }
.stage-caption.is-lifted .line  { transform: translateY(3px); }
.stage-caption p > span {
  display: inline-block;
  transform: translateY(0);
  transition: transform 520ms cubic-bezier(0.16, 0.84, 0.28, 1);
}
.stage-caption.is-out p > span { transform: translateY(115%); }
/* The second line follows the first rather than moving with it. */
.stage-caption .line > span { transition-delay: 55ms; }
/* Both lines of the caption are the one taupe — sampled off the reference,
   where the heading and the line under it are the same #8C8080 and the
   weight alone separates them. The near-black belongs to page titles. */
.stage-caption .title {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.5px;
  line-height: 1.15;
  color: var(--ink);
}
.stage-caption .line {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
}
@media (max-width: 700px) {
  .stage-caption .title { font-size: 1.125rem; }
  .stage-caption .line  { font-size: 0.75rem; }
}

.scroll-cue {
  text-align: center;
  /* Clear of the caption above it: attached to it, it read as a third
     line of the caption rather than an instruction about the page. */
  margin: clamp(2.5rem, 7vh, 5rem) 0 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.scroll-cue span { display: block; margin-top: 8px; font-size: 0.875rem; }

/* Without the script: photos in a plain column, everything still readable. */
.stage:not(.is-live) { height: auto; cursor: default; }
.stage:not(.is-live) .stage-track {
  position: static; display: grid; gap: 20px; justify-items: center;
}
.stage:not(.is-live) .stage-item { position: static; }
.stage:not(.is-live) .stage-item img { max-width: min(19rem, 76vw); max-height: none; }

@media (prefers-reduced-motion: reduce) {
  /* The script already places the row without the spring or the
     distortion; this covers the parts CSS owns. */
  .stage.is-live .stage-item img { transition-duration: 1ms; }
  .stage-caption p > span { transition-duration: 1ms; transition-delay: 0ms; }
}

/* Headings the design does not show but a screen reader and the document
   outline still need. Not `opacity: 0` or `display: none`: the first leaves
   the text announced, the second removes it from the outline entirely. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The banner's heading is itself the way through to the blog. It takes the
   heading's own colour and size — nothing about it should say "link" until
   it is hovered, in a design that underlines nothing. */
.hero-link {
  color: inherit;
  text-decoration: none;
  transition: color 240ms ease;
}
.hero-link:hover { color: var(--hover); }
.hero-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }


/* --- The atlas -----------------------------------------------------------
   The About page's photographs, shown where they were taken. The map is
   drawn in the site's own taupe: land at a third of its strength, because
   at full strength the silhouette shouts over the photographs pinned to
   it, and the photographs are the point. No borders — this map has no
   business asserting any.
   ------------------------------------------------------------------------ */
.atlas-section { padding-block: clamp(1rem, 3vw, 2rem); }

.atlas {
  position: relative;
  width: 100%;
  /* Wider than the text column it sits under: the map is the page's
     centrepiece, and at 1100px it read as another block of content. */
  max-width: 1400px;
  margin: 0 auto;
  padding-inline: var(--pad);
}

.atlas-map {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* The landmass: the text colour, quietened. */
.atlas-land {
  fill: color-mix(in srgb, var(--ink) 34%, transparent);
  stroke: none;
}

/* Meridians and parallels, barely there — enough to read the shape as a
   globe flattened out, not enough to become a grid. No borders: this map
   has no business asserting any. */
.atlas-grid {
  fill: none;
  stroke: color-mix(in srgb, var(--ink) 16%, transparent);
  stroke-width: 0.5;
}

/* Where a place really is, when its pin has been pushed off it. */
.atlas-tether {
  stroke: color-mix(in srgb, var(--ink) 55%, transparent);
  stroke-width: 0.8;
}
.atlas-true {
  fill: color-mix(in srgb, var(--ink) 70%, transparent);
}

/* --- The pins ------------------------------------------------------------ */
.atlas-pin {
  position: absolute;
  /* --sx/--sy: how far the script has moved it from its built position,
     to keep it clear of its neighbours at the width the map is shown. */
  transform: translate(-50%, -50%) translate(var(--sx, 0px), var(--sy, 0px));
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  transition: transform 260ms cubic-bezier(0.16, 0.84, 0.28, 1);
}
.atlas-pin img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  /* A ring in the ground colour lifts the photograph off the landmass. */
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px color-mix(in srgb, var(--ink) 60%, transparent);
}
.atlas-pin:hover,
.atlas-pin:focus-visible { transform: translate(-50%, -50%) translate(var(--sx, 0px), var(--sy, 0px)) scale(1.22); z-index: 5; }
.atlas-pin:focus-visible { outline: 2px solid var(--strong); outline-offset: 6px; }

/* How many photographs are behind this one. */
.atlas-count {
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--strong);
  color: var(--paper);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* The place name, on hover and on focus only — fourteen labels at once
   would bury the map they are meant to describe. */
.atlas-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  /* Two places sharing a pin are both named, so this has to be able to
     wrap rather than run off the edge of the map. */
  white-space: normal;
  width: max-content;
  max-width: 190px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--strong);
  background: var(--paper);
  padding: 2px 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.atlas-pin:hover .atlas-label,
.atlas-pin:focus-visible .atlas-label { opacity: 1; }

.atlas-hint {
  margin: 1.25rem auto 0;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

/* --- The ones with nowhere to go ----------------------------------------- */
.atlas-note { margin-bottom: 1.25rem; }

.atlas-unplaced {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: clamp(1rem, 3vw, 1.75rem);
}
.atlas-loose {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.atlas-loose img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  margin-bottom: 0.6rem;
}
.atlas-loose .title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.5px;
  color: var(--ink);
  transition: color 240ms ease;
}
.atlas-loose .line {
  display: block;
  margin-top: 3px;
  font-size: 0.8125rem;
  color: var(--ink);
}
.atlas-loose:hover .title { color: var(--hover); }
.atlas-loose:focus-visible { outline: 2px solid var(--strong); outline-offset: 4px; }

/* --- Small screens -------------------------------------------------------
   The pins stay the same size while the map shrinks, so below this width
   they crowd. Dropping them a little keeps the shape readable. */
@media (max-width: 700px) {
  .atlas-pin { width: 30px; height: 30px; }
  .atlas-count { min-width: 15px; height: 15px; line-height: 15px; font-size: 9px; }
  .atlas-label { font-size: 10px; }
}

/* --- A country opened out ------------------------------------------------
   Its places are in the page from the start but out of sight, so that
   opening one costs no layout and no fetching. They travel out from the
   country's own pin, and the marks showing where each truly sits appear
   with them.
   ------------------------------------------------------------------------ */
.atlas-place {
  position: absolute;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 4;
  /* Stacked on the country until .is-out sends it to its place. */
  transform: translate(-50%, -50%) translate(var(--fromX, 0), var(--fromY, 0)) scale(0.3);
  opacity: 0;
  pointer-events: none;
  transition: transform 420ms cubic-bezier(0.16, 0.84, 0.28, 1),
              opacity 260ms ease;
}
.atlas-place.is-out {
  transform: translate(-50%, -50%) translate(var(--sx, 0px), var(--sy, 0px)) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.atlas-place img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px color-mix(in srgb, var(--ink) 60%, transparent);
}
.atlas-place.is-out:hover,
.atlas-place.is-out:focus-visible { transform: translate(-50%, -50%) translate(var(--sx, 0px), var(--sy, 0px)) scale(1.2); z-index: 7; }
.atlas-place:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
.atlas-place:hover .atlas-label,
.atlas-place:focus-visible .atlas-label { opacity: 1; }
.atlas-place.is-open img { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--strong); }
.atlas-place.is-open .atlas-count { opacity: 0; }

/* The true-position marks for a country's places. */
.atlas-place-marks { opacity: 0; transition: opacity 300ms ease; }
.atlas-place-marks.is-shown { opacity: 1; }

/* Each level pushes the one above it out of focus: opening a country
   blurs the other countries, and opening a place blurs the countries
   further and the sibling places with them. Whatever was pressed to get
   here stays sharp, and so does anything under the pointer. */
.atlas .atlas-pin,
.atlas .atlas-place {
  transition: transform 260ms cubic-bezier(0.16, 0.84, 0.28, 1),
              opacity 260ms ease, filter 260ms ease;
}

.atlas.is-open .atlas-pin { opacity: 0.3; filter: blur(2px); }
.atlas.is-open .atlas-pin.is-open { opacity: 1; filter: none; }

/* Scoped to .is-out: a place that has not been opened out is at zero
   opacity, and must not be lifted to a third of the way visible. */
.atlas.is-fanned .atlas-pin { opacity: 0.16; filter: blur(4px); }
.atlas.is-fanned .atlas-place.is-out { opacity: 0.34; filter: blur(2.5px); }
.atlas.is-fanned .atlas-place.is-out.is-open { opacity: 1; filter: none; }
.atlas.is-fanned .atlas-place.is-out:hover,
.atlas.is-fanned .atlas-place.is-out:focus-visible { opacity: 1; filter: none; }

@media (max-width: 700px) {
  .atlas-place { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-place { transition-duration: 1ms; transition-delay: 0ms !important; }
  .atlas-place-marks { transition-duration: 1ms; }
}

/* --- A place opened out --------------------------------------------------
   A pin holding several photographs opens into a ring of them around its
   point on the map. They start stacked on the pin and travel outwards, so
   the movement says where they came from.
   ------------------------------------------------------------------------ */
.atlas-pin.is-open img {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--strong);
}
/* The count is what you pressed; while the photographs are out, it would
   only be repeating itself. */
.atlas-pin.is-open .atlas-count { opacity: 0; }

.atlas-fanned {
  position: absolute;
  /* Larger than the pin's own photographs: these are the things being
     chosen from, and a thirteen-strong ring wants targets worth aiming at. */
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 6;
  /* Stacked on the pin until .is-out moves it to its place in the ring.
     --fromX/--fromY: where the pin has been moved to, if it was. */
  transform: translate(-50%, -50%) translate(var(--fromX, 0px), var(--fromY, 0px)) scale(0.3);
  opacity: 0;
  transition: transform 400ms cubic-bezier(0.16, 0.84, 0.28, 1),
              opacity 260ms ease;
}
.atlas-fanned.is-out {
  transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(1);
  opacity: 1;
}
.atlas-fanned img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px color-mix(in srgb, var(--ink) 60%, transparent);
}
.atlas-fanned:hover,
.atlas-fanned:focus-visible {
  transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(1.2);
  z-index: 8;
}
.atlas-fanned:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; }
.atlas-fanned:hover .atlas-label,
.atlas-fanned:focus-visible .atlas-label { opacity: 1; }

@media (max-width: 700px) {
  .atlas-fanned { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-fanned { transition-duration: 1ms; transition-delay: 0ms !important; }
}

/* --- The contact form ----------------------------------------------------
   Fields are a line and a label, nothing more: this design has no boxes,
   no rounded corners and no fills, and a form is no reason to introduce
   three at once.
   ------------------------------------------------------------------------ */
.form {
  max-width: 34rem;
  margin: clamp(2rem, 5vw, 3rem) 0 0;
}

.field { margin-bottom: 1.6rem; }

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  background: none;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--strong);
  transition: border-color 240ms ease;
}
.field textarea { resize: vertical; min-height: 7rem; }

.field input:hover,
.field textarea:hover { border-bottom-color: var(--ink); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--strong);
}
/* The line is the focus indicator for a pointer; a keyboard reader gets
   the ring as well, since a 1px colour change is not enough on its own. */
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* The trap. Off-screen rather than display:none, which some robots skip. */
.honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form button[type="submit"] {
  cursor: pointer;
  margin-top: 0.5rem;
}
.form button[type="submit"]:disabled { opacity: 0.5; cursor: default; }
.form button[type="submit"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.form-status {
  margin: 1rem 0 0;
  min-height: 1.4em;          /* no jump when a message appears */
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink);
}
.form-status.is-sent { color: var(--strong); font-weight: 500; }
.form-status.is-failed { color: var(--strong); font-weight: 500; }

.form-elsewhere { margin-top: clamp(2.5rem, 6vw, 4rem); }
