/* =============================================================
   CoupoZ - Custom Styles
   Edit colors by changing the --brand-* custom properties below.
   ============================================================= */

/* ---- Root variables ---- */
:root {
  --brand-500: #6C3EFF;
  --brand-600: #5a2de7;
  --radius-card: 1rem;
  --transition-base: 200ms ease;
}

/* ---- Scroll offset for fixed header ---- */
html {
  scroll-padding-top: 80px;
}

/* ---- Body base ---- */
body {
  font-family: 'Inter', system-ui, sans-serif;
}

/* =============================================================
   SKIP LINK (keyboard / screen reader navigation)
   ============================================================= */

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  background: var(--brand-500);
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* =============================================================
   SCREEN-READER ONLY UTILITY
   ============================================================= */

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

/* =============================================================
   ANIMATIONS
   ============================================================= */

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadein-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fadein {
  animation: fadein 0.6s ease both;
}

.animate-fadein-up {
  animation: fadein-up 0.6s ease both;
}

/* Intersection Observer reveal class */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  transition-delay: var(--delay, 0ms);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================================
   REDUCED MOTION  — honour user preference
   Disables all non-essential animations and transitions.
   ============================================================= */

@media (prefers-reduced-motion: reduce) {
  .animate-fadein,
  .animate-fadein-up {
    animation: none;
    opacity: 1;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Keep colour transition on FAQ icon but remove rotation */
  .faq-icon {
    transition: color 0ms;
  }

  .faq-item.open .faq-icon {
    transform: none;
  }

  /* Remove card lift-on-hover transforms */
  .problem-card:hover,
  .step-card:hover,
  .use-case-card:hover,
  .metric-card:hover {
    transform: none;
  }

  /* Remove slide animation on FAQ panels */
  .faq-answer-inner {
    transition: none;
  }

  /* Skip-link transition not needed */
  .skip-link {
    transition: none;
  }
}

/* =============================================================
   SECTION TYPOGRAPHY HELPERS
   ============================================================= */

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-500);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: inherit;
  margin-bottom: 1rem;
}

.dark .section-title {
  color: #fff;
}

/* Contrast-fixed: #5C6370 gives ~5.5:1 on white, passing WCAG AA */
.section-sub {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #5C6370;
}

.dark .section-sub {
  color: #9CA3AF;
}

/* =============================================================
   PROBLEM CARDS
   ============================================================= */

.problem-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 1.75rem;
  border: 1px solid #F3F4F6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.dark .problem-card {
  background: #111827;
  border-color: #1F2937;
}

.problem-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.09);
  transform: translateY(-3px);
}

.problem-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  margin-bottom: 1.25rem;
}

/* =============================================================
   STEP CARDS (HOW IT WORKS)
   ============================================================= */

.step-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius-card);
  padding: 2rem 1.5rem;
  border: 1px solid #F3F4F6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.dark .step-card {
  background: #111827;
  border-color: #1F2937;
}

.step-card:hover {
  box-shadow: 0 8px 24px rgba(108,62,255,0.12);
  transform: translateY(-3px);
}

.step-number {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  color: #F3F4F6;
  margin-bottom: 0.5rem;
  user-select: none;
  letter-spacing: -0.04em;
}

.dark .step-number {
  color: #1F2937;
}

.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background: #F0EBFF;
  color: var(--brand-500);
  margin-bottom: 1rem;
}

.dark .step-icon {
  background: rgba(108,62,255,0.15);
}

/* =============================================================
   USE CASE CARDS
   ============================================================= */

.use-case-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 2rem;
  border: 1px solid #F3F4F6;
  border-top-width: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.dark .use-case-card {
  background: #111827;
  border-color: #1F2937;
  border-top-color: inherit;
}

.use-case-card:hover {
  box-shadow: 0 10px 28px rgba(0,0,0,0.10);
  transform: translateY(-4px);
}

.use-case-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  margin-bottom: 1.25rem;
}

.use-case-bullet {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: #374151;
}

.dark .use-case-bullet {
  color: #D1D5DB;
}

.use-case-bullet::before {
  content: '';
  display: block;
  margin-top: 0.4rem;
  flex-shrink: 0;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--brand-500);
}

/* =============================================================
   METRIC CARDS
   ============================================================= */

.metric-card {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-card);
  padding: 1.75rem 1.25rem;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: background var(--transition-base), transform var(--transition-base);
}

.metric-card:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-3px);
}

.metric-value {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* Contrast-fixed: rgba(255,255,255,0.95) gives ~5.4:1 on brand-500, passing WCAG AA */
.metric-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255,255,255,0.95);
  line-height: 1.4;
}

/* =============================================================
   FAQ ACCORDION
   ============================================================= */

.faq-item {
  background: #fff;
  border-radius: var(--radius-card);
  border: 1px solid #E5E7EB;
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.dark .faq-item {
  background: #111827;
  border-color: #1F2937;
}

.faq-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.07);
}

.faq-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.25rem 1.5rem;
  text-align: left;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111827;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--transition-base);
}

.dark .faq-trigger {
  color: #F9FAFB;
}

.faq-trigger:hover {
  color: var(--brand-500);
}

.faq-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: #9CA3AF;
  transition: transform 0.3s ease, color 0.2s ease;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
  color: var(--brand-500);
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
  font-size: 0.9rem;
  line-height: 1.75;
  color: #4B5563;
}

.dark .faq-answer {
  color: #9CA3AF;
}

/* Animated expand/collapse */
.faq-answer-inner {
  overflow: hidden;
  transition: max-height 0.35s ease;
  max-height: 0;
}

.faq-item.open .faq-answer-inner {
  max-height: 600px;
}

/* =============================================================
   HEADER SCROLL SHADOW
   ============================================================= */

#site-header.scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

/* =============================================================
   FOCUS STYLES (accessibility)
   ============================================================= */

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 4px;
}

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

@media (max-width: 640px) {
  .section-title {
    font-size: 1.75rem;
  }
}

/* =============================================================
   ACCESSIBILITY TOOLBAR
   Floating button (bottom-left) + side drawer from left edge.
   All selectors are prefixed with .a11y- to avoid conflicts.
   ============================================================= */

/* ---- Floating toggle button ---- */
.a11y-btn {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 9003;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--brand-500);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(108, 62, 255, 0.45);
  transition: background 0.2s ease, box-shadow 0.2s ease,
              transform 0.15s ease;
}

.a11y-btn:hover {
  background: var(--brand-600);
  box-shadow: 0 4px 18px rgba(108, 62, 255, 0.55);
  transform: scale(1.06);
}

.a11y-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--brand-500);
}

/* ---- Backdrop overlay ---- */
.a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.a11y-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.dark .a11y-backdrop {
  background: rgba(0, 0, 0, 0.62);
}

/* ---- Side drawer panel ---- */
.a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 20rem;
  max-width: 85vw;
  z-index: 9002;
  background: #fff;
  border: none;
  border-right: 1px solid #e5e7eb;
  border-radius: 0;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.a11y-panel[aria-hidden="false"] {
  transform: translateX(0);
  pointer-events: auto;
}

.dark .a11y-panel {
  background: #1f2937;
  border-right-color: #374151;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.5);
}

/* ---- Panel header ---- */
.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.dark .a11y-panel-header {
  border-bottom-color: #374151;
}

.a11y-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.dark .a11y-panel-title {
  color: #f9fafb;
}

/* ---- Close button ---- */
.a11y-close {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.a11y-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.dark .a11y-close {
  color: #9ca3af;
}

.dark .a11y-close:hover {
  background: #374151;
  color: #f9fafb;
}

.a11y-close:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ---- Panel body (scrollable) ---- */
.a11y-panel-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
}

/* ---- Text-size row ---- */
.a11y-text-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.25rem;
}

.a11y-text-label {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  line-height: 1.4;
}

.dark .a11y-text-label {
  color: #d1d5db;
}

.a11y-size-display {
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 2.75rem;
  text-align: center;
  color: #6b7280;
}

.dark .a11y-size-display {
  color: #9ca3af;
}

/* ---- Step buttons (text +/-) ---- */
.a11y-step-btn {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.a11y-step-btn:hover:not(:disabled) {
  background: #f0ebff;
  border-color: var(--brand-500);
  color: var(--brand-500);
}

.a11y-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dark .a11y-step-btn {
  background: #374151;
  border-color: #4b5563;
  color: #d1d5db;
}

.dark .a11y-step-btn:hover:not(:disabled) {
  background: rgba(108, 62, 255, 0.2);
  border-color: var(--brand-500);
  color: #a78bfa;
}

.a11y-step-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* ---- Toggle row (label + switch) ---- */
.a11y-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.25rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.a11y-toggle-row:hover {
  background: #f9fafb;
}

.dark .a11y-toggle-row:hover {
  background: #374151;
}

.a11y-toggle-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  line-height: 1.4;
  user-select: none;
}

.dark .a11y-toggle-label {
  color: #d1d5db;
}

/* ---- Toggle switch (visual) ---- */
.a11y-switch {
  position: relative;
  display: inline-block;
  width: 2.5rem;
  height: 1.375rem;
  flex-shrink: 0;
}

.a11y-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.a11y-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  background: #d1d5db;
  cursor: pointer;
  transition: background 0.2s ease;
}

.a11y-switch input:checked + .a11y-switch-track {
  background: var(--brand-500);
}

.a11y-switch input:focus-visible + .a11y-switch-track {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.a11y-switch-track::after {
  content: '';
  position: absolute;
  left: 0.125rem;
  top: 0.125rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.a11y-switch input:checked + .a11y-switch-track::after {
  transform: translateX(1.125rem);
}

/* ---- Divider ---- */
.a11y-divider {
  height: 1px;
  background: #f3f4f6;
  margin: 0.25rem 0;
}

.dark .a11y-divider {
  background: #374151;
}

/* ---- Reset button ---- */
.a11y-reset-btn {
  width: 100%;
  padding: 0.4375rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  margin-top: 0.125rem;
}

.a11y-reset-btn:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

.dark .a11y-reset-btn {
  border-color: #4b5563;
  color: #9ca3af;
}

.dark .a11y-reset-btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #f87171;
  border-color: #f87171;
}

.a11y-reset-btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* =============================================================
   ACCESSIBILITY FEATURE CLASSES
   Applied to <html> element and cascade into the whole page.
   All use !important to override Tailwind utility classes.
   ============================================================= */

/* ---- High contrast ---- */
html.a11y-high-contrast * {
  color: #fff !important;
}

html.a11y-high-contrast body {
  background-color: #000 !important;
}

html.a11y-high-contrast header,
html.a11y-high-contrast #site-header,
html.a11y-high-contrast #mobile-menu {
  background-color: #0a0a0a !important;
  border-color: #444 !important;
}

html.a11y-high-contrast footer {
  background-color: #0a0a0a !important;
}

html.a11y-high-contrast section,
html.a11y-high-contrast main {
  background-color: #000 !important;
  background-image: none !important;
}

/* Cards get a slightly lighter bg for visual separation */
html.a11y-high-contrast .problem-card,
html.a11y-high-contrast .step-card,
html.a11y-high-contrast .use-case-card,
html.a11y-high-contrast .faq-item {
  background-color: #111 !important;
  border-color: #555 !important;
}

html.a11y-high-contrast .metric-card {
  background-color: #111 !important;
  border: 1px solid #555 !important;
  backdrop-filter: none !important;
}

/* Links: yellow for strong contrast against black */
html.a11y-high-contrast a:not(.a11y-btn):not(.a11y-close):not(.a11y-reset-btn) {
  color: #ffff00 !important;
}

html.a11y-high-contrast a:focus-visible,
html.a11y-high-contrast button:focus-visible {
  outline-color: #ffff00 !important;
}

/* Keep toolbar panel readable in high-contrast mode */
html.a11y-high-contrast .a11y-panel {
  background-color: #1c1c1c !important;
  border-right-color: #555 !important;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.8) !important;
}

html.a11y-high-contrast .a11y-panel-header {
  border-bottom-color: #444 !important;
}

html.a11y-high-contrast .a11y-step-btn {
  background-color: #2a2a2a !important;
  border-color: #666 !important;
}

html.a11y-high-contrast .a11y-divider {
  background-color: #444 !important;
}

html.a11y-high-contrast .a11y-switch-track {
  background-color: #555 !important;
}

html.a11y-high-contrast .a11y-switch input:checked + .a11y-switch-track {
  background-color: #7c5cff !important;
}

html.a11y-high-contrast .a11y-toggle-row:hover {
  background-color: #2a2a2a !important;
}

html.a11y-high-contrast .a11y-reset-btn {
  border-color: #555 !important;
}

html.a11y-high-contrast .a11y-btn {
  background-color: #4400cc !important;
  box-shadow: 0 2px 12px rgba(68, 0, 204, 0.6) !important;
}

/* ---- Underline links ---- */
html.a11y-underline-links a {
  text-decoration: underline !important;
}

/* ---- Reduce motion (JS-triggered; mirrors prefers-reduced-motion) ---- */
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

html.a11y-reduce-motion .reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

html.a11y-reduce-motion .faq-answer-inner {
  transition: none !important;
}

html.a11y-reduce-motion .a11y-panel {
  transition: none !important;
}

html.a11y-reduce-motion .a11y-backdrop {
  transition: none !important;
}

/* ---- Comfortable text spacing ---- */
html.a11y-readable-text body {
  line-height: 1.85 !important;
  letter-spacing: 0.02em !important;
  word-spacing: 0.1em !important;
}

html.a11y-readable-text p,
html.a11y-readable-text li,
html.a11y-readable-text .section-sub,
html.a11y-readable-text .faq-answer {
  max-width: 68ch;
}

/* ---- Readable font (Verdana — wider letterforms, good readability) ---- */
html.a11y-readable-font,
html.a11y-readable-font body,
html.a11y-readable-font button,
html.a11y-readable-font input,
html.a11y-readable-font a {
  font-family: Verdana, Geneva, 'DejaVu Sans', sans-serif !important;
}

/* Restore Inter for the toolbar panel — keep it consistent */
html.a11y-readable-font .a11y-panel,
html.a11y-readable-font .a11y-panel * {
  font-family: 'Inter', system-ui, sans-serif !important;
}
