/* ============================================
   H.J. LEONE — AI Router
   Brand Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:wght@400;500;600;700;800;900&display=swap');

/* --- CSS Variables --- */
:root {
  --navy: #0A1628;
  --navy-light: #111D32;
  --navy-mid: #162340;
  --gold: #D4A843;
  --gold-light: #E4C373;
  --gold-dark: #B8912E;
  --warm-white: #F5F0E8;
  --success: #2D8B5E;
  --error: #C43333;
  --text-light: #E8E4DC;
  --text-muted: #8A8678;
  --text-dim: #5A5850;
  --border-subtle: rgba(212, 168, 67, 0.15);
  --border-gold: rgba(212, 168, 67, 0.3);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-gold: 0 4px 24px rgba(212, 168, 67, 0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--navy);
  color: var(--text-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; height: auto; }

/* --- Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Typography --- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--warm-white); }
h3 { font-size: 1.3rem; color: var(--warm-white); }

.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-transform: uppercase;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: var(--navy);
}
.btn-primary:hover {
  background: var(--gold-light);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1.5px solid var(--gold);
}
.btn-secondary:hover {
  background: rgba(212, 168, 67, 0.1);
  border-color: var(--gold-light);
  color: var(--gold-light);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 20px;
  font-size: 0.85rem;
}

.btn-danger {
  background: var(--error);
  color: white;
}
.btn-danger:hover { background: #d44; }

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.nav-logo span { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; margin-left: 8px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--gold); }

.nav-links .btn { padding: 8px 20px; font-size: 0.82rem; }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-light);
  transition: var(--transition);
}

/* --- Hero --- */
.hero {
  padding: 160px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--warm-white);
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  color: var(--text-muted);
  font-weight: 300;
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Stats Bar --- */
.stats-bar {
  padding: 48px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--navy-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  text-align: center;
}

.stat-item { padding: 16px; }

.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* --- Section --- */
.section {
  padding: 80px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 16px auto 0;
  font-size: 1.05rem;
}

.section-divider {
  width: 48px;
  height: 2px;
  background: var(--gold);
  margin: 16px auto 0;
}

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

.feature-card {
  background: var(--navy-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  transition: all var(--transition);
}

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

.feature-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 { margin-bottom: 10px; }

.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- Steps / How It Works --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 40px;
  counter-reset: step;
}

.step {
  text-align: center;
  position: relative;
  counter-increment: step;
}

.step::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 auto 20px;
}

.step h3 { margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: 0.95rem; }

/* --- Code Block --- */
.code-section { background: var(--navy-light); }

.code-block {
  background: #060D18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  overflow-x: auto;
  max-width: 720px;
  margin: 0 auto;
}

.code-block pre {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-light);
  white-space: pre;
  margin: 0;
}

.code-block .cm { color: #6A737D; }  /* comment */
.code-block .kw { color: #C792EA; }  /* keyword */
.code-block .fn { color: #82AAFF; }  /* function */
.code-block .st { color: #C3E88D; }  /* string */
.code-block .op { color: #89DDFF; }  /* operator */
.code-block .nb { color: #F78C6C; }  /* number/builtin */
.code-block .var { color: #FFCB6B; } /* variable */

.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.code-dot.red { background: #FF5F56; }
.code-dot.yellow { background: #FFBD2E; }
.code-dot.green { background: #27C93F; }

.code-header span:last-child {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- Pricing Table --- */
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.pricing-table thead th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--gold);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--border-gold);
}

.pricing-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-light);
}

.pricing-table tbody tr:hover {
  background: rgba(212, 168, 67, 0.04);
}

.pricing-table .model-name {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.pricing-table .price {
  font-family: var(--font-mono);
  color: var(--gold);
}

.pricing-wrap {
  background: var(--navy-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* --- CTA Section --- */
.cta-section {
  padding: 80px 0;
  text-align: center;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
}

.cta-section h2 { margin-bottom: 16px; }
.cta-section p {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1.05rem;
}

/* --- Footer --- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 20px;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.footer-links a:hover { color: var(--gold); }

.footer-copy {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* --- Auth Forms --- */
.auth-container {
  max-width: 440px;
  margin: 120px auto 80px;
  padding: 0 24px;
}

.auth-card {
  background: var(--navy-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.auth-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--navy);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold);
}

.form-group input::placeholder { color: var(--text-dim); }

.form-error {
  background: rgba(196, 51, 51, 0.1);
  border: 1px solid rgba(196, 51, 51, 0.3);
  color: var(--error);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 20px;
  display: none;
}

.form-error.visible { display: block; }

.auth-card .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* --- Dashboard --- */
.dashboard {
  padding: 100px 0 60px;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  flex-wrap: wrap;
  gap: 16px;
}

.balance-display {
  background: var(--navy-light);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  text-align: center;
  margin-bottom: 40px;
}

.balance-amount {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--gold);
  font-weight: 500;
}

.balance-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.dash-section {
  background: var(--navy-light);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.dash-section h3 {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

/* API Keys */
.api-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.api-key-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--navy);
  padding: 6px 12px;
  border-radius: var(--radius);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-actions { display: flex; gap: 8px; }

/* Usage Table */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.usage-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-subtle);
}

.usage-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-light);
}

.usage-table .mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Chart */
.chart-container {
  position: relative;
  height: 240px;
  margin-top: 16px;
}

/* --- Live Page --- */
.live-hero {
  padding: 120px 0 40px;
  text-align: center;
}

.live-counter-large {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--gold);
  font-weight: 500;
  line-height: 1;
}

.live-pulse {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(45, 139, 94, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 8px rgba(45, 139, 94, 0); }
}

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

.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

/* Counter tick animation */
@keyframes counterTick {
  0% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

.counter-tick {
  animation: counterTick 0.15s ease;
}

/* --- Overlay (OBS) --- */
.overlay-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  text-align: right;
  font-family: var(--font-mono);
}

.overlay-amount {
  font-size: 3rem;
  color: var(--gold);
  font-weight: 500;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  line-height: 1;
}

.overlay-model {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.overlay-watermark {
  font-size: 0.7rem;
  color: rgba(212, 168, 67, 0.4);
  margin-top: 8px;
  letter-spacing: 0.1em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 22, 40, 0.98);
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .nav-hamburger { display: flex; }

  .stats-grid { grid-template-columns: 1fr; gap: 16px; }

  .hero { padding: 120px 0 60px; }
  .hero-actions { flex-direction: column; align-items: center; }

  .section { padding: 60px 0; }

  .auth-card { padding: 28px 24px; }

  .dash-header { flex-direction: column; align-items: flex-start; }

  .api-key-row { flex-direction: column; align-items: flex-start; }

  .pricing-table { font-size: 0.82rem; }
  .pricing-table thead th, .pricing-table tbody td { padding: 10px 8px; }

  .footer-links { flex-wrap: wrap; gap: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .btn { padding: 12px 24px; font-size: 0.88rem; }
  .balance-display { padding: 24px 20px; }
}
