/* App shell on the landing page's palette (taste-skill system in assets/site: warm ink #15130f, cream #f6f3ee,
   amber accent, Bricolage Grotesque + Figtree). Loaded after every other sheet.
   1. Base: one set of neutrals for light and dark, no decorative glows.
   2. Left pane: warm ink in both themes, bold uppercase sections that fold with an animated chevron and a count,
      icon + label rows, amber active row, and a rail mode (html.rp-rail) that keeps only the icons. */

/* ---------- 1. base ---------- */
:root[data-theme="light"] {
  --frame: #f6f3ee; --sheet: #f6f3ee; --card: #ffffff; --raised: #f2eee7; --active: #ebe5da;
  --border: #e7e0d4; --rule: #efe9df; --control: #d6cec0;
  --text: #15130f; --muted: #5f594e; --faint: #7d7669;
  --glass: rgba(255, 255, 255, .86);
}
:root[data-theme="dark"], :root:not([data-theme]) {
  --frame: #0f0e0c; --sheet: #0f0e0c; --card: #191714; --raised: #211e1a; --active: #2a2621;
  --border: #2b2722; --rule: #24211d; --control: #3b362f;
  --text: #f3efe7; --muted: #b6ae9f; --faint: #8d8679;
  --glass: rgba(25, 23, 20, .88);
}
body { background: var(--frame); font-family: Figtree, var(--font, system-ui), sans-serif; }
body::before, body::after { display: none !important; }
.top { background: color-mix(in oklab, var(--frame) 92%, transparent) !important; backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--border); }
:root[data-theme="light"] .btn.primary { background: #15130f; color: #f6f3ee; border-color: #15130f; }
:root[data-theme="light"] .btn.primary:hover { background: #2a2620; }
.card, .kpi { border-radius: 14px; }
:root[data-theme="light"] .card, :root[data-theme="light"] .kpi { box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(21, 19, 15, .04) !important; }
/* KPI tiles: values never clip, sub-lines wrap to two lines instead of "Overwhelmingly P…" */
.kpi .v { font-size: clamp(20px, 1.15rem + .9vw, 30px); overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em; }
.kpi.lead .v { font-size: clamp(22px, 1.2rem + 1.1vw, 34px); }
.kpi .s { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
h1, .title-row h1 { font-family: "Bricolage Grotesque", var(--display), sans-serif; font-weight: 500; letter-spacing: -0.03em; }

/* ---------- 2. left pane ---------- */
.side {
  --sb-bg: #15130f; --sb-bg2: #1d1a16;
  --text: #f3efe7; --muted: #cbc3b5; --faint: #8f877a;
  --raised: rgba(243, 239, 231, .05); --active: rgba(243, 239, 231, .085); --border: rgba(243, 239, 231, .09); --control: rgba(243, 239, 231, .18);
  --card: #201d19; --accent: #ffb547; --accent-soft: rgba(255, 181, 71, .12); --accent-ink: #ffcf85; --on-accent: #1a1408;
  --primary: #f3efe7; --on-primary: #15130f;
  background: linear-gradient(180deg, var(--sb-bg2) 0%, var(--sb-bg) 34%) !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  border-right: 1px solid rgba(0, 0, 0, .4) !important;
  color: var(--text); transition: padding .28s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: thin; scrollbar-color: rgba(243, 239, 231, .14) transparent;
}
.side .brand { color: var(--text); font-family: "Bricolage Grotesque", var(--display), sans-serif; font-weight: 600; letter-spacing: -0.01em; }
.side .nav { gap: 1px; }

/* section headings: fold toggles */
.side .nav-group {
  display: flex !important; align-items: center; gap: 8px;
  margin: 18px 0 4px !important; padding: 7px 10px !important; height: auto !important; min-height: 0 !important; border-radius: 8px;
  font: 700 11.5px/1.2 "Bricolage Grotesque", var(--display), sans-serif !important; letter-spacing: .08em !important; text-transform: uppercase !important;
  color: var(--text) !important; background: none !important; cursor: default; user-select: none;
}
.side .nav-group:first-child { margin-top: 4px !important; }
.side .nav-group::after { display: none !important; }
.side .nav-group .ng-ic { display: none !important; }
.side .nav-group .ng-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .nav-group[data-acc] { cursor: pointer; transition: background-color .16s ease, color .16s ease; }
.side .nav-group[data-acc]:hover { background: var(--raised) !important; }
.side .nav-group[data-acc]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side .nav-group.ng-here { color: var(--accent) !important; }
.side .nav-group .ng-n:not(:empty) { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font: 600 10.5px/1 var(--mono, monospace); letter-spacing: 0; color: var(--muted); background: var(--active); }
.side .nav-group .ng-chev { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .7; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.side .nav-group[aria-expanded="true"] .ng-chev { transform: rotate(90deg); }
.side .nav-sep { margin: 22px 10px 6px !important; font: 700 11.5px/1.2 "Bricolage Grotesque", var(--display), sans-serif !important; letter-spacing: .08em; text-transform: uppercase; color: var(--faint) !important; }

/* rows */
.side .nav a {
  height: 38px; max-height: 38px; padding: 0 10px 0 12px; gap: 13px; border-radius: 9px;
  font: 500 14px/1 Figtree, var(--font), sans-serif; color: var(--muted); background: none; transform: none !important;
  white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; opacity: 1;
  transition: max-height .3s cubic-bezier(.2, .8, .2, 1), opacity .22s ease, margin .3s ease, background-color .16s ease, color .16s ease;
}
.side .nav a.ng-item { margin-left: 0; padding-left: 12px; height: 38px; font-size: 14px; border-radius: 9px; }
.side .nav a.ng-item::after { content: none; }
.side .nav a.ng-item > svg:first-child { width: 18px; height: 18px; opacity: .9; }
.side .nav a.ng-c { max-height: 0; opacity: 0; margin: 0; pointer-events: none; }
.side .nav a > svg:first-child { width: 18px; height: 18px; flex: none; stroke-width: 1.75; color: currentColor; opacity: .9; filter: none !important; }
.side .nav a:hover { color: var(--text); background: var(--raised); }
.side .nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.side .nav a[aria-current="page"] > svg:first-child { color: var(--accent); opacity: 1; }
.side .nav a[aria-current="page"]::before { display: none !important; }
.side .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side .nav a em, .side .nav a .rp-navlock { margin-left: auto; }
.side .nav a em.in-ai { background: rgba(255, 181, 71, .14) !important; color: var(--accent-ink) !important; }
.side .nav a[href$="/loc"]::after, .side .nav a[href="/localization"]::after, .side .nav a[href$="/timing"]::after, .side .nav a[href="/fests"]::after, .side .nav a[href$="/syndicate"]::after, .side .nav a[href="/syndicates"]::after {
  /* a dot, not a pill: long labels ("Localization partners") no longer push it out of the row */
  content: ""; position: static; flex: none; width: 7px; height: 7px; margin-left: auto; padding: 0; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 181, 71, .16);
}

/* role switcher and game card on the dark pane */
.side .rp-navrole > span { color: var(--faint); }
.side .rp-navrole > div { background: rgba(243, 239, 231, .06) !important; border: 1px solid var(--border) !important; border-radius: 10px; }
.side .rp-navrole button { color: #ddd5c7 !important; height: 32px; font-size: 12.5px; }
.side .rp-navrole button:hover { color: #fff !important; background: rgba(243, 239, 231, .06); }
.side .rp-navrole button[aria-selected="true"] { color: #1a1408 !important; background: var(--accent) !important; box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.side .scope { background: var(--raised); border: 1px solid var(--border); border-radius: 12px; }
.side .scope b { color: var(--text); }
.side .scope span { color: var(--faint); }
.side #plan .plan { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }

/* collapse button */
.rp-railbtn { position: absolute; top: 14px; right: 10px; z-index: 2; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--raised); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background-color .16s ease, color .16s ease, transform .28s cubic-bezier(.2, .8, .2, 1); }
.rp-railbtn:hover { color: var(--text); background: var(--active); }
.rp-railbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- rail mode ---------- */
.shell { transition: grid-template-columns .3s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 901px) {
  html.rp-rail .shell { grid-template-columns: 72px minmax(0, 1fr); }
  html.rp-rail .side { padding-left: 10px; padding-right: 10px; overflow-x: hidden; }
  html.rp-rail .rp-railbtn { position: static; margin: 0 auto 4px; transform: scaleX(-1); }
  html.rp-rail .side .brand { font-size: 0; justify-content: center; gap: 0; }
  html.rp-rail .side .rp-navrole, html.rp-rail .side #plan, html.rp-rail .side .scope div { display: none !important; }
  html.rp-rail .side .scope { padding: 4px; justify-content: center; }
  html.rp-rail .side .scope img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
  html.rp-rail .side .nav-group { font-size: 0 !important; padding: 0 !important; margin: 10px 8px 6px !important; height: 1px !important; background: var(--border) !important; pointer-events: none; }
  html.rp-rail .side .nav-group > * { display: none !important; }
  html.rp-rail .side .nav a, html.rp-rail .side .nav a.ng-c { max-height: 38px; opacity: 1; pointer-events: auto; justify-content: center; padding: 0; font-size: 0; gap: 0; }
  html.rp-rail .side .nav a::after, html.rp-rail .side .nav a em, html.rp-rail .side .nav a .rp-navlock { display: none !important; }
  html.rp-rail .side .nav a > svg:first-child { width: 20px; height: 20px; }
  html.rp-rail .side .nav-sep { font-size: 0 !important; height: 1px; background: var(--border); margin: 12px 8px !important; }
}
@media (max-width: 900px) { .rp-railbtn { display: none; } }
@media (prefers-reduced-motion: reduce) { .side .nav a, .side .nav-group .ng-chev, .shell, .rp-railbtn { transition: none; } }
