/* ClipScales Discover: shared look for every page.
   Palette follows clipscales.com (warm off-black / off-white) with the logo's yellow. */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Geist:wght@400..700&family=Geist+Mono:wght@400..600&family=Instrument+Serif:ital@0;1&display=swap");

:root {
  color-scheme: dark;
  --bg: #0d0d0c;
  --bg-2: #121211;
  --surface: #171716;
  --surface-2: #201f1d;
  --glass: rgba(23, 23, 22, .62);
  --border: #292927;
  --border-2: #3a3936;
  --fg: #f4f3ef;
  --muted: #c2c0b6;
  --muted-2: #8a877d;
  --accent: #ffd21f;          /* logo yellow: fills */
  --accent-2: #ffe466;
  --accent-ink: #16150f;      /* text on yellow */
  --accent-text: #ffd84d;     /* yellow used as text */
  --accent-soft: rgba(255, 210, 31, .12);
  --accent-line: rgba(255, 210, 31, .35);
  --danger: #e06a69;
  --ok: #1baf7a;
  --yt: #ff4d4f;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 20px 60px -20px rgba(0,0,0,.7);
  --glow: 0 0 0 1px var(--accent-line), 0 10px 40px -10px rgba(255, 210, 31, .45);
  --grain-opacity: .05;
  /* read by the 3D scene */
  --scene-fg: #f4f3ef;
  --scene-dim: #5b5952;
  --scene-card: #1d1c1a;

  --f-display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --f-body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;
  --f-mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --r-sm: 10px; --r: 16px; --r-lg: 24px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f7f7f4; --bg-2: #efeee9; --surface: #ffffff; --surface-2: #f0efeb;
    --glass: rgba(255, 255, 255, .7);
    --border: #e5e4de; --border-2: #d6d4cc;
    --fg: #0b0b0a; --muted: #504e48; --muted-2: #85827a;
    --accent-text: #8a6400; --accent-soft: rgba(255, 196, 0, .16); --accent-line: rgba(214, 160, 0, .45);
    --danger: #c2403f; --ok: #199e70; --yt: #e5252a;
    --shadow: 0 1px 2px rgba(20,18,10,.06), 0 20px 50px -24px rgba(20,18,10,.25);
    --glow: 0 0 0 1px var(--accent-line), 0 10px 40px -12px rgba(230, 170, 0, .45);
    --grain-opacity: .035;
    --scene-fg: #1a1917; --scene-dim: #b9b6ac; --scene-card: #fbfaf6;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f4; --bg-2: #efeee9; --surface: #ffffff; --surface-2: #f0efeb;
  --glass: rgba(255, 255, 255, .7);
  --border: #e5e4de; --border-2: #d6d4cc;
  --fg: #0b0b0a; --muted: #504e48; --muted-2: #85827a;
  --accent-text: #8a6400; --accent-soft: rgba(255, 196, 0, .16); --accent-line: rgba(214, 160, 0, .45);
  --danger: #c2403f; --ok: #199e70; --yt: #e5252a;
  --shadow: 0 1px 2px rgba(20,18,10,.06), 0 20px 50px -24px rgba(20,18,10,.25);
  --glow: 0 0 0 1px var(--accent-line), 0 10px 40px -12px rgba(230, 170, 0, .45);
  --grain-opacity: .035;
  --scene-fg: #1a1917; --scene-dim: #b9b6ac; --scene-card: #fbfaf6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
/* film grain for depth */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- type ---------- */
.display {
  font-family: var(--f-display); font-weight: 800; letter-spacing: -.035em;
  line-height: .92; font-variation-settings: "opsz" 96;
  margin: 0;
}
.serif { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.mono { font-family: var(--f-mono); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2);
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-line); animation: ping 2s var(--ease) infinite;
}
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255,210,31,.55); } 80%, 100% { box-shadow: 0 0 0 10px rgba(255,210,31,0); } }
.hl {
  position: relative; white-space: nowrap; z-index: 0;
}
.hl::before {
  content: ""; position: absolute; left: -.06em; right: -.06em; bottom: .06em; height: .38em; z-index: -1;
  background: var(--accent); border-radius: .08em; transform-origin: left;
  transform: scaleX(0); animation: swipe .9s .55s var(--ease) forwards;
}
@keyframes swipe { to { transform: scaleX(1); } }
.grad-text {
  background: linear-gradient(100deg, var(--fg) 20%, var(--accent-text) 50%, var(--fg) 80%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 6s linear infinite;
}
@keyframes sheen { to { background-position: -250% 0; } }

/* ---------- nav ---------- */
.nav {
  position: relative; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  max-width: 1320px; margin: 0 auto; padding: 18px 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none !important; }
.brand img {
  width: 30px; height: 30px; border-radius: 8px; display: block;
  box-shadow: 0 4px 18px -4px rgba(255,210,31,.6);
  transition: transform .5s var(--ease);
}
.brand:hover img { transform: rotate(-8deg) scale(1.08); }
.brand span { font: 700 17px/1 var(--f-display); letter-spacing: -.02em; }
.brand span b { font: 400 19px/1 var(--f-serif); font-style: italic; color: var(--accent-text); margin-left: 2px; }
/* main menu: three big pills, each with its own colour */
.links { display: flex; gap: 8px; margin-left: 14px; }
.links a {
  --c: var(--accent); position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; font: 650 15px/1 var(--f-display); letter-spacing: -.01em;
  color: var(--fg); text-decoration: none !important; background: var(--surface);
  border: 1.5px solid color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .3s var(--ease), background .25s, color .25s, box-shadow .3s, border-color .25s;
}
.links a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.links a[href^="/radar"] { --c: #ffd21f; }
.links a[href^="/logs"]  { --c: #22d3ee; }
.links a[href^="/about"] { --c: #e0673a; }
.links a:hover { transform: translateY(-2px); border-color: var(--c); box-shadow: 0 8px 24px -10px var(--c); }
.links a.on { background: var(--c); color: #111; border-color: var(--c); box-shadow: 0 10px 30px -10px var(--c); }
.links a.on::before { background: #111; box-shadow: none; }
.nav .grow { flex: 1; }
.nav-r { display: flex; align-items: center; gap: 8px; }
.ext-link { font: 500 12px var(--f-mono); color: var(--muted-2); padding: 8px 10px; border-radius: 999px; }
.ext-link:hover { color: var(--fg); text-decoration: none; background: var(--surface-2); }

/* ---------- buttons & inputs ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  font: 600 14px/1 var(--f-body); text-decoration: none !important; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s, color .2s, border-color .2s;
  overflow: hidden;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 30px -10px rgba(255,210,31,.8); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transition: transform .7s var(--ease);
}
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.xs { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--fg);
  transition: transform .35s var(--ease), border-color .2s;
}
.icon-btn:hover { border-color: var(--border-2); transform: rotate(18deg); }
.icon-btn svg { width: 17px; height: 17px; }
[data-theme-toggle] .moon { display: none; }
:root[data-theme="light"] [data-theme-toggle] .sun { display: none; }
:root[data-theme="light"] [data-theme-toggle] .moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) [data-theme-toggle] .sun { display: none; }
  :root:not([data-theme="dark"]) [data-theme-toggle] .moon { display: block; }
}

.field {
  width: 100%; padding: 14px 16px; font: 15px var(--f-body); color: var(--fg);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field::placeholder { color: var(--muted-2); }
.field:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }

.err { min-height: 20px; color: var(--danger); font-size: 13px; }

/* ---------- surfaces ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.glass {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font: 500 12px var(--f-mono); color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border);
}
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font: 600 10.5px/1.4 var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
}
.badge.ready { background: rgba(27,175,122,.14); color: var(--ok); }
.badge.analyzing { background: var(--accent-soft); color: var(--accent-text); }
.badge.error { background: rgba(224,106,105,.14); color: var(--danger); }
.badge.ready::before, .badge.analyzing::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.analyzing::before { animation: ping 1.4s infinite; }

/* tilt (set by ui.js) */
[data-tilt] { transform-style: preserve-3d; transition: transform .5s var(--ease), box-shadow .3s, border-color .3s; will-change: transform; }
[data-tilt] .tilt-shine {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255,210,31,.16), transparent 45%);
}
[data-tilt]:hover .tilt-shine { opacity: 1; }

/* ---------- motion ---------- */
/* content folds up in 3D as it scrolls in */
[data-reveal] { opacity: 0; transform: perspective(1000px) translateY(34px) rotateX(16deg) scale(.97); transform-origin: 50% 100%; filter: blur(6px);
  transition: opacity .9s var(--ease), transform 1s var(--ease), filter .9s var(--ease); transition-delay: var(--d, 0s); }
[data-reveal].in { opacity: 1; transform: none; filter: none; }

/* the 3D world behind the page */
canvas.world { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; opacity: .9; }
.scroll-progress { position: fixed; left: 0; top: 0; z-index: 120; width: 100%; height: 3px; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--world-accent, var(--accent-2))); box-shadow: 0 0 12px var(--accent); pointer-events: none; }
.cursor-glow { position: fixed; left: 0; top: 0; z-index: -1; width: 600px; height: 600px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%); opacity: .9; mix-blend-mode: normal; will-change: transform; }
[data-depth] { transition: transform .2s linear; will-change: transform; }
.split-word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; margin-bottom: -.06em; }
.split-word > span { display: inline-block; transform: translateY(105%); animation: rise .9s var(--ease) forwards; animation-delay: var(--d, 0s); }
@keyframes rise { to { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.foot {
  max-width: 1320px; margin: 0 auto; padding: 36px 24px 40px;
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  color: var(--muted-2); font-size: 13px; border-top: 1px solid var(--border);
}
.foot .brand span { font-size: 15px; }
.foot .brand img { width: 24px; height: 24px; }
.foot a { color: var(--muted); }
.foot .credit { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.made-by { display: inline-flex; align-items: center; gap: 8px; text-decoration: none !important; }
.made-by img { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; filter: grayscale(1); border: 1px solid var(--border-2); transition: transform .35s var(--ease), filter .35s; }
.made-by:hover img { transform: rotate(-6deg) scale(1.1); filter: none; }
.made-by b { color: var(--fg); font-weight: 650; }

/* ---------- 3D canvas ---------- */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.scene-wrap { position: relative; }
.scene-wrap.nogl { background: radial-gradient(closest-side, var(--accent-soft), transparent); }

@media (max-width: 760px) {
  .nav { padding: 14px 16px; gap: 10px; flex-wrap: wrap; }
  .links { margin-left: 0; order: 3; width: 100%; }
  .links a { padding: 9px 14px; font-size: 14px; }
  .ext-link { display: none; }
  .foot { padding: 28px 16px 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
}

/* Team-only links and tools (Campaigns, Logs) are hidden from clippers. */
html:not(.is-team) .team-only { display: none !important; }
