/* premium-tokens.css — Phase 6 design-token schema.
 * Loaded by _base.html ahead of site.css. Defines defaults (naturalist
 * theme); per-theme stylesheets in themes/<slug>.css override these
 * tokens scoped to [data-theme="<slug>"].
 *
 * Token contract (every theme implements these):
 *   --bg                — page background
 *   --bg-overlay        — full-bleed overlay tint over hero photos
 *   --panel             — panel/card background
 *   --panel-edge        — panel border colour
 *   --ink               — primary text
 *   --ink-soft          — secondary text / labels
 *   --ink-dim           — tertiary / metadata
 *   --accent            — primary accent (links, focus, key data)
 *   --accent-2          — secondary accent (alerts, hover)
 *   --rule              — divider colour
 *   --ornament-fill     — corner-flourish tint
 *   --shadow-panel      — panel drop shadow
 *   --radius-panel      — panel corner radius
 *   --btn-bg            — button background
 *   --btn-ink           — button text
 *   --btn-edge          — button border / inner-light
 *   --btn-hover-bg      — button background on hover
 *   --focus-ring        — focus outline colour
 *   --font-display      — headings / hero
 *   --font-body         — paragraphs / lists
 *   --font-mono         — stat tables / addresses
 *   --tracking-display  — letter-spacing for display text
 *   --weight-display    — heading weight
 *   --texture-panel     — url() to a panel-background texture (or none)
 *   --texture-hero-veil — gradient or image() over hero photos
 */

:root,
[data-theme="naturalist"] {
  /* Naturalist Field Station — parchment + brass + ember */
  --bg:               #0E0F12;
  --bg-overlay:       rgba(232, 217, 176, 0.03);
  --panel:            #1A1815;
  --panel-edge:       rgba(201, 166, 107, 0.32);
  --ink:              #E8D9B0;
  --ink-soft:         rgba(232, 217, 176, 0.78);
  --ink-dim:          rgba(232, 217, 176, 0.52);
  --accent:           #C9A66B;
  --accent-2:         #E36848;
  --rule:             rgba(201, 166, 107, 0.28);
  --ornament-fill:    #C9A66B;
  --shadow-panel:     0 14px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(232, 217, 176, 0.08);
  --radius-panel:     10px;
  --btn-bg:           linear-gradient(180deg, #2A2520 0%, #1A1815 100%);
  --btn-ink:          #E8D9B0;
  --btn-edge:         #C9A66B;
  --btn-hover-bg:     linear-gradient(180deg, #3B342C 0%, #2A2520 100%);
  --focus-ring:       #E36848;
  --font-display:     'Cormorant Garamond', 'Cormorant', Georgia, 'Times New Roman', serif;
  --font-body:        -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --font-mono:        'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --tracking-display: 0.04em;
  --weight-display:   500;
  --texture-panel:    none;
  --texture-hero-veil: linear-gradient(180deg, rgba(14,15,18,0.55) 0%, rgba(14,15,18,0.85) 100%);
}

/* Reset base typography to use the tokens. Pages can opt out by
 * scoping their own selectors. */
html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}
body {
  background:
    var(--bg-overlay),
    var(--bg);
}
h1, h2, h3, h4, .display, .hero h1 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-display);
  font-weight: var(--weight-display);
  color: var(--ink);
}
.t-mono, .stat, code, kbd, pre, samp,
[data-mono] {
  font-family: var(--font-mono);
}

/* Panel / card primitive shared across themes. Pages can use
 * .premium-panel as a drop-in for any boxed content. */
.premium-panel {
  background: var(--panel);
  background-image: var(--texture-panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px 22px;
  position: relative;
}
.premium-panel + .premium-panel {
  margin-top: 14px;
}

.premium-rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 22px 0;
}

.premium-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--btn-edge);
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, transform 80ms ease, box-shadow 160ms ease;
}
.premium-btn:hover {
  background: var(--btn-hover-bg);
  box-shadow: 0 0 0 1px var(--btn-edge), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.premium-btn:active { transform: translateY(1px); }
.premium-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(201, 166, 107, 0.42);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* Live status widget in the nav — server players + bot heartbeat. */
.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--bg), var(--panel) 35%);
}
.live-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-dim);
  box-shadow: 0 0 0 0 transparent;
  transition: background 200ms ease, box-shadow 200ms ease;
}
.live-status__dot[data-state="ok"] {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 70%);
  animation: live-pulse 2.4s ease-in-out infinite;
}
.live-status__dot[data-state="stale"] { background: var(--accent-2); }
.live-status__dot[data-state="off"]   { background: var(--ink-dim); }
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent), transparent 60%); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent), transparent 90%); }
}
.live-status__count { color: var(--ink); font-weight: 500; letter-spacing: 0.04em; }
.live-status__weather { color: var(--ink-dim); font-size: 0.70rem; }

/* Theme-switcher dropdown — same on every theme, restyled by tokens. */
.theme-switch {
  position: relative;
  display: inline-block;
}
.theme-switch__trigger {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
.theme-switch__trigger:hover { border-color: var(--accent); color: var(--ink); }
.theme-switch__trigger[aria-expanded="true"] { border-color: var(--accent); }
.theme-switch__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 280px;
  /* User reported only the first ~4 themes were reachable in the
   * dropdown — items below the viewport edge were getting clipped
   * because there was no max-height + no overflow-y. With 10 themes
   * each ~52 px tall the menu can hit ~520 px and run off-screen on
   * a 720-px-tall window. Cap to 70vh and scroll inside. */
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 8px;
  list-style: none;
  margin: 0;
  z-index: 800;
  display: none;
}
/* Slim themed scrollbar so the menu doesn't paint a chrome bar. */
.theme-switch__menu::-webkit-scrollbar { width: 6px; }
.theme-switch__menu::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent), transparent 60%);
  border-radius: 3px;
}
.theme-switch__menu::-webkit-scrollbar-track { background: transparent; }
.theme-switch__menu[data-open="true"] { display: block; }
.theme-switch__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink-soft);
  border: 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  cursor: pointer;
}
.theme-switch__item:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
.theme-switch__item[aria-current="true"] { color: var(--accent); }
.theme-switch__item span.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
  background: var(--accent);
  border: 1px solid var(--ink-dim);
}
