@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Jost:wght@300;400&display=swap');

:root {
  --ivory:      #F3EEE4;
  --parchment:  #E5DDCB;
  --sand:       #353225;
  --terracotta: #8C3D43;
  --fig:        #593448;
  --charcoal:   #252619;
  --warm-grey:  #6A664A;
  --surface:    #FAF7EE;
  --line:       #D2CCBA;

  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans:  'Jost', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ivory);
  color: var(--charcoal);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 0.9375rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Film grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.35s steps(1) infinite;
}

@keyframes grain {
  0%   { transform: translate(0,   0);   }
  14%  { transform: translate(-2%, -3%); }
  28%  { transform: translate(3%,   1%); }
  42%  { transform: translate(-1%,  3%); }
  57%  { transform: translate(2%,  -2%); }
  71%  { transform: translate(-3%,  2%); }
  85%  { transform: translate(1%,  -1%); }
  100% { transform: translate(-2%,  2%); }
}

/* ── Animations ──────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-up {
  opacity: 0;
  animation: fadeUp 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.45s; }
.delay-3 { animation-delay: 0.7s; }
.delay-4 { animation-delay: 1.0s; }
.delay-5 { animation-delay: 1.3s; }

/* ── Scroll Reveal ───────────────────────────────────────── */

.reveal-lift {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-lift.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Flash Messages ──────────────────────────────────── */

.flash-notice,
.flash-alert {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1rem 2rem;
  white-space: nowrap;
  animation: fadeIn 0.5s ease;
}

.flash-alert {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

/* ── Hero ────────────────────────────────────────────── */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 9rem 2rem;
  position: relative;
}

.hero-eyebrow {
  font-family: var(--sans);
  font-size: 0.5625rem;
  font-weight: 400;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 3.5rem;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(4.5rem, 15vw, 15rem);
  font-weight: 300;
  font-style: italic;
  line-height: 0.875;
  letter-spacing: -0.03em;
  color: var(--charcoal);
  margin-bottom: 3rem;
}

.hero-rule {
  width: 36px;
  height: 1px;
  background: var(--sand);
  border: none;
  margin: 0 auto 2.5rem;
}

.hero-date {
  font-family: var(--sans);
  font-size: 0.5625rem;
  font-weight: 400;
  letter-spacing: 0.48em;
  text-transform: uppercase;
  color: var(--warm-grey);
}

.hero-stats {
  position: absolute;
  bottom: 3rem;
  right: 3rem;
  text-align: right;
}

.hero-stats span {
  display: block;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--sand);
  line-height: 2.8;
}

.scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: 3rem;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--sand);
  animation: scrollPulse 4s ease-in-out 2s infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 0.95; }
}

/* ── Section Rule ────────────────────────────────────── */

.section-rule {
  width: 100%;
  height: 1px;
  background: var(--line);
  border: none;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 2s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-rule.is-visible {
  transform: scaleX(1);
}

/* ── Contribute ──────────────────────────────────────── */

.contribute {
  max-width: 600px;
  margin: 0 auto;
  padding: 10rem 2rem 11rem;
}

.section-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 2rem;
}

.contribute-heading {
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--charcoal);
  margin-bottom: 5.5rem;
}

/* Form fields */

.form-field {
  margin-bottom: 3.5rem;
}

.form-field label {
  display: block;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 1.25rem;
}

.form-field input[type="text"] {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 300;
  color: var(--charcoal);
  outline: none;
  transition: border-color 0.5s ease;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

.form-field input[type="text"]::placeholder {
  color: var(--sand);
  font-style: italic;
  opacity: 0.7;
}

.form-field input[type="text"]:focus {
  border-bottom-color: var(--terracotta);
}

.form-field:focus-within label {
  color: var(--warm-grey);
  transition: color 0.8s ease;
}

/* Welcome back */

.welcome-back {
  display: none;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3.5rem;
}

.welcome-text {
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 300;
  font-style: italic;
  color: var(--charcoal);
}

.welcome-name {
  color: var(--terracotta);
}

.welcome-edit {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--sand);
  cursor: pointer;
  padding: 0;
  margin-left: 0.75rem;
  transition: color 0.35s ease;
  vertical-align: middle;
}

.welcome-edit:hover { color: var(--warm-grey); }

/* File upload */

.upload-field {
  margin-bottom: 4rem;
}

.upload-field > label {
  display: block;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--sand);
  margin-bottom: 1.25rem;
}

.upload-zone {
  position: relative;
  border: 1px solid var(--line);
  padding: 4.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.5s ease, background 0.5s ease;
}

.upload-zone:hover,
.upload-zone.has-files {
  border-color: var(--terracotta);
  background: rgba(140, 61, 67, 0.025);
}

.upload-zone-inner { pointer-events: none; }

.upload-zone-glyph {
  font-family: var(--serif);
  font-size: 2.75rem;
  font-weight: 300;
  color: var(--sand);
  display: block;
  margin-bottom: 1rem;
  line-height: 1;
  transition: color 0.6s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s ease;
}

.upload-zone:hover .upload-zone-glyph,
.upload-zone.has-files .upload-zone-glyph {
  color: var(--terracotta);
  transform: translateY(-4px);
}

.upload-zone-text {
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--sand);
  transition: color 0.5s ease;
}

.upload-zone:hover .upload-zone-text,
.upload-zone.has-files .upload-zone-text { color: var(--warm-grey); }

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-status {
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 300;
  font-style: italic;
  color: var(--terracotta);
  display: block;
  margin-top: 0.875rem;
  min-height: 1.5em;
}

/* Submit */

.btn-offer {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 300;
  font-style: italic;
  color: var(--charcoal);
  transition: color 0.65s ease;
}

.btn-offer:hover { color: var(--terracotta); }

.btn-offer:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-arrow {
  display: inline-block;
  width: 52px;
  height: 1px;
  background: currentColor;
  position: relative;
  flex-shrink: 0;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-arrow::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -4px;
  width: 9px;
  height: 9px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(-45deg);
}

.btn-offer:not(:disabled):hover .btn-arrow { width: 72px; }

/* ── Gallery ─────────────────────────────────────────── */

.gallery { padding-bottom: 12rem; }

.gallery-header {
  padding: 8rem 3rem 4rem;
  display: flex;
  align-items: baseline;
  gap: 2.25rem;
}

.gallery-heading {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5.5vw, 5.5rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1.0;
  color: var(--charcoal);
}

.gallery-tally {
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--sand);
}

/* CSS masonry via columns */
.media-grid {
  columns: 3;
  column-gap: 4px;
  padding: 0 3rem;
}

.media-card {
  break-inside: avoid;
  margin-bottom: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: block;
}

/* Warm-to-cool split-tone overlay — amber highlights, slight lavender shadows */
.media-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    148deg,
    rgba(252, 234, 186, 0.11) 0%,
    rgba(168, 150, 198, 0.07) 100%
  );
  mix-blend-mode: overlay;
  transition: opacity 1.1s ease;
}

/* Optical vignette — draws the eye inward, simulates lens fall-off */
.media-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 46%,
    transparent 48%,
    rgba(37, 38, 25, 0.32) 100%
  );
  transition: opacity 1.1s ease;
}

.media-card:hover::before { opacity: 0.3; }
.media-card:hover::after  { opacity: 0.45; }

.media-card img,
.media-card video {
  width: 100%;
  display: block;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), filter 1.1s ease;
  filter: saturate(0.68) brightness(1.06) contrast(0.90) sepia(0.14);
}

.media-card:hover img,
.media-card:hover video {
  transform: scale(1.025);
  filter: saturate(0.86) brightness(1.02) contrast(0.96) sepia(0.06);
}

.media-card-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to top, rgba(37, 38, 25, 0.55) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.8s ease;
  display: flex;
  align-items: flex-end;
  padding: 1rem 1.125rem;
}

.media-card:hover .media-card-overlay { opacity: 1; }

.media-card-name {
  font-family: var(--serif);
  font-size: 0.875rem;
  font-weight: 300;
  font-style: italic;
  color: rgba(250, 247, 238, 0.88);
}

.play-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 38, 25, 0.2);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.play-mark svg {
  width: 13px;
  height: 13px;
  fill: rgba(255, 255, 255, 0.82);
  margin-left: 2px;
}

/* Empty state */
.gallery-empty {
  padding: 8rem 3rem 12rem;
  text-align: center;
}

.gallery-empty-text {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.5vw, 3rem);
  font-weight: 300;
  font-style: italic;
  color: var(--sand);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* ── Lightbox ────────────────────────────────────────── */

.lightbox-modal {
  border: none;
  background: rgba(37, 38, 25, 0.97);
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  position: fixed;
  inset: 0;
  opacity: 1;
  transition: opacity 0.65s ease;
}

@starting-style {
  .lightbox-modal[open] {
    opacity: 0;
  }
}

.lightbox-modal.is-closing {
  opacity: 0;
}

.lightbox-modal::backdrop {
  background: rgba(37, 38, 25, 0.97);
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 5rem 2rem 4rem;
  transition: opacity 0.35s ease;
}

.lightbox-content.is-fading {
  opacity: 0;
}

.lightbox-image,
.lightbox-video {
  max-width: 88vw;
  max-height: 76vh;
  object-fit: contain;
  filter: saturate(0.68) brightness(1.06) contrast(0.90) sepia(0.14);
}

/* Fine grain over the dark lightbox field — more visible against dark background */
.lightbox-modal::before {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
  animation: grain 0.35s steps(1) infinite;
}

.lightbox-caption {
  font-family: var(--serif);
  font-size: 0.875rem;
  font-weight: 300;
  font-style: italic;
  color: rgba(250, 247, 238, 0.28);
  text-align: center;
  margin-top: 1.25rem;
  letter-spacing: 0.01em;
}

.lightbox-close {
  position: fixed;
  top: 2rem;
  right: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: rgba(250, 247, 238, 0.28);
  transition: color 0.35s ease;
  padding: 0;
}

.lightbox-close:hover { color: rgba(250, 247, 238, 0.72); }

.lightbox-prev,
.lightbox-next {
  position: fixed;
  bottom: 2.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(250, 247, 238, 0.25);
  transition: color 0.35s ease;
  padding: 0;
}

.lightbox-prev { left: 2.5rem; }
.lightbox-next { right: 2.5rem; }

.lightbox-prev:hover,
.lightbox-next:hover { color: rgba(250, 247, 238, 0.65); }

/* ── Footer ──────────────────────────────────────────── */

.site-footer {
  padding: 4rem 3rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-footer p {
  font-family: var(--sans);
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--sand);
}

/* ── Reduced Motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .fade-up {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .reveal-lift {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .section-rule {
    transform: scaleX(1);
    transition: none;
  }

  .scroll-hint {
    animation: none;
    opacity: 0.7;
  }

  .lightbox-modal,
  .lightbox-content {
    transition: none;
  }

  .media-card img,
  .media-card video {
    filter: saturate(0.92) brightness(1.01);
    transition-duration: 0.01ms;
  }

  .media-card::before,
  .media-card::after {
    display: none;
  }

  .lightbox-image,
  .lightbox-video {
    filter: none;
  }

  .upload-zone-glyph,
  .btn-arrow {
    transition-duration: 0.01ms;
  }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 900px) {
  .media-grid {
    columns: 2;
    padding: 0 2rem;
  }

  .gallery-header { padding: 6rem 2rem 3rem; }
}

@media (max-width: 600px) {
  .hero { padding: 6rem 1.5rem; }

  .hero-stats,
  .scroll-hint { display: none; }

  .contribute { padding: 6rem 1.5rem 7rem; }

  .media-grid {
    columns: 2;
    column-gap: 2px;
    padding: 0;
  }

  .media-card { margin-bottom: 2px; }

  .gallery-header { padding: 5rem 1.5rem 2.5rem; }

  .gallery-empty { padding: 6rem 1.5rem 9rem; }

  .lightbox-content { padding: 4rem 1rem 3.5rem; }

  .lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
  }

  .lightbox-prev { left: 1.5rem; }
  .lightbox-next { right: 1.5rem; }

  .site-footer { padding: 3rem 1.5rem; }
}
