/* ═══════════════════════════════════════════
   CAVARIDGE DESIGN SYSTEM v1.1
   Light / Dark / System theme support
   ═══════════════════════════════════════════ */

/* ─── DARK THEME (default) ─── */
:root, [data-theme="dark"] {
  --midnight: #060a14;
  --deep: #0c1221;
  --surface: #131c30;
  --surface-raised: #1a2540;
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.1);
  --border-focus: rgba(229,168,37,0.5);
  --text: #e8ecf4;
  --text-secondary: #8b97b0;
  --text-muted: #5c6a82;
  --amber: #e5a825;
  --amber-glow: rgba(229,168,37,0.12);
  --amber-bright: #f5c542;
  --amber-on-bg: #060a14;
  --teal: #2ac5a8;
  --teal-glow: rgba(42,197,168,0.1);
  --blue: #4a8eff;
  --blue-glow: rgba(74,142,255,0.1);
  --rose: #e55c7a;
  --rose-glow: rgba(229,92,122,0.1);
  --violet: #9870f5;
  --violet-glow: rgba(152,112,245,0.1);
  --green: #3dc97a;
  --green-glow: rgba(61,201,122,0.1);
  --nav-bg: rgba(6,10,20,0.85);
  --nav-blur: blur(20px) saturate(1.4);
  --card-shadow: 0 20px 60px rgba(0,0,0,0.3);
  --noise-opacity: 0.025;
  --glow-opacity: 1;
  color-scheme: dark;
}

/* ─── LIGHT THEME ─── */
[data-theme="light"] {
  --midnight: #ffffff;
  --deep: #f7f8fa;
  --surface: #ffffff;
  --surface-raised: #f0f2f5;
  --border: rgba(0,0,0,0.07);
  --border-light: rgba(0,0,0,0.12);
  --border-focus: rgba(180,125,10,0.4);
  --text: #1a1f2e;
  --text-secondary: #4a5568;
  --text-muted: #8892a4;
  --amber: #c8920a;
  --amber-glow: rgba(200,146,10,0.08);
  --amber-bright: #a87a08;
  --amber-on-bg: #ffffff;
  --teal: #0e9a80;
  --teal-glow: rgba(14,154,128,0.06);
  --blue: #2b6fdb;
  --blue-glow: rgba(43,111,219,0.06);
  --rose: #cc3d5c;
  --rose-glow: rgba(204,61,92,0.06);
  --violet: #7a52e0;
  --violet-glow: rgba(122,82,224,0.06);
  --green: #1da35e;
  --green-glow: rgba(29,163,94,0.06);
  --nav-bg: rgba(255,255,255,0.9);
  --nav-blur: blur(20px) saturate(1.2);
  --card-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --noise-opacity: 0;
  --glow-opacity: 0.3;
  color-scheme: light;
}

/* ─── SYSTEM PREFERENCE (no explicit theme set) ─── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --midnight: #ffffff;
    --deep: #f7f8fa;
    --surface: #ffffff;
    --surface-raised: #f0f2f5;
    --border: rgba(0,0,0,0.07);
    --border-light: rgba(0,0,0,0.12);
    --border-focus: rgba(180,125,10,0.4);
    --text: #1a1f2e;
    --text-secondary: #4a5568;
    --text-muted: #8892a4;
    --amber: #c8920a;
    --amber-glow: rgba(200,146,10,0.08);
    --amber-bright: #a87a08;
    --amber-on-bg: #ffffff;
    --teal: #0e9a80;
    --teal-glow: rgba(14,154,128,0.06);
    --blue: #2b6fdb;
    --blue-glow: rgba(43,111,219,0.06);
    --rose: #cc3d5c;
    --rose-glow: rgba(204,61,92,0.06);
    --violet: #7a52e0;
    --violet-glow: rgba(122,82,224,0.06);
    --green: #1da35e;
    --green-glow: rgba(29,163,94,0.06);
    --nav-bg: rgba(255,255,255,0.9);
    --nav-blur: blur(20px) saturate(1.2);
    --card-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --noise-opacity: 0;
    --glow-opacity: 0.3;
    color-scheme: light;
  }
}

/* ─── SHARED TOKENS ─── */
:root {
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius-lg: 20px;
  --max-w: 1200px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font-body); background: var(--midnight); color: var(--text); overflow-x: hidden; line-height: 1.6; transition: background 0.35s ease, color 0.35s ease; }
body::after { content: ''; position: fixed; inset: 0; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E"); opacity: var(--noise-opacity); pointer-events: none; z-index: 9999; transition: opacity 0.35s; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ═══ NAVIGATION ═══ */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; padding: 16px 0; background: var(--nav-bg); backdrop-filter: var(--nav-blur); -webkit-backdrop-filter: var(--nav-blur); box-shadow: 0 1px 0 var(--border); transition: background 0.35s, box-shadow 0.35s; }
.nav-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 22px; letter-spacing: -0.02em; }
.nav-logo .paw { font-size: 20px; }
.nav-links { display: flex; align-items: center; gap: 24px; list-style: none; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-cta { display: inline-flex; padding: 10px 22px; background: var(--amber); color: var(--amber-on-bg); font-size: 13px; font-weight: 700; border-radius: 8px; transition: all 0.25s var(--ease-out); }
.nav-cta:hover { background: var(--amber-bright); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(229,168,37,0.25); }
.nav-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; }
.nav-toggle svg { width: 24px; height: 24px; }

/* ═══ THEME TOGGLE ═══ */
.theme-toggle { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; }
.theme-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s; color: var(--text-muted); line-height: 1; }
.theme-btn:hover { color: var(--text-secondary); }
.theme-btn.active { background: var(--amber-glow); color: var(--amber); }

/* ═══ BUTTONS ═══ */
.btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 14px 32px; background: var(--amber); color: var(--amber-on-bg); font-family: var(--font-body); font-size: 15px; font-weight: 700; border-radius: 10px; border: none; cursor: pointer; transition: all 0.25s var(--ease-out); letter-spacing: 0.01em; }
.btn-primary:hover { background: var(--amber-bright); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(229,168,37,0.2); }
.btn-secondary { display: inline-flex; align-items: center; gap: 8px; padding: 14px 28px; background: transparent; color: var(--text-secondary); font-family: var(--font-body); font-size: 15px; font-weight: 500; border-radius: 10px; border: 1px solid var(--border-light); cursor: pointer; transition: all 0.25s var(--ease-out); }
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); background: var(--surface); }

/* ═══ SECTION HEADERS ═══ */
.section-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.section-label::before { content: ''; width: 20px; height: 1px; background: var(--text-muted); }
.section-title { font-family: var(--font-display); font-size: clamp(32px, 4vw, 48px); line-height: 1.1; letter-spacing: -0.02em; color: var(--text); margin-bottom: 16px; }
.section-desc { font-size: 17px; color: var(--text-secondary); max-width: 560px; line-height: 1.6; margin-bottom: 56px; }

/* ═══ PAGE HEADER ═══ */
.page-header { padding: 160px 0 80px; text-align: center; position: relative; }
.page-header-glow { position: absolute; top: -100px; left: 50%; transform: translateX(-50%); width: 800px; height: 500px; background: radial-gradient(ellipse, rgba(229,168,37,0.06) 0%, rgba(42,197,168,0.03) 40%, transparent 70%); pointer-events: none; opacity: var(--glow-opacity); transition: opacity 0.35s; }
.page-header h1 { font-family: var(--font-display); font-size: clamp(36px, 5vw, 56px); line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 16px; position: relative; }
.page-header h1 em { font-style: italic; color: var(--amber); }
.page-header-sub { font-size: 18px; color: var(--text-secondary); max-width: 560px; margin: 0 auto; position: relative; line-height: 1.6; }

/* ═══ CARDS ═══ */
.card { position: relative; padding: 32px; background: var(--deep); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: all 0.35s var(--ease-out); }
.card:hover { border-color: var(--border-light); transform: translateY(-4px); box-shadow: var(--card-shadow); }

/* ═══ CTA SECTION ═══ */
.cta-section { padding: 120px 0; text-align: center; position: relative; overflow: hidden; }
.cta-glow { position: absolute; bottom: -100px; left: 50%; transform: translateX(-50%); width: 800px; height: 400px; background: radial-gradient(ellipse, rgba(229,168,37,0.06) 0%, transparent 60%); pointer-events: none; opacity: var(--glow-opacity); transition: opacity 0.35s; }
.cta-section h2 { font-family: var(--font-display); font-size: clamp(32px, 4vw, 52px); line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 16px; position: relative; }
.cta-section h2 em { font-style: italic; color: var(--amber); }
.cta-sub { font-size: 17px; color: var(--text-secondary); max-width: 500px; margin: 0 auto 40px; line-height: 1.6; position: relative; }
.cta-actions { display: flex; justify-content: center; gap: 16px; position: relative; }

/* ═══ FOOTER ═══ */
.footer { padding: 64px 0 40px; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 48px; }
.footer-brand-name { font-family: var(--font-display); font-size: 20px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.footer-brand-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; max-width: 280px; margin-bottom: 20px; }
.footer-ai-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); padding: 6px 12px; background: var(--amber-glow); border: 1px solid var(--border); border-radius: 6px; }
.footer-heading { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 20px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.footer-links a { font-size: 14px; color: var(--text-secondary); transition: color 0.2s; }
.footer-links a:hover { color: var(--text); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 32px; border-top: 1px solid var(--border); }
.footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-legal { display: flex; gap: 24px; }
.footer-legal a { font-size: 13px; color: var(--text-muted); transition: color 0.2s; }
.footer-legal a:hover { color: var(--text-secondary); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 960px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .nav-links { display: none; }
  .nav-toggle { display: block; }
}
@media (max-width: 600px) {
  .page-header { padding: 140px 0 60px; }
  .cta-actions { flex-direction: column; align-items: center; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
  .footer-legal { flex-direction: column; gap: 8px; }
}

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