/* =============================================================
   Learnfyra — Frontend Styles v2.0
   File: frontend/css/styles.css
   Design: School Kids Aesthetic — Energetic, Joyful, Trustworthy
   ============================================================= */

/* ---------------------------------------------------------------
   Design Tokens — Color System
   --------------------------------------------------------------- */
:root {
  /* Core palette */
  --color-sky:        #3B82F6;   /* bright blue — trust, learning */
  --color-sky-dark:   #1D4ED8;   /* deep blue — hover, depth */
  --color-sky-soft:   #DBEAFE;   /* light blue tint */
  --color-sun:        #FBBF24;   /* amber yellow — energy, highlight */
  --color-sun-dark:   #D97706;   /* dark amber */
  --color-sun-soft:   #FEF3C7;   /* pale yellow tint */
  --color-leaf:       #10B981;   /* emerald green — correct, success */
  --color-leaf-dark:  #059669;
  --color-leaf-soft:  #D1FAE5;
  --color-coral:      #F97316;   /* orange — CTAs, solve button */
  --color-coral-dark: #EA580C;
  --color-coral-soft: #FFEDD5;
  --color-berry:      #8B5CF6;   /* purple — premium, answer key */
  --color-berry-dark: #7C3AED;
  --color-berry-soft: #EDE9FE;
  --color-chalk:      #F8FAFC;   /* near-white background */
  --color-ink:        #1E293B;   /* deep navy text */
  --color-ink-soft:   #475569;   /* muted text */
  --color-cloud:      #E2E8F0;   /* borders, dividers */
  --color-cloud-dark: #CBD5E1;
  --color-white:      #FFFFFF;
  --color-error:      #EF4444;
  --color-error-bg:   #FEF2F2;
  --color-error-border: #FECACA;

  /* Semantic aliases */
  --primary:          var(--color-sky);
  --primary-dark:     var(--color-sky-dark);
  --primary-soft:     var(--color-sky-soft);
  --bg:               var(--color-chalk);
  --surface:          var(--color-white);
  --surface-soft:     #F1F5F9;
  --text:             var(--color-ink);
  --text-muted:       var(--color-ink-soft);
  --border:           var(--color-cloud);
  --accent:           var(--color-coral);
  --success:          var(--color-leaf);
  --success-bg:       var(--color-leaf-soft);
  --error:            var(--color-error);
  --error-bg:         var(--color-error-bg);
  --error-border:     var(--color-error-border);

  /* Button colors */
  --btn-pdf:          #EF4444;
  --btn-pdf-dark:     #DC2626;
  --btn-docx:         #3B82F6;
  --btn-docx-dark:    #2563EB;
  --btn-html:         #10B981;
  --btn-html-dark:    #059669;
  --btn-key:          #8B5CF6;
  --btn-key-dark:     #7C3AED;

  /* Shape tokens */
  --radius-xs:        6px;
  --radius:           10px;
  --radius-md:        14px;
  --radius-lg:        20px;
  --radius-xl:        28px;
  --radius-pill:      999px;

  /* Shadow tokens */
  --shadow-xs:        0 1px 3px rgb(0 0 0 / 0.07);
  --shadow-sm:        0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow:           0 10px 24px -4px rgb(0 0 0 / 0.10), 0 4px 8px -4px rgb(0 0 0 / 0.06);
  --shadow-hover:     0 16px 32px -4px rgb(0 0 0 / 0.14), 0 6px 12px -4px rgb(0 0 0 / 0.08);
  --shadow-btn:       0 4px 12px rgb(59 130 246 / 0.35);
  --shadow-btn-coral: 0 4px 12px rgb(249 115 22 / 0.40);

  /* Typography */
  --font:         'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Nunito', var(--font);
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Animation */
  --transition:     180ms ease;
  --transition-md:  280ms ease;
  --transition-lg:  400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    /* Pencil-stripe accent — subtle diagonal pattern */
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 28px,
      rgb(59 130 246 / 0.022) 28px,
      rgb(59 130 246 / 0.022) 29px
    ),
    /* Radial warm glow top-right */
    radial-gradient(ellipse 60% 40% at 90% 0%, rgb(251 191 36 / 0.12) 0%, transparent 60%),
    /* Radial cool glow top-left */
    radial-gradient(ellipse 50% 35% at 5% 5%, rgb(59 130 246 / 0.10) 0%, transparent 55%),
    /* Subtle bottom gradient */
    linear-gradient(180deg, #F8FAFC 0%, #EEF4FF 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Background orbs — CSS-only decorative blobs */
.bg-orb {
  position: fixed;
  border-radius: var(--radius-pill);
  pointer-events: none;
  z-index: -1;
  opacity: 0;  /* hidden — background is handled by body gradient */
}

/* ---------------------------------------------------------------
   Layout
   --------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.main-content {
  flex: 1;
  padding: var(--space-10) 0 var(--space-12);
}

/* ---------------------------------------------------------------
   Header — Notebook-tab style
   --------------------------------------------------------------- */
.site-header {
  background: var(--color-white);
  border-bottom: 3px solid var(--color-sky);
  box-shadow: 0 2px 16px rgb(59 130 246 / 0.10);
  padding: 0.875rem 0;
  position: relative;
}

/* Colorful top accent strip — like notebook tabs */
.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--color-sky)   0%   20%,
    var(--color-sun)   20%  40%,
    var(--color-leaf)  40%  60%,
    var(--color-coral) 60%  80%,
    var(--color-berry) 80%  100%
  );
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.logo-icon {
  font-size: 1.75rem;
  /* CSS-only rotating accent behind the icon */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  background: linear-gradient(135deg, var(--color-sky) 0%, var(--color-berry) 100%);
  border-radius: 10px;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 2px 8px rgb(59 130 246 / 0.35);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.02em;
}

.logo-accent {
  color: var(--color-sky);
}

.header-tagline {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-left: 2px solid var(--color-cloud);
  padding-left: var(--space-6);
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------
   Hero — Energetic banner with ruled-line decoration
   --------------------------------------------------------------- */
.hero {
  margin-bottom: var(--space-6);
  padding: var(--space-8) 0 var(--space-6);
  animation: fadeRise 380ms ease-out both;
  position: relative;
}

/* Notebook ruling lines behind hero text */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    transparent,
    transparent calc(2rem - 1px),
    rgb(59 130 246 / 0.07) calc(2rem - 1px),
    rgb(59 130 246 / 0.07) 2rem
  );
  pointer-events: none;
  z-index: -1;
  border-radius: var(--radius-lg);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-sky-dark);
  background: var(--color-sky-soft);
  border: 1.5px solid rgb(59 130 246 / 0.25);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.8rem;
  margin-bottom: var(--space-3);
}

/* Star dot before kicker */
.hero-kicker::before {
  content: '★';
  font-size: 0.65rem;
  color: var(--color-sun);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.025em;
  color: var(--color-ink);
  margin-bottom: var(--space-3);
}

/* Underline accent on last word via a span if desired — works without it */
.hero-title-highlight {
  color: var(--color-sky);
  position: relative;
}

.hero-subtitle {
  max-width: 660px;
  color: var(--text-muted);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.65;
}

/* ---------------------------------------------------------------
   Card — Paper-on-desk look with warm shadow
   --------------------------------------------------------------- */
.card {
  background: var(--color-white);
  border: 1.5px solid var(--color-cloud);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-8) 2.25rem;
  margin-bottom: var(--space-6);
  position: relative;
  transition: box-shadow var(--transition-md);
}

/* Colored left-edge tab on cards — like folder tabs */
.card::before {
  content: '';
  position: absolute;
  top: var(--space-6);
  bottom: var(--space-6);
  left: -1.5px;
  width: 4px;
  background: linear-gradient(180deg, var(--color-sky) 0%, var(--color-berry) 100%);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.reveal {
  animation: fadeRise 460ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.card--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-8);
  text-align: center;
}

.card-header {
  margin-bottom: var(--space-6);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.card-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.55;
}

/* Section titles inside form card */
.form-section-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-sky-dark);
  margin: 0 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Dot accent before section titles */
.form-section-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-sky);
  flex-shrink: 0;
}

.form-grid + .form-section-title {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1.5px dashed var(--color-cloud);
}

/* ---------------------------------------------------------------
   Form Grid
   --------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-6);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group--full {
  grid-column: 1 / -1;
}

/* ---------------------------------------------------------------
   Labels & Inputs
   --------------------------------------------------------------- */
.form-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: 0.01em;
}

.required {
  color: var(--color-error);
  margin-left: 2px;
}

.optional-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--color-cloud);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.5rem;
  margin-left: var(--space-2);
  vertical-align: middle;
  line-height: 1.5;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
}

.form-select,
.form-input {
  width: 100%;
  min-height: 2.875rem;
  padding: 0.6875rem 1rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-ink);
  background-color: var(--surface-soft);
  border: 2px solid var(--color-cloud);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background-color var(--transition);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.75rem;
  cursor: pointer;
}

.form-input {
  appearance: none;
}

.form-input::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--color-sky);
  background-color: var(--color-white);
  box-shadow: 0 0 0 4px rgb(59 130 246 / 0.14);
}

.form-select:disabled {
  background-color: #F1F5F9;
  color: #94A3B8;
  cursor: not-allowed;
  opacity: 1;
  border-color: #E2E8F0;
}

.form-select.is-invalid,
.form-input.is-invalid {
  border-color: var(--color-error);
  box-shadow: 0 0 0 4px rgb(239 68 68 / 0.12);
}

/* ---------------------------------------------------------------
   Field Errors
   --------------------------------------------------------------- */
.field-error {
  font-size: 0.8125rem;
  color: var(--color-error);
  font-weight: 600;
  min-height: 1rem;
  display: block;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------
   Checkbox — Custom pill-shaped toggle-adjacent style
   --------------------------------------------------------------- */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-cloud);
  background: var(--surface-soft);
  transition: border-color var(--transition), background-color var(--transition);
}

.checkbox-label:has(.checkbox-input:checked) {
  border-color: var(--color-sky);
  background: var(--color-sky-soft);
}

.checkbox-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-cloud-dark);
  border-radius: var(--radius-xs);
  background-color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), border-color var(--transition), transform 120ms ease;
}

.checkbox-input:checked + .checkbox-custom {
  background-color: var(--color-sky);
  border-color: var(--color-sky);
  transform: scale(1.05);
}

.checkbox-input:checked + .checkbox-custom::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}

.checkbox-input:focus-visible + .checkbox-custom {
  outline: 3px solid var(--color-sky);
  outline-offset: 2px;
}

.checkbox-text {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-ink);
}

/* ---------------------------------------------------------------
   Form Actions
   --------------------------------------------------------------- */
.form-actions {
  margin-top: var(--space-8);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------
   Button System
   --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.625rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition:
    background-color var(--transition),
    box-shadow var(--transition),
    transform 120ms ease,
    opacity var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Ripple shimmer on hover */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.btn:hover:not(:disabled)::after {
  opacity: 1;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Primary — Sky blue with depth */
.btn--primary {
  background: linear-gradient(145deg, var(--color-sky) 0%, var(--color-sky-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(145deg, #2563EB 0%, #1E40AF 100%);
  box-shadow: 0 6px 20px rgb(59 130 246 / 0.45);
  transform: translateY(-1px);
}

.btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Secondary — Clean outlined */
.btn--secondary {
  background: var(--color-white);
  color: var(--color-ink);
  border: 2px solid var(--color-cloud);
  box-shadow: var(--shadow-xs);
}

.btn--secondary:hover {
  background: var(--surface-soft);
  border-color: var(--color-cloud-dark);
  transform: translateY(-1px);
}

/* Format buttons */
.btn--pdf {
  background: linear-gradient(145deg, #EF4444 0%, #DC2626 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgb(239 68 68 / 0.30);
}
.btn--pdf:hover {
  background: linear-gradient(145deg, #DC2626 0%, #B91C1C 100%);
  box-shadow: 0 6px 16px rgb(239 68 68 / 0.40);
  transform: translateY(-1px);
}

.btn--docx {
  background: linear-gradient(145deg, #3B82F6 0%, #2563EB 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgb(59 130 246 / 0.30);
}
.btn--docx:hover {
  background: linear-gradient(145deg, #2563EB 0%, #1D4ED8 100%);
  box-shadow: 0 6px 16px rgb(59 130 246 / 0.40);
  transform: translateY(-1px);
}

.btn--html {
  background: linear-gradient(145deg, #10B981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgb(16 185 129 / 0.30);
}
.btn--html:hover {
  background: linear-gradient(145deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 16px rgb(16 185 129 / 0.40);
  transform: translateY(-1px);
}

.btn--key {
  background: linear-gradient(145deg, #8B5CF6 0%, #7C3AED 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgb(139 92 246 / 0.30);
}
.btn--key:hover {
  background: linear-gradient(145deg, #7C3AED 0%, #6D28D9 100%);
  box-shadow: 0 6px 16px rgb(139 92 246 / 0.40);
  transform: translateY(-1px);
}

/* Solve button — Energetic coral/orange */
.btn--solve {
  background: linear-gradient(145deg, var(--color-coral) 0%, var(--color-coral-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-btn-coral);
}

.btn--solve:hover {
  background: linear-gradient(145deg, #EA580C 0%, #C2410C 100%);
  box-shadow: 0 6px 20px rgb(249 115 22 / 0.50);
  transform: translateY(-1px);
}

/* ---------------------------------------------------------------
   Loading Spinner — Segmented ring design
   --------------------------------------------------------------- */
.spinner {
  width: 3.25rem;
  height: 3.25rem;
  border: 4px solid var(--color-sky-soft);
  border-top-color: var(--color-sky);
  border-right-color: var(--color-sun);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-ink);
}

.loading-subtext {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------------------------------------------------------------
   Results Section — Celebratory success state
   --------------------------------------------------------------- */
.results-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.success-badge {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, var(--color-leaf) 0%, #0d9488 100%);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  font-weight: 900;
  box-shadow: 0 4px 14px rgb(16 185 129 / 0.40);
  animation: popIn 400ms var(--transition-lg) both;
}

@keyframes popIn {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}

.download-btn {
  font-size: 0.9375rem;
}

/* ---------------------------------------------------------------
   Error Box
   --------------------------------------------------------------- */
.error-box {
  background: var(--color-error-bg);
  border: 2px solid var(--color-error-border);
  border-left: 5px solid var(--color-error);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-6);
}

.error-box__inner {
  margin-bottom: var(--space-3);
}

.error-box__title {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-error);
  margin-bottom: var(--space-2);
}

.error-box__message {
  font-size: 0.9375rem;
  color: var(--color-ink);
  font-weight: 500;
}

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.site-footer {
  border-top: 2px solid var(--color-cloud);
  padding: var(--space-5) 0;
  background: var(--color-white);
  margin-top: auto;
}

.footer-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------
   Animations
   --------------------------------------------------------------- */
@keyframes fadeRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------------------------------------------------------------
   Utility: hidden
   --------------------------------------------------------------- */
[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------
   Responsive — Mobile first
   --------------------------------------------------------------- */
@media (max-width: 640px) {
  .main-content {
    padding-top: var(--space-6);
  }

  .hero {
    padding: var(--space-4) 0 var(--space-4);
  }

  .hero-subtitle {
    font-size: 0.9375rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group--full {
    grid-column: 1;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .header-tagline {
    border-left: none;
    padding-left: 0;
    font-size: 0.78rem;
  }

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

  .card::before {
    top: var(--space-4);
    bottom: var(--space-4);
  }

  .results-header {
    flex-direction: column;
    gap: var(--space-3);
  }

  .form-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------------------------------------------------------------
   Print — preserve worksheet print functionality
   --------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .hero,
  .form-actions,
  .bg-orb {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
