:root {
  --bg: #0b0b0d;
  --bg-2: #121216;
  --cream: #f2ede3;
  --red: #ff2d1a;
  --muted: rgba(242, 237, 227, .58);
  --line: rgba(242, 237, 227, .1);
  --gap: 6px;
  --radius: 8px;
  --pill-bg: rgba(18, 18, 22, .62);
  --pill-border: rgba(242, 237, 227, .1);
  --tile-ratio: 4 / 5;
  --cols: 4;
  --pill-h: 46px;
  --display: "Archivo Black", Inter, system-ui, sans-serif;
  color-scheme: dark;
}
@media (max-width: 1100px) { :root { --cols: 3; } }
@media (max-width: 640px)  { :root { --cols: 2; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
::selection { background: var(--red); color: #0b0b0d; }

/* ---------- top pill nav ---------- */
.pill {
  position: fixed;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}
.pill--top {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  height: var(--pill-h);
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px 0 10px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .08em;
  white-space: nowrap;
}
.brand em { font-style: normal; color: var(--red); }
.brand-bolt { width: 11px; height: 22px; color: var(--red); }
.navlinks {
  display: flex;
  gap: 2px;
  align-items: center;
  padding-left: 8px;
  border-left: 1px solid var(--pill-border);
}
.navlinks a {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .2s, background .2s;
}
.navlinks a:hover { color: var(--cream); }
.navlinks-upload { background: var(--red); color: #0b0b0d !important; }
.navlinks-upload:hover { background: var(--cream); }
@media (max-width: 560px) {
  .navlinks a:not(.navlinks-upload) { display: none; }
}

/* ---------- scroll-driven hero ---------- */
.hero { height: 240vh; position: relative; }
.hero:not(.has-video) { height: 160vh; } /* shorter pin while the placeholder runs */
.hero-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
}
#hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .6s ease;
}
.hero.has-video #hero-video { opacity: 1; }

/* Placeholder until real footage exists: red bolt + drifting glow, both scroll-reactive via --p. */
.hero-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120vmax 80vmax at calc(20% + var(--p, 0) * 60%) 110%, rgba(255, 45, 26, .16), transparent 55%),
    radial-gradient(90vmax 70vmax at calc(85% - var(--p, 0) * 55%) -15%, rgba(255, 45, 26, .12), transparent 60%),
    var(--bg);
}
.hero.has-video .hero-fallback { display: none; }
.fallback-bolt {
  width: min(42vh, 60vw);
  color: var(--red);
  opacity: .9;
  transform:
    translateY(calc(var(--p, 0) * -9vh))
    rotate(calc(var(--p, 0) * 10deg - 5deg))
    scale(calc(1 + var(--p, 0) * .25));
  filter: drop-shadow(0 0 60px rgba(255, 45, 26, .35));
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(11, 11, 13, .45), transparent 30%, transparent 62%, var(--bg));
  pointer-events: none;
}
.hero-overlay {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 16px;
  transform: translateY(calc(var(--p, 0) * -8vh));
  opacity: calc(1 - var(--p, 0) * 1.3);
}
/* Title lockup: small NYC top left, big ¡DALE!, RUN CLUB underneath.
   inline-block so the block is exactly as wide as ¡DALE! and the other lines align to it. */
.wordmark-lockup {
  display: inline-block;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 1;
  color: var(--cream);
  text-shadow: 0 10px 60px rgba(0, 0, 0, .55);
  text-transform: uppercase;
}
.wordmark {
  display: block;
  font-size: clamp(64px, 21vw, 220px);
  line-height: .9;
  letter-spacing: .02em;
}
.wm-x { color: var(--red); }
/* letter-spacing leaves a gap after the last letter: RUN CLUB balances it with equal left padding
   so it stays centered. NYC is left-aligned over the "¡", where the trailing gap doesn't matter. */
.wm-nyc {
  display: block;
  text-align: left;
  font-size: clamp(14px, 3.25vw, 34px);
  letter-spacing: .35em;
  margin-bottom: .3em;
}
.wm-runclub {
  --track: .3em;
  display: block;
  text-align: center;
  font-size: clamp(20px, 6.5vw, 68px);
  letter-spacing: var(--track);
  padding-left: var(--track);
  margin-top: .18em;
}
.hero-sub {
  margin: 16px 0 0;
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 600;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-slogan {
  margin: 24px 0 0;
  font-family: var(--display);
  font-size: clamp(20px, 3.2vw, 30px);
  line-height: 1.1;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 6px 30px rgba(0, 0, 0, .6);
}
.hero-tag {
  margin: 10px auto 0;
  max-width: 440px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--cream);
}
.btn {
  display: inline-block;
  margin-top: 28px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: transform .15s ease, background .2s;
}
.btn--red { background: var(--red); color: #0b0b0d; }
.btn--red:hover { background: var(--cream); transform: translateY(-2px); }

.hero-handle { margin: 22px 0 0; }
.hero-handle a {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .2s;
}
.hero-handle a:hover { color: var(--red); }
.hero-handle .dot { margin: 0 10px; color: var(--muted); }

.scroll-cue {
  position: absolute;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue span {
  display: block;
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--red), transparent);
  animation: cueDrop 1.6s ease-in-out infinite;
}
@keyframes cueDrop { 0% { transform: scaleY(0); transform-origin: top; } 55% { transform: scaleY(1); } 100% { opacity: 0; } }
.hero.is-scrolled .scroll-cue { opacity: 0; transition: opacity .4s; }

/* ---------- sections ---------- */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 20px 24px;
}
.section-title {
  margin: 0 0 32px;
  font-family: var(--display);
  font-size: clamp(32px, 6vw, 56px);
  letter-spacing: .01em;
  text-transform: uppercase;
  line-height: 1;
}
.section-title span { color: var(--red); }
.section-title span.is-event { color: var(--cream); }
.section-empty { color: var(--muted); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- next run (red card) ---------- */
.next-card {
  border-radius: 16px;
  background: var(--red);
  color: #140505;
  padding: clamp(28px, 5vw, 52px);
  box-shadow: 0 24px 80px rgba(255, 45, 26, .22);
}
.next-card--event { background: var(--cream); color: #0b0b0d; box-shadow: 0 24px 80px rgba(242, 237, 227, .12); }
.next-card--empty { background: var(--bg-2); color: var(--cream); box-shadow: none; border: 1px solid var(--line); }
.next-card .kind-tag { color: inherit; margin-bottom: 16px; }
.next-card--empty .next-meta { color: var(--muted); }
.next-date {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(30px, 6.5vw, 64px);
  line-height: 1;
  text-transform: uppercase;
}
.next-title { margin: 14px 0 4px; font-size: 18px; font-weight: 600; }
.next-meta { margin: 2px 0 0; font-size: 14px; font-weight: 500; opacity: .85; }
.next-note { margin: 12px 0 0; font-size: 13px; opacity: .75; max-width: 560px; }

/* ---------- runs list ---------- */
.runs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.run-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 4px 24px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
}
.run-when {
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--red);
}
.run-when small { display: block; font-family: Inter, sans-serif; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .08em; }
.run-row--event .run-when { color: var(--cream); }

/* RUN / EVENT tags: red for runs, white for events */
.kind-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.kind-tag--run { color: var(--red); }
.kind-tag--event { color: var(--cream); }
.run-what { min-width: 0; }
.run-title { margin: 0; font-size: 15px; font-weight: 600; }
.run-meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { .run-row { grid-template-columns: 1fr; } }

/* ---------- gallery grid (ported from pics site) ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { color: var(--cream); border-color: rgba(242, 237, 227, .3); }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #0b0b0d; }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
}
.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: var(--tile-ratio);
  background: var(--bg-2);
  outline-offset: 2px;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .45s ease, transform .4s ease;
}
.tile img.is-loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }

.tile-meta {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, .7), rgba(0, 0, 0, .18) 55%, transparent);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.tile:hover .tile-meta,
.tile:focus-visible .tile-meta { opacity: 1; }
.tile-title {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tile-date { font-size: 11px; color: var(--red); letter-spacing: .06em; }
@media (hover: none) { .tile-meta { display: none; } }

@media (prefers-reduced-motion: no-preference) {
  .tile {
    animation: tileIn .32s ease both;
    animation-delay: min(calc(var(--i, 0) * 14ms), 300ms);
  }
  @keyframes tileIn { from { opacity: 0; transform: scale(.97); } }
}

/* ---------- about ---------- */
.about-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
@media (max-width: 860px) { .about-cols { grid-template-columns: 1fr; } }
.about-lede {
  margin: 0;
  font-size: clamp(19px, 2.6vw, 26px);
  line-height: 1.5;
  font-weight: 500;
}
.about-lede em { color: var(--red); font-style: normal; font-family: var(--display); }
.about-slogan {
  margin: 28px 0 0;
  font-family: var(--display);
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--red);
}
.about-slogan span { color: var(--cream); }
.about-body p { margin: 0 0 18px; font-size: 15px; line-height: 1.75; color: rgba(242, 237, 227, .82); }
.about-cta a { color: var(--red); border-bottom: 1px solid var(--red); }
.about-cta a:hover { color: var(--cream); border-color: var(--cream); }
.about-handle {
  margin-top: 26px !important;
  font-size: 12px !important;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.about-handle--next { margin-top: 10px !important; }
.about-handle a { color: var(--red); }
.about-handle a:hover { color: var(--cream); }

/* ---------- footer ---------- */
.footer {
  margin-top: 56px;
  padding: 56px 20px calc(44px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-bolt { width: 16px; height: 32px; color: var(--red); }
.footer-mark { margin: 0; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 20px; }
.footer-links a {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-links a:hover { color: var(--red); }

/* ---------- lightbox (ported) ---------- */
.lightbox {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  background: transparent;
  color: var(--cream);
  overflow: hidden;
}
.lightbox::backdrop {
  background: rgba(8, 8, 10, .95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
html.lb-open { overflow: hidden; }

.lb-figure {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 16px 24px;
  pointer-events: none;
}
#lb-img {
  max-width: min(96vw, 1800px);
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  pointer-events: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.lb-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: auto;
}
.lb-date { color: var(--red); }
.lb-original { color: var(--muted); }
.lb-original:hover { color: var(--cream); text-decoration: underline; }

.lb-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(242, 237, 227, .08);
  color: var(--cream);
  font-size: 26px;
  line-height: 1;
  transition: background .2s;
}
.lb-btn:hover { background: rgba(242, 237, 227, .18); }
.lb-btn:disabled { opacity: .25; cursor: default; }
.lb-close { top: 14px; right: 14px; font-size: 22px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 640px) {
  .lb-prev, .lb-next { display: none; }
  #lb-img { max-height: 76vh; }
}

/* ---------- upload / admin page ---------- */
.admin-page .section { padding-top: 110px; }
.admin-page .section + .section,
.admin .title-gap { padding-top: 0; margin-top: 48px; }
.navlinks-signout {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.navlinks-signout:hover { color: var(--red); }

.gate-text { max-width: 420px; color: var(--muted); line-height: 1.7; }
.gate-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.gate-form .btn { margin-top: 0; }

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  padding: clamp(20px, 3.5vw, 32px);
}
.field {
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--cream);
  font: inherit;
  font-size: 14px;
  padding: 11px 14px;
  min-width: 0;
}
.field:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
select.field { padding-right: 32px; }
.field-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; max-width: 480px; }
.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.dropzone {
  border: 1.5px dashed rgba(255, 45, 26, .4);
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--red); background: rgba(255, 45, 26, .05); }
.dropzone p { margin: 0 0 6px; font-size: 14px; }
.dropzone strong { color: var(--red); }
.dz-hint { font-size: 12px !important; color: var(--muted); }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li, .admin-run {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.file-remove {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.file-remove:hover { background: rgba(255, 45, 26, .18); color: var(--red); }

.upload-actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.upload-actions .btn { margin-top: 0; }
.upload-actions progress { flex: 1; accent-color: var(--red); height: 8px; }
.btn:disabled { opacity: .35; cursor: default; transform: none; }

.form-msg, .form-error { margin: 14px 0 0; font-size: 13px; color: var(--cream); }
.form-msg.is-error, .form-error { color: var(--red); }

.run-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.run-form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) {
  .run-form-grid { grid-template-columns: 1fr; }
  .run-form-grid .span-2 { grid-column: span 1; }
}
.run-form .btn { margin-top: 0; }
.admin-runs { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.admin-run.is-past { opacity: .45; }
.admin-run.is-editing { border-color: var(--red); opacity: 1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form-actions .btn { margin-top: 0; }
.btn--ghost { border: 1px solid var(--line); color: var(--muted); }
.btn--ghost:hover { color: var(--cream); border-color: rgba(242, 237, 227, .35); }
.admin-run-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-run-info .kind-tag { margin-bottom: 0; }
.flip-kind {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.flip-kind:hover { color: var(--cream); border-color: rgba(242, 237, 227, .35); }

/* Run / Event picker on the calendar form */
.kind-pick { display: flex; gap: 8px; align-items: center; margin: 0; padding: 0; border: 0; }
.kind-pick legend { float: left; margin-right: 6px; padding: 0; }
.kind-opt input { position: absolute; opacity: 0; pointer-events: none; }
.kind-opt span {
  display: inline-block;
  padding: 8px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.kind-opt--run input:checked + span { background: var(--red); border-color: var(--red); color: #140505; }
.kind-opt--event input:checked + span { background: var(--cream); border-color: var(--cream); color: #0b0b0d; }
.kind-opt input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
