/* ============================================================================
   SKILLGATE · Base + Component Library
   Every page composes these classes. Do NOT invent new colors — use tokens.
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01","cv01","cv03","cv11";
  overflow-x: hidden;
}
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight); color: var(--text); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg, canvas { display: block; max-width: 100%; }
::selection { background: rgba(224,168,106,0.28); color: var(--text); }

/* scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--surface-4); }

/* ---- Scene background: graphite depth + grain + moving glow ---------------- */
.scene { position: fixed; inset: 0; z-index: -2; background:
   var(--grad-scene), var(--bg-0); }
.scene-glow { position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background: radial-gradient(600px 400px at var(--gx,30%) var(--gy,18%),
              rgba(200,133,90,0.10), transparent 60%);
  animation: glowDrift 26s var(--ease-in-out) infinite alternate; }
@keyframes glowDrift {
  0%   { --gx: 24%; --gy: 14%; transform: translate3d(-1%, -1%, 0); }
  100% { --gx: 72%; --gy: 28%; transform: translate3d(1.5%, 1.5%, 0); }
}
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.04;
  mix-blend-mode: overlay;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---- Layout ---------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto;
  padding-inline: var(--s-6); }
.container-wide { max-width: var(--maxw-wide); }
.section { padding-block: var(--s-12); position: relative; }
.section-sm { padding-block: var(--s-10); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: var(--s-5); }
.gap-2 { gap: var(--s-2);} .gap-3{gap:var(--s-3);} .gap-4{gap:var(--s-4);}
.gap-5 { gap: var(--s-5);} .gap-6{gap:var(--s-6);} .gap-8{gap:var(--s-8);}
.mt-2{margin-top:var(--s-2);} .mt-3{margin-top:var(--s-3);} .mt-4{margin-top:var(--s-4);}
.mt-6{margin-top:var(--s-6);} .mt-8{margin-top:var(--s-8);} .mt-10{margin-top:var(--s-10);}

/* ---- Type helpers ---------------------------------------------------------- */
.eyebrow { font-size: var(--fs-xs); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--copper-hi); font-weight: 600;
  display: inline-flex; align-items: center; gap: var(--s-2); }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--copper); opacity:.7; }
.display { font-size: var(--fs-hero); font-weight: 600; letter-spacing: -0.035em; }
.h2 { font-size: var(--fs-2xl); } .h3 { font-size: var(--fs-xl); }
.lead { font-size: var(--fs-md); color: var(--text-2); line-height: var(--lh-body); }
.muted { color: var(--text-muted); } .t2 { color: var(--text-2); }
.mono { font-family: var(--font-mono); }
.gradient-text { background: var(--grad-milk); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.copper-text { background: var(--grad-copper); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.balance { text-wrap: balance; }

/* ---- Buttons --------------------------------------------------------------- */
.btn { --bh: 44px; height: var(--bh); display: inline-flex; align-items: center;
  justify-content: center; gap: var(--s-2); padding-inline: var(--s-5);
  border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600;
  letter-spacing: 0; border: 1px solid transparent; position: relative;
  white-space: nowrap; transition: transform var(--t-fast) var(--ease),
  background var(--t-mid) var(--ease), border-color var(--t-mid) var(--ease),
  box-shadow var(--t-mid) var(--ease); overflow: hidden; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn svg { width: 16px; height: 16px; }
.btn-lg { --bh: 52px; padding-inline: var(--s-6); font-size: var(--fs-base); }
.btn-sm { --bh: 34px; padding-inline: var(--s-4); font-size: var(--fs-xs); }
.btn-icon { width: var(--bh); padding-inline: 0; }

/* primary: milk on dark, ink text, light sweep on hover */
.btn-primary { background: var(--grad-milk); color: var(--text-ink);
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,0.6); }
.btn-primary::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform var(--t-slow) var(--ease); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--sh-3),
  0 10px 30px rgba(224,168,106,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }
.btn-primary:hover::after { transform: translateX(120%); }

/* copper variant */
.btn-copper { background: var(--grad-copper); color: #1a0f08;
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-copper:hover { transform: translateY(-1px); box-shadow: var(--sh-glow); }

/* ghost / secondary: transparent, thin border */
.btn-ghost { background: rgba(255,255,255,0.02); color: var(--text);
  border-color: var(--line-strong); backdrop-filter: blur(6px); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); border-color: var(--silver);
  transform: translateY(-1px); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.btn-danger { background: var(--danger-soft); color: var(--danger);
  border-color: rgba(196,106,94,0.3); }
.btn-danger:hover { background: rgba(196,106,94,0.2); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }
.btn-block { width: 100%; }

/* ---- Cards ----------------------------------------------------------------- */
.card { background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-2), var(--sh-inset);
  position: relative; }
.card-pad { padding: var(--s-6); }
.card-3d { transition: transform var(--t-mid) var(--ease-out),
  border-color var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease),
  background var(--t-mid) var(--ease); transform-style: preserve-3d; will-change: transform; }
.card-3d:hover { transform: translateY(-4px); border-color: var(--line-strong);
  background: var(--surface-2); box-shadow: var(--sh-3),
  0 0 0 1px var(--line-copper), var(--sh-inset); }
.card-glow::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120px 80px at 50% -10%, rgba(224,168,106,0.14), transparent 70%);
  opacity: 0; transition: opacity var(--t-mid) var(--ease); pointer-events: none; }
.card-glow:hover::after { opacity: 1; }
.card-lined { background:
  linear-gradient(var(--surface-1),var(--surface-1)) padding-box,
  linear-gradient(135deg, var(--line-copper), transparent 40%) border-box;
  border: 1px solid transparent; }

/* ---- Badges / tags / pills ------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: var(--s-1);
  height: 24px; padding-inline: var(--s-3); border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.badge svg { width: 13px; height: 13px; }
.badge-approved { color: var(--ok); background: var(--ok-soft); border-color: rgba(127,168,139,0.3); }
.badge-warning  { color: var(--warn); background: var(--warn-soft); border-color: rgba(217,168,92,0.3); }
.badge-rejected { color: var(--danger); background: var(--danger-soft); border-color: rgba(196,106,94,0.3); }
.badge-copper   { color: var(--copper-hi); background: rgba(200,133,90,0.12); border-color: var(--line-copper); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px;
  padding-inline: 10px; border-radius: var(--r-sm); font-size: var(--fs-xs);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 999px; background: var(--text-muted); }
.dot-ok { background: var(--ok); box-shadow: 0 0 8px rgba(127,168,139,0.7); }
.dot-warn { background: var(--warn); } .dot-bad { background: var(--danger); }

/* ---- Forms ----------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2);
  letter-spacing: 0.02em; }
.input, .select, .textarea { width: 100%; height: 46px; padding-inline: var(--s-4);
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  color: var(--text); font-size: var(--fs-base); font-family: inherit;
  transition: border-color var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease),
  background var(--t-mid) var(--ease); }
.textarea { height: auto; min-height: 120px; padding: var(--s-4); resize: vertical;
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { outline: none;
  border-color: var(--copper); box-shadow: var(--ring); background: var(--bg-1); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px;
  border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line-strong);
  border-bottom-width: 2px; color: var(--text-2); }

/* ---- Score ring (SVG-driven via --score 0..100) ---------------------------- */
.score-ring { --score: 0; --ring-size: 84px; width: var(--ring-size); height: var(--ring-size);
  position: relative; display: grid; place-items: center; }
.score-ring .ring-track, .score-ring .ring-val { fill: none; stroke-width: 7; }
.score-ring .ring-track { stroke: var(--surface-3); }
.score-ring .ring-val { stroke: var(--copper-hi);
  stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease-out); }
.score-ring .ring-num { position: absolute; font-weight: 700; font-size: 22px;
  font-family: var(--font-mono); }
.score-ring.is-ok .ring-val { stroke: var(--ok); }
.score-ring.is-warn .ring-val { stroke: var(--warn); }
.score-ring.is-bad .ring-val { stroke: var(--danger); }

/* meter bar */
.meter { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--grad-copper);
  width: var(--v,0%); transition: width 0.9s var(--ease-out); }
.meter.is-ok > i { background: linear-gradient(90deg, #7FA88B, #9CC4A6); }
.meter.is-bad > i { background: linear-gradient(90deg, #C46A5E, #D98A7E); }

/* ---- Icon system ----------------------------------------------------------- */
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle;
  stroke: currentColor; fill: none; flex: none; }
.icon-16 { width: 16px; height: 16px; } .icon-24 { width: 24px; height: 24px; }
.icon-28 { width: 28px; height: 28px; }
.icon-chip { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid;
  place-items: center; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--copper-hi); }
.icon-chip .icon { width: 20px; height: 20px; }

/* ---- Divider / misc -------------------------------------------------------- */
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.hr-fade { height: 1px; border: 0; background:
  linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.pill-nav { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill);
  background: var(--surface-1); border: 1px solid var(--line); }
.pill-nav button { height: 32px; padding-inline: 14px; border-radius: var(--r-pill);
  border: 0; background: transparent; color: var(--text-2); font-size: var(--fs-xs);
  font-weight: 600; transition: all var(--t-fast) var(--ease); }
.pill-nav button.is-active { background: var(--surface-3); color: var(--text); }

/* ---- Language toggle ------------------------------------------------------- */
.lang-toggle { display: inline-flex; padding: 3px; border-radius: var(--r-pill);
  background: var(--surface-1); border: 1px solid var(--line); gap: 2px; }
.lang-toggle button { height: 28px; min-width: 34px; padding-inline: 9px; border: 0;
  border-radius: var(--r-pill); background: transparent; color: var(--text-muted);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer;
  transition: all var(--t-fast) var(--ease); }
.lang-toggle button:hover { color: var(--text-2); }
.lang-toggle button.is-active { background: var(--surface-3); color: var(--copper-hi);
  box-shadow: var(--sh-1); }

/* ---- Brand mark ------------------------------------------------------------ */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650;
  font-size: 17px; letter-spacing: -0.01em; color: var(--text); }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand b { font-weight: 700; }
.brand .gate { color: var(--copper-hi); }

/* ---- Top navigation (shared on landing + docs) ----------------------------- */
.nav { position: fixed; top: 0; inset-inline: 0; height: var(--nav-h); z-index: var(--z-nav);
  display: flex; align-items: center; transition: background var(--t-mid) var(--ease),
  border-color var(--t-mid) var(--ease); border-bottom: 1px solid transparent; }
.nav.is-stuck { background: rgba(8,9,11,0.72); backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line); }
.nav .container { display: flex; align-items: center; justify-content: space-between; gap: var(--s-6); }
.nav-links { display: flex; align-items: center; gap: var(--s-2); }
.nav-links a { padding: 8px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm);
  color: var(--text-2); transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }

/* ---- Footer ---------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line); padding-block: var(--s-10) var(--s-8);
  margin-top: var(--s-12); background: var(--bg-1); }
.footer a { color: var(--text-muted); font-size: var(--fs-sm); display: block;
  padding: 5px 0; transition: color var(--t-fast) var(--ease); }
.footer a:hover { color: var(--text); }
.footer h5 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--text-faint); margin: 0 0 var(--s-3); font-weight: 600; }

/* ---- Reveal on scroll (set by JS: .reveal -> .in) -------------------------- */
.reveal { opacity: 0; transform: translateY(22px); transition:
  opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 80ms; } .reveal-d2 { transition-delay: 160ms; }
.reveal-d3 { transition-delay: 240ms; } .reveal-d4 { transition-delay: 320ms; }

/* ---- Toast ----------------------------------------------------------------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--line-strong);
  box-shadow: var(--sh-3); font-size: var(--fs-sm); color: var(--text);
  animation: toastIn var(--t-mid) var(--ease-out); max-width: 92vw; }
.toast.is-ok { border-color: rgba(127,168,139,0.4); }
.toast.is-bad { border-color: rgba(196,106,94,0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* ---- Modal ----------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(3,3,4,0.6); backdrop-filter: blur(8px); display: grid; place-items: center;
  padding: var(--s-5); animation: fadeIn var(--t-mid) var(--ease); }
.modal { width: 100%; max-width: 480px; background: var(--surface-1);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--sh-4);
  animation: modalIn var(--t-mid) var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } }

/* ---- Code block ------------------------------------------------------------ */
.code { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-md);
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.65; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text-muted);
  font-size: var(--fs-xs); background: var(--surface-1); }
.code pre { margin: 0; padding: 16px; overflow-x: auto; color: var(--text-2); }
.code .tok-str { color: var(--ok); } .code .tok-key { color: var(--copper-hi); }
.code .tok-num { color: var(--amber); } .code .tok-com { color: var(--text-faint); }
.code .tok-fn  { color: var(--silver); }

/* ---- Utility --------------------------------------------------------------- */
.hide { display: none !important; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.float { animation: floaty 6s var(--ease-in-out) infinite alternate; }
@keyframes floaty { to { transform: translateY(-10px); } }

@media (max-width: 860px) {
  .section { padding-block: var(--s-10); }
  .nav-links { display: none; }
  .container { padding-inline: var(--s-5); }
}
