/* =========================
   Caelon — Lux Dark Theme (smooth scroll + refined motion)
   ========================= */

:root {
  --bg-0: #0B0F14;
  --bg-1: #0E141B;
  --line: rgba(255, 255, 255, 0.07);

  --text-0: #E6EEF5;
  --text-1: #A6B3C2;
  --text-2: #7A8897;

  --acc-1: #6EE7F9;
  --acc-2: #60A5FA;
  --acc-3: #A78BFA;

  --radius: 16px;
  --shadow-1: 0 2px 20px rgba(0,0,0,0.35);
  --shadow-2: 0 8px 40px rgba(0,0,0,0.45);

  --maxw: 1120px;
  --pad: clamp(16px, 2vw, 28px);

  --header-h: 64px;
  --ease-out: cubic-bezier(.22,1,.36,1);    /* snappy ease */
  --ease-soft: cubic-bezier(.25,.46,.45,.94);
}

/* Smooth anchor scrolling */
html { color-scheme: dark; scroll-behavior: smooth; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% -10%, #12202b 0%, transparent 60%),
              radial-gradient(1200px 800px at 110% 10%, #1b1430 0%, transparent 60%),
              var(--bg-0);
  color: var(--text-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ensure sections don't hide under sticky header on anchor jump */
.section-anchor { scroll-margin-top: calc(var(--header-h) + 12px); }

.container { max-width: var(--maxw); padding-inline: var(--pad); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0;
  height: var(--header-h);
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(11,15,20,0.75), rgba(11,15,20,0));
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.4px; color: var(--text-0); text-decoration: none; }
.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #7dd3fc, #2563eb 80%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.15),
    0 0 0 3px rgba(255,255,255,0.05),
    0 2px 10px rgba(96,165,250,0.35);
}
.brand-text { font-size: 16px; }

/* Desktop nav */
.nav-links { display: flex; gap: 18px; padding: 0; margin: 0; align-items: center; }
.nav-links li { list-style: none; }
.nav-links a {
  color: var(--text-1); text-decoration: none; padding: 10px 12px; border-radius: 10px;
  transition: color .2s var(--ease-soft), background .2s var(--ease-soft);
  position: relative;
}
.nav-links a:hover,
.nav-links a:focus-visible { color: var(--text-0); background: rgba(255,255,255,0.04); outline: none; }
.nav-links a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 6px; height: 2px;
  background: linear-gradient(90deg, var(--acc-1), var(--acc-2), var(--acc-3));
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease-out);
}
.nav-links a:hover::after,
.nav-links a:focus-visible::after { transform: scaleX(1); }

/* Mobile nav */
.nav-toggle {
  display: none;
  appearance: none; background: transparent; border: 1px solid var(--line);
  color: var(--text-0); border-radius: 10px; padding: 8px 10px; font-size: 18px; line-height: 1;
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    position: absolute; right: var(--pad); top: calc(var(--header-h) + 8px);
    display: none; flex-direction: column; align-items: stretch; gap: 8px;
    background: rgba(8, 10, 14, 0.9);
    border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: min(260px, 90vw);
    box-shadow: var(--shadow-2);
  }
  .nav-links.open { display: flex; animation: menuIn .24s var(--ease-out); }
  @keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
  .nav-links a { padding: 12px; }
}

/* Hero */
.hero { text-align: center; padding-block: clamp(64px, 14vh, 160px); }
.hero-title {
  font-size: clamp(48px, 9vw, 104px);
  line-height: 0.95; letter-spacing: -0.02em; margin: 0 0 8px;
  background: linear-gradient(120deg, var(--acc-1), var(--acc-2) 40%, var(--acc-3) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(96,165,250,0.25);
}
.hero-subtitle { margin: 0 auto; max-width: 60ch; color: var(--text-1); font-size: clamp(16px, 2.2vw, 20px); }
.hero-cta { margin-top: 24px; display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Badges */
.hero-badges { margin-top: 24px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge {
  font-size: 12px; color: var(--text-1); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 999px; backdrop-filter: blur(6px); background: rgba(255,255,255,0.03);
}

/* Buttons */
.btn {
  --btn-pad-x: 18px; --btn-pad-y: 12px;
  appearance: none; border: 0; border-radius: 12px; padding: var(--btn-pad-y) var(--btn-pad-x);
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .06s ease, filter .2s var(--ease-soft), box-shadow .2s var(--ease-soft);
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  color: #061018;
  background: linear-gradient(135deg, var(--acc-1), var(--acc-2) 45%, var(--acc-3) 90%);
  box-shadow: 0 8px 24px rgba(96,165,250,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { color: var(--text-0); background: rgba(255,255,255,0.04); border: 1px solid var(--line); }
.btn--ghost:hover { background: rgba(255,255,255,0.06); }

/* Sections */
.section { padding-block: clamp(40px, 8vh, 80px); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }
.card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  backdrop-filter: blur(8px); padding: 20px; box-shadow: var(--shadow-1);
  will-change: transform, opacity;
}
.card h3 { margin: 12px 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--text-1); }
.card-icon {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, rgba(110,231,249,0.12), rgba(96,165,250,0.12) 60%, rgba(167,139,250,0.12));
  color: var(--text-0); border: 1px solid var(--line);
}

/* Panel (Access) */
.panel {
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-2);
  will-change: transform, opacity;
}
.panel h2 { margin: 0 0 6px; }
.panel .muted { color: var(--text-1); margin: 0 0 14px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.inline-form input[type="email"] {
  flex: 1 1 260px;
  min-width: 220px;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text-0);
  font-size: 16px;
  outline: none;
  min-height: 44px;
}
.inline-form input::placeholder { color: var(--text-2); }
.meta { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--text-1); }
.meta code {
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); padding: 6px 10px; border-radius: 10px;
}
/* Larger font just for the access form's Send button */
.inline-form .btn { font-size: 16px; padding: 14px 20px; }

/* ===== Footer ===== */
.site-footer {
  position: relative;
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding-block: 26px;
  background: linear-gradient(to top, rgba(0,0,0,0.35), transparent);
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  color: var(--text-1); font-size: 14px;
}

/* Left column */
.footer-left { display: flex; flex-direction: column; gap: 4px; }
.footer-left p { margin: 0; line-height: 1.5; }
.footer-left .credits { font-size: 13px; opacity: 0.8; }
.footer-left .credits strong { color: var(--text-0); font-weight: 600; }

/* Credit link hover underline */
.credit-link {
  color: var(--text-0); font-weight: 600; text-decoration: none; position: relative; transition: color .25s var(--ease-soft);
}
.credit-link::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--acc-1), var(--acc-2), var(--acc-3));
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease-out); opacity: 0.9;
}
.credit-link:hover { color: var(--acc-2); }
.credit-link:hover::after { transform: scaleX(1); }

/* Back to top */
.tiny-link {
  color: var(--text-1);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255,255,255,0.25);
  transition: color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.tiny-link:hover { color: var(--text-0); border-color: rgba(255,255,255,0.4); }

/* Decorative divider */
.site-footer::before {
  content: "";
  position: absolute; left: 0; right: 0; height: 1px; top: 0;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.05), transparent);
}

/* Background FX */
.bg.fx {
  position: fixed; inset: -30%; filter: blur(80px); opacity: 0.45; z-index: -2; pointer-events: none; transform: translateZ(0);
  background:
    radial-gradient(40% 40% at 20% 30%, rgba(110,231,249,0.18), transparent 60%),
    radial-gradient(40% 40% at 80% 20%, rgba(96,165,250,0.18), transparent 60%),
    radial-gradient(40% 40% at 50% 80%, rgba(167,139,250,0.18), transparent 60%);
  animation: drift 36s linear infinite;
}
.fx--b { animation-duration: 52s; animation-direction: reverse; opacity: 0.35; }
@keyframes drift { 0%{ transform: translate3d(-2%,-1%,0) scale(1); } 50%{ transform: translate3d(2%,1%,0) scale(1.02);} 100%{ transform: translate3d(-2%,-1%,0) scale(1);} }

/* Subtle grain */
.grain {
  position: fixed; inset: 0; pointer-events: none; opacity: .08; z-index: -1;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/ filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

/* Reveal animations */
.reveal-up, .panel, .card, .reveal-fade {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity .7s var(--ease-out),
    transform .7s var(--ease-out),
    filter .7s var(--ease-out);
  filter: saturate(.96);
}
.reveal-fade { transform: none; }
.reveal-in { opacity: 1 !important; transform: translateY(0) !important; filter: saturate(1); }

/* Focus styles (mouse vs keyboard) */
*:focus:not(:focus-visible) { outline: none; box-shadow: none; }
:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.10),
    0 0 0 4px rgba(96,165,250,0.25);
  border-radius: 12px;
}

/* Accessibility & motion */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Global: stop horizontal scrolling */
html, body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
img, video, canvas { max-width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fx { animation: none !important; }
  .reveal-up, .panel, .card, .reveal-fade {
    opacity: 1 !important; transform: none !important; transition: none !important; filter: none !important;
  }
}