/* ─────────────────────────────────────────────────────────────────
   Theme variables: defaults match the glaser-flyer palette.
   Themes override these at runtime by setting CSS custom properties
   on <main class="page"> via JS.
   ───────────────────────────────────────────────────────────────── */
:root {
  --cream:        #EFE7D6;
  --cream-soft:   #F5EFE0;
  --navy:         #0F1F36;
  --navy-soft:    #1A2B47;
  --ink:          #1A2B47;
  --muted:        #4A5567;
  --rule:         rgba(15, 31, 54, 0.12);
  --gold:         #C2A55B;
  --gold-bright:  #D4B66A;
  --gold-deep:    #9C7F3A;

  --font-serif: 'DM Serif Display', Cormorant Garamond, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', Menlo, monospace;
}

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

body {
  font-family: var(--font-sans);
  background: var(--navy);
  color: var(--ink);
  line-height: 1.5;
  font-size: 11pt;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ─────────────────────────────────────────────────────────────────
   The page card: echoes the flyer's cream slab on a navy ground
   ───────────────────────────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: 560px;
  background: var(--cream);
  color: var(--ink);
  position: relative;
  box-shadow: 0 8px 48px rgba(0,0,0,0.45);
  padding: 36px 40px 32px;
  overflow: hidden;
}

/* Dot grid: same recipe as the flyer */
.page::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1.5px 1.5px, rgba(15,31,54,0.24) 1.3px, transparent 2.1px);
  background-size: 6mm 6mm;
  background-position: 8mm 8mm;
  pointer-events: none;
  z-index: 0;
}

/* Dual wave overlay: scattered dot windows, not parallel bands */
.page::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(
      -38deg,
      rgba(239, 231, 214, 0.88) 0%,
      rgba(239, 231, 214, 0.12) 18%,
      rgba(239, 231, 214, 0.84) 35%,
      rgba(239, 231, 214, 0.10) 52%,
      rgba(239, 231, 214, 0.90) 70%,
      rgba(239, 231, 214, 0.16) 87%,
      rgba(239, 231, 214, 0.82) 100%
    ),
    linear-gradient(
      22deg,
      rgba(239, 231, 214, 0.92) 0%,
      rgba(239, 231, 214, 0.14) 14%,
      rgba(239, 231, 214, 0.86) 30%,
      rgba(239, 231, 214, 0.10) 48%,
      rgba(239, 231, 214, 0.88) 64%,
      rgba(239, 231, 214, 0.12) 80%,
      rgba(239, 231, 214, 0.90) 100%
    );
  pointer-events: none;
  z-index: 0;
}

.page > * { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────────────────
   States
   ───────────────────────────────────────────────────────────────── */
.state { display: block; }
.state[hidden] { display: none; }

.state-loading {
  text-align: center;
  padding: 32px 0;
}

/* ─────────────────────────────────────────────────────────────────
   Typography primitives
   ───────────────────────────────────────────────────────────────── */
.label {
  font-family: var(--font-mono);
  font-size: 8pt;
  letter-spacing: 2pt;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 700;
  display: inline-block;
  margin-bottom: 8pt;
}

h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30pt;
  line-height: 1.05;
  letter-spacing: -0.6pt;
  margin: 0 0 12pt;
  color: var(--navy);
}
h1 em { font-style: italic; color: var(--gold-deep); }

p { margin: 0 0 10pt; color: var(--ink); }

p.lead {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 13pt;
  line-height: 1.35;
  color: var(--muted);
  margin: 0 0 20pt;
}

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

.error-heading { font-size: 24pt; }
.error-body { color: var(--muted); }

/* ─────────────────────────────────────────────────────────────────
   Form
   ───────────────────────────────────────────────────────────────── */
form { margin-top: 8pt; }

.field {
  margin-bottom: 14pt;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 1.4pt;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4pt;
}

.field label .required { color: var(--gold-deep); margin-left: 2pt; }

.field input,
.field textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 11pt;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: none;
  border-bottom: 0.8pt solid var(--rule);
  padding: 7pt 0 6pt;
  outline: none;
  border-radius: 0;
  transition: border-color 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus {
  border-bottom-color: var(--gold);
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(74, 85, 103, 0.5);
}

.field.invalid input,
.field.invalid textarea {
  border-bottom-color: #C04D3E;
}

.field-error {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 0.6pt;
  color: #C04D3E;
  margin-top: 3pt;
  display: none;
}
.field.invalid .field-error { display: block; }

/* Honeypot: visually hidden but available to bots that fill every input */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────
   Submit button: echoes the flyer CTA exactly
   ───────────────────────────────────────────────────────────────── */
.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 6pt;
  padding: 9pt 18pt;
  margin-top: 6pt;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 8pt;
  letter-spacing: 1.8pt;
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cta-button:hover:not(:disabled) { background: var(--navy-soft); }
.cta-button:disabled { cursor: progress; }
.cta-button .arrow { color: var(--gold-bright); }

/* Inline spinner: hidden by default, swapped in for the arrow while sending */
.cta-button .spinner {
  display: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 182, 106, 0.25);
  border-top-color: var(--gold-bright);
  animation: cta-spinner-rotate 0.7s linear infinite;
}
.cta-button[data-state="sending"] .arrow   { display: none; }
.cta-button[data-state="sending"] .spinner { display: inline-block; }
.cta-button[data-state="sending"]          { opacity: 0.85; }

@keyframes cta-spinner-rotate {
  to { transform: rotate(360deg); }
}

.cta-meta {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 1pt;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 14pt;
}

/* ─────────────────────────────────────────────────────────────────
   Modal: dismissable dialog used for submission errors and any
   future inline message that needs to interrupt the user briefly
   without leaving the page. Picks up the same palette/fonts as
   the surrounding card via the CSS variables on .page.
   ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 54, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  z-index: 100;
  animation: modal-backdrop-in 0.18s ease-out;
}
.modal-backdrop[hidden] { display: none; }

@keyframes modal-backdrop-in {
  from { background: rgba(15, 31, 54, 0); }
  to   { background: rgba(15, 31, 54, 0.72); }
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--cream);
  color: var(--ink);
  padding: 30px 32px 28px;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.55);
  animation: modal-dialog-in 0.22s ease-out;
}

@keyframes modal-dialog-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-dialog .label {
  margin-bottom: 6pt;
}

.modal-dialog h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 22pt;
  line-height: 1.1;
  letter-spacing: -0.4pt;
  margin: 0 0 10pt;
  color: var(--navy);
}

.modal-dialog .lead {
  font-size: 12pt;
  margin: 0 0 18pt;
}

.modal-dialog .cta-button {
  margin-top: 0;
}

/* Upper-right × dismiss */
.modal-dismiss {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: 0;
  transition: color 0.15s ease;
}
.modal-dismiss:hover,
.modal-dismiss:focus-visible {
  color: var(--navy);
  outline: none;
}

/* ─────────────────────────────────────────────────────────────────
   Mobile
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 16px 8px; }
  .page { padding: 24px 22px 24px; }
  h1 { font-size: 24pt; }
  p.lead { font-size: 12pt; }

  .modal-dialog { padding: 24px 22px 22px; }
  .modal-dialog h2 { font-size: 19pt; }
}
