/* ==========================================================================
   OperatorOne – Design system
   Light: #1A3263 #547792 #FAB95B #E8E2DB  |  Dark: #090040 #471396 #B13BFF #FFCC00
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* -------------------------------------------------------------------------- */
/* TOKENS: Light theme                                                        */
/* -------------------------------------------------------------------------- */
:root {
  --bg: #E8E2DB;
  --surface: #ffffff;
  --surface-2: #E8E2DB;
  --text: #1A3263;
  --text-muted: #547792;
  --border: rgba(26, 50, 99, 0.18);
  --primary: #1A3263;
  --primary-hover: #2d4a7c;
  --primary-2: #0f1f3d;
  --accent: #FAB95B;
  --accent-hover: #e5a84a;
  --accent-2: #c99438;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warning: #b45309;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --shadow-sm: 0 1px 2px rgba(26, 50, 99, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(26, 50, 99, 0.08), 0 2px 4px -2px rgba(26, 50, 99, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(26, 50, 99, 0.08), 0 4px 6px -4px rgba(26, 50, 99, 0.06);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --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;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --focus-ring: 2px solid var(--primary);
  --focus-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* TOKENS: Dark theme                                                         */
/* -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #090040;
  --surface: #0d0052;
  --surface-2: #471396;
  --text: #E8E2DB;
  --text-muted: #B13BFF;
  --border: rgba(177, 59, 255, 0.25);
  --primary: #B13BFF;
  --primary-hover: #c55fff;
  --primary-2: #8b2ecc;
  --accent: #FFCC00;
  --accent-hover: #ffd633;
  --accent-2: #e6b800;
  --danger: #f87171;
  --danger-bg: #450a0a;
  --warning: #fbbf24;
  --success: #4ade80;
  --success-bg: #14532d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

.theme-auto { color-scheme: light; }
[data-theme="dark"] .theme-auto,
.theme-auto[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* -------------------------------------------------------------------------- */
/* BASE                                                                       */
/* -------------------------------------------------------------------------- */
html {
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Focus visible for keyboard nav (WCAG) */
:focus { outline: none; }
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* Skip link (a11y) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--primary);
  color: #fff;
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: var(--space-4);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* LAYOUT: container, section, grid, stack                                    */
/* -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}
@media (max-width: 380px) {
  .container {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }
}

.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section--sm { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.section--lg { padding-top: var(--space-16); padding-bottom: var(--space-16); }

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-6); }

/* -------------------------------------------------------------------------- */
/* TYPOGRAPHY                                                                 */
/* -------------------------------------------------------------------------- */
h1, .h1 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  font-weight: var(--font-bold);
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.02em;
}

h2, .h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-3);
}

h3, .h3 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin: 0 0 var(--space-2);
}

.lead {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0 auto var(--space-6);
}

.text-muted { color: var(--text-muted); font-size: var(--text-sm); }
.text-center { text-align: center; }

/* -------------------------------------------------------------------------- */
/* HEADER / NAV – modern, clean, sticky                                      */
/* -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.logo {
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
}

.logo:hover { color: var(--text); }
.logo:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

.logo-img {
  display: block;
  max-height: 2.25rem;
  width: auto;
  height: auto;
}

/* Light theme: show dark logo (dark logo on light bg); dark theme: show light logo */
.logo-img--light { display: none; }
.logo-img--dark { display: block; }
[data-theme="dark"] .logo-img--light { display: block; }
[data-theme="dark"] .logo-img--dark { display: none; }

/* Mobile: hamburger (44px tap target) */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.nav-toggle:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.nav-toggle-bar {
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
@media (max-width: 767px) {
  .nav-toggle { display: flex; }
  .nav-main {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4);
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
  }
  .nav-main.nav-main--open {
    max-height: 320px;
    opacity: 1;
  }
  .nav-main a {
    display: block;
    padding: var(--space-4);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}
@media (min-width: 768px) {
  .nav-main {
    display: flex;
    gap: var(--space-6);
    align-items: center;
  }
  .nav-main a {
    min-height: 44px;
    align-items: center;
    display: inline-flex;
  }
}

.nav-main a {
  text-decoration: none;
  color: var(--nav-link, var(--text-muted));
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}

.nav-main a:hover { color: var(--nav-link-hover, var(--text)); }
.nav-main a:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-actions .btn {
  font-size: 0.9375rem;
  padding: var(--space-2) var(--space-4);
  min-height: 44px;
}

/* Theme switch – pill with sun/moon */
.theme-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
}

.theme-switch-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.theme-switch-btn:hover {
  color: var(--text);
}

.theme-switch-btn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.theme-switch-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

[data-theme="light"] .theme-switch--light,
[data-theme="dark"] .theme-switch--dark {
  background: var(--accent);
  color: var(--primary);
}

[data-theme="light"] .theme-switch--light:hover,
[data-theme="dark"] .theme-switch--dark:hover {
  background: var(--accent-hover);
  color: var(--primary);
}

/* -------------------------------------------------------------------------- */
/* BUTTONS                                                                     */
/* -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: inherit;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.btn:disabled, .btn.is-loading { opacity: 0.7; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

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

.btn-outline:hover:not(:disabled) { background: var(--surface-2); }

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

.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }

.btn-block { display: flex; width: 100%; }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }
.btn-sm { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }

/* -------------------------------------------------------------------------- */
/* CARDS                                                                       */
/* -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

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

@media (prefers-reduced-motion: no-preference) {
  .card:hover { transform: translateY(-2px); }
}

.card h2, .card h3 { margin-top: 0; }

/* -------------------------------------------------------------------------- */
/* BADGE                                                                       */
/* -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-sm);
  text-transform: capitalize;
}

.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--warning { background: #fffbeb; color: var(--warning); }
[data-theme="dark"] .badge--warning { background: #422006; }
.badge--muted { background: var(--surface-2); color: var(--text-muted); }

/* -------------------------------------------------------------------------- */
/* FORMS: input, label, helptext, error                                        */
/* -------------------------------------------------------------------------- */
.label { display: block; font-weight: var(--font-medium); font-size: var(--text-sm); margin-bottom: var(--space-1); }
.helptext { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); }
.field-error, .form-error { color: var(--danger); font-size: var(--text-sm); margin-top: var(--space-1); }

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: var(--space-1);
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.15);
}

[data-theme="dark"] .input:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2); }

textarea { min-height: 120px; resize: vertical; }

/* -------------------------------------------------------------------------- */
/* TABLES                                                                      */
/* -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: var(--text-sm);
}
.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--surface-2);
  font-weight: var(--font-semibold);
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table--zebra tbody tr:nth-child(even) { background: var(--bg); }
.table--zebra tbody tr:hover { background: var(--surface-2); }

@media (min-width: 768px) {
  .table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
}

.table-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* -------------------------------------------------------------------------- */
/* FLASH / ALERTS (contrast-safe)                                              */
/* -------------------------------------------------------------------------- */
.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  border: 1px solid transparent;
}
.flash-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success);
}
.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

/* -------------------------------------------------------------------------- */
/* HOME PAGE FALLBACK (so content is visible even if site.css fails to load)  */
/* -------------------------------------------------------------------------- */
body.home .site-hero,
body.marketing .site-hero {
  padding: var(--space-16) var(--space-4);
  min-height: 50vh;
}
body.home .hero-inner,
body.marketing .hero-inner {
  max-width: 1200px;
  margin: 0 auto;
}
body.home .hero-copy h1,
body.marketing .hero-copy h1 {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  margin: 0 0 var(--space-4);
}
body.home .hero-lead,
body.marketing .hero-lead {
  font-size: var(--text-lg);
  color: var(--text-muted);
  margin: 0 0 var(--space-6);
}
body.home .hero-cta,
body.marketing .hero-cta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
body.home .proof-row,
body.marketing .proof-row {
  padding: var(--space-8) var(--space-4);
  border-bottom: 1px solid var(--border);
}
body.home .how-section,
body.home .features-cluster,
body.home .integrations-section,
body.home .security-section,
body.home .pricing-teaser,
body.home .faq-preview,
body.marketing .how-section,
body.marketing .features-cluster,
body.marketing .integrations-section,
body.marketing .security-section,
body.marketing .pricing-teaser,
body.marketing .faq-preview {
  padding: var(--space-12) var(--space-4);
}
body.home .cta-strip,
body.marketing .cta-strip {
  padding: var(--space-12) var(--space-4);
  text-align: center;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------------------- */
/* HERO + MARKETING SECTIONS                                                   */
/* -------------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: var(--space-16) var(--space-4);
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(3, 105, 161, 0.08), transparent),
              linear-gradient(180deg, transparent 0%, var(--bg) 100%);
  pointer-events: none;
}

[data-theme="dark"] .hero::before {
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(56, 189, 248, 0.06), transparent),
              linear-gradient(180deg, transparent 0%, var(--bg) 100%);
}

/* Hero with background image: image behind, overlay for contrast, light text */
.hero--bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 70vh;
  display: flex;
  align-items: center;
}
.hero--bg::before {
  background: rgba(0, 0, 0, 0.45);
}
.hero--bg .hero-inner {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.hero--bg .lead {
  color: rgba(255, 255, 255, 0.92);
}
.hero--bg .btn-outline {
  border-color: rgba(255, 255, 255, 0.9);
  color: #fff;
}
.hero--bg .btn-outline:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
  color: #fff;
}

.hero-inner { position: relative; z-index: 1; }
.hero h1 { margin-bottom: var(--space-4); }
.hero .lead { margin-bottom: var(--space-8); }
.hero-cta { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; }

/* How it works: 3 steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-8);
  counter-reset: step;
}
.step {
  position: relative;
  padding-left: var(--space-10);
  counter-increment: step;
}
.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: #fff;
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.step h3 { margin-bottom: var(--space-2); }
.step p { color: var(--text-muted); margin: 0; font-size: var(--text-sm); }

/* Feature grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-card h3 { margin: 0 0 var(--space-2); font-size: var(--text-lg); }

/* CTA band (before footer) */
.cta-band {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-12) var(--space-4);
  text-align: center;
}
.cta-band h2 { margin-bottom: var(--space-3); }
.cta-band .lead { margin-left: auto; margin-right: auto; margin-bottom: var(--space-6); }
.cta-band .hero-cta { justify-content: center; }

/* -------------------------------------------------------------------------- */
/* PRICING                                                                     */
/* -------------------------------------------------------------------------- */
.pricing-section { max-width: 960px; margin: 0 auto; }
.pricing-section .h1 { margin-bottom: var(--space-2); }
.pricing-intro { text-align: center; color: var(--text-muted); margin-bottom: var(--space-10); }
.pricing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-12);
}
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.pricing-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.pricing-card h2 { margin: 0 0 var(--space-2); font-size: var(--text-xl); }
.pricing-desc { color: var(--text-muted); font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.pricing-price { font-size: var(--text-2xl); font-weight: var(--font-bold); margin: 0 0 var(--space-4); }
.pricing-price span { font-weight: 400; font-size: var(--text-sm); color: var(--text-muted); }
.pricing-features { list-style: none; padding: 0; margin: 0 0 var(--space-6); flex: 1; }
.pricing-features li {
  padding: var(--space-2) 0;
  padding-left: var(--space-6);
  position: relative;
  font-size: var(--text-sm);
}
.pricing-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: var(--font-bold);
}
.pricing-card .btn { margin-top: auto; }

/* FAQ accordion */
.pricing-faq { margin-top: var(--space-10); }
.pricing-faq h2 { margin-bottom: var(--space-4); }
.faq-item {
  margin-bottom: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.faq-item summary {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: var(--font-medium);
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; float: right; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0; padding: 0 var(--space-4) var(--space-4); color: var(--text-muted); font-size: var(--text-sm); }

/* -------------------------------------------------------------------------- */
/* PAGE (generic content)                                                      */
/* -------------------------------------------------------------------------- */
.page-content {
  max-width: 720px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  overflow-x: auto;
}
.page-content h1 { margin-bottom: var(--space-4); }
.page-body { margin-top: var(--space-6); overflow-wrap: break-word; word-wrap: break-word; }
.page-body h2 { margin-top: var(--space-8); }
.page-body h3 { margin-top: var(--space-6); }
.page-body img,
.page-content img,
#main-content img {
  max-width: 100%;
  height: auto;
  display: block;
}
.page-body pre,
.page-content pre {
  max-width: 100%;
  overflow-x: auto;
}

/* Timeline (how-it-works, product) */
.timeline { position: relative; padding-left: var(--space-6); border-left: 2px solid var(--border); margin-left: var(--space-4); }
.timeline-item { margin-bottom: var(--space-8); position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-6) - 5px);
  top: 0.4em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}
.timeline-item h3 { margin-bottom: var(--space-2); }
.timeline-item p { color: var(--text-muted); margin: 0; }

/* -------------------------------------------------------------------------- */
/* POSTS / RESOURCES                                                           */
/* -------------------------------------------------------------------------- */
.posts-list ul { list-style: none; padding: 0; margin: 0; }
.posts-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
}
.posts-list a { font-weight: var(--font-medium); }
.posts-list time { font-size: var(--text-sm); color: var(--text-muted); }
.post-single time { display: block; color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-4); }
.post-body { margin-top: var(--space-6); }

.empty-state {
  text-align: center;
  padding: var(--space-10);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-state p { margin: 0 0 var(--space-4); }

/* -------------------------------------------------------------------------- */
/* AUTH                                                                        */
/* -------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.auth-main { width: 100%; max-width: 400px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}
.auth-card h1 { margin: 0 0 var(--space-6); font-size: var(--text-2xl); }
.auth-card label { display: block; margin-bottom: var(--space-4); }
.auth-card .btn { width: 100%; margin-top: var(--space-2); }
.auth-switch { margin-top: var(--space-6); text-align: center; font-size: var(--text-sm); }

/* -------------------------------------------------------------------------- */
/* MAIN CONTENT (default layout)                                                */
/* -------------------------------------------------------------------------- */
#main-content {
  min-height: 60vh;
  padding: var(--space-8) var(--space-4);
  min-width: 0;
}
@media (max-width: 380px) {
  #main-content {
    padding: var(--space-6) var(--space-3);
  }
}

#main-content .container { max-width: 1200px; }

/* -------------------------------------------------------------------------- */
/* DASHBOARD                                                                   */
/* -------------------------------------------------------------------------- */
.dashboard-section h1 { margin-bottom: var(--space-6); }
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}
.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.dashboard-card:hover { box-shadow: var(--shadow-md); }
.dashboard-card h2 { margin: 0 0 var(--space-3); font-size: var(--text-lg); }
.dashboard-card p { margin: var(--space-1) 0; }
.dashboard-card .btn { margin-top: var(--space-3); }
.new-key {
  display: block;
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--bg);
  border-radius: var(--radius-md);
  word-break: break-all;
  font-size: var(--text-sm);
  font-family: ui-monospace, monospace;
}
.api-key-list { list-style: none; padding: 0; margin: 0; }
.api-key-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.key-label { font-weight: var(--font-medium); }
.key-meta { color: var(--text-muted); font-size: var(--text-sm); }

/* -------------------------------------------------------------------------- */
/* ADMIN                                                                       */
/* -------------------------------------------------------------------------- */
.admin-page .site-header { margin-bottom: 0; }
.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}
.admin-section h1 { margin: 0 0 var(--space-6); }
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
}
.admin-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.admin-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.admin-card strong { font-size: var(--text-2xl); margin-bottom: var(--space-1); }
.admin-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.admin-form-card label { display: block; margin-bottom: var(--space-3); }
.admin-form-card input,
.admin-form-card textarea,
.admin-form-card select { max-width: 600px; }
.admin-form-card textarea.wide { max-width: 100%; min-height: 200px; }
.admin-form-card .btn { margin-top: var(--space-3); margin-right: var(--space-2); }

/* Admin table uses .table */
.admin-table { font-size: var(--text-sm); }
.admin-table th, .admin-table td { padding: var(--space-3) var(--space-4); }
.admin-table th { background: var(--surface-2); font-weight: var(--font-semibold); }
.admin-table .badge { margin-left: var(--space-1); }

/* -------------------------------------------------------------------------- */
/* FOOTER                                                                      */
/* -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 0;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
  background: var(--surface);
}
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-brand { font-weight: var(--font-semibold); margin-bottom: var(--space-3); }
.footer-logo { display: block; max-height: 1.5rem; width: auto; max-width: 100%; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-3); }
@media (max-width: 380px) {
  .site-footer { padding: var(--space-6) var(--space-3); }
  .footer-links { gap: var(--space-2); }
}
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-copy { margin: 0; }

/* -------------------------------------------------------------------------- */
/* FAQ (expandable)                                                            */
/* -------------------------------------------------------------------------- */
.section-faq { padding-top: var(--space-10); padding-bottom: var(--space-12); }
.faq-header { margin-bottom: var(--space-8); }
.faq-header .h1 { margin-bottom: var(--space-2); }
.faq-intro { margin: 0; font-size: var(--text-lg); max-width: 42em; }
.faq-list { display: flex; flex-direction: column; gap: 0; }
.faq-item {
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--surface);
}
.faq-item:last-of-type { border-bottom: 1px solid var(--border); }
.faq-item:first-of-type { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.faq-item:last-of-type { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.faq-item:only-of-type { border-radius: var(--radius-md); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  list-style: none;
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question:hover { background: var(--surface-2); }
.faq-question-text { flex: 1; }
.faq-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  position: relative;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.faq-icon::before,
.faq-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: currentColor;
  transition: transform 0.2s ease;
}
.faq-icon::before { width: 12px; height: 2px; margin: -1px 0 0 -6px; }
.faq-icon::after { width: 2px; height: 12px; margin: -6px 0 0 -1px; }
.faq-item[open] .faq-icon::after { transform: scaleY(0); }
.faq-item[open] .faq-question { background: var(--surface-2); }
.faq-answer {
  padding: 0 var(--space-5) var(--space-5);
  margin-top: -2px;
  padding-top: 0;
}
.faq-item[open] .faq-answer { padding-top: 0; padding-bottom: var(--space-6); }
.faq-description { margin: 0 0 var(--space-4); color: var(--text-muted); line-height: 1.6; }
.faq-how-to { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.faq-how-to-title { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--font-semibold); text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.faq-how-to-content { font-size: var(--text-sm); line-height: 1.7; color: var(--text); }
