/* ==========================================================================
   Form Pages — Newsletter & Volunteer Signup
   Shared styles for /newsletter.html and /volunteer.html
   ========================================================================== */

/* --------------------------------------------------------------------------
   Custom Properties (mirrors main site)
   -------------------------------------------------------------------------- */
:root {
  --orange: #FF8A65;
  --orange-bright: #FF6D3F;
  --magenta: #E91E63;
  --magenta-dark: #C2185B;
  --purple: #4A148C;
  --purple-deep: #311B92;
  --cream: #FFF8F0;
  --cream-dark: #F5EDE4;
  --charcoal: #2D2D2D;
  --slate: #1F2933;
  --white: #FFFFFF;

  --font-display: 'Bebas Neue', 'Arial Black', sans-serif;
  --font-body: 'Barlow', 'Segoe UI', sans-serif;
  --font-accent: 'Permanent Marker', cursive;

  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--charcoal);
  background: linear-gradient(135deg, var(--purple-deep) 0%, var(--purple) 50%, var(--magenta-dark) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--magenta);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--magenta-dark);
}

/* --------------------------------------------------------------------------
   Header Bar
   -------------------------------------------------------------------------- */
.form-header {
  background: rgba(0, 0, 0, 0.25);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-header__brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  background: var(--white);
  padding: 0.35rem 1rem;
  border: 2.5px solid var(--charcoal);
  transform: rotate(-4deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1;
  clip-path: polygon(
    0% 1%, 3% 0%, 8% 2%, 15% 0%, 22% 1%, 30% 0%,
    40% 1.5%, 50% 0%, 60% 1%, 70% 0%, 80% 1.5%, 90% 0%, 97% 1%, 100% 0%,
    100% 99%, 97% 100%, 90% 98%, 82% 100%, 74% 99%, 65% 100%,
    55% 98.5%, 45% 100%, 35% 99%, 25% 100%, 15% 98.5%, 8% 100%, 2% 99%, 0% 100%
  );
}

.form-header__brand:hover {
  transform: rotate(-1deg) scale(1.04);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}

.form-header__name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple);
}

.form-header__tagline {
  font-family: var(--font-accent);
  font-size: 0.75rem;
  color: var(--orange-bright);
}

.form-header__back {
  font-family: var(--font-accent);
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
  padding-bottom: 2px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.form-header__back:hover {
  color: var(--orange);
  border-color: var(--orange);
}

.form-header__back-arrow {
  display: inline-block;
  transition: transform var(--transition-fast);
}

.form-header__back:hover .form-header__back-arrow {
  transform: translateX(-4px);
}

/* Slim down header on mobile */
@media (max-width: 600px) {
  .form-header__tagline {
    display: none;
  }

  .form-header__back-long {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Form Section
   -------------------------------------------------------------------------- */
.form-section {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
}

@media (min-width: 768px) {
  .form-section {
    padding: 4rem 2rem 6rem;
    align-items: center;
  }
}

.form-card {
  width: 100%;
  max-width: 560px;
  background: var(--white);
  padding: 2.5rem 2rem;
  border-left: 6px solid var(--magenta);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.08);
}

@media (min-width: 768px) {
  .form-card {
    padding: 3rem 2.5rem;
  }
}

.form-card h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--purple);
  margin: 0 0 0.5rem;
}

.form-card__sub {
  font-size: 1.05rem;
  color: var(--charcoal);
  opacity: 0.85;
  margin: 0 0 2rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Form Layout
   -------------------------------------------------------------------------- */
.form-row {
  margin-bottom: 1.5rem;
}

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

@media (max-width: 480px) {
  .form-row--pair {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Helper Note
   -------------------------------------------------------------------------- */
.form-note {
  font-size: 0.9rem;
  color: var(--purple);
  opacity: 0.7;
  font-style: italic;
  margin: 0 0 1rem;
}

.form-optional {
  font-family: var(--font-body);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: normal;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   Labels & Inputs
   -------------------------------------------------------------------------- */
.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--purple);
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--charcoal);
  background: transparent;
  border: none;
  border-bottom: 3px solid var(--cream-dark);
  outline: none;
  transition: border-color var(--transition-base);
}

.form-input::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

.form-input:focus {
  border-bottom-color: var(--orange);
  outline: none;
}

.form-input:focus-visible {
  outline: none;
  border-bottom-color: var(--orange);
}

.form-input.has-error {
  border-bottom-color: var(--magenta);
}

/* --------------------------------------------------------------------------
   Validation Errors
   -------------------------------------------------------------------------- */
.form-error {
  display: none;
  font-size: 0.85rem;
  color: var(--magenta);
  margin-top: 0.3rem;
  line-height: 1.3;
}

.form-error[role="alert"] {
  display: block;
}

/* --------------------------------------------------------------------------
   Checkbox Groups
   -------------------------------------------------------------------------- */
.checkbox-group {
  margin-bottom: 1.5rem;
}

.checkbox-group__label {
  font-family: var(--font-display);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--purple);
  margin-bottom: 0.75rem;
  display: block;
}

.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.checkbox-item input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.checkbox-item label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  color: var(--charcoal);
  background: var(--cream);
  border: 2px solid var(--cream-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.checkbox-item label:hover {
  border-color: var(--magenta);
}

.checkbox-item label::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--cream-dark);
  background: var(--white);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.checkbox-item input[type="checkbox"]:checked + label {
  border-color: var(--magenta);
  background: rgba(233, 30, 99, 0.06);
}

.checkbox-item input[type="checkbox"]:checked + label::before {
  background: var(--magenta);
  border-color: var(--magenta);
  /* Checkmark via box-shadow trick */
  box-shadow:
    inset 2px -2px 0 var(--white),
    inset -2px 2px 0 var(--white);
}

.checkbox-item input[type="checkbox"]:focus-visible + label {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* "Other" free text input */
.other-text-wrap {
  width: 100%;
  margin-top: 0.5rem;
  display: none;
}

.other-text-wrap.is-visible {
  display: block;
}

.other-text-wrap .form-input {
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Honeypot
   -------------------------------------------------------------------------- */
.form-hp {
  position: absolute;
  left: -9999px;
}

/* --------------------------------------------------------------------------
   Submit Button
   -------------------------------------------------------------------------- */
.form-submit {
  display: block;
  width: 100%;
  padding: 1rem 2rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--white);
  background: var(--magenta);
  border: none;
  cursor: pointer;
  transform: rotate(-1deg);
  transition: all var(--transition-fast);
  margin-top: 0.5rem;
}

.form-submit:hover {
  background: var(--magenta-dark);
  transform: rotate(0deg) scale(1.02);
}

.form-submit:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.form-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: rotate(0deg);
}

/* Loading pulse */
.form-submit.is-loading {
  animation: btnPulse 1.2s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.9; }
}

/* --------------------------------------------------------------------------
   Success State
   -------------------------------------------------------------------------- */
.form-success {
  display: none;
  text-align: center;
  padding: 2rem 0;
}

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

.form-success__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.form-success h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--purple);
  margin: 0 0 0.75rem;
}

.form-success p {
  font-size: 1.05rem;
  color: var(--charcoal);
  opacity: 0.85;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.form-success a {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--orange);
  color: var(--charcoal);
  text-decoration: none;
  transform: rotate(1deg);
  transition: all var(--transition-fast);
}

.form-success a:hover {
  background: var(--orange-bright);
  color: var(--charcoal);
  transform: rotate(0deg) scale(1.02);
}

/* Error fallback */
.form-fail {
  display: none;
  text-align: center;
  padding: 1.5rem 0;
}

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

.form-fail p {
  font-size: 1rem;
  color: var(--magenta);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.form-fail a {
  color: var(--magenta-dark);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Footer (matches issue page pattern)
   -------------------------------------------------------------------------- */
.form-footer {
  background: var(--slate);
  padding: 1.5rem;
  text-align: center;
}

.form-footer__disclaimer {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 0.75rem;
}

.form-footer__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.form-footer__links a {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.form-footer__links a:hover {
  color: var(--orange);
}

.form-footer__links svg {
  display: block;
}

/* --------------------------------------------------------------------------
   Animations — Scroll Reveal
   -------------------------------------------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in:nth-child(2) { transition-delay: 0.1s; }
.fade-in:nth-child(3) { transition-delay: 0.15s; }

/* --------------------------------------------------------------------------
   Focus States
   -------------------------------------------------------------------------- */
:focus {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .form-submit.is-loading {
    animation: none;
    opacity: 0.7;
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */
@media print {
  .form-header,
  .form-footer {
    display: none;
  }
}
