/* ============================================================
   TOKENS — Blue / Amethyst palette
   ============================================================ */
:root {
  /* Backgrounds */
  --bg:        #F4F5FB;
  --surface:   #FFFFFF;
  --surface-2: #ECEEF7;
  --border:    #D8DCF0;

  /* Text */
  --text-primary:   #0F1340;
  --text-secondary: #4A5080;
  --text-muted:     #8890B8;

  /* Accent — deep indigo */
  --accent:       #2D3FBE;
  --accent-light: #E0E4F9;
  --accent-dark:  #1A2578;

  /* Purple — amethyst */
  --purple:       #7B2FBE;
  --purple-light: #F0E6FA;
  --purple-dark:  #4A1580;

  /* Gradient — the signature element */
  --gradient: linear-gradient(135deg, #2D3FBE 0%, #7B2FBE 100%);
  --gradient-soft: linear-gradient(135deg, #E0E4F9 0%, #F0E6FA 100%);

  /* Amber for timing badges */
  --amber:       #A05C10;
  --amber-light: #FEF0DC;

  /* Misc */
  --font-display: 'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', monospace;
  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    20px;
  --shadow-sm:    0 1px 3px rgba(45,63,190,0.07), 0 1px 2px rgba(45,63,190,0.04);
  --shadow-md:    0 4px 20px rgba(45,63,190,0.12);
  --shadow-glow:  0 0 0 3px rgba(45,63,190,0.18);
  --transition:   0.2s ease;
}

[data-theme="dark"] {
  --bg:        #0B0D1A;
  --surface:   #131629;
  --surface-2: #1C2038;
  --border:    #272B4A;

  --text-primary:   #E8EAFA;
  --text-secondary: #8890B8;
  --text-muted:     #4A5080;

  --accent:       #6B7EFF;
  --accent-light: #1A2050;
  --accent-dark:  #C0C8FF;

  --purple:       #B06AE0;
  --purple-light: #2A1545;
  --purple-dark:  #E8CCFF;

  --gradient: linear-gradient(135deg, #6B7EFF 0%, #B06AE0 100%);
  --gradient-soft: linear-gradient(135deg, #1A2050 0%, #2A1545 100%);

  --amber:       #F0A030;
  --amber-light: #2A1C08;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 3px rgba(107,126,255,0.25);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav-brand {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.nav-dot { color: var(--text-muted); margin: 0 4px; }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Language switch */
.lang-switch {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-btn {
  background: none;
  border: none;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.lang-btn:hover { background: var(--surface-2); color: var(--text-secondary); }

.lang-btn.active {
  background: var(--gradient);
  color: #fff;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: border-color var(--transition), background var(--transition);
}

.theme-toggle:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 6rem 2rem 5rem;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

/* Signature element: gradient text on italic */
.hero-title em {
  font-style: italic;
  font-weight: 400;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.075rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 3rem;
  line-height: 1.75;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.stat { text-align: center; }

.stat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ============================================================
   ARCHITECTURE STRIP
   ============================================================ */
.arch-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 2rem;
  overflow-x: auto;
}

.arch-flow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto;
  justify-content: center;
  flex-wrap: wrap;
}

.arch-node {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  white-space: nowrap;
}

.arch-node--active {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
}

.arch-arrow { color: var(--text-muted); font-size: 14px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient);
  color: #fff;
  border: none;
  padding: 0.8rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 12px rgba(123,47,190,0.25);
}

.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 4px 20px rgba(123,47,190,0.35);
}

.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 5rem 2rem; }
.section-inner { max-width: 800px; margin: 0 auto; }
.section-inner--narrow { max-width: 560px; }
.section-header { margin-bottom: 3rem; }

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
}

/* ============================================================
   FORM
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 2.5rem; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }

.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.field-hint {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.field-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}

.field-input::placeholder { color: var(--text-muted); }

.field-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.radio-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.radio-card:has(input:checked) {
  border-color: var(--purple);
  background: var(--purple-light);
  box-shadow: 0 0 0 2px rgba(123,47,190,0.15);
}

.radio-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.radio-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.radio-card:has(input:checked) .radio-label { color: var(--purple); }
.radio-card:has(input:checked) .radio-desc { color: var(--purple); opacity: 0.75; }

[data-theme="dark"] .radio-card:has(input:checked) .radio-label { color: var(--purple); }
[data-theme="dark"] .radio-card:has(input:checked) .radio-desc { color: var(--purple); opacity: 0.65; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   PIPELINE / PROGRESS
   ============================================================ */
.pipeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 2.5rem;
}

.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  opacity: 0.3;
  transition: opacity 0.4s ease;
}

.pipeline-step:last-child { border-bottom: none; }
.pipeline-step.active { opacity: 1; }
.pipeline-step.done { opacity: 0.55; }

.step-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  margin-top: 5px;
  flex-shrink: 0;
  transition: background 0.4s ease;
}

.pipeline-step.active .step-indicator {
  background: var(--gradient);
  box-shadow: 0 0 8px rgba(123,47,190,0.5);
}

.pipeline-step.done .step-indicator { background: var(--accent); }

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

.step-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.step-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.timer-display {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.timer-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 500;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.timer-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================================
   OUTPUT
   ============================================================ */
.output-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.output-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.meta-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--accent-light);
  color: var(--accent);
  white-space: nowrap;
}

.meta-badge--purple {
  background: var(--purple-light);
  color: var(--purple);
}

.gagne-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.gagne-event {
  background: var(--surface);
  padding: 1.5rem;
  transition: background var(--transition);
}

.gagne-event:hover { background: var(--surface-2); }

.gagne-event-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.gagne-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  background: var(--gradient);
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.06em;
}

.gagne-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gagne-content {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.75;
  white-space: pre-wrap;
}

.output-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gallery-loading, .gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 14px;
}

.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.gallery-card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.gallery-card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card-hook {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.gallery-card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.gallery-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.gallery-tag--time {
  background: var(--amber-light);
  color: var(--amber);
  border-color: transparent;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-stack {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .hero { padding: 4rem 1.25rem 3rem; }
  .section { padding: 3rem 1.25rem; }
  .nav { padding: 0 1.25rem; }
  .hero-stats { gap: 1.25rem; }
  .stat-divider { display: none; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn-primary,
  .form-actions .btn-ghost { width: 100%; justify-content: center; }
  .output-header { flex-direction: column; }
  .footer { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
