:root {
  --bg: #ffffff;
  --text: #1d1d1f;
  --muted: #7a7a80;
  --dim: #a1a1a6;
  --rule: #e8e8ed;
  --pill-bg: rgba(255, 255, 255, 0.82);
  --pill-border: rgba(0, 0, 0, 0.08);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --measure: 600px;
  --size: clamp(18px, 0.6vw + 14.5px, 22px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0e;
    --text: #f5f5f7;
    --muted: #9a9aa0;
    --dim: #5c5c62;
    --rule: #2a2a2e;
    --pill-bg: rgba(28, 28, 30, 0.82);
    --pill-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--size);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.letter {
  max-width: calc(var(--measure) + 32px);
  margin: 0 auto;
  padding: 18vh 16px 30vh;
}

/* Intro */

.eyebrow {
  margin: 0 0 6vh;
  text-align: center;
  color: var(--muted);
  font-size: 1em;
}
.eyebrow span { color: var(--text); }

.portrait {
  max-width: 400px;
  margin: 0 auto 4.5em;
}
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

/* Text */

section { margin-bottom: 4.5em; }

h2 {
  margin: 0 0 1.4em;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

p {
  position: relative;
  margin: 0 0 1.1em;
  color: var(--text);
  transition: color 0.35s ease;
}

strong { font-weight: 500; color: var(--text); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--dim);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.2s ease;
}
a:hover { text-decoration-color: currentColor; }

/* Reading focus: once JS is running, paragraphs rest in grey and the one
   being read turns dark, with a dot in the margin (desktop only). */

.js p { color: var(--muted); }
.js p.is-active { color: var(--text); }

.js p::before {
  content: "";
  position: absolute;
  left: -40px;
  /* Centre of the first line box (line-height 1.5) minus half the dot */
  top: calc(0.75em - 4.5px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.js p.is-active::before { opacity: 1; transform: scale(1); }

@media (max-width: 720px) {
  .js p::before { display: none; }
}

.eyebrow::before,
.signoff p::before,
blockquote p::before,
figcaption::before { display: none; }

/* Pull quote */

blockquote {
  margin: 2em 0 0;
  padding: 0;
}
blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.45em;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

/* Photos */

figure { margin: 2.2em 0 2.4em; }

figure img,
figure video {
  display: block;
  height: auto;
  border-radius: 12px;
  background: var(--rule);
}

.single img { width: 100%; }

.pair {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
/* Flex-grow by aspect ratio so both media share one height */
.pair img,
.pair video {
  flex: calc(var(--ar)) 1 0;
  min-width: 0;
  width: 0;
  aspect-ratio: var(--ar);
  object-fit: cover;
}
.pair .wide {
  flex: 0 0 100%;
  width: 100%;
}

figcaption {
  flex-basis: 100%;
  margin-top: 0.75em;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--muted);
}

/* Sign-off */

.signoff {
  margin-top: 3.5em;
  padding-top: 1.6em;
  border-top: 1px solid var(--rule);
}
.signature {
  margin: 0 0 0.3em;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6em;
}
.links {
  font-size: 15px;
  letter-spacing: 0;
}
.js .signoff p { color: var(--muted); }
.js .signoff .signature { color: var(--text); }

/* Section pill */

.pill {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  color: var(--text);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
}
.pill-button svg { transition: transform 0.2s ease; }
.pill-button[aria-expanded="true"] svg { transform: rotate(180deg); }

.pill-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 170px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--pill-border);
  border-radius: 14px;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.pill-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--muted);
  text-decoration: none;
}
.pill-menu a:hover,
.pill-menu a[aria-current="true"] { color: var(--text); background: var(--rule); }

/* Soft fade at the bottom of the viewport, as in the reference */

.fade {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 85%);
  z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
