/* =========================================================================
   CodeTransform — Design tokens & shared styles
   Dark mode is the default brand surface (matches the original converter).
   Light mode is an opt-in override toggled via `html.light-mode`.
   ========================================================================= */

:root {
  --bg: #0a0a0a;
  --bg-surface: #111113;
  --bg-elevated: #17171a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: #27272a;
  --border-subtle: #1f1f22;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --accent-from: #6366f1;
  --accent-to: #22d3ee;
  --accent-solid: #818cf8;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

html.light-mode {
  --bg: #fafafa;
  --bg-surface: #ffffff;
  --bg-elevated: #f4f4f5;
  --bg-card: rgba(0, 0, 0, 0.02);
  --border: #e4e4e7;
  --border-subtle: #ececee;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #71717a;
}

* { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
}

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* =========================================================================
   Landing page — gradient signature
   ========================================================================= */

.gradient-text {
  background: linear-gradient(100deg, var(--accent-from), var(--accent-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gradient-bg-soft {
  background: radial-gradient(60% 60% at 20% 20%, rgba(99, 102, 241, 0.25), transparent 70%),
              radial-gradient(50% 50% at 85% 30%, rgba(34, 211, 238, 0.18), transparent 70%),
              radial-gradient(40% 60% at 50% 100%, rgba(99, 102, 241, 0.12), transparent 70%);
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, -4%) scale(1.05); }
}
.hero-orb {
  animation: drift 14s ease-in-out infinite;
}
.hero-orb-2 {
  animation: drift 18s ease-in-out infinite reverse;
}

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
}

.btn-gradient {
  background: linear-gradient(100deg, var(--accent-from), var(--accent-to));
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-gradient:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.55);
}

.nav-glass {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

/* Reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Feature / language cards */
.feature-card, .lang-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.feature-card:hover, .lang-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-solid);
  box-shadow: 0 16px 40px -20px rgba(99, 102, 241, 0.4);
}

/* Timeline connector for "How it works" */
.timeline-connector {
  background: linear-gradient(180deg, var(--accent-from), var(--accent-to));
}

/* FAQ accordion */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.faq-answer.open {
  max-height: 300px;
}
.faq-chevron { transition: transform 0.25s ease; }
.faq-chevron.open { transform: rotate(180deg); }

/* Browser mockup frame for the screenshots section */
.browser-frame {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.browser-frame-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.browser-dot { width: 10px; height: 10px; border-radius: 999px; }

/* Code morph hero visual */
.morph-panel {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 220px;
}
.morph-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--accent-to);
  vertical-align: text-bottom;
  animation: blink 1s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Mobile nav */
#mobileNav { transition: max-height 0.3s ease, opacity 0.3s ease; }

/* =========================================================================
   Converter page — original styles (kept intact for functional compatibility)
   ========================================================================= */

.drop-zone {
  transition: all 0.3s ease;
}
.drop-zone.dragover {
  border-color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05);
}
.code-textarea {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  tab-size: 2;
  -moz-tab-size: 2;
}
.btn-icon {
  transition: all 0.2s ease;
}
.btn-icon:hover {
  transform: scale(1.1);
}
.history-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.6); }
}
.converting {
  animation: pulse-glow 1s infinite;
}
.toast {
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.progress-bar {
  transition: width 0.5s ease-in-out;
}
.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.collapsible-content.expanded {
  max-height: 500px;
}
.language-badge {
  font-size: 10px;
  letter-spacing: 0.5px;
}
.confidence-ring {
  transition: stroke-dashoffset 0.5s ease-in-out;
}
.warning-state {
  border-color: #666;
  box-shadow: 0 0 0 2px rgba(100, 100, 100, 0.2);
}
/* Syntax highlighting editor styles */
.code-editor-container {
  position: relative;
  height: 100%;
}
.code-editor-container pre {
  margin: 0;
  padding: 1rem;
  height: 100%;
  overflow: auto;
  background: transparent !important;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.code-editor-container pre code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: transparent !important;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  tab-size: 2;
  -moz-tab-size: 2;
}
.code-editor-container textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  color: transparent;
  caret-color: #fff;
  resize: none;
  z-index: 2;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  border: none;
  margin: 0;
  tab-size: 2;
  -moz-tab-size: 2;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  box-sizing: border-box;
}
.code-editor-container .highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: auto;
}
/* Override Prism theme for dark background */
.code-editor-container code[class*="language-"],
.code-editor-container pre[class*="language-"] {
  background: transparent !important;
  text-shadow: none !important;
}
/* Diff view styles */
.diff-container {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
}
.diff-line {
  display: flex;
  padding: 2px 8px;
  border-left: 3px solid transparent;
}
.diff-line-number {
  width: 40px;
  text-align: right;
  padding-right: 12px;
  color: #6b7280;
  user-select: none;
  flex-shrink: 0;
}
.diff-line-content {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
}
.diff-added {
  background-color: rgba(255, 255, 255, 0.06);
  border-left-color: #ccc;
}
.diff-added .diff-line-content {
  color: #e0e0e0;
}
.diff-removed {
  background-color: rgba(255, 255, 255, 0.02);
  border-left-color: #555;
}
.diff-removed .diff-line-content {
  color: #888;
}
.diff-unchanged {
  color: #9ca3af;
}
.diff-stats {
  display: flex;
  gap: 16px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  font-size: 12px;
}
/* Validation score bar */
.validation-score-bar {
  height: 8px;
  border-radius: 4px;
  background: #222;
  overflow: hidden;
}
.validation-score-fill {
  height: 100%;
  border-radius: 4px;
  background: #fff;
  transition: width 0.5s ease;
}

/* =========================================================================
   Converter page — light mode override
   The converter markup uses fixed Tailwind neutral/black utility classes
   (not `dark:` variants), so light mode is applied by re-targeting those
   same utility classes underneath the `.light-mode` root. This preserves
   every element ID and every class hook the JS depends on.
   ========================================================================= */

html.light-mode .converter-shell,
html.light-mode .converter-shell .bg-\[\#0a0a0a\] {
  background-color: #f7f7f8 !important;
  color: #18181b !important;
}
html.light-mode .converter-shell .bg-neutral-900,
html.light-mode .converter-shell .bg-neutral-900\/50,
html.light-mode .converter-shell .bg-neutral-900\/30 {
  background-color: #ffffff !important;
}
html.light-mode .converter-shell .bg-neutral-800,
html.light-mode .converter-shell .bg-neutral-800\/50,
html.light-mode .converter-shell .bg-neutral-700 {
  background-color: #eef0f3 !important;
}
html.light-mode .converter-shell .bg-neutral-800:hover,
html.light-mode .converter-shell .hover\:bg-neutral-700:hover {
  background-color: #e4e6ea !important;
}
html.light-mode .converter-shell .border-neutral-800,
html.light-mode .converter-shell .border-neutral-700 {
  border-color: #e2e4e8 !important;
}
html.light-mode .converter-shell .text-white {
  color: #18181b !important;
}
html.light-mode .converter-shell .text-neutral-200,
html.light-mode .converter-shell .text-neutral-300 {
  color: #3f3f46 !important;
}
html.light-mode .converter-shell .text-neutral-400 {
  color: #52525b !important;
}
html.light-mode .converter-shell .text-neutral-500,
html.light-mode .converter-shell .text-neutral-600 {
  color: #71717a !important;
}
html.light-mode .converter-shell .bg-white.text-black {
  background: linear-gradient(100deg, var(--accent-from), var(--accent-to)) !important;
  color: #ffffff !important;
}
html.light-mode .converter-shell .code-editor-container textarea {
  caret-color: #18181b;
}
