/* ═══════════════════════════════════════════════════════════════════════════
   MarkItUp — Premium Design System
   Design tokens + Component styles + Animations + Responsive layout
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. DESIGN TOKENS ──────────────────────────────────────────────────── */
:root {
  /* Colors */
  --color-bg:            #F8FAFC;
  --color-bg-subtle:     #F1F5F9;
  --color-surface:       #FFFFFF;
  --color-surface-raised:#FFFFFF;
  --color-border:        #E2E8F0;
  --color-border-subtle: #F1F5F9;

  --color-primary:       #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-light: #EFF6FF;
  --color-primary-ring:  rgba(37, 99, 235, 0.25);

  --color-text:          #0F172A;
  --color-text-secondary:#475569;
  --color-text-muted:    #94A3B8;
  --color-text-on-primary: #FFFFFF;

  --color-success:       #22C55E;
  --color-success-light: #F0FDF4;
  --color-success-text:  #166534;
  --color-error:         #EF4444;
  --color-error-light:   #FEF2F2;
  --color-error-text:    #991B1B;
  --color-warning:       #F59E0B;
  --color-warning-light: #FFFBEB;
  --color-warning-text:  #92400E;
  --color-info:          #3B82F6;
  --color-info-light:    #EFF6FF;
  --color-info-text:     #1E40AF;

  /* Accent palette for category icons */
  --color-accent-blue:   #2563EB;
  --color-accent-green:  #22C55E;
  --color-accent-purple: #8B5CF6;
  --color-accent-amber:  #F59E0B;
  --color-accent-red:    #EF4444;
  --color-accent-teal:   #14B8A6;
  --color-accent-rose:   #F43F5E;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;

  /* Font sizes */
  --text-xs:   0.75rem;     /* 12px */
  --text-sm:   0.875rem;    /* 14px */
  --text-base: 1rem;        /* 16px */
  --text-lg:   1.125rem;    /* 18px */
  --text-xl:   1.25rem;     /* 20px */
  --text-2xl:  1.5rem;      /* 24px */
  --text-3xl:  2rem;        /* 32px */
  --text-4xl:  2.5rem;      /* 40px */
  --text-5xl:  3rem;        /* 48px */

  /* Font weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Spacing */
  --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;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 4px 6px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:  0 10px 15px rgba(15, 23, 42, 0.08), 0 4px 6px rgba(15, 23, 42, 0.04);
  --shadow-xl:  0 20px 25px rgba(15, 23, 42, 0.10), 0 8px 10px rgba(15, 23, 42, 0.04);
  --shadow-2xl: 0 40px 60px rgba(15, 23, 42, 0.14);
  --shadow-focus: 0 0 0 3px var(--color-primary-ring);

  /* Transitions */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── 1b. DARK THEME TOKENS ─────────────────────────────────────────────── */
[data-theme="dark"] {
  /* Surfaces */
  --color-bg:            #0C1117;
  --color-bg-subtle:     #161B22;
  --color-surface:       #0D1117;
  --color-surface-raised:#161B22;
  --color-border:        #30363D;
  --color-border-subtle: #21262D;

  /* Primary — slightly brighter for dark bg contrast */
  --color-primary:       #3B82F6;
  --color-primary-hover: #60A5FA;
  --color-primary-light: rgba(59, 130, 246, 0.12);
  --color-primary-ring:  rgba(59, 130, 246, 0.30);

  /* Text */
  --color-text:            #E6EDF3;
  --color-text-secondary:  #8B949E;
  --color-text-muted:      #484F58;
  --color-text-on-primary: #FFFFFF;

  /* Semantic */
  --color-success:       #3FB950;
  --color-success-light: rgba(63, 185, 80, 0.12);
  --color-success-text:  #3FB950;
  --color-error:         #F85149;
  --color-error-light:   rgba(248, 81, 73, 0.12);
  --color-error-text:    #F85149;
  --color-warning:       #D29922;
  --color-warning-light: rgba(210, 153, 34, 0.12);
  --color-warning-text:  #D29922;
  --color-info:          #58A6FF;
  --color-info-light:    rgba(88, 166, 255, 0.12);
  --color-info-text:     #58A6FF;

  /* Shadows become lighter-colored glows in dark mode */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.6), 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.65), 0 8px 10px rgba(0, 0, 0, 0.35);
  --shadow-2xl: 0 40px 60px rgba(0, 0, 0, 0.7);
}

/* ─── 2. RESET & BASE ───────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Prevent any element from creating horizontal scroll */
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal scroll from any overflow source */
  overflow-x: hidden;
  /* Smooth theme transition — covers background & text across the whole page */
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

input[type="file"] {
  display: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Focus styles — accessible for all interactive elements */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── 3. LAYOUT UTILITIES ───────────────────────────────────────────────── */
.section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  /* Prevent content from ever creating horizontal scroll */
  box-sizing: border-box;
  width: 100%;
}

.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  box-sizing: border-box;
  width: 100%;
}

/* ─── 4. REVEAL ANIMATIONS ──────────────────────────────────────────────── */
.reveal-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.reveal-right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-up.is-visible,
.reveal-right.is-visible {
  opacity: 1;
  transform: none;
}

/* Stagger delay utility via data-delay */
[data-delay="1"] { transition-delay: 80ms; }
[data-delay="2"] { transition-delay: 160ms; }
[data-delay="3"] { transition-delay: 240ms; }
[data-delay="4"] { transition-delay: 320ms; }
[data-delay="5"] { transition-delay: 400ms; }
[data-delay="6"] { transition-delay: 480ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal-up, .reveal-right {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ─── 5. NAVBAR ─────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .navbar {
  background: rgba(12, 17, 23, 0.92);
}

.navbar__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: opacity var(--transition-fast);
}

.navbar__logo:hover { opacity: 0.8; }
.navbar__logo:focus-visible { border-radius: var(--radius-md); }

.navbar__logo-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.navbar__logo-text { line-height: 1; }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.navbar__badge {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.navbar__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all var(--transition-fast);
}

.navbar__link:hover {
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ─── 6. HERO SECTION ───────────────────────────────────────────────────── */
.hero {
  padding: var(--space-20) 0 var(--space-16);
  overflow: hidden;
  position: relative;
}

/* Subtle grid background */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 50%, transparent 100%);
}

.hero__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
  /* Prevent hero from ever overflowing horizontally */
  width: 100%;
  box-sizing: border-box;
}

.hero__content {
  max-width: 560px;
}

.hero__eyebrow {
  margin-bottom: var(--space-5);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
}

.hero__headline {
  font-size: clamp(2rem, 5vw, var(--text-5xl));
  font-weight: var(--font-extrabold);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.hero__headline-accent {
  color: var(--color-primary);
  position: relative;
}

/* Subtle underline on the accent word */
.hero__headline-accent::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  opacity: 0.35;
}

.hero__description {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-8);
  max-width: 480px;
}

.hero__cta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.hero__stats {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.hero__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero__stat strong {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.hero__stat span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero__stat-divider {
  width: 1px;
  height: 32px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* ─── 6a. FLOW DIAGRAM ILLUSTRATION ─────────────────────────────────────── */
.hero__illustration {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-diagram {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  position: relative;
  /* Prevent diagram from ever overflowing its container */
  max-width: 100%;
  box-sizing: border-box;
}

.flow-sources {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.flow-file {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  animation: fileFloat 3s ease-in-out infinite;
}

.flow-file:nth-child(1) { animation-delay: 0s; }
.flow-file:nth-child(2) { animation-delay: 1s; }
.flow-file:nth-child(3) { animation-delay: 2s; }

@keyframes fileFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

.flow-file__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.flow-file__icon svg {
  width: 100%;
  height: 100%;
}

.flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-primary);
}

.flow-arrow__line {
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--color-primary), transparent);
  border-radius: 1px;
}

.flow-arrow__label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  white-space: nowrap;
  background: var(--color-primary-light);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.flow-arrow__head {
  color: var(--color-primary);
  animation: arrowPulse 2s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%, 100% { opacity: 0.5; transform: translateX(0); }
  50%       { opacity: 1;   transform: translateX(4px); }
}

/* Downward-pointing pulse — used when diagram stacks vertically on mobile */
@keyframes arrowPulseDown {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(4px); }
}

/* Vertical arrow variant — used when flow diagram is stacked vertically */
.flow-arrow--vertical {
  flex-direction: column;
  align-items: center;
}

.flow-arrow--vertical .flow-arrow__head {
  animation: arrowPulseDown 2s ease-in-out infinite;
}

@keyframes arrowPulseDown {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(4px); }
}

/* SVG inside arrow head — points right by default; rotated via class for down direction */
.flow-arrow--vertical .flow-arrow__head svg {
  transform: rotate(90deg);
}

.flow-output__card {
  width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.flow-output__header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border);
}

.flow-output__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.flow-output__dot--red    { background: #EF4444; }
.flow-output__dot--yellow { background: #F59E0B; }
.flow-output__dot--green  { background: #22C55E; }

.flow-output__filename {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

.flow-output__content {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.flow-output__line {
  height: 6px;
  border-radius: 3px;
  background: var(--color-border);
  animation: shimmer 2s ease-in-out infinite;
}

.flow-output__line--h1   { height: 10px; width: 70%; background: var(--color-primary); opacity: 0.4; }
.flow-output__line--h2   { height: 8px;  width: 50%; background: var(--color-primary); opacity: 0.25; }
.flow-output__line--text { width: 100%; }
.flow-output__line--code { background: var(--color-bg-subtle); border: 1px solid var(--color-border); }
.flow-output__line--short { width: 60%; }

@keyframes shimmer {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

/* ─── 7. BUTTONS ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px var(--space-5);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:active { transform: translateY(1px); }

/* Ripple effect */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.2);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:active::after { opacity: 1; }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn--primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

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

.btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--color-bg-subtle);
  color: var(--color-text);
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn--lg {
  padding: 12px var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* ─── 8. UPLOAD ZONE SECTION ────────────────────────────────────────────── */
.upload-zone-section {
  margin-bottom: var(--space-8);
}

.dropzone {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--transition-base),
    background-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast);
  outline: none;
}

.dropzone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.dropzone:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px var(--color-primary-ring), var(--shadow-lg);
}

.dropzone__default {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.dropzone.is-dragover .dropzone__default { display: none; }
.dropzone:not(.is-dragover) .dropzone__dragover { display: none; }

/* Upload icon with animated ring */
.dropzone__icon-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: var(--space-2);
}

.dropzone__icon-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.dropzone:hover .dropzone__icon-ring,
.dropzone:focus-visible .dropzone__icon-ring {
  opacity: 0.3;
  transform: scale(1);
}

.dropzone__icon {
  width: 72px;
  height: 72px;
  color: var(--color-primary);
  stroke: var(--color-primary);
  transition: transform var(--transition-spring);
}

.dropzone:hover .dropzone__icon { transform: translateY(-3px); }

.dropzone__title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-top: var(--space-2);
}

.dropzone__subtitle {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}

.dropzone__browse {
  color: var(--color-primary);
  font-weight: var(--font-semibold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dropzone__formats {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  letter-spacing: 0.02em;
}

/* Drag-over state content */
.dropzone__dragover {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  pointer-events: none;
}

.dropzone__dragover-icon {
  width: 56px;
  height: 56px;
  color: var(--color-primary);
  animation: bounceUp 0.6s ease-in-out infinite alternate;
}

.dropzone__dragover-icon svg { width: 100%; height: 100%; stroke: currentColor; }

@keyframes bounceUp {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}

.dropzone__dragover-text {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-primary);
  letter-spacing: -0.01em;
}

/* ─── 9. STATUS BANNER ──────────────────────────────────────────────────── */
.status-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-5);
  border: 1px solid transparent;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.status-banner.success {
  background: var(--color-success-light);
  color: var(--color-success-text);
  border-color: #BBF7D0;
}

.status-banner.error {
  background: var(--color-error-light);
  color: var(--color-error-text);
  border-color: #FECACA;
}

.status-banner.info {
  background: var(--color-info-light);
  color: var(--color-info-text);
  border-color: #BFDBFE;
}

.status-banner__icon {
  font-size: var(--text-base);
  flex-shrink: 0;
  line-height: 1;
}

.status-banner__text { flex: 1; }

.status-banner__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  opacity: 0.6;
  transition: opacity var(--transition-fast), background-color var(--transition-fast);
  flex-shrink: 0;
}

.status-banner__close:hover { opacity: 1; background: rgba(0,0,0,0.06); }

/* ─── 10. CONVERSION DASHBOARD ──────────────────────────────────────────── */
.dashboard {
  margin-bottom: var(--space-6);
  animation: slideDown 0.25s ease-out;
}

.dashboard__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

/* ─ File card ─ */
.file-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition: box-shadow var(--transition-base);
}

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

.file-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.file-card__icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--color-bg-subtle);
}

.file-card__icon-wrap svg {
  width: 28px;
  height: 28px;
}

.file-card__meta {
  flex: 1;
  min-width: 0;
}

.file-card__name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
  margin-bottom: var(--space-1);
}

.file-card__type {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.file-card__remove {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.file-card__remove:hover {
  color: var(--color-error);
  background: var(--color-error-light);
}

.file-card__details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-lg);
}

.file-card__detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}

.file-card__detail-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.file-card__detail-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.file-card__status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-semibold);
}

/* Progress bar */
.file-card__progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.progress-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-primary), #60A5FA);
  width: 0%;
  transition: width 0.4s ease;
  position: relative;
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  animation: progressShine 1.2s ease-in-out infinite;
}

@keyframes progressShine {
  0%   { opacity: 0; transform: translateX(-100%); }
  50%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

.progress-bar__label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
}

/* Status dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--ready    { background: var(--color-success); }
.status-dot--working  {
  background: var(--color-warning);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.status-dot--done     { background: var(--color-success); }
.status-dot--error    { background: var(--color-error); }

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ─ Action panel ─ */
.action-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.action-panel__title {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.action-panel__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  font-family: var(--font-sans);
}

.action-btn:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
}

.action-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.action-btn:active { transform: translateX(3px) translateY(1px); }

.action-btn--preview {
  border-color: var(--color-border);
}

.action-btn--preview:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.action-btn--preview:hover .action-btn__icon { color: var(--color-primary); }

.action-btn--convert {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}

.action-btn--convert:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.action-btn--convert:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.action-btn__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.06);
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.action-btn--convert .action-btn__icon { background: rgba(255,255,255,0.2); }

.action-btn__text {
  flex: 1;
  min-width: 0;
}

.action-btn__text strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.3;
  margin-bottom: 2px;
}

.action-btn__text span {
  display: block;
  font-size: var(--text-xs);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Prevent extremely long descriptions from overflowing on mobile */
  max-width: 100%;
}

.action-btn__arrow {
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.action-btn:hover .action-btn__arrow {
  transform: translateX(3px);
  opacity: 1;
}

.action-panel__note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.action-panel__note svg { flex-shrink: 0; margin-top: 1px; }

/* ─── 11. PREVIEW PANEL ─────────────────────────────────────────────────── */
.preview-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  animation: slideDown 0.25s ease-out;
}

.preview-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.preview-panel__title-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.preview-panel__title-group h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.preview-panel__badge {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-muted);
  background: var(--color-border);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.preview-panel__controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.preview-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  font-family: var(--font-sans);
}

.preview-ctrl-btn:hover {
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border-color: var(--color-border);
}

.preview-ctrl-btn--close:hover {
  color: var(--color-error-text);
  background: var(--color-error-light);
  border-color: #FECACA;
}

.preview-panel__body {
  position: relative;
  min-height: 280px;
}

/* Loading skeleton */
.preview-skeleton {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-bg-subtle) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line--h1   { height: 20px; width: 45%; }
.skeleton-line--h2   { height: 16px; width: 30%; margin-top: var(--space-2); }
.skeleton-line--short { width: 60%; }
.skeleton-line--code  { background-color: var(--color-bg-subtle); height: 10px; border-radius: var(--radius-sm); }

/* Preview content */
.preview-content {
  display: block;
  margin: 0;
  padding: var(--space-6);
  overflow: auto;
  max-height: 480px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
  background: var(--color-surface);
}

.preview-content code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  white-space: pre-wrap;
}

/* Syntax-like coloring for markdown content */
.md-h1, .md-h2, .md-h3 { color: var(--color-text); font-weight: var(--font-bold); }
.md-bold   { color: var(--color-text); }
.md-code   { color: var(--color-primary); background: var(--color-primary-light); padding: 1px 4px; border-radius: 3px; }
.md-link   { color: var(--color-primary); text-decoration: underline; }

/* ─── 12. EXPAND MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 0.2s ease-out;
}

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

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  flex-shrink: 0;
}

.modal__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--color-error-light);
  color: var(--color-error-text);
}

.modal__content {
  padding: var(--space-6);
  overflow: auto;
  flex: 1;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ─── 13. SECTION SHARED STYLES ─────────────────────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.section-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── 14. FORMATS SECTION ───────────────────────────────────────────────── */
.formats-section {
  padding: var(--space-16) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.formats-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}

.format-category {
  padding: var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  cursor: default;
}

.format-category:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.format-category__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.format-category__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.format-category__icon svg {
  width: 20px;
  height: 20px;
}

.format-category__icon--documents     { background: #FEF2F2; color: #EF4444; }
.format-category__icon--spreadsheets  { background: #F0FDF4; color: #22C55E; }
.format-category__icon--presentations { background: #FFF7ED; color: #F97316; }
.format-category__icon--data          { background: #EFF6FF; color: #2563EB; }
.format-category__icon--images        { background: #F5F3FF; color: #8B5CF6; }
.format-category__icon--audio         { background: #FDF2F8; color: #EC4899; }
.format-category__icon--archives      { background: #FEFCE8; color: #EAB308; }

.format-category__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: var(--space-1);
}

.format-category__desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.format-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.format-badge {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.format-category:hover .format-badge {
  background: white;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ─── 15. WHY SECTION ───────────────────────────────────────────────────── */
.why-section {
  padding: var(--space-16) 0;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.why-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
}

.why-card {
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
}

.why-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-subtle);
}

.why-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.why-card__icon svg {
  width: 22px;
  height: 22px;
}

.why-card__icon--blue   { background: #EFF6FF; color: #2563EB; }
.why-card__icon--green  { background: #F0FDF4; color: #22C55E; }
.why-card__icon--purple { background: #F5F3FF; color: #8B5CF6; }
.why-card__icon--amber  { background: #FFFBEB; color: #F59E0B; }

.why-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.why-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.7;
}

/* ─── 16. FOOTER ────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) 0 var(--space-8);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-10);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.site-footer__brand {
  max-width: 280px;
}

.site-footer__logo {
  margin-bottom: var(--space-3);
}

.site-footer__tagline {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.site-footer__links {
  display: flex;
  gap: var(--space-12);
  flex-wrap: wrap;
}

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

.site-footer__link-heading {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-1);
}

.site-footer__link {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.site-footer__link:hover { color: var(--color-primary); }

.site-footer__tech {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.site-footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.site-footer__copy a {
  color: var(--color-primary);
  text-decoration: none;
}

.site-footer__copy a:hover { text-decoration: underline; }

.site-footer__version {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ─── 17. FILE TYPE ICON COLORS ─────────────────────────────────────────── */
.file-icon--pdf         { background: #FEF2F2; color: #EF4444; }
.file-icon--doc,
.file-icon--docx        { background: #EFF6FF; color: #2563EB; }
.file-icon--xls,
.file-icon--xlsx,
.file-icon--csv         { background: #F0FDF4; color: #22C55E; }
.file-icon--pptx        { background: #FFF7ED; color: #F97316; }
.file-icon--json,
.file-icon--xml         { background: #EFF6FF; color: #3B82F6; }
.file-icon--html,
.file-icon--htm         { background: #FFF7ED; color: #F97316; }
.file-icon--txt,
.file-icon--epub        { background: #F1F5F9; color: #475569; }
.file-icon--jpg,
.file-icon--jpeg,
.file-icon--png,
.file-icon--gif,
.file-icon--bmp,
.file-icon--webp        { background: #F5F3FF; color: #8B5CF6; }
.file-icon--mp3,
.file-icon--wav,
.file-icon--m4a,
.file-icon--flac        { background: #FDF2F8; color: #EC4899; }
.file-icon--zip         { background: #FEFCE8; color: #EAB308; }
.file-icon--msg         { background: #EFF6FF; color: #2563EB; }
.file-icon--default     { background: var(--color-bg-subtle); color: var(--color-text-secondary); }

/* ─── 18. RESPONSIVE ────────────────────────────────────────────────────── */

/* ── 18a. Large desktop (1440px+) ─────────────────────────────────────── */
@media (min-width: 1440px) {
  .hero__inner {
    gap: var(--space-20);
  }
}

/* ── 18b. Laptop / Tablet Large (≤1024px) ─────────────────────────────── */
@media (max-width: 1024px) {
  /* Hero switches to single-column with content first, illustration below */
  .hero__inner {
    grid-template-columns: 1fr;
    gap: var(--space-10);
    text-align: center;
  }

  .hero__content { max-width: none; }
  .hero__description { max-width: none; }
  .hero__cta { justify-content: center; }
  .hero__stats { justify-content: center; }

  /* Content stays first (natural DOM order), illustration second */
  .hero__content   { order: 1; }
  .hero__illustration { order: 2; }

  /* Flow diagram stays horizontal at tablet, capped to container */
  .flow-diagram {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: var(--space-4);
    justify-content: center;
    max-width: 100%;
    overflow: visible;
  }

  /* Dashboard stacks at tablet */
  .dashboard__grid {
    grid-template-columns: 1fr;
  }
}

/* ── 18c. Tablet (768px–1023px) ───────────────────────────────────────── */
@media (max-width: 1023px) and (min-width: 769px) {
  /* Reduce flow diagram gaps slightly to fit */
  .flow-diagram {
    gap: var(--space-3);
    padding: var(--space-6);
  }

  /* Slightly reduce format grid min size to fit 2 columns */
  .formats-categories {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

/* ── 18d. Mobile (≤768px) ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Hero padding reduced */
  .hero {
    padding: var(--space-12) 0 var(--space-8);
  }

  /* Fluid headline — won't overflow between 480–768 */
  .hero__headline {
    font-size: clamp(1.75rem, 6vw, var(--text-4xl));
  }

  .hero__description {
    font-size: var(--text-base);
  }

  /* Section typography */
  .section-title    { font-size: var(--text-2xl); }
  .section-subtitle { font-size: var(--text-base); }

  /* App container gets tighter horizontal padding */
  .app-container {
    padding: var(--space-6) var(--space-4);
  }

  /* Dropzone: reduce vertical padding, keep it spacious */
  .dropzone {
    padding: var(--space-8) var(--space-4);
  }

  /* Prevent formats string from overflowing */
  .dropzone__formats {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.6;
  }

  /* Ensure CTA buttons meet 44px touch target */
  .btn--lg {
    min-height: 44px;
  }

  /* Hide version badge to free navbar space at 768px */
  .navbar__badge { display: none; }

  /* Format categories: 2-column at 768px */
  .formats-categories {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  /* Footer */
  .site-footer__inner {
    flex-direction: column;
    gap: var(--space-6);
  }

  .site-footer__links {
    flex-direction: row;
    gap: var(--space-8);
    flex-wrap: wrap;
  }

  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  /* Action button sub-description: allow it to wrap on mobile */
  .action-btn__text span {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  /* Preview panel: reduce max-height so it doesn't dwarf the viewport */
  .preview-content {
    max-height: 55vh;
  }

  /* Preview panel header: stack on narrow viewports */
  .preview-panel__header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Modal: tighter padding so content fits narrow screens */
  .modal-overlay {
    padding: var(--space-3);
  }

  .modal {
    max-height: 90vh;
    border-radius: var(--radius-xl);
  }

  .modal__content {
    padding: var(--space-4);
    font-size: var(--text-xs);
  }

  /* File name should not overflow its card */
  .file-card__name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
}

/* ── 18e. Mobile Small (≤480px) ──────────────────────────────────────── */
@media (max-width: 480px) {
  /* Fluid headline that scales smoothly from 320px up */
  .hero__headline {
    font-size: clamp(1.5rem, 7vw, var(--text-3xl));
  }

  /* Hero CTA: stack buttons full-width */
  .hero__cta {
    flex-direction: column;
    align-items: stretch;
  }

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

  /* Stats: stack vertically */
  .hero__stats {
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
  }

  .hero__stat-divider {
    width: 48px;
    height: 1px;
  }

  /* Flow diagram: stack vertically on small mobile */
  .flow-diagram {
    flex-direction: column;
    align-items: center;
    padding: var(--space-5);
    gap: var(--space-4);
  }

  /* When diagram is vertical, reorient the arrow to point downward naturally.
     We use a nested flex column to achieve a down-pointing arrow
     WITHOUT rotating the whole element (which makes label text sideways). */
  .flow-arrow {
    flex-direction: column;
    align-items: center;
    transform: none; /* explicitly cancel any inherited rotation */
  }

  .flow-arrow__line {
    /* Vertical line stays the same — it already points down */
    height: 32px;
  }

  /* Arrow head SVG: rotate so the > becomes a ˅ */
  .flow-arrow__head svg {
    transform: rotate(90deg);
    display: block;
  }

  /* Downward pulse animation for arrow head in vertical layout */
  .flow-arrow__head {
    animation: arrowPulseDown 2s ease-in-out infinite;
  }

  /* Scale output card to fit narrow screens, never exceed viewport */
  .flow-output__card {
    width: min(180px, 80vw);
  }

  /* Preview panel header: stack title and controls */
  .preview-panel__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .preview-panel__controls {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  /* Hide text labels on very small screens to prevent overflow */
  .preview-ctrl-btn span {
    display: none;
  }

  /* Navbar: reduce gap so logo + toggle + GitHub all fit at 320px */
  .navbar__inner {
    padding: 0 var(--space-4);
    gap: var(--space-2);
    height: 56px;
  }

  .navbar__actions {
    gap: var(--space-2);
    flex-shrink: 0;
  }

  /* Theme toggle: hide text label, keep icon only */
  .theme-toggle__label {
    display: none;
  }

  /* GitHub link: icon only on small screens */
  .navbar__link {
    padding: var(--space-2);
    font-size: 0;
    gap: 0;
  }

  .navbar__link svg {
    font-size: initial;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  /* Action buttons: ensure 44px minimum touch target */
  .action-btn {
    min-height: 44px;
  }

  /* File card details: guard against overflowing values */
  .file-card__detail-value {
    word-break: break-all;
    overflow-wrap: anywhere;
    text-align: right;
    max-width: 60%;
  }

  /* Format categories: always single column on small mobile */
  .formats-categories {
    grid-template-columns: 1fr;
  }

  /* Why cards: single column */
  .why-cards {
    grid-template-columns: 1fr;
  }

  /* Footer links: stack vertically */
  .site-footer__links {
    flex-direction: column;
    gap: var(--space-5);
  }

  /* Status banner: allow text to wrap */
  .status-banner {
    flex-wrap: wrap;
    font-size: var(--text-xs);
  }
}

/* ── 18f. Very small mobile (≤375px) ─────────────────────────────────── */
@media (max-width: 375px) {
  /* Tighter app container */
  .app-container {
    padding: var(--space-4) var(--space-3);
  }

  .section-container {
    padding: 0 var(--space-3);
  }

  /* Even tighter dropzone */
  .dropzone {
    padding: var(--space-6) var(--space-3);
    border-radius: var(--radius-lg);
  }

  /* Shrink dropzone icon slightly */
  .dropzone__icon,
  .dropzone__icon-wrap {
    width: 56px;
    height: 56px;
  }

  /* Hero eyebrow badge: allow text to wrap */
  .hero__badge {
    text-align: center;
    white-space: normal;
  }

  /* Hero stats: reduce font-size */
  .hero__stat strong {
    font-size: var(--text-lg);
  }

  /* Headline: tighter clamp for 320px */
  .hero__headline {
    font-size: clamp(1.375rem, 8vw, 1.75rem);
  }

  /* Format category: tighter padding */
  .format-category {
    padding: var(--space-4);
  }

  /* Why card: tighter padding */
  .why-card {
    padding: var(--space-5);
  }

  /* File card: tighter padding */
  .file-card,
  .action-panel {
    padding: var(--space-4);
  }

  /* Preview skeleton: reduce padding */
  .preview-skeleton {
    padding: var(--space-4);
  }

  .preview-content {
    padding: var(--space-4);
    font-size: var(--text-xs);
  }

  /* Modal */
  .modal__content {
    padding: var(--space-3);
  }

  /* Navbar: absolute minimum for 320px */
  .navbar__inner {
    padding: 0 var(--space-3);
  }

  /* Theme toggle: reduce padding */
  .theme-toggle {
    padding: 5px 8px;
  }

  /* Navbar logo text: allow shrink */
  .navbar__logo-text {
    font-size: var(--text-base);
  }

  /* Dashboard grid: ensure columns are single */
  .dashboard__grid {
    grid-template-columns: 1fr;
  }

  /* Action btn: reduce icon size slightly */
  .action-btn__icon {
    width: 36px;
    height: 36px;
  }

  /* Flow diagram output card: even narrower for 320px */
  .flow-output__card {
    width: min(160px, 78vw);
  }

  /* Flow sources: reduce file item padding */
  .flow-file {
    padding: var(--space-1) var(--space-2);
    font-size: 10px;
  }

  .flow-file__icon {
    width: 26px;
    height: 26px;
  }
}

/* ── 18g. Extra small (≤320px) ────────────────────────────────────────── */
@media (max-width: 320px) {
  /* Absolute minimum headline size */
  .hero__headline {
    font-size: 1.25rem;
  }

  /* Reduce section padding to near-zero horizontal */
  .section-container,
  .app-container {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  /* Status banner icon: hide on 320px to save space */
  .status-banner__icon {
    display: none;
  }

  /* Flow file label text: hide to prevent overflow */
  .flow-file span {
    display: none;
  }

  /* Navbar: ultra-compact */
  .navbar__inner {
    padding: 0 var(--space-2);
    gap: var(--space-1);
  }
}

/* ── 18h. Landscape on short viewports (phones in landscape) ──────────── */
@media (max-height: 500px) and (orientation: landscape) {
  /* Keep hero compact so user can reach the upload zone quickly */
  .hero {
    padding: var(--space-8) 0 var(--space-6);
  }

  /* Reduce hero headline to avoid filling the whole viewport height */
  .hero__headline {
    font-size: clamp(1.25rem, 4vw, var(--text-2xl));
    margin-bottom: var(--space-3);
  }

  .hero__description {
    margin-bottom: var(--space-4);
  }

  /* Preview content: shorter max-height so controls remain reachable */
  .preview-content {
    max-height: 40vh;
  }

  /* Modal: full height on landscape */
  .modal {
    max-height: 95vh;
  }

  .modal-overlay {
    padding: var(--space-2) var(--space-4);
  }
}


/* ─── 19. THEME TOGGLE BUTTON ───────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  font-weight: var(--font-medium);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:active { transform: translateY(0); }

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Icon visibility — default light mode shows moon, dark mode shows sun */
.theme-toggle__icon {
  flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

/* In light mode: show moon, hide sun */
.theme-toggle__icon--sun  { display: none; }
.theme-toggle__icon--moon { display: block; }

/* In dark mode: show sun, hide moon */
[data-theme="dark"] .theme-toggle__icon--sun  { display: block; }
[data-theme="dark"] .theme-toggle__icon--moon { display: none; }

/* Spin sun icon on theme switch */
[data-theme="dark"] .theme-toggle__icon--sun {
  animation: spinIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes spinIn {
  from { transform: rotate(-90deg) scale(0.5); opacity: 0; }
  to   { transform: rotate(0deg)   scale(1);   opacity: 1; }
}

/* Moon fade-in on switch to light */
[data-theme="light"] .theme-toggle__icon--moon,
:root:not([data-theme="dark"]) .theme-toggle__icon--moon {
  animation: moonIn 0.3s ease-out;
}

@keyframes moonIn {
  from { transform: translateX(6px); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

.theme-toggle__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.02em;
  min-width: 28px;
  transition: opacity 0.2s ease;
}

/* ─── 20. DARK MODE: COMPONENT TWEAKS ───────────────────────────────────── */

/* Hero grid — slightly more visible in dark */
[data-theme="dark"] .hero::before {
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.06) 1px, transparent 1px);
}

/* Dropzone dashed border looks better with a slightly transparent dash in dark */
[data-theme="dark"] .dropzone {
  background: var(--color-bg-subtle);
}

/* Format category icon backgrounds — muted in dark to avoid color clash */
[data-theme="dark"] .format-category__icon--documents     { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .format-category__icon--spreadsheets  { background: rgba(34,197,94,0.12); }
[data-theme="dark"] .format-category__icon--presentations { background: rgba(249,115,22,0.12); }
[data-theme="dark"] .format-category__icon--data          { background: rgba(37,99,235,0.12); }
[data-theme="dark"] .format-category__icon--images        { background: rgba(139,92,246,0.12); }
[data-theme="dark"] .format-category__icon--audio         { background: rgba(236,72,153,0.12); }
[data-theme="dark"] .format-category__icon--archives      { background: rgba(234,179,8,0.12); }

/* Why card icon backgrounds */
[data-theme="dark"] .why-card__icon--blue   { background: rgba(59,130,246,0.12); }
[data-theme="dark"] .why-card__icon--green  { background: rgba(34,197,94,0.12); }
[data-theme="dark"] .why-card__icon--purple { background: rgba(139,92,246,0.12); }
[data-theme="dark"] .why-card__icon--amber  { background: rgba(245,158,11,0.12); }

/* Flow diagram card in dark */
[data-theme="dark"] .flow-diagram {
  background: var(--color-bg-subtle);
}

[data-theme="dark"] .flow-output__card {
  background: var(--color-bg);
}

/* Preview pane code block */
[data-theme="dark"] .preview-content,
[data-theme="dark"] .modal__content {
  background: #0D1117;
  color: #E6EDF3;
}

/* Skeleton shimmer darker */
[data-theme="dark"] .skeleton-line {
  background: linear-gradient(
    90deg,
    var(--color-border) 25%,
    var(--color-bg-subtle) 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
}

/* Progress bar gradient in dark */
[data-theme="dark"] .progress-bar__fill {
  background: linear-gradient(90deg, #3B82F6, #93C5FD);
}

/* Transition all borders and backgrounds smoothly */
.navbar, .file-card, .action-panel, .preview-panel,
.dropzone, .format-category, .why-card, .site-footer,
.flow-diagram, .flow-output__card, .modal {
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    color 0.3s ease;
}

/* Respect user preference: no transitions if reduced motion is set */
@media (prefers-reduced-motion: reduce) {
  body,
  .theme-toggle,
  .navbar,
  .file-card, .action-panel, .preview-panel,
  .dropzone, .format-category, .why-card, .site-footer,
  .flow-diagram, .flow-output__card, .modal {
    transition: none !important;
  }
  .theme-toggle__icon--sun,
  .theme-toggle__icon--moon {
    animation: none !important;
  }
}

/* ─── 21. PRINT STYLES ──────────────────────────────────────────────────── */
@media print {
  .navbar,
  .hero,
  .why-section,
  .site-footer { display: none; }

  .preview-content {
    max-height: none;
    overflow: visible;
  }
}
