/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
}

/* Keep the hidden attribute working on elements that set their own display */
[hidden] {
  display: none !important;
}

/* ==========================================================================
   Themes: each page sets one of these classes on <body>.
   Components below only ever use these variables.
   ========================================================================== */

body {
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);
  --bg: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 50%, #dde4f0 100%);
  --text: #1f2937;
  --muted: #4b5563;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --button-bg: var(--accent);
  --button-bg-hover: var(--accent-hover);
  --button-text: #fff;
  --surface: rgba(255, 255, 255, 0.7);
  --input-bg: rgba(255, 255, 255, 0.85);
  --border: rgba(203, 213, 225, 0.8);
  --header-bg: rgba(255, 255, 255, 0.7);
  --shadow: rgba(30, 41, 59, 0.25);
  --success: #047857;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
}

/* Home: dark "launch night" in both light and dark mode */
.theme-home {
  color-scheme: dark;
  --bg:
    radial-gradient(circle at 15% 20%, rgba(139, 92, 246, 0.35), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.25), transparent 45%),
    linear-gradient(180deg, #0b1020 0%, #111633 100%);
  --text: #f1f5f9;
  --muted: #a5b4cc;
  --accent: #c4b5fd;
  --accent-hover: #ddd6fe;
  --accent-soft: rgba(196, 181, 253, 0.14);
  --button-bg: linear-gradient(90deg, #7c3aed, #db2777);
  --button-bg-hover: linear-gradient(90deg, #6d28d9, #be185d);
  --surface: rgba(255, 255, 255, 0.06);
  --input-bg: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --header-bg: rgba(11, 16, 32, 0.6);
  --shadow: rgba(0, 0, 0, 0.6);
  --success: #6ee7b7;
  --error: #fca5a5;
  --error-bg: rgba(127, 29, 29, 0.5);
  --error-text: #fecaca;
}

/* About: warm, editorial */
.theme-about {
  --font-heading: Georgia, "Times New Roman", Times, serif;
  --bg: linear-gradient(160deg, #fdf8f3 0%, #f7ebe0 100%);
  --text: #2b2118;
  --muted: #6b5a4c;
  --accent: #b54a24;
  --accent-hover: #963c1c;
  --accent-soft: rgba(181, 74, 36, 0.1);
  --surface: #fffaf5;
  --input-bg: #fffaf5;
  --border: #ead9c8;
  --header-bg: rgba(253, 248, 243, 0.8);
  --shadow: rgba(92, 51, 23, 0.2);
}

/* Contact: fresh and calm */
.theme-contact {
  --bg: linear-gradient(135deg, #ecfdf5 0%, #e0f2fe 100%);
  --text: #0f2a2e;
  --muted: #4a6b70;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --surface: #ffffff;
  --input-bg: #f8fdfc;
  --border: #c7e3e0;
  --header-bg: rgba(255, 255, 255, 0.7);
  --shadow: rgba(15, 42, 46, 0.15);
}

/* Gallery: dark "gallery wall" in both light and dark mode, so images stand out */
.theme-gallery {
  color-scheme: dark;
  --bg: radial-gradient(ellipse at 50% 0%, #2a241d 0%, #141210 55%, #0e0d0c 100%);
  --text: #f5f1ea;
  --muted: #a8a095;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --button-bg: #f59e0b;
  --button-bg-hover: #fbbf24;
  --button-text: #1c1917;
  --surface: rgba(255, 255, 255, 0.05);
  --input-bg: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --header-bg: rgba(20, 18, 16, 0.7);
  --shadow: rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  body {
    --bg: linear-gradient(135deg, #111827 0%, #1e293b 50%, #1f2a44 100%);
    --text: #f3f4f6;
    --muted: #9ca3af;
    --accent: #a5b4fc;
    --accent-hover: #c7d2fe;
    --accent-soft: rgba(165, 180, 252, 0.14);
    --button-bg: #4f46e5;
    --button-bg-hover: #4338ca;
    --surface: rgba(15, 23, 42, 0.55);
    --input-bg: rgba(15, 23, 42, 0.6);
    --border: #334155;
    --header-bg: rgba(15, 23, 42, 0.7);
    --shadow: rgba(0, 0, 0, 0.6);
    --success: #6ee7b7;
    --error: #fca5a5;
    --error-bg: rgba(127, 29, 29, 0.5);
    --error-text: #fecaca;
  }

  .theme-about {
    --bg: linear-gradient(160deg, #1c1511 0%, #261c16 100%);
    --text: #f5ebe0;
    --muted: #bba898;
    --accent: #f08a5d;
    --accent-hover: #f5a57f;
    --accent-soft: rgba(240, 138, 93, 0.14);
    --button-bg: #b54a24;
    --button-bg-hover: #963c1c;
    --surface: rgba(255, 255, 255, 0.04);
    --input-bg: rgba(255, 255, 255, 0.05);
    --border: #3d2e24;
    --header-bg: rgba(28, 21, 17, 0.75);
  }

  .theme-contact {
    --bg: linear-gradient(135deg, #071a1d 0%, #0a2230 100%);
    --text: #e6f6f4;
    --muted: #8fb3b3;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-soft: rgba(45, 212, 191, 0.12);
    --button-bg: #0f766e;
    --button-bg-hover: #115e59;
    --surface: rgba(255, 255, 255, 0.04);
    --input-bg: rgba(255, 255, 255, 0.05);
    --border: #1f3d42;
    --header-bg: rgba(7, 26, 29, 0.75);
  }
}

/* ==========================================================================
   Header and navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.nav {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
}

.nav-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.5rem 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 0.5rem;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Centred pages (Home, Contact, form results)
   ========================================================================== */

.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.25rem, 8vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0;
  max-width: 32rem;
  font-size: clamp(1rem, 3vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
}

.page-link {
  margin: 1.5rem 0 0;
}

.page-link a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.page-link a:hover,
.page-link a:focus-visible {
  text-decoration: underline;
}

/* Home: gradient heading. The gradient only paints inside the element's box,
   so extra bottom padding keeps descenders (g, y) from being clipped. */
.theme-home h1 {
  padding-bottom: 0.15em;
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, #e9d5ff 0%, #c4b5fd 40%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   Buttons and form fields
   ========================================================================== */

.button,
.contact-form button,
.notify-row button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--button-text);
  text-decoration: none;
  white-space: nowrap;
  background: var(--button-bg);
  border: 0;
  border-radius: 0.5rem;
  cursor: pointer;
}

.button:hover,
.button:focus-visible,
.contact-form button:hover,
.contact-form button:focus-visible,
.notify-row button:hover,
.notify-row button:focus-visible {
  background: var(--button-bg-hover);
}

.contact-form input,
.contact-form textarea,
.notify-row input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font: inherit;
  font-size: 1rem;
  color: inherit;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.contact-form input:focus,
.contact-form textarea:focus,
.notify-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

/* Honeypot field: hidden from people, visible to naive bots */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   Contact form
   ========================================================================== */

.contact-form {
  width: 100%;
  max-width: 32rem;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.contact-form label {
  margin-bottom: 0.375rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  margin-bottom: 1.25rem;
}

.contact-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.contact-form button {
  align-self: flex-start;
}

/* Contact: form sits on a raised card */
.theme-contact .contact-form {
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 20px 40px -20px var(--shadow);
}

.form-errors {
  width: 100%;
  max-width: 32rem;
  margin: 1.5rem 0 0;
  padding: 0.75rem 1rem 0.75rem 2rem;
  text-align: left;
  color: var(--error-text);
  background: var(--error-bg);
  border-radius: 0.5rem;
}

/* ==========================================================================
   Launch countdown (Home)
   ========================================================================== */

.countdown {
  margin-top: 2.5rem;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 5.5rem));
  gap: 0.75rem;
  justify-content: center;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.875rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.theme-home .countdown-unit {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 24px -6px rgba(139, 92, 246, 0.45);
}

.countdown-value {
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.countdown-label {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.countdown-date {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ==========================================================================
   "Notify me" sign-up (Home)
   ========================================================================== */

.notify-form {
  width: 100%;
  max-width: 28rem;
  margin-top: 2.5rem;
}

.notify-label {
  display: block;
  margin-bottom: 0.625rem;
  font-weight: 600;
}

.notify-row {
  display: flex;
  gap: 0.5rem;
}

.notify-row input {
  flex: 1;
  min-width: 0;
}

.notify-row button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.notify-status {
  min-height: 1.5em;
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
}

.notify-status.is-success {
  color: var(--success);
}

.notify-status.is-error {
  color: var(--error);
}

/* ==========================================================================
   Content pages (About)
   ========================================================================== */

.page {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.hero {
  padding: 4rem 0 3rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.lead {
  max-width: 38rem;
  margin: 0 auto;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  line-height: 1.6;
  color: var(--muted);
}

.section {
  padding: 2rem 0;
}

.section h2,
.cta h2 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.01em;
  text-align: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}

.card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -10px var(--shadow);
}

.card-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 0.75rem;
}

.card-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.card h3,
.step h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}

.card p,
.step p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.step {
  position: relative;
  counter-increment: step;
  padding-top: 3.25rem;
}

.step::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--button-text);
  background: var(--button-bg);
  border-radius: 50%;
}

/* Connecting line between steps */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.125rem;
  left: 2.75rem;
  right: -1rem;
  height: 2px;
  background: var(--border);
}

.cta {
  margin-top: 2rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 1rem;
}

.cta h2 {
  margin-bottom: 0.75rem;
}

.cta p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

/* About: editorial touches */
.theme-about .hero h1 {
  font-weight: 400;
  font-style: italic;
}

.theme-about .hero::after {
  content: "";
  display: block;
  width: 4rem;
  height: 3px;
  margin: 2rem auto 0;
  background: var(--accent);
  border-radius: 2px;
}

/* ==========================================================================
   Gallery
   ========================================================================== */

.theme-gallery .hero h1 {
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 2rem;
}

.filter-button {
  padding: 0.5rem 1.125rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-button:hover,
.filter-button:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

.filter-button[aria-pressed="true"] {
  color: var(--button-text);
  background: var(--accent);
  border-color: var(--accent);
}

.gallery {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}

.gallery-link {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface);
  border-radius: 0.75rem;
  box-shadow: 0 12px 30px -16px var(--shadow);
}

.gallery-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.gallery-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-link:hover img,
.gallery-link:focus-visible img {
  transform: scale(1.05);
}

.gallery-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 2.5rem 1rem 0.875rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-link:hover .gallery-caption,
.gallery-link:focus-visible .gallery-caption {
  opacity: 1;
  transform: none;
}

/* Touch screens have no hover, so always show captions there */
@media (hover: none) {
  .gallery-caption {
    opacity: 1;
    transform: none;
  }
}

.gallery-title {
  font-weight: 600;
}

.gallery-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

/* Lightbox */
.lightbox-open {
  overflow: hidden;
}

.lightbox {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 1rem;
  color: #f5f1ea;
  background: transparent;
  border: 0;
}

/* Only lay out when open, or it would override the browser's hidden state */
.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox::backdrop {
  background: rgba(10, 9, 8, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: lightbox-in 0.25s ease;
}

.lightbox-image {
  display: block;
  width: min(100%, 64rem, calc((100vh - 12rem) * 4 / 3));
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 0.5rem;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
}

.lightbox-caption {
  max-width: 40rem;
  margin-top: 1rem;
  text-align: center;
}

.lightbox-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.lightbox-text {
  margin: 0;
  color: #a8a095;
}

.lightbox-counter {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: #78716c;
}

.lightbox-button {
  position: fixed;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-button:hover,
.lightbox-button:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-button:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

.lightbox-button svg {
  width: 1.5rem;
  height: 1.5rem;
}

.lightbox-close {
  top: calc(1rem + env(safe-area-inset-top, 0px));
  right: 1rem;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

@media (max-width: 760px) {
  /* Move arrows below the image so they don't cover it */
  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: none;
  }

  .lightbox-prev {
    left: calc(50% - 3.5rem);
  }

  .lightbox-next {
    right: calc(50% - 3.5rem);
  }

  .lightbox-image {
    width: min(100%, calc((100vh - 16rem) * 4 / 3));
  }
}

/* ==========================================================================
   Responsive and motion preferences
   ========================================================================== */

@media (max-width: 760px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Vertical timeline on small screens */
  .step {
    padding: 0 0 1.75rem 3.25rem;
  }

  .step:not(:last-child)::after {
    top: 2.5rem;
    bottom: 0.25rem;
    left: 1.0625rem;
    right: auto;
    width: 2px;
    height: auto;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }
}

@media (max-width: 480px) {
  .contact-form button {
    align-self: stretch;
  }

  .theme-contact .contact-form {
    padding: 1.25rem;
  }

  .notify-row {
    flex-direction: column;
  }

  .countdown-grid {
    gap: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .gallery-link img,
  .gallery-caption {
    transition: none;
  }

  .card:hover,
  .gallery-link:hover img,
  .gallery-link:focus-visible img {
    transform: none;
  }

  .lightbox-figure {
    animation: none;
  }
}
