/* Karambit.Network / shared site layer v6 — tokens, type, header, buttons, footer, toasts, background.
 * Used by the home page and /stats/. Page files add their own sections on top. */
@font-face { font-family: 'Museo Sans'; src: url('/nc_assets/fonts/museo-sans-300-webfont.woff') format('woff'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Museo Sans'; src: url('/nc_assets/fonts/museo-sans-500-webfont.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Museo Sans'; src: url('/nc_assets/fonts/museo-sans-700-webfont.woff') format('woff'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --void: #08090d;
  --panel: #10121a;
  --panel-2: #161925;
  --line: #242836;
  --line-soft: #1b1e29;
  --ink: #eef0f5;
  --muted: #a1a6b6;
  --dim: #6f7486;
  --red: #e0334a;
  --red-hot: #ff5269;
  --red-deep: #3a1420;
  --live: #4fd88c;
  --amber: #f2b453;
  --font: 'Museo Sans', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --max: 1240px;
  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 18px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --header-h: 72px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; background: var(--void); color: var(--ink); font: 300 16px/1.6 var(--font); overflow-x: hidden; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
strong, b { font-weight: 700; }
h1, h2, h3, h4 { font-weight: 700; margin: 0; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red-hot); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 999; padding: 10px 14px; background: var(--red); color: #fff; border-radius: var(--radius-s); text-decoration: none; font-weight: 700; }
.skip-link:focus { top: 12px; }
.shell { width: min(var(--max), 100% - 48px); margin-inline: auto; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Background: the live map (blurred) under an animated course scene drawn by kn-site.js. */
.atmos { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: radial-gradient(ellipse 90% 60% at 50% 115%, #e0334a26, transparent 70%), var(--void); }
.atmos-art { position: absolute; inset: -10% -10% auto; height: 95vh; background-size: cover; background-position: center; opacity: 0; filter: blur(42px) saturate(1.25); transform: scale(1.08); transition: opacity 1.6s ease; mask-image: linear-gradient(#000 0%, #0009 45%, transparent 90%); }
.atmos-art.is-on { opacity: .2; }
.atmos-scene { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.4s ease; }
.atmos-scene.is-ready { opacity: .9; }
@media (min-width: 1081px) { .atmos-scene { mask-image: radial-gradient(ellipse 34% 40% at 24% 46%, #0006 0%, #000 100%); -webkit-mask-image: radial-gradient(ellipse 34% 40% at 24% 46%, #0006 0%, #000 100%); } }
.atmos::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 120% 80% at 50% 40%, transparent 40%, #08090dcc 100%); }

/* Buttons */
.btn { --bg: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; border-radius: var(--radius-s); border: 1px solid transparent; background: var(--bg); text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: .005em; white-space: nowrap; transition: background-color .18s, border-color .18s, transform .18s var(--ease-out), color .18s; }
.btn .i { transition: transform .25s var(--ease-out); }
.btn:hover .i { transform: translateX(3px); }
.btn:active { transform: translateY(1px); }
.btn-primary { --bg: var(--red); color: #fff; border-color: #ff6a7d40; box-shadow: 0 10px 30px -12px #e0334acc; }
.btn-primary:hover { --bg: #ec4258; }
.btn-primary:disabled { --bg: #4a2630; color: #c9a9b0; box-shadow: none; cursor: not-allowed; }
.btn-ghost { --bg: #ffffff06; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { --bg: #ffffff0d; border-color: #3a3f52; }
.btn-link { padding-inline: 4px; color: var(--muted); font-weight: 500; }
.btn-link:hover { color: var(--ink); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-s); border: 1px solid var(--line); background: #ffffff05; color: var(--muted); text-decoration: none; transition: color .18s, border-color .18s, background-color .18s; }
.icon-btn:hover { color: var(--ink); border-color: #3a3f52; background: #ffffff0b; }
.text-btn { border: 0; background: none; padding: 0; color: var(--red-hot); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); display: flex; align-items: center; background: #08090dcc; backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid transparent; transition: border-color .3s, background-color .3s; }
.site-header.is-scrolled { border-bottom-color: var(--line-soft); background: #08090def; }
.header-row { display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand-mark { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; border: 1px solid #e0334a55; background: #0b0508; box-shadow: 0 0 0 3px #e0334a12; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand-text { display: grid; line-height: 1.1; }
.brand-text strong { font-size: 17px; letter-spacing: -.02em; }
.brand-text strong span { color: var(--red-hot); }
.brand-text small { color: var(--dim); font-size: 12px; font-weight: 500; margin-top: 3px; }
.primary-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.primary-nav a { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius-s); color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; transition: color .18s, background-color .18s; }
.primary-nav a .i { width: 14px; height: 14px; }
.primary-nav a:hover { color: var(--ink); background: #ffffff08; }
.primary-nav a[aria-current="page"] { color: var(--ink); }
.primary-nav a[aria-current="page"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--red); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 40px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; transition: border-color .2s, color .2s; }
.live-pill:hover { color: var(--ink); border-color: #3a3f52; }
.live-pill i, .status-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.live-pill[data-state="online"] i, .status-chip[data-state="online"] i { background: var(--live); box-shadow: 0 0 0 0 #4fd88c88; animation: ping 2.2s ease-out infinite; }
.live-pill[data-state="offline"] i, .status-chip[data-state="offline"] i { background: var(--amber); }
#knMotionControl .motion-off { display: none; }
#knMotionControl[aria-pressed="false"] .motion-on { display: none; }
#knMotionControl[aria-pressed="false"] .motion-off { display: block; }
.account-control { position: relative; }
.steam-button { display: inline-flex; align-items: center; gap: 9px; height: 40px; max-width: 220px; padding: 0 14px 0 10px; border-radius: var(--radius-s); background: var(--ink); color: var(--void); text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap; transition: background-color .18s; }
.steam-button:hover { background: #fff; }
.steam-button span { overflow: hidden; text-overflow: ellipsis; }
.steam-button[data-logged-in="true"] { background: #ffffff0a; color: var(--ink); border: 1px solid var(--line); padding-left: 6px; }
.steam-button[data-logged-in="true"]:hover { background: #ffffff12; }
.steam-avatar { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 24px 60px #000c; }
.account-menu a { display: block; padding: 10px 12px; border-radius: var(--radius-s); text-decoration: none; }
.account-menu a:hover { background: #ffffff0a; }
.menu-btn { display: none; }


/* Avatars */
.av { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; background: var(--panel-2); display: block; }
.av-lg { width: 36px; height: 36px; border-radius: 7px; }

/* Section heads */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -.035em; }
.section-head p { margin-top: 8px; color: var(--muted); max-width: 40em; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }


/* Footer */
.site-footer { padding: 34px 0 calc(34px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); color: var(--dim); }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-brand { display: grid; gap: 4px; }
.footer-brand strong { color: var(--ink); }
.footer-brand strong span { color: var(--red-hot); }
.footer-brand small { font-size: 14px; }
.footer-nav { display: flex; gap: 6px 20px; flex-wrap: wrap; }
.footer-nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.footer-nav a:hover { color: var(--ink); }


/* Toasts */
.toasts { position: fixed; z-index: 400; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-m); background: #1d2030; border: 1px solid #343a50; box-shadow: 0 18px 40px #000a; font-size: 15px; font-weight: 500; animation: toast-in .35s var(--ease-out); }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; }
.toast.is-error::before { background: var(--red-hot); }
.toast.is-out { animation: toast-out .25s ease forwards; }


/* Shared keyframes */
@keyframes ping { 0% { box-shadow: 0 0 0 0 #4fd88c88; } 70%, 100% { box-shadow: 0 0 0 8px #4fd88c00; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Motion off (site toggle) or reduced motion (OS) */
html.kn-motion-off *, html.kn-motion-off *::before, html.kn-motion-off *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Responsive header */
@media (max-width: 1080px) { .live-pill { display: none; } }
@media (max-width: 900px) {
  :root { --header-h: 64px; }
  .menu-btn { display: inline-grid; }
  .primary-nav { position: fixed; inset: var(--header-h) 0 auto; flex-direction: column; align-items: stretch; gap: 0; padding: 10px 16px 18px; background: #0b0c12; box-shadow: 0 30px 60px #000c; border-bottom: 1px solid var(--line); transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity .2s, transform .25s var(--ease-out), visibility 0s .25s; }
  .primary-nav.is-open { opacity: 1; transform: none; visibility: visible; transition: opacity .2s, transform .25s var(--ease-out); }
  .primary-nav a { padding: 14px 8px; font-size: 17px; border-bottom: 1px solid var(--line-soft); border-radius: 0; }
  .primary-nav a[aria-current="page"]::after { left: 8px; right: auto; width: 18px; bottom: 8px; }
  .header-actions { margin-left: auto; }
  .section-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
  .shell { width: calc(100% - 32px); }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 15px; }
  .steam-button { padding: 0 10px; }
  .steam-button:not([data-logged-in="true"]) span { display: none; }
  .steam-button[data-logged-in="true"] span { max-width: 90px; }
  #knMotionControl { display: none; }
}
