/*
 * Strider657's Milkshake Mania — Wiki
 * Additions layered ON TOP of the homepage stylesheet
 * (https://striderplays.vercel.app/index.css). Everything here reuses the
 * homepage's CSS custom properties (--card, --line, --accent-2, --muted, …) so
 * the theme — including the light-mode override — stays perfectly in sync.
 *
 * This is a MULTI-PAGE wiki: a shared top bar + left sidebar wrap every page,
 * and cross-document View Transitions animate navigation between them.
 */

/* Fonts pulled in via the <head> Google Fonts link. The homepage falls back to
   a system stack; the wiki gently prefers Inter / Outfit where available. */
body {
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}
h1,
h2,
h3,
h4,
.section__title,
.hero__title,
.cta h2,
.wk-page__title {
  font-family: "Outfit", "Inter", "Segoe UI", system-ui, sans-serif;
}

/* ── Cross-page transitions ────────────────────────────────────────────
   The homepage stylesheet already enables `@view-transition { navigation:
   auto; }`. We name the main column so it slides while the persistent chrome
   (top bar + sidebar) stays put. */
.wk-main {
  view-transition-name: wk-main;
}
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(wk-main) {
    animation: wk-fade-out 0.16s ease both;
  }
  ::view-transition-new(wk-main) {
    animation: wk-slide-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}
@keyframes wk-fade-out {
  to {
    opacity: 0;
    transform: translateY(-0.4rem);
  }
}
@keyframes wk-slide-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

/* ── Layout shell: sidebar + content ───────────────────────────────────── */
.wk-shell {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  max-width: calc(var(--maxw) + 17rem);
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 5vw, 3rem) 0;
}

.wk-sidebar {
  flex: 0 0 15rem;
  position: sticky;
  top: 4.75rem;
  align-self: flex-start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 0.5rem 0.75rem 1.5rem 0;
  scrollbar-width: thin;
}

.wk-main {
  flex: 1 1 auto;
  min-width: 0;
}
/* Inside the shell, sections fill the column instead of re-centering. */
.wk-main .section {
  max-width: none;
  margin: 0;
  padding-inline: 0;
  padding-block: clamp(1.25rem, 3vw, 2.25rem);
}
.wk-main .section--alt {
  border-radius: var(--radius);
  border-block: 0;
  border: 1px solid var(--line);
  padding-inline: clamp(1.25rem, 3vw, 2rem);
  margin-block: 1rem;
}
.wk-main .section--alt > * {
  max-width: none;
  margin-inline: 0;
}
.wk-main .section__title,
.wk-main .section__lead {
  text-align: left;
}

/* ── Sidebar navigation ────────────────────────────────────────────────── */
.wk-nav {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.wk-nav__group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.wk-nav__label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 0.6rem;
  margin-bottom: 0.25rem;
}
.wk-nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.55rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.94rem;
  border: 1px solid transparent;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.12s ease;
}
.wk-nav a .lucide {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--accent-2);
  opacity: 0.85;
}
.wk-nav a:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.1);
  transform: translateX(0.15rem);
}
.wk-nav a.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--glow);
}
.wk-nav a.is-active .lucide {
  opacity: 1;
}

/* ── Page header (per content page) ────────────────────────────────────── */
.wk-page {
  padding: clamp(1.25rem, 4vw, 2.5rem) 0 0.5rem;
}
.wk-page__title {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  font-weight: 800;
  margin: 0.5rem 0 0.4rem;
}
.wk-page__lead {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 60ch;
}
.wk-crumbs {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.wk-crumbs a {
  color: var(--muted);
}
.wk-crumbs a:hover {
  color: var(--accent-2);
}

/* ── Reference tables ──────────────────────────────────────────────────── */
.wk-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  margin: 0.4rem 0;
}
.wk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.wk-table.wk-table--wide {
  min-width: 34rem;
}
/* Tall reference tables scroll internally so they don't dominate the page;
   the sticky header keeps the column labels visible while you scroll. */
.wk-scroll--tall {
  max-height: 30rem;
  overflow-y: auto;
}
.wk-table th,
.wk-table td {
  text-align: left;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.wk-table thead th {
  color: var(--accent-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  position: sticky;
  top: 0;
  background: var(--card);
}
.wk-table tbody tr:last-child td {
  border-bottom: 0;
}
.wk-table tbody tr:hover {
  background: rgba(127, 127, 127, 0.06);
}
.wk-table td:first-child {
  color: var(--text);
  font-weight: 600;
}
.wk-num {
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  font-size: 0.86rem;
  color: var(--muted);
}

/* Small table that lives directly inside a .card (level unlocks etc.) */
.card .wk-table {
  margin-top: 0.5rem;
}
.card .wk-table td {
  padding: 0.35rem 0.5rem;
}

/* ── Tip / note callouts ───────────────────────────────────────────────── */
.wk-tip {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: color-mix(in srgb, var(--accent) 9%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  color: var(--text);
}
.wk-tip .lucide {
  color: var(--accent-2);
  flex: 0 0 auto;
  margin-top: 0.15rem;
}
.wk-tip p {
  color: var(--muted);
  margin: 0;
}
.wk-tip strong {
  color: var(--text);
}
.wk-tip--warn {
  background: color-mix(in srgb, #f59e0b 10%, var(--card));
  border-color: color-mix(in srgb, #f59e0b 40%, var(--line));
  border-left-color: #f59e0b;
}
.wk-tip--warn .lucide {
  color: #fbbf24;
}

/* ── Pills (combo bonuses, tags) ───────────────────────────────────────── */
.wk-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.pill .lucide {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--accent-2);
}

/* ── em emphasis reads as a soft accent in body copy ───────────────────── */
.card em,
.wk-main p em,
.faq__item p em,
.wk-tip em {
  color: var(--accent-2);
  font-style: normal;
  font-weight: 600;
}

/* ── "Up next" page links at the foot of each page ─────────────────────── */
.wk-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--gap);
  margin: 1.5rem 0 0.5rem;
}
.wk-next a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.wk-next a:hover {
  transform: translateY(-0.25rem);
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.wk-next a .lucide {
  color: var(--accent-2);
}
.wk-next small {
  display: block;
  color: var(--muted);
  font-weight: 500;
}

/* ── Top bar tweaks for the menu button ────────────────────────────────── */
.wk-menu-btn {
  display: none;
}

/* ── Mobile: sidebar becomes a slide-in drawer ─────────────────────────── */
.wk-backdrop {
  display: none;
}
@media (max-width: 56rem) {
  .wk-menu-btn {
    display: inline-grid;
  }
  .wk-shell {
    display: block;
    padding-top: 1rem;
  }
  .wk-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 16rem;
    max-height: none;
    z-index: 70;
    background: var(--bg-alt);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 1.25rem 1rem;
    transform: translateX(-105%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.wk-sidebar-open .wk-sidebar {
    transform: none;
  }
  body.wk-sidebar-open .wk-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
}

/* ── Hero stat strip on the home page ──────────────────────────────────── */
.wk-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.wk-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.wk-stat b {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
}
.wk-stat small {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ── FAQ — self-contained native <details> accordion ───────────────────────
   Deliberately NOT reusing the homepage's floating `.faq__content` panel: this
   is a plain native disclosure so it expands reliably with zero JS. */
.wk-faq {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}
.wk-faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.wk-faq details[open] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--glow);
}
.wk-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  transition: color 0.15s ease;
}
.wk-faq summary::-webkit-details-marker {
  display: none;
}
.wk-faq summary:hover {
  color: var(--accent-2);
}
.wk-faq summary .lucide {
  color: var(--accent-2);
  flex: 0 0 auto;
  transition: transform 0.25s ease;
}
.wk-faq details[open] summary .lucide {
  transform: rotate(180deg);
}
.wk-faq details > p {
  padding: 0 1.15rem 1.05rem;
  color: var(--muted);
  margin: 0;
}
.wk-faq details > p + p {
  padding-top: 0;
}

/* ── Section-level lists: give bullets a proper indent ─────────────────────
   The homepage reset zeroes list padding, which makes markers hang to the LEFT
   of the heading. Restore a consistent indent for lists in the content column. */
.wk-main ul,
.wk-main ol {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.35rem;
  color: var(--muted);
}
.wk-main li {
  margin: 0.3rem 0;
}
.wk-main li strong {
  color: var(--text);
}

/* ── Sidebar table of contents (per-page subheading tree, built by JS) ───── */
.wk-toc {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0.25rem 0 0.35rem 0.95rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}
.wk-toc a {
  display: block;
  padding: 0.28rem 0.5rem;
  border: 0;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.wk-toc a:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.08);
  transform: none;
}
.wk-toc a.is-current {
  color: var(--accent-2);
  font-weight: 600;
}
.wk-toc a.wk-toc__sub {
  padding-left: 1.2rem;
  font-size: 0.82rem;
}

/* ── Per-section version badges (added by JS) ──────────────────────────────
   Every documented section shows the game version(s) it applies to. Defaults to
   the version the wiki currently documents; a <section> can override or extend
   with data-versions="1.2-2,1.3". */
.wk-vers {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-left: 0.55rem;
  vertical-align: middle;
}
.wk-ver {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-2);
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  font-size: 0.6em;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* The newest version on a section reads as "current". */
.wk-ver--latest {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Sidebar filter box (added by JS) ──────────────────────────────────── */
.wk-search {
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.wk-search::placeholder {
  color: var(--muted);
}
.wk-search:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.wk-nav__empty {
  padding: 0.5rem 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── Hover anchor links on headings (added by JS) ──────────────────────── */
.wk-anchor {
  margin-left: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  opacity: 0;
  transition:
    opacity 0.15s ease,
    color 0.15s ease;
}
.wk-main h2:hover .wk-anchor,
.wk-main h3:hover .wk-anchor {
  opacity: 0.55;
}
.wk-anchor:hover,
.wk-anchor:focus-visible {
  opacity: 1;
  color: var(--accent-2);
}

/* ── Reduced motion: kill the reveal offset ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Smooth, flicker-free inter-page transitions ────────────────────────────
   Keep cross-document (MPA) View Transitions ON, but give the persistent chrome
   its own view-transition-names so the top bar and sidebar are matched between
   pages and stay perfectly still — instead of being swept into the root
   cross-fade, which is what made navigation flicker. Only `.wk-main` animates
   (its keyframes are defined near the top of this file). */
@view-transition {
  navigation: auto;
}
.nav {
  view-transition-name: wk-topbar;
}
.wk-sidebar {
  view-transition-name: wk-sidebar;
}
/* The chrome is identical on every page — hold it still (no cross-fade). */
::view-transition-group(wk-topbar),
::view-transition-group(wk-sidebar) {
  animation: none;
}
/* The content's entrance is owned by the View Transition, so drop the homepage's
   generic main fade-in here to avoid a double animation. */
.wk-main {
  animation: none;
}

/* ── Theme-aware scrollbars ─────────────────────────────────────────────────
   Inner scroll areas live inside <body> (which carries `.theme-light`), so they
   read the live theme tokens. The viewport scrollbar belongs to <html>, which
   only receives the `wk-pre-light` flag, so it is themed explicitly. */
.wk-sidebar,
.wk-scroll {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}
.wk-sidebar::-webkit-scrollbar,
.wk-scroll::-webkit-scrollbar {
  width: 0.6rem;
  height: 0.6rem;
}
.wk-sidebar::-webkit-scrollbar-track,
.wk-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.wk-sidebar::-webkit-scrollbar-thumb,
.wk-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 38%, transparent);
  border-radius: 999px;
}
.wk-sidebar:hover::-webkit-scrollbar-thumb,
.wk-scroll:hover::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 60%, transparent);
}

/* Viewport (page) scrollbar — dark by default, light when the theme is light. */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(154, 163, 173, 0.4) #0b0d11;
}
html.wk-pre-light {
  scrollbar-color: rgba(91, 107, 122, 0.45) #eef2f7;
}
html::-webkit-scrollbar {
  width: 0.85rem;
}
html::-webkit-scrollbar-track {
  background: #0b0d11;
}
html::-webkit-scrollbar-thumb {
  background: rgba(154, 163, 173, 0.35);
  border-radius: 999px;
  border: 2px solid #0b0d11;
}
html.wk-pre-light::-webkit-scrollbar-track {
  background: #eef2f7;
}
html.wk-pre-light::-webkit-scrollbar-thumb {
  background: rgba(91, 107, 122, 0.45);
  border: 2px solid #eef2f7;
}
