/*
 * global.css — Blush Boudoir Forms Global Stylesheet
 *
 * Implements the full Blush Boudoir brand kit for all form pages.
 * Covers base reset, typography, color system, layout, form elements,
 * buttons, validation states, success/error messages, and responsive behavior.
 *
 * Brand Reference:
 *   Fonts:     Playfair Display Bold (headings) · Raleway Regular (body)
 *   Noir:      #1C201F — main background
 *   Smoke:     #252B29 — section headers / content blocks
 *   Parchment: #F5EEE6 — headings & button text
 *   Linen:     #D6CEC6 — body copy & dividers
 *   Rosewood:  #8B5E52 — button background
 *   Dusty Rose:#A3746A — button hover
 *   Champagne: #C9A67A — hyperlinks & accents
 */

/* ============================================================
   GOOGLE FONTS IMPORT
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Raleway:wght@400;500;700&display=swap');


/* ============================================================
   CSS CUSTOM PROPERTIES (Brand Tokens)
   ============================================================ */

:root {
  /* Color palette */
  --color-noir:       #1C201F;
  --color-smoke:      #252B29;
  --color-parchment:  #F5EEE6;
  --color-linen:      #D6CEC6;
  --color-rosewood:   #8B5E52;
  --color-dusty-rose: #A3746A;
  --color-champagne:  #C9A67A;

  /* Derived utility colors */
  --color-border:     rgba(214, 206, 198, 0.2);   /* Linen at low opacity for subtle dividers */
  --color-border-focus: var(--color-champagne);
  --color-error:      #C47A6A;                     /* Warm error tone — slightly more saturated Dusty Rose */
  --color-error-bg:   rgba(196, 122, 106, 0.12);
  --color-success:    #8FAF8A;                     /* Muted sage — complements the warm palette */
  --color-success-bg: rgba(143, 175, 138, 0.12);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Raleway', 'Helvetica Neue', Arial, sans-serif;

  /* Type scale */
  --text-h1:  40px;
  --text-h2:  32px;
  --text-h3:  24px;
  --text-h4:  22px;
  --text-h5:  18px;
  --text-p1:  17px;
  --text-p2:  15px;
  --text-p3:  13px;

  /* Spacing */
  --space-xs:  8px;
  --space-sm:  16px;
  --space-md:  24px;
  --space-lg:  40px;
  --space-xl:  64px;

  /* Radius */
--radius-sm: 2px;
--radius-md: 4px;
--radius-lg: 50px;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;

  /* Form layout */
  --form-max-width: 680px;
}


/* ============================================================
   BASE RESET
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-noir);
  color: var(--color-linen);
  font-family: var(--font-body);
  font-size: var(--text-p1);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

ul,
ol {
  list-style: none;
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-parchment);
  font-weight: 700;
}

h1 {
  font-size: var(--text-h1);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

h2 {
  font-size: var(--text-h2);
  line-height: 1.3;
  letter-spacing: 0em;
}

h3 {
  font-size: var(--text-h3);
  line-height: 1.35;
  letter-spacing: 0em;
}

h4 {
  font-size: var(--text-h4);
  line-height: 1.35;
  letter-spacing: 0em;
}

h5 {
  font-size: var(--text-h5);
  line-height: 1.4;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

p {
  color: var(--color-linen);
  font-size: var(--text-p1);
  line-height: 1.75;
}

p.small {
  font-size: var(--text-p2);
  line-height: 1.65;
}

p.caption {
  font-size: var(--text-p3);
  line-height: 1.6;
}

a {
  color: var(--color-champagne);
  text-decoration: underline;
  text-decoration-color: rgba(201, 166, 122, 0.4);
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-parchment);
  text-decoration-color: var(--color-parchment);
}

strong,
b {
  font-weight: 700;
  color: var(--color-parchment);
}

em {
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}


/* ============================================================
   LAYOUT — FORM PAGE WRAPPER
   ============================================================ */

/* Outer page wrapper — used for standalone pages */
.page-wrapper {
  min-height: 100vh;
  padding: var(--space-xl) var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The form section container — used as scroll target and visual card */
.form-section {
  width: 100%;
  max-width: var(--form-max-width);
}

/* Section header block (Smoke background per brand guidelines) */
.form-section__header {
  background-color: var(--color-smoke);
  padding: var(--space-lg) var(--space-lg);
  margin-bottom: var(--space-md);
  text-align: center;
}

.form-section__header p {
  margin-top: var(--space-sm);
  font-size: var(--text-p2);
}

/* Form card — the white-bordered content area */
.form-card {
  background-color: var(--color-smoke);
  border: 1px solid var(--color-border);
  padding: var(--space-lg);
}

/* Divider between form field groups */
.form-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

/* Group label (e.g. "Contact Information") */
.form-group-label {
  font-family: var(--font-heading);
  font-size: var(--text-h5);
  color: var(--color-champagne);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}


/* ============================================================
   FORM FIELDS — BASE STYLES
   ============================================================ */

/* Wrapper for each individual field — provides consistent vertical spacing */
.field {
  margin-bottom: var(--space-md);
}

/* Field label */
.field__label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-p3);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-linen);
  margin-bottom: var(--space-xs);
}

/* Required field asterisk */
.field__label .required-mark {
  color: var(--color-champagne);
  margin-left: 3px;
}

/* Helper text beneath the label */
.field__hint {
  font-size: var(--text-p3);
  color: var(--color-linen);
  opacity: 0.7;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Base input/select/textarea styles */
.field__input,
.field__select,
.field__textarea {
  width: 100%;
  background-color: var(--color-noir);
  color: var(--color-parchment);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-p2);
  line-height: 1.5;
  padding: 12px 16px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.field__input::placeholder,
.field__textarea::placeholder {
  color: var(--color-linen);
  opacity: 0.4;
}

/* Focus state */
.field__input:focus,
.field__select:focus,
.field__textarea:focus {
  border-color: var(--color-champagne);
  box-shadow: 0 0 0 3px rgba(201, 166, 122, 0.15);
  background-color: rgba(201, 166, 122, 0.04);
}

/* Textarea */
.field__textarea {
  resize: vertical;
  min-height: 120px;
}

/* Select — custom arrow icon */
.field__select-wrapper {
  position: relative;
}

.field__select-wrapper::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--color-champagne);
  pointer-events: none;
}

.field__select {
  cursor: pointer;
  padding-right: 40px; /* Space for custom arrow */
}

.field__select option {
  background-color: var(--color-smoke);
  color: var(--color-parchment);
}


/* ============================================================
   FORM FIELDS — VALIDATION STATES
   ============================================================ */

/* Error state on the field wrapper */
.field.has-error .field__input,
.field.has-error .field__select,
.field.has-error .field__textarea {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-bg);
}

/* Error message text beneath the field */
.field__error {
  display: none;
  font-size: var(--text-p3);
  color: var(--color-error);
  margin-top: 6px;
  line-height: 1.4;
}

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

/* Valid state */
.field.is-valid .field__input,
.field.is-valid .field__select,
.field.is-valid .field__textarea {
  border-color: var(--color-success);
}


/* ============================================================
   FORM FIELDS — RADIO BUTTONS & CHECKBOXES
   ============================================================ */

/* Group wrapper for radio/checkbox sets */
.field__options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Horizontal layout variant */
.field__options--horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px 24px;
}

/* Individual radio or checkbox item */
.field__option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.field__option input[type="radio"],
.field__option input[type="checkbox"] {
  /* Hide the native control */
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px; /* Optical alignment with label text */
  border: 1px solid var(--color-border);
  background-color: var(--color-noir);
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  position: relative;
}

.field__option input[type="radio"] {
  border-radius: 50%; /* Circle for radio */
}

.field__option input[type="checkbox"] {
  border-radius: var(--radius-sm); /* Square for checkbox */
}

/* Checked state */
.field__option input[type="radio"]:checked,
.field__option input[type="checkbox"]:checked {
  background-color: var(--color-rosewood);
  border-color: var(--color-rosewood);
}

/* Custom checkmark / dot via pseudo-element */
.field__option input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-parchment);
}

.field__option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%) rotate(45deg);
  width: 5px;
  height: 9px;
  border-right: 2px solid var(--color-parchment);
  border-bottom: 2px solid var(--color-parchment);
}

/* Focus state for accessibility */
.field__option input[type="radio"]:focus,
.field__option input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(201, 166, 122, 0.2);
}

/* Option label text */
.field__option-label {
  font-size: var(--text-p2);
  color: var(--color-linen);
  line-height: 1.5;
  user-select: none;
}

/* Error state for radio/checkbox groups */
.field.has-error .field__option input[type="radio"],
.field.has-error .field__option input[type="checkbox"] {
  border-color: var(--color-error);
}


/* ============================================================
   FORM FIELDS — DATE PICKER
   ============================================================ */

.field__input[type="date"] {
  color-scheme: dark; /* Tells browser to use dark styling for date picker popup */
}

/* Hide the native calendar icon in webkit browsers; we style consistently */
.field__input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(0.3) saturate(2) hue-rotate(10deg);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.field__input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}


/* ============================================================
   CLOUDFLARE TURNSTILE WIDGET
   ============================================================ */

.turnstile-wrapper {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

/* Ensure Turnstile iframe is not wider than the form */
.turnstile-wrapper iframe {
  max-width: 100%;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: var(--text-p2);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-parchment);
  background-color: var(--color-rosewood);
  border: none;
  border-radius: var(--radius-lg);
  padding: 14px 32px;
  cursor: pointer;
  transition:
    background-color var(--transition-normal),
    transform var(--transition-fast),
    box-shadow var(--transition-normal);
  white-space: nowrap;
  user-select: none;
}

.btn:hover,
.btn:focus-visible {
  background-color: var(--color-dusty-rose);
  box-shadow: 0 4px 20px rgba(139, 94, 82, 0.4);
  outline: none;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Disabled / loading state */
.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Full-width button variant */
.btn--full {
  width: 100%;
}

/* Loading spinner inside button */
.btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(245, 238, 230, 0.3);
  border-top-color: var(--color-parchment);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn[aria-busy="true"] .btn__spinner {
  display: inline-block;
}

.btn[aria-busy="true"] .btn__text {
  opacity: 0.7;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Submit button row */
.form-submit {
  margin-top: var(--space-lg);
}


/* ============================================================
   INLINE FORM MESSAGES (Success / Error)
   ============================================================ */

/* Base message block — hidden by default, shown by JS */
.form-message {
  display: none;
  padding: var(--space-md) var(--space-md);
  border-left: 3px solid;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

.form-message.is-visible {
  display: block;
}

/* Success message */
.form-message--success {
  background-color: var(--color-success-bg);
  border-color: var(--color-success);
}

.form-message--success .form-message__title {
  color: var(--color-success);
  font-family: var(--font-heading);
  font-size: var(--text-h4);
  margin-bottom: 8px;
}

.form-message--success .form-message__text {
  color: var(--color-parchment);
  font-size: var(--text-p2);
}

/* Error message (form-level, not field-level) */
.form-message--error {
  background-color: var(--color-error-bg);
  border-color: var(--color-error);
}

.form-message--error .form-message__title {
  color: var(--color-error);
  font-family: var(--font-heading);
  font-size: var(--text-h4);
  margin-bottom: 8px;
}

.form-message--error .form-message__text {
  color: var(--color-parchment);
  font-size: var(--text-p2);
}


/* ============================================================
   BRANDING ELEMENT — optional logo/wordmark area
   ============================================================ */

.form-brand {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.form-brand__wordmark {
  font-family: var(--font-heading);
  font-size: var(--text-h5);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-champagne);
}

.form-brand__tagline {
  font-size: var(--text-p3);
  color: var(--color-linen);
  opacity: 0.6;
  margin-top: 4px;
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-champagne { color: var(--color-champagne); }
.text-linen   { color: var(--color-linen); }
.text-parchment { color: var(--color-parchment); }

.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }

/* Visually hidden (for screen readers) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Two-column field layout for wider screens */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  :root {
    --text-h1: 30px;
    --text-h2: 26px;
    --text-h3: 22px;
  }

  .page-wrapper {
    padding: var(--space-md) var(--space-sm);
  }

  .form-card {
    padding: var(--space-md);
  }

  .form-section__header {
    padding: var(--space-md);
  }

  /* Stack two-column rows on mobile */
  .field-row {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 14px 24px;
  }
}

/* Full-width block style for radio/checkbox options */
.field__option--block {
    background-color: var(--color-noir);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    width: 100%;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.field__option--block:hover {
    border-color: var(--color-champagne);
    background-color: rgba(201, 166, 122, 0.04);
}

.field__option--block input[type="radio"]:checked ~ .field__option-label {
    color: var(--color-parchment);
}

.field.has-error .field__option--block {
    border-color: var(--color-error);
}