/* ============================================================
   ENVITATION — Builder / Brand UI Stylesheet
   Used by: index.html (builder form), confirm.html
   ============================================================ */

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

:root {
  /* Brand palette */
  --brand-navy:   #0F1B2D;
  --brand-gold:   #D4A853;
  --brand-gold-l: #F0D898;
  --brand-gold-d: #A8823A;
  --brand-cream:  #F8F4EE;
  --brand-white:  #FFFFFF;
  --brand-ink:    #1A1410;
  --brand-soft:   #5C5248;
  --brand-muted:  #9C9088;
  --brand-border: #E8E2D8;
  --brand-bg-alt: #F2EDE5;

  /* UI tokens */
  --radius:    10px;
  --radius-lg: 18px;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);

  /* Typography */
  --font-d: 'Playfair Display', Georgia, serif;
  --font-b: 'Inter', system-ui, sans-serif;
}

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

body {
  background: var(--brand-cream);
  color: var(--brand-ink);
  font-family: var(--font-b);
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }

/* ============================================================
   NAV / HEADER
   ============================================================ */
.env-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248,244,238,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--brand-border);
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.env-logo {
  font-family: var(--font-d);
  font-style: italic;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--brand-navy);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.env-logo span {
  color: var(--brand-gold);
}

.env-nav__right {
  font-size: 0.78rem;
  color: var(--brand-muted);
  font-weight: 400;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  text-align: center;
  padding: clamp(2.5rem, 7vw, 4.5rem) 1.5rem clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--brand-border);
}

.page-header__eyebrow {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--brand-gold);
  margin-bottom: 0.75rem;
}

.page-header__title {
  font-family: var(--font-d);
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.15;
  color: var(--brand-navy);
  margin-bottom: 0.75rem;
}

.page-header__title em {
  font-style: italic;
  color: var(--brand-gold);
}

.page-header__sub {
  font-size: 0.95rem;
  color: var(--brand-soft);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.72;
  font-weight: 400;
}

/* ============================================================
   PROGRESS STEPPER
   ============================================================ */
.stepper {
  max-width: 520px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
}

.stepper__track {
  display: flex;
  align-items: center;
  position: relative;
}

.stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
}

/* Connector line between steps */
.stepper__step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 1.5px;
  background: var(--brand-border);
  z-index: 0;
  transition: background 0.4s;
}

.stepper__step.is-done:not(:last-child)::after {
  background: var(--brand-gold);
}

.stepper__dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--brand-border);
  background: var(--brand-cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--brand-muted);
  position: relative;
  z-index: 1;
  transition: all 0.35s var(--ease);
}

.stepper__step.is-active .stepper__dot {
  border-color: var(--brand-gold);
  background: var(--brand-gold);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(212,168,83,0.18);
}

.stepper__step.is-done .stepper__dot {
  border-color: var(--brand-gold);
  background: var(--brand-gold);
  color: #fff;
}

.stepper__label {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-muted);
  white-space: nowrap;
}

.stepper__step.is-active .stepper__label { color: var(--brand-gold); font-weight: 600; }
.stepper__step.is-done  .stepper__label { color: var(--brand-gold-d); }

/* ============================================================
   FORM LAYOUT
   ============================================================ */
.form-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* Step panels */
.step-panel { display: none; }
.step-panel.is-active { display: block; }

.step-panel__heading {
  font-family: var(--font-d);
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.15;
  color: var(--brand-navy);
  margin-bottom: 0.4rem;
}

.step-panel__heading em {
  font-style: italic;
  color: var(--brand-gold);
}

.step-panel__intro {
  font-size: 0.9rem;
  color: var(--brand-soft);
  line-height: 1.68;
  margin-bottom: 2rem;
}

/* ============================================================
   FIELD COMPONENTS
   ============================================================ */
.field {
  margin-bottom: 1.2rem;
}

.field__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-soft);
  margin-bottom: 0.45rem;
}

.field__input,
.field__select {
  width: 100%;
  padding: 0.78rem 1rem;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius);
  background: var(--brand-white);
  font-family: var(--font-b);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--brand-ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.field__input:focus,
.field__select:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(212,168,83,0.15);
}

.field__input::placeholder { color: #C8C2BA; }

.field__hint {
  font-size: 0.75rem;
  color: var(--brand-muted);
  margin-top: 0.4rem;
  line-height: 1.55;
}

.field__error {
  font-size: 0.75rem;
  color: #B53C3C;
  margin-top: 0.35rem;
  display: none;
}

/* Error state */
.field.has-error .field__input,
.field.has-error .field__select {
  border-color: #B53C3C;
  box-shadow: 0 0 0 3px rgba(181,60,60,0.12);
}

.field.has-error .field__error {
  display: block;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ============================================================
   THEME PICKER
   ============================================================ */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 420px) {
  .theme-picker { grid-template-columns: repeat(3, 1fr); }
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.theme-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.theme-swatch-lg {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2.5px solid transparent;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

.theme-option input:checked + .theme-swatch-lg,
.theme-option:hover .theme-swatch-lg {
  border-color: var(--brand-gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.theme-option input:checked + .theme-swatch-lg::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  background: rgba(0,0,0,0.25);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Individual theme swatches */
.swatch--classic  { background: linear-gradient(135deg, #F8F4EE 50%, #D4A853 50%); }
.swatch--midnight { background: linear-gradient(135deg, #0F1B2D 50%, #C9A84C 50%); }
.swatch--rose     { background: linear-gradient(135deg, #FDF8F5 50%, #C4706A 50%); }
.swatch--navy     { background: linear-gradient(135deg, #F5F7FA 50%, #2A5CAA 50%); }
.swatch--sage     { background: linear-gradient(135deg, #F4F7F2 50%, #5C8A52 50%); }

.theme-option__name {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--brand-soft);
  text-align: center;
}

/* ============================================================
   PHOTO UPLOAD
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--brand-white);
  position: relative;
  transition: border-color 0.22s, background 0.22s;
}

.upload-zone:hover,
.upload-zone.is-dragover {
  border-color: var(--brand-gold);
  background: #FAF6ED;
}

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

.upload-zone__icon  { font-size: 2.2rem; margin-bottom: 0.6rem; }

.upload-zone__title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--brand-ink);
  margin-bottom: 0.3rem;
}

.upload-zone__title span {
  color: var(--brand-gold);
  text-decoration: underline;
}

.upload-zone__sub {
  font-size: 0.78rem;
  color: var(--brand-muted);
}

/* Preview thumbnails */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 1rem;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--brand-border);
}

.preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.preview-item__remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s;
}

.preview-item__remove:hover { background: rgba(181,60,60,0.85); }

.preview-item--hero::after {
  content: 'HERO';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(212,168,83,0.9);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 3px 0;
}

.photo-count {
  font-size: 0.78rem;
  color: var(--brand-soft);
  margin-top: 0.6rem;
}

/* ============================================================
   RSVP MODE TOGGLE
   ============================================================ */
.rsvp-toggle {
  display: flex;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.rsvp-toggle__btn {
  flex: 1;
  padding: 0.7rem;
  border: none;
  background: var(--brand-white);
  font-family: var(--font-b);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--brand-muted);
  cursor: pointer;
  transition: background 0.22s, color 0.22s;
}

.rsvp-toggle__btn.is-active {
  background: var(--brand-gold);
  color: #fff;
}

/* ============================================================
   NAVIGATION ROW
   ============================================================ */
.nav-row {
  display: flex;
  gap: 0.85rem;
  margin-top: 2.25rem;
  align-items: center;
}

/* ============================================================
   BUILDER BUTTONS (inherit from brand palette, not theme palette)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.88rem 1.8rem;
  border-radius: var(--radius);
  font-family: var(--font-b);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.18s, transform 0.18s var(--ease);
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: var(--brand-gold);
  color: #fff;
}

.btn--primary:hover { opacity: 0.9; }

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--brand-border);
  color: var(--brand-soft);
}

.btn--outline:hover { border-color: var(--brand-muted); }
.btn--full { width: 100%; justify-content: center; }

/* ============================================================
   LOADING & SUCCESS STATES
   ============================================================ */
.spinner-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 4rem 1.5rem;
  text-align: center;
}

.spinner-screen.is-active { display: flex; }

.spinner {
  width: 38px; height: 38px;
  border: 2.5px solid var(--brand-border);
  border-top-color: var(--brand-gold);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.spinner-label {
  font-size: 0.92rem;
  color: var(--brand-soft);
  line-height: 1.6;
}

/* ============================================================
   UTILITY
   ============================================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.fade-in {
  animation: fadeIn 0.5s var(--ease) both;
}
