/* ---------- Tokens ---------- */
:root {
  /* Charcoal palette: warm charcoal black, ivory text, a champagne-gold accent. */
  --bg: #131313;
  --bg-deep: #050505;  /* bottom of the page gradient */
  --text-deep: #A9A398; /* end of the gradient on headings */
  --surface: rgb(24 24 24 / 0.86);
  --surface-solid: #1A1A1A;
  --text: #EDEAE4;
  --text-muted: #A19C93;
  --accent: #CDB57E;
  --on-accent: #131313;
  --hairline: rgb(255 255 255 / 0.09);
  --hairline-strong: rgb(255 255 255 / 0.16);
  --scrim: rgb(12 12 12 / 0.95);
  --tile-bg: #1B1B1B;
  --shadow: 0 18px 48px rgb(0 0 0 / 0.5);
  --glow: 0 14px 40px -6px rgb(0 0 0 / 0.7), 0 0 26px rgb(0 0 0 / 0.45); /* photo hover */

  /* Filter bar: warmer charcoal fade, ivory-to-champagne script labels. */
  --dock-top: rgb(32 30 27 / 0.92);
  --dock-bottom: rgb(13 12 11 / 0.94);
  --dock-sheen: rgb(255 244 220 / 0.05);
  --dock-ink-from: #EFEBE3;
  --dock-ink-to: #B9A576;
  --dock-gold-from: #F1DFAF;
  --dock-gold-to: #A6884A;
  --dock-glow: rgb(222 196 132 / 0.38); /* soft gold glow on selected labels and underlines */

  --font: "Jost", system-ui, sans-serif;
  --font-script: "Pinyon Script", "Snell Roundhand", cursive;
  --font-serif: "Cormorant Garamond", "Cormorant", Garamond, Georgia, serif; /* navigation: view switcher and filter bar */  --radius: 4px;
  --gutter: clamp(16px, 2.2vw, 28px);
  --gap: clamp(12px, 1.4vw, 20px);
  --blur: blur(18px) saturate(120%);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --dur: 240ms;

  --z-dock: 20;
  --z-top: 30;
  --z-pop: 40;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F2F1EE;
  --bg-deep: #DEDBD5;
  --text-deep: #55514B;
  --surface: rgb(250 249 247 / 0.82);
  --surface-solid: #FAF9F7;
  --text: #161616;
  --text-muted: #5C5852;
  --accent: #8A6A2C;
  --on-accent: #FFFFFF;
  --hairline: rgb(22 22 22 / 0.1);
  --hairline-strong: rgb(22 22 22 / 0.2);
  --scrim: rgb(242 241 238 / 0.97);
  --tile-bg: #E2E0DC;
  --shadow: 0 18px 48px rgb(22 22 22 / 0.12);
  --glow: 0 14px 36px -8px rgb(22 22 22 / 0.28), 0 0 22px rgb(22 22 22 / 0.12);

  --dock-top: rgb(252 251 249 / 0.92);
  --dock-bottom: rgb(234 231 225 / 0.94);
  --dock-sheen: rgb(255 255 255 / 0.6);
  --dock-ink-from: #1C1B19;
  --dock-ink-to: #7A6640;
  --dock-gold-from: #9C7A34;
  --dock-gold-to: #5E4A22;
  --dock-glow: rgb(138 106 44 / 0.25);
  color-scheme: light;
}

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

/* Hidden always wins. Layout rules like the Flow strip's display: flex are just as
   specific as a component's own [hidden] rule, and would otherwise keep it on screen. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

/* A slow fade from charcoal at the top of the screen to near-black at the bottom.
   It sits on a fixed layer, so it stays put while the photos scroll over it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 55%, var(--bg-deep)) 55%, var(--bg-deep) 100%);
  pointer-events: none;
}

/* The same slow fade on display type: ivory at the top of each line to soft stone below. */
.brand-pill > span,
.tile .title,
.sheet-title,
.sheet-h,
.popover legend,
.lb-caption strong,
.map-pop strong {
  background: linear-gradient(170deg, var(--text) 20%, var(--text-deep) 110%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text); /* fallback where text clipping isn't supported */
}

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

button { font: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; }

a { color: inherit; }

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ---------- Text buttons (no backgrounds) ---------- */
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  font-size: 15px;
  text-decoration: none;
  transition: color var(--dur) var(--ease-out);
}
.pill:hover { color: var(--accent); }

.round-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  transition: color var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.round-btn:hover { color: var(--accent); }
.round-btn .icon { width: 20px; height: 20px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-top);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gutter) 20px;
  /* A soft fade keeps the bar legible over photos without a hard edge; it matches the top of the page gradient. */
  background: linear-gradient(var(--bg) 40%, color-mix(in srgb, var(--bg) 70%, transparent) 70%, transparent);
}

.brand-pill { white-space: nowrap; gap: 12px; }
.brand-pill > span {
  font-family: var(--font-script);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
  padding-top: 4px; /* optical centring for the script's tall ascenders */
}

.segmented {
  position: relative;
  display: inline-flex;
  gap: 4px;
}
/* Same underline, colour and glow as the filter bar's labels. */
.segmented-indicator {
  position: absolute;
  bottom: 6px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--dock-gold-from) 30%, var(--dock-gold-to) 70%, transparent);
  box-shadow: 0 0 8px var(--dock-glow);
  transition: transform 420ms var(--ease-out), width 420ms var(--ease-out);
}
.segmented button {
  position: relative;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: linear-gradient(165deg, var(--g-from) 15%, var(--g-to) 125%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.05em;
  --g-from: var(--dock-ink-from);
  --g-to: var(--dock-ink-to);
  transition: --g-from 360ms var(--ease-out), --g-to 360ms var(--ease-out), filter 360ms var(--ease-out);
}
.segmented button:hover,
.segmented button[aria-pressed="true"] {
  --g-from: var(--dock-gold-from);
  --g-to: var(--dock-gold-to);
  filter: drop-shadow(0 0 6px var(--dock-glow));
}

/* ---------- Gallery ---------- */
main {
  padding: 12px var(--gutter) 0;
}

.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 48px var(--gap);
  grid-template-columns: 1fr;
}
.gallery[hidden] { display: none; }

@media (min-width: 480px) { .gallery[data-view="grid"] { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .gallery[data-view="grid"] { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .gallery[data-view="grid"] { grid-template-columns: repeat(4, 1fr); } }

/* Flow: a horizontal filmstrip that runs edge to edge. */
.gallery[data-view="flow"] {
  display: flex;
  align-items: center;
  /* Fill the space between the top bar and the dock, with the strip centred in it. */
  min-height: calc(100dvh - 172px);
  gap: clamp(28px, 4vw, 64px);
  margin-inline: calc(var(--gutter) * -1);
  padding: 8px var(--gutter) 20px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}
.gallery[data-view="flow"] > li { flex: none; }
.gallery[data-view="flow"]:not([hidden]) ~ .site-footer { display: none; }

.tile { margin: 0; }

.tile-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--tile-bg);
  cursor: zoom-in;
  overflow: hidden;
}
.tile-btn:focus-visible { outline-offset: 4px; }

.tile img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  opacity: 0;
  transition: opacity 600ms var(--ease-out), transform 900ms var(--ease-out), filter 600ms var(--ease-out);
}
.tile img.is-loaded { opacity: 1; }

.tile-btn { transition: box-shadow 500ms var(--ease-out); }

@media (hover: hover) {
  .tile-btn:hover img { transform: scale(1.02); filter: brightness(1.05); }
  /* A soft dark glow settles around the photo under the pointer. */
  .tile-btn:hover { box-shadow: var(--glow); }
}
.tile-btn:focus-visible { box-shadow: var(--glow); }

/* Each Flow photo keeps its own shape at a shared height; the caption wraps to its width. */
.gallery[data-view="flow"] .tile { width: min-content; }
.gallery[data-view="flow"] .tile-btn { background: transparent; }
.gallery[data-view="flow"] .tile img {
  aspect-ratio: auto;
  width: auto;
  /* Fits the screen height, and keeps a 3:2 landscape under ~80% of the screen width. */
  height: clamp(220px, min(calc(100dvh - 290px), 54vw), 820px);
  max-width: none;
}

/* Scroll motion: tiles are transformed by app.js; the canvas is the pixelated overlay. */
.tile { will-change: transform; transform-origin: 50% 50%; }
.tile-btn { position: relative; }
.tile-pixels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  opacity: 0;
  pointer-events: none;
}
.tile-pixels.is-on { opacity: 1; }

.tile figcaption {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0 12px;
  padding-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}
.tile .title {
  grid-column: 1 / -1;
  font-family: var(--font-script);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--text);
}
.tile .place { grid-column: 1; grid-row: 2; color: var(--text-muted); font-weight: 300; }
.tile time {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  color: var(--text-muted);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}

.gallery[data-view="flow"] .tile .title { font-size: 34px; }

.empty {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 120px 0;
  color: var(--text-muted);
}
.empty[hidden] { display: none; }
.empty .pill { color: var(--accent); border-bottom: 1px solid currentColor; min-height: 32px; }

/* ---------- Map ---------- */
.map-view[hidden] { display: none; }

.map {
  height: calc(100dvh - 72px - 120px);
  min-height: 420px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--tile-bg);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

/* Leaflet's stylesheet loads after this one, so these are scoped to .map to win. */
.map.leaflet-container { font-family: var(--font); background: var(--tile-bg); }
.map .leaflet-tile-pane { filter: grayscale(1) contrast(0.95); }
:root:not([data-theme="light"]) .map .leaflet-tile-pane {
  filter: grayscale(1) invert(1) brightness(0.72) contrast(0.9);
}
.map .leaflet-popup-content-wrapper,
.map .leaflet-popup-tip {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow);
}
.map .leaflet-popup-content-wrapper { border-radius: var(--radius); }
.map .leaflet-popup-content { margin: 12px; width: 180px !important; }
.map a.leaflet-popup-close-button { color: var(--text-muted); width: 28px; height: 28px; font-size: 20px; }
.map .leaflet-control-attribution { font-size: 11px; background: color-mix(in srgb, var(--bg) 75%, transparent); color: var(--text-muted); }
.map .leaflet-control-attribution a { color: var(--text); }
.map .leaflet-bar { border: 0; box-shadow: 0 0 0 1px var(--hairline); border-radius: var(--radius); overflow: hidden; }
.map .leaflet-bar a { background: var(--surface-solid); color: var(--text); border-color: var(--hairline); }
.map .leaflet-bar a:hover { background: var(--tile-bg); color: var(--accent); }

.map-pop img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; margin-bottom: 8px; border-radius: 2px; }
.map-pop button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: zoom-in;
}
.map-pop.is-group {
  display: grid;
  gap: 16px;
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.map-pop strong { display: block; font-family: var(--font-script); font-weight: 400; font-size: 24px; line-height: 1.3; }
.map-pop span { color: var(--text-muted); font-size: 13px; }

.map-hit { display: grid; place-items: center; }
.map-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(205 181 126 / 0.2), 0 0 16px 2px rgb(205 181 126 / 0.35);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 80px 0 140px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 300;
}

/* ---------- Dock: slim serif labels on a warm charcoal strip ---------- */
/* Registered so the label gradients can cross-fade on hover instead of switching. */
@property --g-from { syntax: "<color>"; inherits: true; initial-value: #EFEBE3; }
@property --g-to { syntax: "<color>"; inherits: true; initial-value: #B9A576; }

.dock {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: var(--z-dock);
  display: flex;
  align-items: stretch;
  padding: 0 4px;
  border-radius: 2px;
  /* The page's slow vertical fade, in a slightly warmer charcoal. */
  background: linear-gradient(180deg, var(--dock-top), var(--dock-bottom));
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  box-shadow: inset 0 0 0 1px var(--hairline), inset 0 1px 0 var(--dock-sheen), var(--shadow);
  max-width: calc(100vw - 32px);
}

.dock-btn,
.dock-count {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: var(--text);
  white-space: nowrap;
}
/* Short hairline dividers that stop short of the strip's edges. */
.dock > * + *::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 1px;
  background: var(--hairline);
}

.dock-btn {
  --g-from: var(--dock-ink-from);
  --g-to: var(--dock-ink-to);
  transition: --g-from 360ms var(--ease-out), --g-to 360ms var(--ease-out);
}
.dock-btn:hover,
.dock-btn[aria-expanded="true"],
.dock-btn.is-active {
  --g-from: var(--dock-gold-from);
  --g-to: var(--dock-gold-to);
}

.dock-btn [data-label] {
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Same face, size and spacing as the Flow / Grid / Map switcher. */
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.05em;
  background: linear-gradient(165deg, var(--g-from) 15%, var(--g-to) 125%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: filter 360ms var(--ease-out);
}
.dock-btn:hover [data-label],
.dock-btn[aria-expanded="true"] [data-label],
.dock-btn.is-active [data-label] { filter: drop-shadow(0 0 6px var(--dock-glow)); }

/* A fine gold line draws in under an open or chosen filter. */
.dock-btn::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--dock-gold-from) 30%, var(--dock-gold-to) 70%, transparent);
  box-shadow: 0 0 8px var(--dock-glow);
  transform: scaleX(0);
  transition: transform 460ms var(--ease-out);
}
.dock-btn.is-active::after,
.dock-btn[aria-expanded="true"]::after { transform: scaleX(1); }

.dock-btn .chev {
  width: 9px;
  height: 9px;
  stroke-width: 1.2;
  color: var(--dock-ink-to);
  opacity: 0.7;
  transition: transform 360ms var(--ease-out), color 360ms var(--ease-out);
}
.dock-btn:hover .chev,
.dock-btn[aria-expanded="true"] .chev { color: var(--dock-gold-from); }
.dock-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.dock-count {
  min-width: 46px;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  cursor: default;
  transition: color var(--dur) var(--ease-out);
}
.dock-count.is-clearable { cursor: pointer; color: var(--text); }
.dock-count.is-clearable:hover { color: var(--accent); }
.dock-count.is-clearable::after {
  content: "";
  width: 11px;
  height: 11px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Filter dropdowns ---------- */
.popover {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 6px 0 10px;
  min-width: 240px;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow);
  z-index: var(--z-pop);
  scrollbar-width: thin;

  /* Closed state; also where the open animation starts. */
  opacity: 0;
  transform: translateY(8px);
  transform-origin: var(--origin, bottom left);
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out),
    overlay 200ms allow-discrete,
    display 200ms allow-discrete;
}
.popover:popover-open {
  opacity: 1;
  transform: none;
  transition:
    opacity 280ms var(--ease-out),
    transform 420ms var(--ease-out),
    overlay 420ms allow-discrete,
    display 420ms allow-discrete;
}
@starting-style {
  .popover:popover-open { opacity: 0; transform: translateY(8px); }
}

.popover fieldset { border: 0; margin: 0; padding: 0; }
.popover legend {
  width: 100%;
  margin-bottom: 4px;
  padding: 8px 20px 10px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-script);
  font-size: 28px;
  line-height: 1.2;
  color: var(--text);
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 20px;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 200ms var(--ease-out), padding-left 300ms var(--ease-out);
}
.popover.is-opening .option {
  animation: option-in 380ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 30ms + 80ms);
}
@keyframes option-in {
  from { opacity: 0; transform: translateY(4px); }
}
.option:hover { color: var(--text); padding-left: 24px; }
.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.option:has(input:focus-visible) { outline: 1px solid var(--accent); outline-offset: -4px; }
.option .check {
  width: 14px;
  height: 14px;
  stroke-width: 1.6;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 200ms var(--ease-out), transform 300ms var(--ease-out);
}
.option:has(input:checked) { color: var(--accent); }
.option:has(input:checked) .check { opacity: 1; transform: none; }
.option .n {
  margin-left: auto;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 300;
  opacity: 0.8;
}

/* ---------- Corner buttons ---------- */
.corner {
  position: fixed;
  left: calc(var(--gutter) - 12px);
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: var(--z-dock);
  display: flex;
  gap: 0;
}
.corner .round-btn { filter: drop-shadow(0 1px 6px rgb(0 0 0 / 0.6)); }

/* ---------- Menu sheet ---------- */
.sheet {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  margin: 12px auto auto 12px;
  padding: 16px 28px 28px;
  border: 0;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  -webkit-backdrop-filter: var(--blur);
          backdrop-filter: var(--blur);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow);
  /* Opening and closing are animated in app.js: the sheet unfolds out of the menu icon's two lines. */
}

/* The two lines that carry the unfold. */
.sheet-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--dock-gold-from), var(--dock-gold-to));
  transform-origin: 0 0;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.sheet::backdrop {
  background: rgb(0 0 0 / 0);
  -webkit-backdrop-filter: blur(0);
          backdrop-filter: blur(0);
  transition: background-color 300ms var(--ease-out), backdrop-filter 300ms var(--ease-out), overlay 300ms allow-discrete, display 300ms allow-discrete;
}
.sheet[open]::backdrop {
  background: rgb(0 0 0 / 0.5);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
@starting-style {
  .sheet[open]::backdrop { background: rgb(0 0 0 / 0); backdrop-filter: blur(0); }
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-right: -12px;
}
.sheet-logo { width: 34px; height: 34px; }
:root:not([data-theme="light"]) .sheet-logo { filter: invert(93%) sepia(6%) saturate(200%) hue-rotate(10deg); }

.sheet-title {
  margin: 18px 0 8px;
  font-family: var(--font-script);
  font-size: 48px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: 0;
}
.sheet-lede { margin: 0 0 24px; color: var(--text-muted); font-weight: 300; max-width: 46ch; }

.sheet-h {
  margin: 28px 0 8px;
  font-family: var(--font-script);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: 0;
}

.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}
.sheet-list li {
  display: grid;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.sheet-list strong { font-weight: 500; }
.sheet-list span { color: var(--text-muted); font-size: 14px; font-weight: 300; }

.sheet-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: none;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: 0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.sheet-cta:hover { background: var(--accent); color: var(--on-accent); }

.sheet-note { margin: 16px 0 0; color: var(--text-muted); font-size: 14px; font-weight: 300; }

.sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px -12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: var(--text);
  opacity: 0;
  transition: opacity 260ms var(--ease-out), overlay 260ms allow-discrete, display 260ms allow-discrete;
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: grid; place-items: center; opacity: 1; }
@starting-style { .lightbox[open] { opacity: 0; } }

.lb-figure {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0;
  padding: 72px 72px 28px;
  max-width: 100%;
}
.lb-figure img {
  max-width: 100%;
  max-height: calc(100dvh - 190px);
  width: auto;
  height: auto;
  border-radius: 2px;
  will-change: transform;
}
.lb-caption { display: grid; justify-items: center; gap: 0; text-align: center; }
.lb-caption strong { font-family: var(--font-script); font-weight: 400; font-size: 36px; line-height: 1.2; }
.lb-caption span { color: var(--text-muted); font-size: 14px; font-weight: 300; }

.lb-close { position: absolute; top: 12px; right: 12px; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lightbox .round-btn .icon { width: 24px; height: 24px; stroke-width: 1.2; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .corner { display: none; }
  /* Phones: each Flow photo fits within the screen width and the space above the dock. */
  .gallery[data-view="flow"] .tile img {
    width: auto;
    height: auto;
    max-width: 82vw;
    max-height: calc(100dvh - 300px);
  }
  .segmented button { padding: 0 9px; }
  .dock-btn, .dock-count { padding: 0 12px; }
  .dock-btn::after { left: 12px; right: 12px; }
  .dock-btn .icon:not(.chev) { display: none; }
  .lb-figure { padding: 64px 12px 96px; }
  .lb-prev, .lb-next { top: auto; bottom: 20px; transform: none; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
}

@media (max-width: 520px) {
  /* Phones: the wordmark scales with the screen so the full name fits beside Flow / Grid / Map. */
  .topbar { gap: 8px; }
  .brand-pill { gap: 8px; padding-inline: 0; }
  .brand-pill > span { font-size: clamp(17px, 5.6vw, 26px); }
  .segmented { gap: 0; }
  .segmented button { font-size: 15px; padding: 0 7px; letter-spacing: 0.03em; }
}

@media (max-width: 420px) {
  .dock-btn .chev { display: none; }
}

@media (max-width: 340px) {
  .segmented button { padding: 0 5px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
  .tile-btn:hover img { transform: none; }
}
