/* ==========================================================================
   TukTuk Games — core: fonts, design tokens, reset, app shell (header / rail / drawer / footer)
   One source of truth for layout. No !important layering.
   ========================================================================== */

@font-face {
  font-family: "Figtree Variable"; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree Variable"; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url("../fonts/figtree-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* surfaces */
  --bg: #131417;
  --bg-nav: #0c0d0f;
  --surface: #1b1d22;
  --surface-2: #23262c;
  --surface-3: #2c3037;
  --border: #2b2e35;
  --border-2: #3b3f48;
  /* text */
  --text: #f3f4f6;
  --text-2: #a9aeb9;
  --text-3: #8b91a0;
  /* accents sampled from the TukTuk logo — used sparingly */
  --c-orange: #f5920f;
  --c-red: #f2503a;
  --c-pink: #f0189a;
  --c-purple: #7a55f2;
  --c-blue: #12aef2;
  --c-cyan: #18c7c0;
  --c-green: #16cf5c;
  --c-lime: #98d616;
  --accent: var(--c-orange);
  --accent-hover: #ffa42e;
  --on-accent: #1a1204;
  --focus: var(--c-blue);
  /* shape & layout */
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --header-h: 56px;
  --rail-w: 64px;
  --rail-open: 236px;
  --gap: 14px;
  --font: "Figtree Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 10px 30px rgb(0 0 0 / .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg, video { max-width: 100%; }
img { display: block; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--c-orange) 40%, transparent); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: var(--r-sm); font-weight: 700; transition: top .15s; }
.skip-link:focus { top: 10px; outline-offset: 3px; }

.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon.mini { width: 14px; height: 14px; }

/* ----- header --------------------------------------------------------------------------- */
.header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 60;
  display: flex; align-items: center; gap: 10px; padding: 0 12px 0 10px;
  background: var(--bg-nav);
}
/* the one place the full logo palette is used: a hairline in the logo's own colour order */
.header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--c-orange), var(--c-red) 20%, var(--c-purple) 42%, var(--c-blue) 60%, var(--c-green) 80%, var(--c-lime));
  opacity: .85;
}
.brand { display: inline-flex; align-items: center; flex: none; padding: 4px 6px; border-radius: var(--r-sm); }
.brand img { height: 36px; width: auto; }
.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }

/* ----- desktop rail --------------------------------------------------------------------- */
.rail {
  position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--rail-w); z-index: 50;
  background: var(--bg-nav); border-right: 1px solid var(--border); overflow: hidden;
  transition: width .18s ease, box-shadow .18s ease;
}
.rail-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 8px 0 28px; scrollbar-width: none; overscroll-behavior: contain; }
.rail:hover .rail-scroll, html.rail-pinned .rail-scroll { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.rail:hover { width: var(--rail-open); box-shadow: 10px 0 28px rgb(0 0 0 / .45); }
html.rail-pinned .rail { width: var(--rail-open); }
html.rail-pinned .rail:hover { box-shadow: none; }

.nav-link {
  position: relative; display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 21px;
  color: var(--text-2); white-space: nowrap; font-weight: 550; font-size: 14px;
}
.nav-icon { width: 22px; height: 22px; flex: none; color: var(--tint, var(--text-2)); }
.nav-label { opacity: 0; transition: opacity .12s ease; overflow: hidden; text-overflow: ellipsis; }
.rail:hover .nav-label, html.rail-pinned .nav-label { opacity: 1; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.is-current { background: var(--surface-2); color: var(--text); }
.nav-link.is-current::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-sep { height: 1px; margin: 8px 18px; background: var(--border); }
.rail-heading { display: none; padding: 14px 21px 6px; font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.rail:hover .rail-heading, html.rail-pinned .rail-heading { display: block; }
.rail-tags { display: none; }
.rail:hover .rail-tags, html.rail-pinned .rail-tags { display: block; }
.rail:hover .rail-sep, html.rail-pinned .rail-sep { display: none; }

/* ----- page shell: content ALWAYS starts after the rail; footer lives inside it ----------- */
.shell { margin-left: var(--rail-w); padding-top: var(--header-h); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .18s ease; min-width: 0; }
html.rail-pinned .shell { margin-left: var(--rail-open); }
.main { flex: 1 0 auto; padding-bottom: 8px; outline: none; min-width: 0; }
.container { width: 100%; max-width: 1520px; margin: 0 auto; padding: 0 24px; }

/* ----- mobile drawer (completely separate from the rail) -------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgb(0 0 0 / .62); opacity: 0; transition: opacity .2s ease; }
.scrim.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: min(320px, 88vw); display: flex; flex-direction: column;
  background: var(--bg-nav); border-right: 1px solid var(--border);
  transform: translateX(-102%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  padding-left: env(safe-area-inset-left);
}
.drawer.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); padding: 0 10px; border-bottom: 1px solid var(--border); flex: none; }
.drawer-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.drawer .nav-link { height: 44px; padding: 0 20px; }
.drawer .nav-label { opacity: 1; }
.drawer-heading { padding: 16px 20px 6px; font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.drawer-chips { padding: 4px 16px 8px; }
.drawer-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 16px 0; }
body.no-scroll { overflow: hidden; }

/* ----- footer -------------------------------------------------------------------------- */
.footer { margin-top: 48px; background: var(--bg-nav); border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding-top: 36px; padding-bottom: 28px; }
.footer-brand img { height: 52px; width: auto; margin-bottom: 10px; margin-left: -6px; }
.footer-brand p { color: var(--text-2); font-size: 14px; max-width: 320px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h2 { font-size: 12px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.footer-col a { color: var(--text-2); font-size: 14px; width: fit-content; }
.footer-col a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom { padding-top: 16px; padding-bottom: 22px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; }

/* ----- responsive shell ----------------------------------------------------------------- */
@media (max-width: 899.98px) {
  .rail { display: none; }
  .shell, html.rail-pinned .shell { margin-left: 0; }
  .brand img { height: 32px; }
  .container { padding: 0 14px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .scrim, .drawer { display: none !important; }
  .nav-toggle { display: inline-flex; }
}
@media (max-width: 380px) { .footer-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}


/* TukTuk shared desktop/mobile navigation extras */
.nav-social { display:flex; flex-wrap:wrap; gap:8px; padding:12px 16px 4px; }
.social-circle { width:32px; height:32px; display:grid; place-items:center; border:1px solid var(--border-2); border-radius:50%; color:var(--text-2); background:var(--surface); font-size:13px; font-weight:800; line-height:1; }
.social-circle:hover { color:var(--text); border-color:var(--accent); background:var(--surface-2); }
.rail .nav-social { display:none; }
.rail:hover .nav-social, html.rail-pinned .nav-social { display:flex; }
.rail .nav-social .social-circle { flex:0 0 32px; }
@media (max-width:899.98px) { .drawer .nav-social { padding:12px 20px 4px; } }

/* Compact game-tag selector */
.tag-select { position:relative; width:100%; }
.tag-select > summary { list-style:none; min-height:44px; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0 13px; border:1px solid var(--border-2); border-radius:var(--r); background:var(--surface-2); color:var(--text); cursor:pointer; }
.tag-select > summary::-webkit-details-marker { display:none; }
.tag-select > summary::after { content:'⌄'; color:var(--text-3); font-size:15px; }
.tag-select[open] > summary { border-color:var(--accent); border-bottom-left-radius:0; border-bottom-right-radius:0; }
.tag-select-count { color:var(--text-3); font-size:12px; margin-left:auto; }
.tag-select-panel { position:absolute; z-index:40; left:0; right:0; top:100%; padding:10px; background:var(--surface); border:1px solid var(--accent); border-top:0; border-radius:0 0 var(--r) var(--r); box-shadow:0 18px 35px rgb(0 0 0 / .35); }
.tag-select-search { width:100%; margin-bottom:8px; }
.tag-select-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; max-height:260px; overflow-y:auto; padding:2px; }
.tag-option { display:flex; align-items:center; gap:8px; min-width:0; padding:8px 9px; border-radius:7px; color:var(--text-2); cursor:pointer; font-size:13px; }
.tag-option:hover { background:var(--surface-2); color:var(--text); }
.tag-option input { width:16px; height:16px; flex:none; accent-color:var(--c-orange); }
.tag-option span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tag-select-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; padding-top:8px; margin-top:8px; border-top:1px solid var(--border); color:var(--text-3); font-size:11.5px; }
@media (max-width:899.98px) { .tag-select-list { grid-template-columns:repeat(2,minmax(0,1fr)); max-height:300px; } }
@media (max-width:520px) { .tag-select-list { grid-template-columns:1fr; } }
