/* The frame around every page: the sidebar (a drawer on a phone), the top bar, the home page, a section's header. */

/* ── the sidebar: groups that fold, the section shown marked ── */
.sidenav { position: fixed; inset: 0 auto 0 0; z-index: var(--z-nav); width: var(--side); display: flex; flex-direction: column; padding: 18px var(--s-3) var(--s-6); overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--line-2) transparent; background: var(--surface-1); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; padding: var(--s-1) 10px 22px; border-radius: var(--r-1); text-decoration: none; color: inherit; }
.logo { font: 800 22px/1 var(--display); letter-spacing: -.05em; color: var(--white); }
.logo i { color: var(--accent); font-style: normal; }
.brand-name { font: 600 15px/1 var(--display); letter-spacing: -.01em; color: var(--text); }
.navgroups { display: flex; flex-direction: column; gap: 2px; }
.ngroup-head, .ngroup-solo { width: 100%; height: 38px; display: flex; align-items: center; gap: var(--s-3); padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 600 14px var(--body); text-align: left; text-decoration: none; transition: background var(--d-2) var(--ease), color var(--d-2) var(--ease); }
.ngroup-head svg, .ngroup-solo svg { width: 18px; height: 18px; flex: none; color: var(--dim); transition: color var(--d-2) var(--ease); }
.ngroup-head:hover, .ngroup-solo:hover { background: var(--hover); color: var(--text); }
.ngroup-head .chev { width: 14px; height: 14px; margin-left: auto; color: var(--faint); transition: transform var(--d-2) var(--ease); }
.ngroup.open .chev { transform: rotate(90deg); }
.ngroup.has-on .ngroup-head { color: var(--text); }
.ngroup.has-on .ngroup-head > svg:first-child, .ngroup-solo.on svg { color: var(--accent-text); }
.ngroup-solo.on { background: var(--accent-bg); color: var(--white); }
/* folding: the row grows from 0fr to 1fr; the clip hides what is folded */
.ngroup-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--d-2) var(--ease); }
.ngroup.open .ngroup-body { grid-template-rows: 1fr; }
.ngroup-clip { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility var(--d-2); }
.ngroup.open .ngroup-clip { visibility: visible; }
.ngroup-items { margin: 2px 0 var(--s-2) 19px; padding: 2px 0 2px 10px; border-left: 1px solid var(--line-2); }
.ngroup-items .nav { position: relative; display: flex; align-items: center; width: 100%; height: var(--h-sm); padding: 0 10px; border-radius: var(--r-1); color: var(--dim); font: 500 13.5px var(--body); white-space: nowrap; text-decoration: none; transition: background var(--d-2) var(--ease), color var(--d-2) var(--ease); }
.ngroup-items .nav:hover { color: var(--text); background: var(--hover); }
.ngroup-items .nav.on { color: var(--white); background: var(--accent-bg); }
/* the section shown: a bar on the guide line (so .nav must not clip) */
.ngroup-items .nav.on::before { content: ''; position: absolute; left: -11px; top: 8px; width: 2px; height: 16px; border-radius: 2px; background: var(--accent); }
.sidenav :focus-visible, .topbar :focus-visible { box-shadow: inset 0 0 0 2px rgba(196, 181, 253, .7); }

/* ── the top bar and the drawer, on a phone ── */
.topbar, .scrim { display: none; }
.icon-btn { width: var(--h-md); height: var(--h-md); display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--text); transition: background var(--d-2) var(--ease); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--hover-2); }
@media (max-width: 900px) {
  .topbar { position: sticky; top: 0; z-index: var(--z-topbar); display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 var(--s-2); background: rgba(10, 10, 15, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; }
  .sidenav { z-index: var(--z-drawer); width: min(300px, 86vw); transform: translateX(-102%); transition: transform var(--d-3) var(--ease), box-shadow var(--d-3); }
  body.drawer .sidenav { transform: none; box-shadow: 24px 0 60px rgba(0, 0, 0, .5); }
  .scrim { display: block; position: fixed; inset: 0; z-index: var(--z-scrim); background: rgba(5, 5, 8, .62); opacity: 0; pointer-events: none; transition: opacity var(--d-3) var(--ease); }
  body.drawer .scrim { opacity: 1; pointer-events: auto; }
  body.drawer { overflow: hidden; }
}

/* ── the page ── */
main { margin-left: var(--side); padding: 36px var(--gutter) var(--s-7); max-width: 1900px; }
@media (max-width: 900px) { main { margin-left: 0; padding: 22px var(--s-4) 40px; } .gsearch { margin-top: 0; } }
/* a section's header: the group it is in, its name and how many there are */
.eyebrow { font: var(--t-eyebrow); color: var(--accent-text); }
.head { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; margin-top: 6px; }
.head h1 { margin: 0; font: var(--t-page); letter-spacing: var(--ls-page); color: var(--white); }
.head .n { font: 500 15px var(--body); color: var(--dim); font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; margin: var(--s-5) 0 var(--s-3); }

/* ── home: the search in a hero over the radar map, the groups as cards ── */
body.is-home main > #crumb, body.is-home main > .head, body.is-home main > .tools, body.is-home main > .tags, body.is-home main > #empty, body.is-home main > .pages { display: none; }
.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 420px; padding: 40px 0 56px; }
/* the game's radar map of Los Santos, tinted lilac, fading into the page */
.hero-map { position: absolute; z-index: -1; top: -36px; bottom: 0; right: calc(-1 * var(--gutter)); width: 62%; background: url(/img/hero-radar-1400.webp) 38% 84% / 150% auto no-repeat; opacity: .5; filter: grayscale(1) sepia(1) hue-rotate(215deg) saturate(1.5) brightness(.85);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 45%), linear-gradient(0deg, transparent 0, #000 35%); -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent 0, #000 45%), linear-gradient(0deg, transparent 0, #000 35%); mask-composite: intersect; }
.hero-copy { width: min(100%, 640px); }
.hero h1 { margin: 0; font: var(--t-hero); letter-spacing: var(--ls-hero); color: var(--white); max-width: 13ch; }
.hero p { margin: var(--s-4) 0 28px; font-size: 17px; color: var(--muted); }
.hero .gsearch { margin: 0; }
.hero .gsearch .search { height: 56px; border-color: var(--line-3); background: rgba(21, 18, 31, .82); backdrop-filter: blur(6px); box-shadow: 0 18px 48px rgba(0, 0, 0, .35); }
.hero .gsearch .search input { font-size: 16px; }
.quick { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.quick a { display: inline-flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 14px 0 11px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(18, 18, 26, .7); color: var(--text); font: var(--t-label); text-decoration: none; transition: border-color var(--d-2) var(--ease), background var(--d-2) var(--ease); }
.quick a svg { width: 16px; height: 16px; color: var(--accent-text); }
.quick a:hover { border-color: rgba(196, 181, 253, .35); background: var(--surface-3); }
.home-h { margin: var(--s-2) 0 var(--s-4); font: 600 20px var(--display); letter-spacing: -.01em; color: var(--text); }
.gcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 1280px) { .gcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .gcards { grid-template-columns: 1fr; } }
.gcard { display: flex; flex-direction: column; padding: var(--s-2) var(--s-2) var(--s-3); border-radius: var(--r-3); background: var(--surface-1); border: 1px solid var(--line); transition: border-color var(--d-2) var(--ease); }
.gcard:hover { border-color: var(--line-2); }
.gcard-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: var(--s-3); border-radius: var(--r-2); text-decoration: none; transition: background var(--d-2) var(--ease); }
.gcard-head:hover { background: var(--hover); }
.gcard-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: rgba(168, 85, 247, .1); color: var(--accent-text); }
.gcard-icon svg { width: 20px; height: 20px; }
.gcard-title b { display: block; font: var(--t-section); letter-spacing: var(--ls-section); color: var(--white); }
.gcard-title small { display: block; margin-top: 2px; font: var(--t-small); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gcard-links { display: flex; flex-wrap: wrap; margin: 0; padding: 0 var(--s-1); list-style: none; }
.gcard-links a { display: block; padding: 5px var(--s-2); border-radius: 6px; color: var(--dim); font: 500 13.5px var(--body); text-decoration: none; transition: color var(--d-2) var(--ease), background var(--d-2) var(--ease); }
.gcard-links a:hover { color: var(--text); background: var(--hover-2); }
@media (max-width: 900px) {
  .hero { min-height: 0; padding: 28px 0 36px; }
  .hero-map { top: -22px; right: calc(-1 * var(--s-4)); width: 100%; opacity: .3; }
}

/* clears the search and the filters; shown only when something narrows the section */
.clear-all { display: inline-flex; align-items: center; gap: 6px; height: var(--h-lg); padding: 0 var(--s-3); border: 0; border-radius: var(--r-2); background: none; color: var(--muted); font: var(--t-label); font-size: 13.5px; transition: background var(--d-2) var(--ease), color var(--d-2) var(--ease); }
.clear-all:hover { background: var(--hover-2); color: var(--white); }
.clear-all svg { width: 15px; height: 15px; }
.clear-all[hidden] { display: none; }
@media (max-width: 900px) { .clear-all { height: var(--h-md); } }

/* home: the items opened lately, as small cards in a row (wrapping), the section each is in under its name */
.recent { margin-bottom: var(--s-6); }
.recent-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.recent-clear { padding: 4px 8px; border: 0; border-radius: var(--r-1); background: none; color: var(--dim); font: var(--t-small); transition: color var(--d-2) var(--ease), background var(--d-2) var(--ease); }
.recent-clear:hover { background: var(--hover-2); color: var(--white); }
.recent-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.recent-list a { display: grid; gap: 1px; min-width: 0; max-width: 260px; padding: 9px 14px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--surface-1); text-decoration: none; transition: border-color var(--d-2) var(--ease), background var(--d-2) var(--ease); }
.recent-list a:hover { border-color: var(--line-3); background: var(--surface-2); }
/* a title in the text face; a name from the game's files (no title) in the code face */
.recent-list b { overflow: hidden; color: var(--white); font: var(--t-body-strong); text-overflow: ellipsis; white-space: nowrap; }
.recent-list b.key { font: var(--t-code); font-weight: 600; }
.recent-list small { color: var(--dim); font: var(--t-small); }
/* a phone: one row that scrolls sideways */
@media (max-width: 600px) {
  /* out to the screen's edges (main's padding there is --s-4) */
  .recent-list { flex-wrap: nowrap; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4) var(--s-1); overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 var(--s-4); }
  .recent-list a { flex: none; max-width: 200px; scroll-snap-align: start; }
}

/* until the game is read (the first start: a minute or two), only the message: no empty title, no filters to pick */
body.booting main > #crumb, body.booting main > .head, body.booting main > .tools, body.booting main > .tags, body.booting main > .pages,
body.booting #homeview, body.booting #grid { display: none; }
body.booting main > #empty { margin-top: var(--s-7); }

/* the keyboard shortcuts: a link at the foot of the sidebar (with a mouse), and their list */
.keys-link { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: auto; padding: var(--s-2) var(--s-3); border: 0; border-radius: var(--r-1); background: none; color: var(--faint); font: var(--t-small); text-align: left; transition: color var(--d-2) var(--ease), background var(--d-2) var(--ease); }
.keys-link:hover { background: var(--hover-2); color: var(--text); }
.keys-link kbd, .keys kbd { min-width: 22px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px; color: var(--muted); font: 500 11px var(--code); text-align: center; }
@media (pointer: coarse), (max-width: 900px) { .keys-link { display: none; } }
.keys { width: min(440px, calc(100vw - 32px)); padding: var(--s-5); border: 1px solid var(--line-2); border-radius: var(--r-3); background: var(--surface-2); box-shadow: var(--e-3); color: var(--text); }
.keys::backdrop { background: rgba(5, 5, 8, .6); backdrop-filter: blur(4px); }
.keys h2 { margin: 0 0 var(--s-4); font: var(--t-title); color: var(--white); }
.keys dl { display: grid; gap: var(--s-2); margin: 0 0 var(--s-5); }
.keys dl > div { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: var(--s-3); }
.keys dt { display: flex; gap: 4px; }
.keys dd { margin: 0; color: var(--muted); font: var(--t-small); font-size: 13.5px; }
.keys kbd { color: var(--text); }

/* the static build's page for search engines (tools/bake.py, pages): read by them and by screen readers until the
   page starts, which takes it away (core/static.js); never shown */
.prerender { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
