:root {
  --ink: #171717;
  --muted: #62646a;
  --paper: #f7f4ee;
  --surface: #ffffff;
  --line: #ded8ce;
  --track: #1e2226;
  --red: #c83a31;
  --gold: #d29a45;
  --blue: #2f6f8f;
  --shadow: 0 22px 80px rgba(16, 18, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.button {
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button.secondary,
.nav button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button.danger {
  background: #9f241d;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(247, 244, 238, 0.92);
  border-bottom: 1px solid rgba(222, 216, 206, 0.7);
  backdrop-filter: blur(16px);
}

.brand,
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand span {
  display: grid;
  line-height: 1.1;
}

.brand small,
.footer span,
.gallery-card small,
.admin-gallery-row small,
.admin-photo small {
  color: var(--muted);
}

.nav {
  gap: 10px;
}

.nav a,
.nav button {
  border-radius: 8px;
  font-weight: 800;
  padding: 10px 12px;
}

.nav form {
  margin: 0;
}

.flash-stack {
  position: fixed;
  top: 78px;
  right: clamp(16px, 4vw, 44px);
  z-index: 30;
  display: grid;
  gap: 10px;
  max-width: 420px;
}

.flash {
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 800;
}

.flash-error {
  border-color: rgba(200, 58, 49, 0.55);
}

.hero {
  position: relative;
  min-height: min(72vh, 720px);
  display: grid;
  align-items: end;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 8, 10, 0.74), rgba(7, 8, 10, 0.28) 54%, rgba(7, 8, 10, 0.05)),
    linear-gradient(0deg, rgba(247, 244, 238, 1), rgba(247, 244, 238, 0) 34%);
}

.hero-content {
  position: relative;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 72px 0 104px;
  color: #fff;
}

.hero-event-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.hero-event-logos img {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}

.hero-logo-sarian {
  width: min(430px, 64vw);
  max-height: 82px;
}

.hero-logo-club {
  width: 104px;
  height: 104px;
}

.hero-date {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(7, 8, 10, 0.42);
  color: #fff;
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1,
.gallery-title-row h1,
.admin-head h1,
.auth-panel h1 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero p:last-child {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.1rem;
}

.event-copy,
.benefit-note,
.track-layout,
.gallery-list,
.direct-donation,
.gallery-shell,
.admin-shell,
.admin-auth {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.event-copy {
  padding: 34px 0 0;
}

.event-copy h2 {
  max-width: 960px;
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(1.25rem, 2.7vw, 2.55rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
}

.benefit-note {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.1fr);
  gap: 24px;
  align-items: start;
  margin-top: 40px;
  padding: 54px 0 58px;
}

.benefit-note::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  border-top: 1px solid rgba(30, 34, 38, 0.12);
  border-bottom: 1px solid rgba(30, 34, 38, 0.12);
  background:
    linear-gradient(90deg, rgba(47, 111, 143, 0.12), rgba(210, 154, 69, 0.14) 46%, rgba(200, 58, 49, 0.13)),
    #eee8dd;
}

.benefit-note.has-video::before {
  background:
    linear-gradient(90deg, rgba(12, 15, 18, 0.76), rgba(22, 24, 25, 0.46) 46%, rgba(12, 15, 18, 0.7)),
    linear-gradient(180deg, rgba(247, 244, 238, 0.08), rgba(247, 244, 238, 0.2));
}

.benefit-video-wrap {
  position: absolute;
  z-index: -2;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  overflow: hidden;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(47, 111, 143, 0.12), rgba(210, 154, 69, 0.14) 46%, rgba(200, 58, 49, 0.13)),
    #eee8dd;
}

.benefit-video-fallback,
.benefit-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.benefit-video-fallback {
  background: inherit;
  transform: scale(1.01);
}

.benefit-video {
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity 360ms ease;
}

.benefit-video.is-active.is-ready {
  opacity: 1;
}

.benefit-note.has-video .benefit-note-copy .eyebrow,
.benefit-note.has-video .benefit-note-copy h2,
.benefit-note.has-video .benefit-note-copy p:not(.eyebrow) {
  color: #fff8ee;
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
}

.benefit-note-copy {
  display: grid;
  gap: 12px;
  align-self: start;
  padding-top: 2px;
}

.benefit-note-copy h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.benefit-note-copy p:not(.eyebrow) {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.58;
}

.benefit-photo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
  align-items: stretch;
}

.benefit-photo-grid img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 38px rgba(16, 18, 20, 0.08);
}

.benefit-photo-grid img:last-child {
  grid-column: 1 / -1;
  height: min(760px, 72vh);
  object-fit: contain;
  object-position: center;
  background: var(--track);
}

.track-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(280px, 0.66fr);
  gap: 18px;
  align-items: center;
  margin-top: 22px;
}

.track-layout-copy {
  display: grid;
  gap: 8px;
}

.track-layout-copy h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1;
  letter-spacing: 0;
}

.track-layout-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.track-layout-image {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf4e5;
  box-shadow: 0 12px 38px rgba(16, 18, 20, 0.08);
}

.track-layout-image img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.gallery-list {
  position: relative;
  isolation: isolate;
  margin-top: 40px;
  padding: 54px 0 58px;
}

.gallery-list::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  border-top: 1px solid rgba(30, 34, 38, 0.12);
  border-bottom: 1px solid rgba(30, 34, 38, 0.12);
  background:
    linear-gradient(90deg, rgba(200, 58, 49, 0.12), rgba(210, 154, 69, 0.12) 34%, rgba(47, 111, 143, 0.12)),
    #eee8dd;
}

.section-head,
.panel-head,
.admin-head,
.gallery-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.gallery-list .section-head {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(30, 34, 38, 0.14);
}

.section-head h2,
.unlock-panel h2,
.panel h2,
.empty-state h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: 0;
}

.gallery-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 280px);
  gap: 18px;
  justify-content: start;
  margin-top: 20px;
}

.gallery-card,
.panel,
.auth-panel,
.empty-state,
.unlock-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 38px rgba(16, 18, 20, 0.08);
}

.gallery-card {
  display: grid;
  grid-template-rows: 210px 1fr;
  overflow: hidden;
  width: 280px;
  min-height: 390px;
}

.gallery-card-media {
  height: 210px;
  background: var(--track);
}

.gallery-card-media img,
.hero-preview-panel img,
.photo-tile img,
.admin-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  min-height: 180px;
}

.gallery-card-body strong {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.gallery-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  margin-top: auto;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--track);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.gallery-card-cta-free {
  background: var(--blue);
}

.gallery-card-cta-unlocked {
  background: #2f6f4e;
}

.gallery-coming-soon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-column: 1 / -1;
  gap: 22px;
  min-height: 190px;
  overflow: hidden;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(18, 21, 24, 0.96), rgba(47, 111, 143, 0.9) 52%, rgba(200, 58, 49, 0.84)),
    url("images/high-plains-raceway-track-layout.jpg") center / cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.gallery-coming-soon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.gallery-coming-soon > * {
  position: relative;
  z-index: 1;
}

.gallery-coming-soon h2 {
  max-width: 740px;
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.gallery-coming-soon .eyebrow {
  color: rgba(255, 224, 170, 0.95);
}

.gallery-coming-soon span {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.direct-donation {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 86px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.direct-donation-copy {
  display: grid;
  gap: 7px;
}

.direct-donation-copy h2 {
  margin: 0;
  font-family: Newsreader, Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1;
  letter-spacing: 0;
}

.direct-donation-copy p:not(.eyebrow) {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.direct-donation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 10px;
}

.direct-donation-grid form {
  margin: 0;
}

.direct-donation-button {
  width: 100%;
  background: var(--track);
}

.direct-donation .stripe-note {
  margin: 10px 0 0;
  text-align: right;
}

.empty-state {
  padding: 28px;
}

.gallery-shell {
  padding: 46px 0 90px;
}

.gallery-title-row {
  align-items: center;
  margin-bottom: 22px;
}

.gallery-title-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.gallery-title-row h1,
.admin-head h1,
.auth-panel h1 {
  font-size: clamp(2.4rem, 6vw, 5rem);
}

.gallery-title-row p:not(.eyebrow) {
  color: var(--muted);
  max-width: 720px;
}

.unlock-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 460px);
  gap: 22px;
  align-items: center;
  padding: 22px;
  margin-bottom: 26px;
  border-top: 5px solid var(--red);
}

.unlock-panel p {
  color: var(--muted);
}

.admin-buyer-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 111, 143, 0.35);
  border-radius: 8px;
  background: rgba(47, 111, 143, 0.1);
  color: var(--track);
}

.admin-buyer-preview span {
  color: var(--muted);
}

.donation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.donation-button {
  width: 100%;
  min-height: 74px;
  display: grid;
  gap: 3px;
  background: var(--track);
}

.donation-button span {
  font-size: 1.45rem;
}

.donation-button small {
  color: rgba(255, 255, 255, 0.74);
}

.stripe-badge {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.stripe-badge img {
  height: 22px;
}

.stripe-note {
  margin: 10px 0 0;
  color: var(--red);
  font-weight: 800;
  text-align: right;
}

.photo-grid {
  columns: 3 260px;
  column-gap: 16px;
}

.photo-tile {
  break-inside: avoid;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.photo-tile button {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: #111;
}

.photo-tile span {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 8px;
  background: rgba(10, 12, 16, 0.72);
  color: #fff;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.photo-tile a {
  display: block;
  padding: 10px 12px;
  color: var(--blue);
  font-weight: 800;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  padding: 22px;
  background: rgba(7, 8, 10, 0.92);
}

.lightbox figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 0;
}

.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

.lightbox figcaption {
  color: #fff;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

.lightbox-nav {
  background: rgba(255, 255, 255, 0.14);
}

.admin-auth {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(420px, 100%);
  padding: 28px;
}

.admin-shell {
  padding: 38px 0 84px;
}

.admin-head {
  align-items: center;
  margin-bottom: 22px;
}

.head-actions {
  display: flex;
  gap: 10px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 20px;
}

.stack-form,
.auth-panel form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 12px 13px;
}

textarea {
  resize: vertical;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.checkbox-row span {
  display: grid;
  gap: 2px;
}

.checkbox-row strong {
  color: var(--ink);
}

.checkbox-row small {
  color: var(--muted);
  font-weight: 600;
}

.hero-preview-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.hero-preview-panel img {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}

.event-background-preview-video {
  display: block;
  width: 100%;
  max-height: 340px;
  border-radius: 8px;
  background: var(--track);
}

.admin-gallery-list,
.admin-photo-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.admin-gallery-row,
.admin-photo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-gallery-row div,
.admin-photo div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-gallery-row span,
.admin-photo strong {
  overflow-wrap: anywhere;
}

.link-box {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9f7f2;
}

.link-box code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.danger-form {
  margin-top: 12px;
}

.upload-dropzone {
  display: grid;
  gap: 14px;
}

.upload-target {
  min-height: 160px;
  place-items: center;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: #f9f7f2;
  cursor: pointer;
}

.upload-target span {
  font-weight: 600;
}

.admin-photo {
  grid-template-columns: auto 138px minmax(0, 1fr) auto;
}

.admin-photo img {
  width: 138px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
}

.drag-handle {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-photo.is-dragging {
  opacity: 0.55;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 26px clamp(18px, 4vw, 48px);
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .topbar,
  .section-head,
  .panel-head,
  .admin-head,
  .gallery-title-row,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    flex-wrap: wrap;
  }

  .hero {
    min-height: 68vh;
  }

  .hero-content {
    padding: 52px 0 72px;
  }

  .hero-event-logos {
    gap: 12px;
    margin-bottom: 18px;
  }

  .hero-logo-sarian {
    width: min(320px, 78vw);
    max-height: 64px;
  }

  .hero-logo-club {
    width: 76px;
    height: 76px;
  }

  .unlock-panel,
  .admin-layout,
  .admin-gallery-row,
  .benefit-note,
  .benefit-photo-grid,
  .track-layout,
  .direct-donation,
  .admin-photo {
    grid-template-columns: 1fr;
  }

  .benefit-photo-grid img {
    height: 230px;
  }

  .donation-grid {
    grid-template-columns: 1fr 1fr;
  }

  .direct-donation-grid {
    grid-template-columns: 1fr 1fr;
  }

  .direct-donation .stripe-note {
    text-align: left;
  }

  .gallery-list {
    width: 100%;
  }

  .gallery-list .section-head {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
  }

  .gallery-card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
  }

  .gallery-card {
    width: 100%;
  }

  .gallery-coming-soon {
    align-items: flex-start;
    flex-direction: column;
  }

  .photo-grid {
    columns: 1;
  }

  .admin-photo img {
    width: 100%;
  }

  .lightbox {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .lightbox-nav {
    display: none;
  }
}
