/* Wedding collage — STMS Strategy.
   Palette and type tokens lifted from the STMS design system
   (src/styles/global.css in the thestms.com repo): near-black ground,
   navy as the structural color, orange as the single accent. The photographs
   are the only other source of color on the page. */

:root {
  color-scheme: dark;

  --color-bg: oklch(0.09 0 0);
  --color-surface: oklch(0.16 0.02 258);
  --color-surface-2: oklch(0.21 0.025 258);
  --color-border: oklch(0.28 0.02 258);

  --color-ink: oklch(0.96 0.004 258);
  --color-muted: oklch(0.68 0.02 258);

  --color-primary: oklch(0.5 0.09 258);
  --color-primary-strong: oklch(0.4 0.1 258);
  --color-accent: oklch(0.72 0.17 58);
  --color-accent-strong: oklch(0.66 0.19 58);
  --color-on-accent: oklch(0.09 0 0);

  --font-display: 'Archivo', 'Public Sans', system-ui, sans-serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-data: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: 3px;
  --pad: clamp(1rem, 3.2vw, 2.75rem);
  --bar-h: 96px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:where(a, button):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  background: var(--color-accent);
  color: var(--color-on-accent);
  padding: 0.6rem 1rem;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { left: 0; }

/* ---------- Masthead ---------- */

.masthead {
  padding: clamp(2.25rem, 6vw, 4.5rem) var(--pad) clamp(1.5rem, 3vw, 2.25rem);
}

.masthead-inner {
  max-width: 1680px;
  margin: 0 auto;
}

.masthead-id {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mark {
  display: block;
  width: 34px;
  height: 34px;
}

.mark-sm { width: 20px; height: 20px; }

.wordmark {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.title {
  margin: clamp(1.25rem, 3vw, 2.25rem) 0 0;
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 122, 'wght' 760;
  font-size: clamp(3.25rem, 15vw, 13rem);
  line-height: 0.82;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--color-ink);
}

.masthead-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-top: clamp(1.25rem, 2.5vw, 2rem);
  padding-top: 1.1rem;
  border-top: 1px solid var(--color-border);
}

.date {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 108, 'wght' 500;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  letter-spacing: 0.02em;
  color: var(--color-ink);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(1.5rem, 4vw, 3.5rem);
  margin: 0;
}

.fact dt {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.fact dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-data);
  font-size: 0.95rem;
  color: var(--color-ink);
  white-space: nowrap;
}

/* ---------- Cadence ribbon (the signature element) ---------- */

.cadence {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  border-block: 1px solid var(--color-border);
}

.cadence-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0.7rem var(--pad) 0.55rem;
}

.cadence-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.cadence-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.cadence-hint {
  font-size: 0.72rem;
  color: var(--color-muted);
}

.cadence-plot {
  position: relative;
  height: 44px;
  margin-top: 0.45rem;
}

.cadence-plot canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.cadence-hit {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
}

.playhead {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 12px 1px color-mix(in oklab, var(--color-accent) 60%, transparent);
  pointer-events: none;
  transform: translateX(-1px);
}

.cadence-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.3rem;
  font-family: var(--font-data);
  font-size: 0.66rem;
  color: var(--color-muted);
}

.cadence-now {
  color: var(--color-accent);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ---------- Mosaic ---------- */

.mosaic {
  padding: clamp(1rem, 2.5vw, 2rem) var(--pad) 0;
  max-width: 1680px;
  margin: 0 auto;
}

.loading {
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--color-muted);
  padding: 3rem 0;
}

.row {
  display: flex;
  gap: var(--gutter);
  margin-bottom: var(--gutter);
  content-visibility: auto;
}

.tile {
  position: relative;
  display: block;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  overflow: hidden;
  cursor: zoom-in;
  background-color: var(--color-surface);
  background-size: cover;
  background-position: center;
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 420ms ease;
}

.tile img.ready { opacity: 1; }

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 0 var(--color-accent);
  transition: box-shadow 140ms ease;
  pointer-events: none;
}

.tile:hover::after,
.tile:focus-visible::after {
  box-shadow: inset 0 0 0 2px var(--color-accent);
}

.tile:hover img { filter: brightness(1.08); }

/* A frame that stands alone in time earns a marker. Not decoration —
   it is the same signal that made the tile large. */
.tile.solo::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  z-index: 2;
  opacity: 0.9;
}

/* ---------- Colophon ---------- */

.colophon {
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--pad) clamp(3rem, 7vw, 6rem);
}

.note {
  max-width: 62ch;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--color-muted);
}

.sig {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr;
  background: color-mix(in oklab, var(--color-bg) 96%, transparent);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] { display: none; }

.lb-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem var(--pad);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--color-muted);
}

.lb-id { color: var(--color-ink); font-weight: 700; letter-spacing: 0.06em; }
.lb-tc { color: var(--color-accent); }
.lb-count { margin-left: auto; }

.lb-close {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.lb-close:hover { background: var(--color-surface-2); }

.lb-nav {
  align-self: center;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 2.5rem;
  line-height: 1;
  padding: 1rem 0.9rem;
  cursor: pointer;
}

.lb-nav:hover { color: var(--color-accent); }

.lb-stage {
  margin: 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(0.5rem, 2vw, 1.75rem);
}

.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---------- Responsive + motion ---------- */

@media (max-width: 700px) {
  :root { --gutter: 3px; }
  .cadence-hint { display: none; }
  .cadence-plot { height: 34px; }
  .lb-nav { font-size: 1.9rem; padding: 0.75rem 0.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile img { transition: none; }
  .tile::after { transition: none; }
}

/* ---------- Hosted-only: route back into the site ---------- */

.masthead-id {
  text-decoration: none;
  width: fit-content;
}

.masthead-id:hover .wordmark { color: var(--color-ink); }

.cta {
  margin: 2.5rem 0 0;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.cta-line {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 112, 'wght' 600;
  font-size: clamp(1.1rem, 2.4vw, 1.65rem);
  line-height: 1.2;
  color: var(--color-ink);
}

.cta-btn {
  display: inline-block;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.8rem 1.4rem;
}

.cta-btn:hover { background: var(--color-accent-strong); }

.cta-link {
  display: inline-block;
  margin-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-decoration: none;
}

.cta-link:hover { color: var(--color-accent); }

@media (max-width: 560px) {
  .cta-link { margin: 1rem 0 0; display: block; }
}
