/* ============================================================
   CastleJello — Shared Styles (loaded by every page)
   Dark theme · Purple accents · No frameworks · Anti-corporate
   ============================================================ */

:root {
  --bg: #08080f;
  --bg-elevated: #0d0d18;
  --surface: #10101e;
  --surface-2: #15152a;
  --border: #1a1a35;
  --border-soft: #13132a;
  --border-strong: #2a2a4a;
  --purple: #7b44ee;
  --purple-soft: #5e2ec8;
  --purple-glow: #b388ff;
  --purple-deep: #2d0d6e;
  --pink: #e04090;
  --text: #e2dff0;
  --text-dim: #908ca8;
  --text-muted: #5e5b7a;
  --accent: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 60px rgba(0, 0, 0, .5);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* === Reset & Base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
p { color: var(--text-dim); }
a { color: var(--purple-glow); text-decoration: none; transition: color 0.15s; }
a:hover { color: #c8a8ff; }

/* === Layout === */
.container { max-width: 1100px; margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 0 28px; }
section { padding: 120px 0; }
section + section { padding-top: 40px; }

/* === Shared Animations === */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 25% { transform: translate(3px, -5px) scale(1.02); } 50% { transform: translate(-2px, 3px) scale(.98); } 75% { transform: translate(5px, 1px) scale(1.01); } }
@keyframes phase { 0%, 100% { opacity: .45; } 50% { opacity: .75; } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 20px rgba(123, 68, 238, .2); } 50% { box-shadow: 0 0 38px rgba(123, 68, 238, .5); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes float-slow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes rotate-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse-border { 0%, 100% { box-shadow: 0 0 0 0 rgba(123, 68, 238, .3); } 50% { box-shadow: 0 0 0 6px rgba(123, 68, 238, 0); } }

/* === JS Reveal System === */
[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .7s ease-out, transform .7s ease-out; }
[data-reveal].visible { opacity: 1; transform: translateY(0); }
[data-stagger] { opacity: 0; transform: translateY(20px); transition: opacity .5s ease-out, transform .5s ease-out; }
[data-stagger].visible { opacity: 1; transform: translateY(0); }

/* === Ambient BG (home only) === */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient .orb { position: absolute; border-radius: 50%; filter: blur(130px); opacity: .07; }
.ambient .orb-1 { width: 650px; height: 650px; background: var(--purple); top: -250px; right: -150px; animation: drift 22s ease-in-out infinite; }
.ambient .orb-2 { width: 420px; height: 420px; background: var(--pink); bottom: -120px; left: -80px; animation: drift 26s ease-in-out infinite reverse; }

/* === Navigation === */
.nav { position: fixed; top: 0; width: 100%; z-index: 100; background: rgba(8, 8, 15, .85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border-soft); padding: 14px 0; transition: transform .3s, background .3s, padding .3s; }
.nav.scrolled { padding: 10px 0; background: rgba(8, 8, 15, .95); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.logo-link { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon { width: 30px; height: 30px; background: linear-gradient(135deg, var(--purple), var(--purple-soft)); border-radius: 8px; position: relative; box-shadow: 0 0 18px rgba(123, 68, 238, .35); transition: transform .25s, box-shadow .25s; }
.logo-link:hover .logo-icon { transform: rotate(-6deg) scale(1.06); box-shadow: 0 0 24px rgba(123, 68, 238, .55); }
.logo-icon::after { content: ''; position: absolute; inset: 3px; border: 2px solid rgba(255, 255, 255, .45); border-radius: 5px; }
.logo-word { font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; color: #cfc4f0; }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--text-dim); font-size: .88rem; font-weight: 500; text-decoration: none; padding: 6px 0; position: relative; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1px; background: var(--purple-glow); transition: width .25s; }
.nav-links a:hover::after { width: 100%; }

/* === Buttons === */
.btn { padding: 14px 30px; border-radius: 10px; font-weight: 600; font-size: .94rem; text-decoration: none; border: none; cursor: pointer; transition: all .22s ease; display: inline-flex; align-items: center; gap: 8px; position: relative; overflow: hidden; }
.btn-fill { background: var(--purple); color: #fff; box-shadow: 0 4px 14px rgba(123, 68, 238, .25); }
.btn-fill:hover { background: #8f5cf7; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(123, 68, 238, .4); }
.btn-fill:active { transform: translateY(0); }
.btn-line { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-line:hover { border-color: var(--purple); color: var(--text); transform: translateY(-1px); }
.btn-sm { padding: 9px 22px; border-radius: 8px; font-weight: 600; font-size: .84rem; text-decoration: none; background: var(--purple); color: #fff; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-sm:hover { background: #8f5cf7; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(123, 68, 238, .3); }
.btn-sm::after { content: '→'; transition: transform .2s; }
.btn-sm:hover::after { transform: translateX(2px); }

/* === Section Headers === */
.sec-head { text-align: center; margin-bottom: 72px; }
.sec-head h2 { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; }
.sec-head h2 em { font-style: normal; color: var(--purple-glow); }
.sec-head p { color: var(--text-dim); margin-top: 12px; font-size: 1.02rem; max-width: 540px; margin-left: auto; margin-right: auto; }
.sec-head::after { content: ''; display: block; width: 48px; height: 2px; background: linear-gradient(to right, transparent, var(--purple), transparent); margin: 24px auto 0; border-radius: 2px; }

/* === Footer === */
footer { border-top: 1px solid var(--border-soft); padding: 60px 0 32px; font-size: .88rem; color: var(--text-dim); background: var(--bg-elevated); position: relative; }
footer::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 200px; height: 1px; background: linear-gradient(to right, transparent, var(--purple), transparent); }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 40px; }
.footer-brand p { font-size: .9rem; line-height: 1.6; margin-top: 16px; max-width: 320px; }
.footer-brand .footer-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.footer-col h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: 16px; font-weight: 600; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: var(--text-dim); text-decoration: none; font-size: .9rem; transition: color .15s, padding-left .15s; }
.footer-col a:hover { color: var(--purple-glow); padding-left: 4px; }
.footer-bottom { border-top: 1px solid var(--border-soft); padding-top: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-bottom p { font-size: .82rem; }
.footer-bottom .fl { display: flex; gap: 18px; }
.footer-bottom .fl a { color: var(--text-dim); font-size: .82rem; }

/* === Utility === */
hr { border: none; border-top: 1px solid var(--border-soft); margin: 0 24px; }
.back-link { padding: 120px 0 0; max-width: 1100px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }
.back-link a { color: var(--text-dim); font-size: .85rem; text-decoration: none; transition: color .2s; }
.back-link a:hover { color: var(--text); }

/* === Responsive === */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 768px) {
  section { padding: 72px 0; }
  section + section { padding-top: 24px; }
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.4rem; }
  .nav-links { gap: 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  .nav-inner { flex-direction: column; gap: 10px; }
  .nav-links { gap: 16px; }
  .container { padding: 0 20px; }
}
