/* ==========================================================================
   Design tokens. Change the look of the page here.
   ========================================================================== */

:root {
  /* Colour */
  --paper: #FBFAF7;
  --ink: #1A1A1A;
  --muted: #6B6B6B;
  --accent: #1A50CC;
  --accent-tint: rgba(26, 80, 204, 0.3);
  --highlight: #FAEEDC;
  --hairline: #E3E0D8;
  --divider: rgba(26, 26, 26, 0.1);   /* the rule above each section */
  --tile-radius: 8px;                 /* tappable tiles and floating controls */
  --float: 0 1px 2px rgba(26, 26, 26, 0.05), 0 8px 24px -8px rgba(26, 26, 26, 0.2);   /* floating Short/Full and Contents */
  --lift: 0 1px 2px rgba(26, 26, 26, 0.05), 0 8px 18px -8px rgba(26, 26, 26, 0.18);   /* hover elevation on tappable tiles */
  --tint: #F1EEE7;
  --tint-hover: #E8E4DB;
  --tint-ink: #5E5C57;
  --surface: #FFFFFF;

  /* Type */
  --serif: "Newsreader", "Newsreader Fallback", Georgia, serif;
  --ui: "Inter Tight", "Inter Tight Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body-size: 19px;
  --body-leading: 1.6;

  /* Layout */
  --col: 680px;
  --wide: 680px;                 /* media width. Same as --col so images line up with the text */
  --gutter: 20px;
  --radius: 4px;

  /* Rhythm */
  --space-company: 56px;         /* space above each section rule, and the same below it */
  --space-entry: 64px;
  --space-block: 24px;

  /* Motion */
  --fast: 150ms;
  --base: 250ms;
  --swap: 460ms;                 /* Short / Full switch: blur and fade */
  --swap-blur: 10px;
  --reveal: 560ms;               /* content easing in on scroll */
  --reveal-shift: 14px;
  --hl-sweep: 700ms;              /* highlighter sweeping across a phrase */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (min-width: 720px) {
  :root {
    --body-size: 21px;
    --radius: 4px;
    --space-company: 76px;
    --space-entry: 80px;
  }
}

/* Dark theme: follows the system unless the reader picked light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141412;
    --ink: #ECEAE4;
    --muted: #A5A29A;
    --accent: #A3BCE8;
    --accent-tint: rgba(163, 188, 232, 0.38);
    --highlight: rgba(236, 206, 96, 0.3);
    --hairline: #2E2D29;
    --divider: rgba(236, 234, 228, 0.14);
    --tint: #1F1E1B;
    --tint-hover: #2A2926;
    --tint-ink: #A5A29A;
    --surface: #1C1B19;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #141412;
  --ink: #ECEAE4;
  --muted: #A5A29A;
  --accent: #A3BCE8;
  --accent-tint: rgba(163, 188, 232, 0.38);
  --highlight: rgba(236, 206, 96, 0.3);
  --hairline: #2E2D29;
  --divider: rgba(236, 234, 228, 0.14);
  --tint: #1F1E1B;
  --tint-hover: #2A2926;
  --tint-ink: #A5A29A;
  --surface: #1C1B19;
  color-scheme: dark;
}

/* Stand-in fonts, sized to match the web fonts so text does not jump when they load. */
@font-face { font-family: "Newsreader Fallback"; src: local("Georgia"); size-adjust: 91.5%; }
@font-face { font-family: "Newsreader Fallback"; font-style: italic; src: local("Georgia Italic"), local("Georgia-Italic"); size-adjust: 82%; }
@font-face { font-family: "Inter Tight Fallback"; src: local("Arial"); size-adjust: 97%; }

/* ==========================================================================
   Base
   ========================================================================== */

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

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

html.locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--body-size);
  line-height: var(--body-leading);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-tint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color var(--fast) var(--ease);
}
a:hover { text-decoration-color: currentColor; }

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

/* Sections take focus after a jump so keyboard reading continues from there. No ring needed. */
section[tabindex="-1"]:focus, article[tabindex="-1"]:focus, footer[tabindex="-1"]:focus { outline: none; }

/* Highlights: **text** in content.js */
strong.hl {
  font-weight: 500;
  padding: 0 0.12em;
  margin: 0 -0.12em;
  border-radius: 0.18em;
  background: linear-gradient(to bottom, transparent 12%, var(--highlight) 12%, var(--highlight) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* The highlighter sweeps in from the left when the text scrolls into view. app.js adds these classes. */
.hl-sweep strong.hl {
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size var(--hl-sweep) var(--ease) 120ms;
}
.hl-sweep strong.hl.is-lit { background-size: 100% 100%; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--gutter); top: -100px;
  z-index: 50;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 14px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* The reading column, and the wider media column */
.col {
  width: min(var(--col), 100% - 2 * var(--gutter));
  margin-inline: auto;
}
.wide {
  width: min(var(--wide), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* Small UI text */
.ui {
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

.icon { width: 18px; height: 18px; flex: none; }

/* ==========================================================================
   Top bar and header
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: min(var(--col), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-top: 10px;
  min-height: 54px;
}
.topbar .toggle { margin-right: auto; }
.top-label {
  margin-right: auto;
  line-height: 1;
  transform: translateY(1px);      /* optical: sits level with the icons on the right */
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-right: -12px;
  color: var(--muted);
  border-radius: 50%;
  transition: color var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--ink); }

.site-header { padding-top: 20px; scroll-margin-top: 0; }
@media (min-width: 720px) { .site-header { padding-top: 40px; } }

/* Small square portrait above the name */
.portrait { width: 90px; margin-bottom: 20px; }
.portrait .frame { border-radius: 20px; }
.portrait .frame.is-ph { padding: 0; }
.portrait .ph-alt { display: none; }
@media (min-width: 720px) { .portrait { width: 105px; margin-bottom: 24px; } }

.name {
  font-size: clamp(40px, 9vw, 60px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.role {
  margin-top: 12px;
  font-size: 1.1em;
  line-height: 1.4;
  color: var(--muted);
  font-style: italic;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 24px;
}
.links a, .links button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}
.links a:hover, .links button:hover { color: var(--accent); }
.links .icon { color: var(--muted); transition: color var(--fast) var(--ease); }
.links a:hover .icon, .links button:hover .icon { color: var(--accent); }

/* Icon-only links in the top bar */
.links-icons { gap: 0; margin: 0 -11px 0 0; flex-wrap: nowrap; }
.links-icons a, .links-icons button { justify-content: center; width: 44px; height: 44px; }
.links-icons .icon { width: 21px; height: 21px; color: var(--ink); }

/* Company logos in a boxed row under the name and role line */
.logos {
  display: flex;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--tile-radius);
}
.logos li {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
  padding: 0 6px;
}
.logos li + li { border-left: 1px solid var(--hairline); }
.logos img { width: auto; height: 30px; max-width: 100%; object-fit: contain; }
.logos li.is-text {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
@media (min-width: 720px) {
  .logos { margin-top: 28px; }
  .logos li { height: 64px; padding: 0 16px; }
  .logos img { height: 38px; }
}

.intro { margin-top: 32px; }
.intro p + p { margin-top: 1em; }

/* ==========================================================================
   Short / Full toggle
   ========================================================================== */

.toggle-slot { margin-top: 40px; }
.toggle-slot:empty { display: none; }

.toggle {
  flex: none;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--hairline);
  border-radius: var(--tile-radius);
  background: var(--surface);
}
.toggle button {
  min-width: 68px;
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
  border-radius: calc(var(--tile-radius) - 3px);
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.toggle button:hover { color: var(--ink); }
.toggle button[aria-checked="true"] { background: var(--ink); color: var(--paper); }

/* Floating dock: the pinned toggle, plus the Contents button on small screens */
.dock {
  position: fixed;
  left: 50%;
  width: max-content;            /* otherwise it can only use the right half of the screen and wraps */
  max-width: calc(100vw - 16px);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock .toggle, .dock-contents { box-shadow: var(--float); }

.dock-toggle {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--base) var(--ease), transform var(--base) var(--ease), visibility 0s linear var(--base);
}
.is-pinned .dock-toggle {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--base) var(--ease), transform var(--base) var(--ease), visibility 0s;
}
/* On small screens the hidden toggle should not take up room in the dock */
.dock-toggle { position: absolute; right: calc(100% + 8px); }
.is-pinned .dock-toggle { position: static; }

.dock-contents {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--tile-radius);
  background: var(--surface);
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.dock-contents .icon { color: var(--muted); }

/* ==========================================================================
   Companies and entries
   ========================================================================== */

main { display: block; }

.company { margin-top: var(--space-company); }
.company:first-child { margin-top: var(--space-company); }

.company-head {
  /* the logo files carry about 10px of empty space above the wordmark */
  padding-top: calc(var(--space-company) - 10px);
  border-top: 1px solid var(--divider);
  scroll-margin-top: 16px;
}
.company { scroll-margin-top: 16px; }

/* The title is a logo (fixed height, any width) or the name as text. Both sit in a row of the same height. */
.company-name {
  display: flex;
  align-items: center;
  height: 52px;
  font-size: clamp(30px, 6.4vw, 38px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.company-wordmark { height: 52px; width: auto; margin-left: -4px; }
@media (min-width: 720px) {
  .company-name { height: 60px; }
  .company-wordmark { height: 60px; margin-left: -5px; }
}
.company-meta { margin-top: 6px; color: var(--muted); }

.entry {
  margin-top: var(--space-entry);
  scroll-margin-top: 16px;
}
.company-head + .entry { margin-top: 44px; }

.entry-title {
  font-size: clamp(24px, 5.6vw, 30px);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.entry-meta { margin-top: 8px; color: var(--muted); }

/* Links as grey tiles */
.ref-tiles { display: grid; gap: 8px; margin-top: 22px; }
.ref-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 11px 12px 11px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--tile-radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  transition: box-shadow var(--base) var(--ease), transform var(--base) var(--ease);
}
.ref-tile:hover { box-shadow: var(--lift); transform: translateY(-1px); }
.ref-text { flex: 1; min-width: 0; }
.ref-label { display: block; font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.3; }
.ref-src { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--tint-ink); }
.ref-arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px; height: 32px;
  color: var(--tint-ink);
  transition: transform var(--fast) var(--ease), color var(--fast) var(--ease);
}
.ref-tile:hover .ref-arrow { color: var(--ink); transform: translate(2px, -2px); }

.entry-text { margin-top: 18px; }

/* The short and long versions both live in the page. The toggle collapses one. */
.swap {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  filter: blur(0);
  transition: grid-template-rows var(--swap) var(--ease), opacity var(--swap) var(--ease), filter var(--swap) var(--ease), visibility 0s;
}
.swap-inner {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
/* Room for focus rings on links at the edge of the column */
.swap-inner.inset {
  margin-inline: -4px;
  padding-inline: 4px;
}
/* The outgoing version blurs and fades away as it collapses. The incoming one sharpens into place. */
[data-view="short"] .swap-long,
[data-view="long"] .swap-short {
  grid-template-rows: 0fr;
  opacity: 0;
  filter: blur(var(--swap-blur));
  visibility: hidden;
  transition: grid-template-rows var(--swap) var(--ease), opacity calc(var(--swap) * 0.6) var(--ease), filter var(--swap) var(--ease), visibility 0s linear var(--swap);
}

/* Content eases in the first time it scrolls into view. app.js adds these classes. */
.reveal {
  opacity: 0;
  transform: translateY(var(--reveal-shift));
  transition: opacity var(--reveal) var(--ease), transform var(--reveal) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* A link shown as a LinkedIn-style post */
.post-card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--tile-radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--ui);
  text-decoration: none;
  transition: box-shadow var(--base) var(--ease), transform var(--base) var(--ease);
}
.post-card:hover { box-shadow: var(--lift); transform: translateY(-1px); }
.post-card > span { display: block; }
.post-card .post-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 0 16px; }
.post-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px; height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--tint);
  color: var(--tint-ink);
  font-size: 14px;
  font-weight: 600;
}
.post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-who { flex: 1; min-width: 0; }
.post-name { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.post-sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}
.post-logo { flex: none; align-self: flex-start; }
.post-logo .icon { width: 24px; height: 24px; }
.post-text { padding: 12px 16px 14px; font-size: 15px; line-height: 1.5; }
.post-photo { background: var(--tint); }
.post-photo img { width: 100%; height: 100%; object-fit: cover; }
.post-card .post-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 12px 8px 16px;
  border-top: 1px solid var(--hairline);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
}
.post-card:hover .ref-arrow { color: var(--ink); transform: translate(2px, -2px); }

/* Paragraphs and highlights in one flow */
.flow > p + p { margin-top: 1em; }
.flow > .highlights:first-child { margin-top: 0; }
/* Text that follows an inline image */
.media + .swap .entry-text { margin-top: 28px; }

.highlights { margin-top: 1.1em; }
.highlights li {
  position: relative;
  padding-left: 1.3em;
}
.highlights li + li { margin-top: 0.4em; }
.highlights li::before {
  content: "";
  position: absolute;
  left: 0.15em; top: 0.72em;
  width: 0.55em; height: 1px;
  background: var(--muted);
}

/* ==========================================================================
   Media
   ========================================================================== */

.media { margin-top: 32px; }
.media + .media { margin-top: 24px; }

.frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--tint);
}
.frame > .open, .frame img, .frame video {
  display: block;
  width: 100%; height: 100%;
}
.frame img, .frame video { object-fit: cover; }
.frame > .open { cursor: zoom-in; }
.frame > .open:focus-visible { outline-offset: -4px; }

/* Placeholder for empty or missing media */
.frame.is-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
  font-family: var(--ui);
  color: var(--tint-ink);
}
.ph-kind {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ph-alt { font-size: 13px; line-height: 1.4; max-width: 34ch; }

figcaption {
  margin: 10px 0 0;
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

/* Video */
.video-open {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  cursor: zoom-in;
}
.video-open:focus-visible { outline-offset: -4px; }
.video-badge {
  position: absolute;
  right: 10px; bottom: 10px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(20, 20, 18, 0.6);
  color: #fff;
  pointer-events: none;
}
.video-badge .icon { width: 16px; height: 16px; }

/* YouTube link */
.yt-link { position: absolute; inset: 0; display: block; background: #1A1A1A; }
.yt-link img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--base) var(--ease); }
.yt-link:hover img { transform: scale(1.015); }
.yt-play {
  position: absolute;
  left: 50%; top: 50%;
  display: block;
  width: 68px; height: 48px;
  margin: -24px 0 0 -34px;
  transition: transform var(--fast) var(--ease);
}
.yt-link:hover .yt-play { transform: scale(1.06); }
.yt-link:focus-visible { outline-offset: -4px; }

/* Carousel. It widens once someone scrolls it (see app.js). */
.carousel { transition: width 420ms var(--ease), opacity var(--reveal) var(--ease), transform var(--reveal) var(--ease); }
.carousel.is-big .car-track { border-radius: var(--radius); }

.car-track {
  position: relative;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}
.car-track::-webkit-scrollbar { display: none; }
.car-track:focus-visible { outline-offset: 4px; }
.car-slide {
  flex: 0 0 calc(100% - 32px);
  scroll-snap-align: start;
}
.car-slide:last-child { scroll-snap-align: end; }
@media (min-width: 720px) {
  .car-track { gap: 14px; }
  .car-slide { flex-basis: 86%; }
}
.car-dots {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}
.car-dots button {
  display: grid;
  place-items: center;
  width: 28px; height: 32px;
}
.car-dots button::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--hairline);
  box-shadow: inset 0 0 0 1px var(--muted);
  opacity: 0.6;
  transition: background-color var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.car-dots button[aria-current="true"]::before { background: var(--ink); box-shadow: none; opacity: 1; }

/* Before / after compare */
.compare {
  --pos: 50%;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: ew-resize;
}
.compare img { position: absolute; inset: 0; pointer-events: none; }
.compare .cmp-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp-label {
  position: absolute;
  top: 10px;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(20, 20, 18, 0.6);
  color: #fff;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.cmp-label.before { left: 10px; }
.cmp-label.after { right: 10px; }
.cmp-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--pos);
  width: 44px;
  margin-left: -22px;
  display: grid;
  place-items: center;
  cursor: ew-resize;
  touch-action: none;
}
.cmp-handle::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(20, 20, 18, 0.25);
}
.cmp-knob {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #1A1A1A;
  border: 1px solid rgba(20, 20, 18, 0.25);
}
.cmp-handle:focus-visible { outline: none; }
.cmp-handle:focus-visible .cmp-knob { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ==========================================================================
   Skills, explorations, writing
   ========================================================================== */

.block {
  margin-top: var(--space-company);
  scroll-margin-top: 16px;
}
.block-head {
  padding-top: calc(var(--space-company) - 6px);
  border-top: 1px solid var(--divider);
}
.block-title {
  font-size: clamp(26px, 5.6vw, 32px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.rows { margin-top: 20px; }
.rows li { border-bottom: 1px solid var(--hairline); }
.rows a {
  display: block;
  padding: 16px 0;
  color: inherit;
  text-decoration: none;
}
.row-title {
  display: block;
  font-weight: 500;
  line-height: 1.3;
  transition: color var(--fast) var(--ease);
}
.rows a:hover .row-title { color: var(--accent); }
.row-line { display: block; margin-top: 4px; color: var(--muted); font-size: 0.9em; line-height: 1.45; }
.row-meta { display: block; margin-top: 6px; color: var(--muted); }
.skills .row-title { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.82em; font-weight: 500; }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px 24px;
  margin-top: 28px;
}
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card a, .card > div {
  display: block;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--tile-radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--base) var(--ease), transform var(--base) var(--ease);
}
.card a:hover { box-shadow: var(--lift); transform: translateY(-1px); }
.card .frame { border-radius: 0; }
.card-title {
  display: block;
  margin: 14px 16px 0;
  font-weight: 500;
  line-height: 1.3;
}
.card-line { display: block; margin: 4px 16px 16px; color: var(--muted); font-size: 0.9em; line-height: 1.45; }
.card-title:last-child { margin-bottom: 16px; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: var(--space-company);
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  scroll-margin-top: 16px;
}
.contact-line { margin-top: 20px; font-size: 1.15em; line-height: 1.4; }
.block-head + .contact-email { margin-top: 16px; font-size: 1.1em; }
.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 12px;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-tint);
  text-underline-offset: 0.18em;
}
.contact-email:hover { text-decoration-color: currentColor; }
.contact-email .copy-icon { display: grid; color: var(--muted); transition: color var(--fast) var(--ease); }
.contact-email:hover .copy-icon { color: var(--accent); }
.site-footer .links { margin-top: 20px; }
.colophon {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
}

/* ==========================================================================
   Quick jump outline (desktop) and Contents sheet (mobile)
   ========================================================================== */

.outline { display: none; }

@media (min-width: 1024px) and (hover: hover) {
  .dock-contents { display: none; }

  .outline {
    display: block;
    position: fixed;
    right: 0; top: 50%;
    z-index: 15;
    transform: translateY(-50%);
    padding: 12px 14px 12px 20px;
  }
  .outline-dashes {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 9px;
    transition: opacity var(--fast) var(--ease);
  }
  .outline-dashes span {
    display: block;
    width: 16px; height: 2px;
    border-radius: 1px;
    background: var(--muted);
    opacity: 0.45;
    transition: width var(--fast) var(--ease), opacity var(--fast) var(--ease), background-color var(--fast) var(--ease);
  }
  .outline-dashes span.sub { width: 9px; }
  .outline-dashes span.is-active { width: 24px; background: var(--ink); opacity: 1; }
  .outline-dashes span.sub.is-active { width: 16px; }

  .outline-panel {
    position: absolute;
    right: 10px; top: 50%;
    width: max-content;
    max-width: 320px;
    max-height: min(76vh, 640px);
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: var(--surface);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(6px);
    transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
  }
  .outline:hover .outline-panel,
  .outline:focus-within .outline-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%);
  }
  .outline:hover .outline-dashes,
  .outline:focus-within .outline-dashes { opacity: 0; }
}

.toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.toc a.sub { padding-left: 24px; }
.toc a:not(.sub) { font-weight: 500; color: var(--ink); }
.toc a:hover { background: var(--tint); color: var(--ink); }
.toc a[aria-current="true"] { color: var(--accent); }

/* Bottom sheet */
dialog { color: var(--ink); }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 78dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in var(--base) var(--ease); }
.sheet::backdrop { background: rgba(20, 20, 18, 0.4); animation: fade-in var(--base) var(--ease); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 6px 20px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet-head .icon-btn { margin-right: 0; }
.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 10px calc(20px + env(safe-area-inset-bottom, 0px));
}
.sheet .toc a { padding-block: 12px; font-size: 16px; white-space: normal; }

@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ==========================================================================
   Lightbox (always dark)
   ========================================================================== */

.lightbox {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0;
  border: 0;
  /* The page shows through, dimmed and blurred */
  background: rgba(14, 14, 13, 0.7);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #F2F0EA;
  overflow: hidden;
}
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: fade-in var(--base) var(--ease); }
.lightbox::backdrop { background: transparent; }

.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px 20px;
  font-family: var(--ui);
  font-size: 14px;
  color: #F2F0EA;
}
.lb-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  color: #F2F0EA;
  transition: background-color var(--fast) var(--ease);
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.12); }
.lightbox :focus-visible { outline-color: #A3BCE8; }

.lb-stage-wrap {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  min-height: 0;
}
.lb-stage {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  will-change: transform;
}
.lb-stage img { cursor: zoom-in; -webkit-user-drag: none; }
.lb-stage.is-zoomed img { cursor: grab; }
.lb-stage video { touch-action: auto; }

.lb-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  margin-top: -22px;
  background: rgba(14, 14, 13, 0.55);
}
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

.lb-caption {
  min-height: 24px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  color: #D6D3CB;
}
.lb-caption a { color: #A3BCE8; }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 6px);
  pointer-events: none;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   ?edit mode: shows where each block lives in content.js
   ========================================================================== */

.edit [data-path] { cursor: help; }
.edit .edit-hover { outline: 1px dashed #C2410C; outline-offset: 3px; }
.edit-tag {
  position: fixed;
  z-index: 60;
  max-width: calc(100vw - 16px);
  padding: 3px 7px;
  border-radius: 3px;
  background: #C2410C;
  color: #fff;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* Marks the end of the page for the outline's "last section" check */
#page-end { height: 1px; }
