/* =============================================
   HTML Code Runner — Design System & Styles
   ============================================= */

/* --- CSS Variables / Design Tokens --- */
:root {
  /* Brand Colors */
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5A4BD1;
  --accent: #00CEC9;
  --accent-light: #55EFC4;
  --accent-dark: #00B894;

  /* Neutrals */
  --bg-primary: #0F0F1A;
  --bg-secondary: #191930;
  --bg-card: #1E1E3A;
  --bg-card-hover: #252550;
  --bg-surface: #14142B;
  --bg-input: #1A1A35;
  --border-color: rgba(108, 92, 231, 0.2);
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Text */
  --text-primary: #EAEAFF;
  --text-secondary: #A0A0C8;
  --text-muted: #6B6B8D;
  --text-link: #A29BFE;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6C5CE7 0%, #00CEC9 100%);
  --gradient-hero: linear-gradient(160deg, #0F0F1A 0%, #191930 40%, #1E1E3A 100%);
  --gradient-card: linear-gradient(145deg, rgba(30, 30, 58, 0.8), rgba(25, 25, 48, 0.6));
  --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(108, 92, 231, 0.15) 0%, transparent 70%);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fs-4xl: 3.25rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* 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: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --max-width: 1280px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: var(--font-sans);
  border: none;
  background: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::selection {
  background: var(--primary);
  color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-dark);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: var(--fs-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-3xl); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-header p {
  max-width: 640px;
  margin: 0 auto;
  font-size: var(--fs-md);
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-base);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-links a {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

/* Language Switcher */
.lang-switcher {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
}

.lang-dropdown.active {
  display: block;
  animation: fadeSlideDown 0.2s ease;
}

.lang-dropdown a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  transition: background var(--transition-fast);
}

.lang-dropdown a:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.lang-dropdown a.current {
  color: var(--primary-light);
  background: rgba(108, 92, 231, 0.1);
}

/* Mobile Nav */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
}

.mobile-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* --- Hero Section --- */
.hero {
  position: relative;
  padding: var(--space-3xl) 0 var(--space-xl);
  text-align: center;
  background: var(--gradient-hero);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 400px;
  background: var(--gradient-glow);
  pointer-events: none;
}

.hero h1 {
  position: relative;
  margin-bottom: var(--space-md);
}

.hero .subtitle {
  position: relative;
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-2xl);
}

/* --- Editor Section --- */
.editor-section {
  position: relative;
  z-index: 1;
}

.editor-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.editor-tabs {
  display: flex;
  gap: var(--space-xs);
}

.editor-tab {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.editor-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-input);
}

.editor-tab.active {
  color: var(--text-primary);
  background: var(--primary);
  background: rgba(108, 92, 231, 0.2);
  color: var(--primary-light);
}

.toolbar-actions {
  display: flex;
  gap: var(--space-sm);
}

.editor-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}

.editor-pane {
  position: relative;
  display: flex;
  flex-direction: column;
}

.editor-pane + .editor-pane {
  border-left: 1px solid var(--border-subtle);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: rgba(20, 20, 43, 0.5);
  border-bottom: 1px solid var(--border-subtle);
}

.pane-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.code-editor {
  width: 100%;
  height: 100%;
  min-height: 380px;
  padding: var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.65;
  resize: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.code-editor::placeholder {
  color: var(--text-muted);
}

.preview-frame {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: none;
  background: #fff;
}

.line-numbers {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 48px;
  padding: var(--space-md) var(--space-sm);
  background: rgba(14, 14, 30, 0.5);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.65;
  text-align: right;
  user-select: none;
  overflow: hidden;
  white-space: pre;
}

.editor-with-lines {
  padding-left: 56px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-accent {
  background: var(--accent);
  color: #0F0F1A;
  box-shadow: 0 2px 12px rgba(0, 206, 201, 0.3);
}

.btn-accent:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 20px rgba(0, 206, 201, 0.4);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--primary);
}

.btn-sm {
  padding: 6px var(--space-md);
  font-size: var(--fs-xs);
}

.btn-lg {
  padding: var(--space-md) var(--space-2xl);
  font-size: var(--fs-base);
}

.btn-icon {
  padding: var(--space-sm);
  width: 36px;
  height: 36px;
}

/* --- Features Grid --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-lg);
}

.feature-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-base);
}

.feature-card:hover {
  border-color: var(--border-color);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md);
  background: rgba(108, 92, 231, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.feature-card h3 {
  font-size: var(--fs-base);
  margin-bottom: var(--space-sm);
}

.feature-card p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* --- Content Sections --- */
.content-block {
  max-width: 800px;
  margin: 0 auto;
}

.content-block h2 {
  margin-bottom: var(--space-lg);
}

.content-block h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.content-block p {
  margin-bottom: var(--space-md);
}

.content-block ul,
.content-block ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-xl);
}

.content-block ul {
  list-style: disc;
}

.content-block ol {
  list-style: decimal;
}

.content-block li {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.7;
}

.content-block li::marker {
  color: var(--primary-light);
}

/* --- Steps --- */
.steps-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  counter-reset: step;
}

.step-item {
  position: relative;
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  padding-top: var(--space-2xl);
  counter-increment: step;
  transition: all var(--transition-base);
}

.step-item:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-glow);
}

.step-item::before {
  content: counter(step);
  position: absolute;
  top: var(--space-md);
  left: var(--space-xl);
  width: 28px;
  height: 28px;
  background: var(--gradient-primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.step-item h3 {
  font-size: var(--fs-md);
  margin-bottom: var(--space-sm);
}

.step-item p {
  font-size: var(--fs-sm);
}

/* --- Use Cases --- */
.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.use-case-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.use-case-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
}

.use-case-card h3 {
  font-size: var(--fs-base);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.use-case-card p {
  font-size: var(--fs-sm);
}

/* --- FAQ --- */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.faq-item {
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-color);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-lg);
  text-align: left;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.faq-question:hover {
  color: var(--primary-light);
}

.faq-chevron {
  font-size: var(--fs-lg);
  color: var(--text-muted);
  transition: transform var(--transition-base);
  flex-shrink: 0;
  margin-left: var(--space-md);
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow), padding var(--transition-slow);
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 var(--space-lg) var(--space-lg);
}

.faq-answer p {
  font-size: var(--fs-sm);
  line-height: 1.8;
}

/* --- Tools Grid --- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.tool-card {
  display: block;
  background: var(--gradient-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  text-decoration: none;
}

.tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.tool-card h3 {
  font-size: var(--fs-base);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.tool-card p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  background: rgba(108, 92, 231, 0.1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 20px;
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand p {
  font-size: var(--fs-sm);
  margin-top: var(--space-md);
  max-width: 320px;
}

.footer-col h4 {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.footer-col a {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  padding: var(--space-xs) 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--primary-light);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-secondary);
}

.breadcrumbs span {
  color: var(--text-muted);
}

/* --- Page Header --- */
.page-header {
  padding: var(--space-3xl) 0 var(--space-2xl);
  text-align: center;
  background: var(--gradient-hero);
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 300px;
  background: var(--gradient-glow);
  pointer-events: none;
}

.page-header h1 {
  position: relative;
  margin-bottom: var(--space-md);
}

.page-header p {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  font-size: var(--fs-md);
}

/* --- Toast / Notifications --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  transform: translateY(120%);
  transition: transform var(--transition-base);
  z-index: 9999;
}

.toast.show {
  transform: translateY(0);
}

/* --- Contact Form --- */
.contact-form {
  max-width: 640px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

/* --- Tags / Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(108, 92, 231, 0.15);
  color: var(--primary-light);
}

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

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

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

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.1); }
  50% { box-shadow: 0 0 40px rgba(108, 92, 231, 0.25); }
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-xl);
    gap: var(--space-md);
    z-index: 999;
  }

  .nav-links.open {
    display: flex;
    animation: fadeIn 0.2s ease;
  }

  .nav-links a {
    font-size: var(--fs-lg);
    padding: var(--space-sm) 0;
  }

  .mobile-toggle {
    display: flex;
  }

  .editor-panes {
    grid-template-columns: 1fr;
  }

  .editor-pane + .editor-pane {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .code-editor,
  .preview-frame {
    min-height: 280px;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .section {
    padding: var(--space-2xl) 0;
  }

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

  .steps-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-md);
  }

  h1 { font-size: var(--fs-xl); }

  .toolbar-actions {
    flex-wrap: wrap;
  }

  .editor-toolbar {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: stretch;
  }

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

/* --- RTL Support --- */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .editor-with-lines {
  padding-left: var(--space-md);
  padding-right: 56px;
}

[dir="rtl"] .line-numbers {
  left: auto;
  right: 0;
  text-align: left;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .faq-chevron {
  margin-left: 0;
  margin-right: var(--space-md);
}

/* --- Print --- */
@media print {
  .site-header,
  .site-footer,
  .editor-toolbar,
  .toolbar-actions,
  .lang-switcher,
  .mobile-toggle,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
    color: #222;
  }
}
