/* ─── Campfire Theme System ──────────────────────────────────────────────────
   CSS variables are loaded per-theme from assets/css/themes/{name}.css.
   This file contains structural overrides and element theming via var().
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --navbar-height: 52px;
  --menu-height: 0px;
  /* Fallback variables (puzzle-light) — overridden by the loaded theme file */
  --bg:         #faf5ff;
  --bg-sidebar: #f0e8fc;
  --bg-card:    #ffffff;
  --bg-hover:   #f5eeff;
  --bg-inset:   #fdfaff;
  --bg-alt:     rgba(0,0,0,0.025);
  --border:     #d8c8f0;
  --border-sub: #e8ddf8;
  --text:       #1c0c28;
  --text-muted: #7038a8;
  --text-dim:   #b898d8;
  --accent:     #8030d8;
  --accent-bg:  rgba(128,48,216,0.1);
}

/* Remove content max-width caps */
.hextra-max-content-width,
.hextra-max-page-width {
  max-width: 100% !important;
}

/* ─── Fonts ──────────────────────────────────────────────────────────────── */

body {
  font-family: 'DM Sans', sans-serif !important;
  line-height: 1.65;
  background-color: var(--bg) !important;
  color: var(--text) !important;
}

h1, h2, h3, h4, h5, h6,
.hx\:font-extrabold,
.hx\:font-semibold,
.hx\:font-bold {
  font-family: 'Outfit', sans-serif !important;
}

code, pre, kbd, samp {
  font-family: 'JetBrains Mono', monospace !important;
}

/* ─── Navbar: always white ───────────────────────────────────────────────── */

.hextra-nav-container-blur {
  background-color: rgba(255,255,255,0.96) !important;
  border-bottom: 1px solid rgba(0,0,0,0.1) !important;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

.cf-navbar {
  height: 52px;
  gap: 0;
}

/* ── Brand ── */
.cf-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: -1.5rem;
  padding-left: 1.5rem;
  padding-right: 20px;
  width: 16rem;
  height: 100%;
  flex-shrink: 0;
  text-decoration: none;
  border-right: 1px solid rgba(0,0,0,0.09);
  transition: background 0.15s;
}
.cf-brand:hover { background: rgba(0,0,0,0.025); }
.cf-brand-text {
  font-family: 'Outfit', sans-serif !important;
  font-weight: 800;
  font-size: 17px;
  color: #1a1714 !important;
  letter-spacing: -0.03em;
  line-height: 1;
}

.cf-nav-sep { display: none; }

/* ── Game switcher ── */
.cf-game-details {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  border-right: 1px solid rgba(0,0,0,0.08);
}

.cf-game-details summary { list-style: none; }
.cf-game-details summary::-webkit-details-marker { display: none; }

.cf-game-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.04);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: rgba(26,23,20,0.7);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  min-width: 170px;
}
.cf-game-btn:hover,
.cf-game-details[open] .cf-game-btn {
  border-color: rgba(0,0,0,0.22);
  background: rgba(0,0,0,0.07);
  color: #1a1714;
}

.cf-game-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cf-game-name { flex: 1; }
.cf-chevron {
  color: rgba(26,23,20,0.4);
  flex-shrink: 0;
  transition: transform 0.15s;
}
.cf-game-details[open] .cf-chevron { transform: rotate(180deg); }

.cf-game-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  overflow: hidden;
  z-index: 500;
  padding: 4px 0;
}
.cf-game-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: rgba(26,23,20,0.75);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s;
}
.cf-game-item:hover { background: rgba(0,0,0,0.04); color: #1a1714; }
.cf-game-active { color: #1a1714 !important; background: rgba(0,0,0,0.05); font-weight: 600; }
.cf-game-genre {
  margin-left: auto;
  font-size: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(26,23,20,0.4);
}
.cf-game-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 3px 0;
}
.cf-game-add { color: rgba(26,23,20,0.4) !important; font-size: 12.5px; }

/* ── Edit button ── */
.cf-edit-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  color: rgba(26,23,20,0.6);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
  margin-left: 8px;
}
.cf-edit-btn:hover {
  border-color: rgba(0,0,0,0.25);
  color: #1a1714;
  background: #f8f8f6;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.hextra-sidebar-container {
  background-color: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border) !important;
  top: var(--navbar-height) !important;
}

/* Sidebar sticky footer (theme toggle area) */
.hextra-sidebar-container [data-toggle-animation] {
  background-color: var(--bg-sidebar) !important;
  border-color: var(--border) !important;
  box-shadow: 0 -12px 16px var(--bg-sidebar) !important;
}

/* Sidebar section headers */
.hextra-sidebar-container li > div > span[class*="hx:text-xs"],
.hx\:text-xs.hx\:font-semibold {
  font-family: 'Outfit', sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--text-dim) !important;
}

/* Sidebar group/section headers (font-semibold non-link) */
.hextra-sidebar-container [class~="hx:font-semibold"][class~="hx:text-gray-900"] {
  color: var(--text) !important;
}

/* Sidebar items */
.hextra-sidebar-item a,
.hextra-sidebar-item button {
  color: var(--text-muted) !important;
}
.hextra-sidebar-item a:hover,
.hextra-sidebar-item button:hover {
  background-color: var(--bg-hover) !important;
  color: var(--text) !important;
}

/* Active sidebar item */
.hextra-sidebar-active-item {
  background-color: var(--accent-bg) !important;
  color: var(--accent) !important;
  border-left: 2px solid var(--accent) !important;
  font-weight: 600;
}

/* Sidebar connector lines (::before pseudo on the children container) */
[class~="hx:before:bg-gray-200"]::before {
  background-color: var(--border) !important;
}

/* Sidebar collapsible chevron */
.hextra-sidebar-collapsible-button {
  color: var(--text-muted) !important;
}

/* ─── TOC ────────────────────────────────────────────────────────────────── */

/* Fix TOC sticky top — Hextra hardcodes top-16 (64px), override to match our navbar */
.hextra-toc .hextra-scrollbar {
  top: var(--navbar-height) !important;
}

/* TOC bg-white elements (sticky bottom section) */
.hextra-toc [class~="hx:bg-white"] {
  background-color: var(--bg) !important;
  box-shadow: 0 -12px 16px var(--bg) !important;
  border-color: var(--border) !important;
}

/* TOC heading */
.hextra-toc [class~="hx:font-semibold"][class~="hx:tracking-tight"] {
  color: var(--text) !important;
  font-family: 'Outfit', sans-serif !important;
}

/* TOC links */
.hextra-toc a {
  color: var(--text-muted) !important;
}
.hextra-toc a:hover {
  background-color: var(--bg-hover) !important;
  color: var(--text) !important;
}
.hextra-toc a[class*="active"] {
  color: var(--accent) !important;
}

/* TOC utility text (back to top, tags, etc.) */
.hextra-toc [class~="hx:text-gray-500"],
.hextra-toc [class~="hx:text-gray-400"] {
  color: var(--text-muted) !important;
}

/* ─── Breadcrumb ─────────────────────────────────────────────────────────── */

/* Container: hx:mt-1.5 hx:flex hx:items-center hx:gap-1 hx:overflow-hidden hx:text-gray-500 */
[class~="hx:mt-1.5"][class~="hx:overflow-hidden"][class~="hx:gap-1"] {
  color: var(--text-muted) !important;
}
[class~="hx:mt-1.5"][class~="hx:overflow-hidden"][class~="hx:gap-1"] * {
  color: var(--text-muted) !important;
}
/* Current page item */
[class~="hx:mt-1.5"][class~="hx:overflow-hidden"] [class~="hx:text-gray-700"] {
  color: var(--text) !important;
}

/* ─── Pager navigation ───────────────────────────────────────────────────── */

/* Container: hx:mb-8 hx:flex hx:items-center hx:border-t hx:pt-8 */
[class~="hx:mb-8"][class~="hx:border-t"][class~="hx:pt-8"] {
  border-color: var(--border) !important;
}
[class~="hx:mb-8"][class~="hx:border-t"][class~="hx:pt-8"] a {
  color: var(--text-muted) !important;
}
[class~="hx:mb-8"][class~="hx:border-t"][class~="hx:pt-8"] a:hover {
  color: var(--accent) !important;
}

/* ─── h1 title divider ───────────────────────────────────────────────────── */

article h1 {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
article .content > div:first-child {
  border-bottom: 1px solid var(--border) !important;
  padding-bottom: 12px !important;
  margin-bottom: 16px !important;
}

/* ─── Content area ───────────────────────────────────────────────────────── */

main {
  background-color: var(--bg) !important;
}

/* Override any Hextra bg-white inside the content area */
[class~="hx:bg-white"]:not(.hextra-nav-container-blur):not(footer) {
  background-color: var(--bg) !important;
}

article,
article p,
article li,
.hextra-max-content-width {
  color: var(--text) !important;
}

article h1, article h2, article h3,
article h4, article h5, article h6 {
  color: var(--text) !important;
  font-family: 'Outfit', sans-serif !important;
}

article h2 {
  border-bottom-color: var(--border) !important;
}

article a {
  color: var(--accent) !important;
}

article code:not(pre code) {
  background-color: var(--bg-inset) !important;
  border: 1px solid var(--border) !important;
  color: var(--accent) !important;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.84em;
}

article pre,
pre.hextra-code-block {
  background-color: var(--bg-inset) !important;
  border: 1px solid var(--border) !important;
}

/* Tables — rounded outer container, themed header. Width fits content; cap at 100%. */
article table {
  display: table !important;
  width: auto !important;
  max-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  margin: 10px 0 20px !important;
  font-size: 13.5px;
  background: transparent !important;
}

article thead tr,
article thead {
  background: var(--bg-card) !important;
}

article th {
  font-family: 'Outfit', sans-serif !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted) !important;
  background: var(--bg-card) !important;
  text-align: left;
  padding: 9px 14px !important;
  border: 0 !important;
  border-bottom: 2px solid var(--border) !important;
  white-space: nowrap;
}

article tbody tr {
  background: transparent !important;
}
article tbody tr:nth-child(even) {
  background: var(--bg-alt) !important;
}
article tbody tr:hover td {
  background-color: var(--bg-hover) !important;
}

article td {
  padding: 9px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--border-sub) !important;
  color: var(--text) !important;
  vertical-align: middle;
  line-height: 1.5;
}
article tbody tr:last-child td {
  border-bottom: 0 !important;
}

article caption {
  padding: 7px 14px;
  text-align: left;
  font-size: 11.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  caption-side: top;
  font-style: italic;
}

article blockquote {
  border-left-color: var(--accent) !important;
  background-color: var(--bg-card) !important;
  color: var(--text-muted) !important;
}

article hr {
  border-color: var(--border) !important;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.hextra-cards > a,
.hextra-card {
  background-color: var(--bg-card) !important;
  border-color: var(--border) !important;
}
.hextra-cards > a:hover,
.hextra-card:hover {
  background-color: var(--bg-hover) !important;
  border-color: var(--accent) !important;
}
.hextra-cards > a *,
.hextra-card * {
  color: var(--text) !important;
}
.hextra-cards > a p,
.hextra-card p {
  color: var(--text-muted) !important;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */

footer {
  background-color: #ffffff !important;
  border-top: 1px solid rgba(0,0,0,0.1) !important;
  color: rgba(26,23,20,0.45) !important;
  padding: 24px 1.5rem !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.6;
}

footer a {
  color: rgba(26,23,20,0.6) !important;
  text-decoration: underline;
}
footer a:hover {
  color: #1a1714 !important;
}

.cf-footer-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cf-footer-copy { flex: 1; }

/* Navbar theme toggle button — flush to right edge of viewport */
.cf-nav-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-left: auto;
  margin-right: -1.5rem;
  flex-shrink: 0;
  border-radius: 0;
  border: none;
  border-left: 1px solid rgba(0,0,0,0.09);
  background: transparent;
  color: #1a1714;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cf-nav-theme-btn:hover {
  background: rgba(0,0,0,0.04);
}
.cf-nav-theme-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cf-nav-theme-icon {
  display: inline-block;
  transform: translateY(-1px);
}

/* Mobile burger: theme toggle row at the bottom of the burger panel */
.cf-sidebar-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.5rem 0;
  border-top: 1px solid var(--border);
}
.cf-sidebar-theme-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  padding-left: 0.25rem;
}
.cf-sidebar-theme .cf-nav-theme-btn {
  width: 36px;
  height: 36px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
}
/* Beat Tailwind's hx:md:hidden — base .cf-sidebar-theme sets display:flex
   at equal specificity, so we need an explicit desktop hide. */
@media (min-width: 768px) {
  .cf-sidebar-theme { display: none; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */

* {
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

/* ─── Mobile: sidebar as full-width pulldown below navbar ────────────────── */

@media (max-width: 767px) {
  .hextra-sidebar-container {
    top: var(--navbar-height) !important;
    padding-top: 0 !important;
    bottom: auto !important;
    max-height: calc(100vh - var(--navbar-height)) !important;
    overflow-y: auto !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18) !important;
    border-bottom: 1px solid var(--border) !important;
  }

  .hextra-sidebar-container [data-toggle-animation] {
    position: sticky;
    bottom: 0;
  }
}

/* Nav toggle button (hamburger) spacing */
.cf-nav-toggle-btn {
  flex-shrink: 0;
}

/* ── Per-game sub-nav (Characters / Moves / Outfits / ...) ── */
.cf-game-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
  height: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.cf-game-nav-item {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: rgba(26,23,20,0.7);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.cf-game-nav-item:hover {
  background: rgba(0,0,0,0.05);
  color: rgba(26,23,20,0.95);
}

.cf-game-nav-active {
  background: rgba(0,0,0,0.08);
  color: rgba(26,23,20,1);
  font-weight: 600;
}

/* ─── Home: hero + game tiles ────────────────────────────────────────────── */

.cf-home-hero {
  max-width: 760px;
  margin: 2.5rem auto 2.25rem;
  padding: 0 1rem;
  text-align: center;
}

.cf-home-tagline {
  font-family: 'Outfit', sans-serif !important;
  font-weight: 800 !important;
  font-size: clamp(1.9rem, 4.2vw, 2.85rem) !important;
  line-height: 1.1 !important;
  letter-spacing: -0.02em;
  color: var(--text) !important;
  margin: 0 0 0.9rem !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.cf-home-blurb {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.55;
  color: var(--text-muted) !important;
  margin: 0;
}

.cf-home-games {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 3rem;
  padding: 0 1rem;
}

.cf-game-tile {
  --game-color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  width: 120px;
  text-decoration: none !important;
}

.cf-game-tile-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  padding: 0.75rem;
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.15s ease;
}

.cf-game-tile:hover .cf-game-tile-art {
  transform: translateY(-2px);
  border-color: var(--game-color);
  box-shadow: 0 10px 24px rgba(0,0,0,0.08), 0 0 0 2px color-mix(in srgb, var(--game-color) 18%, transparent);
}

.cf-game-tile-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.cf-game-tile-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text) !important;
  text-align: center;
  line-height: 1.25;
}
