/* ─── SHARED STYLES ───
   Single source of truth for CSS variables, base resets, keyword/icon styles,
   header/nav, and theme overrides. Included by all subsites via <link href="/css/shared.css">.
   Subsite-specific stylesheets can override variables as needed. */

/* ─── UNIFIED CARD PLACEHOLDER ───
   Used everywhere a card image can be missing (search grid, card detail, printing
   tooltip, card modal, deck builder preview, decklist image view). Parent controls
   sizing — this fills its container and preserves card aspect ratio.
   Toggled visible by handleCardImgError() (shared.js) via `display: flex`. */
.card-placeholder {
  display: none;
  width: 100%;
  aspect-ratio: 480 / 670;
  background: linear-gradient(160deg, var(--bg-tertiary) 0%, #1e1e2a 100%);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  text-align: center;
  gap: 5px;
  box-sizing: border-box;
  overflow: hidden;
}
.card-placeholder-name { font-size: 0.85rem; color: var(--text); font-weight: 600; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.card-placeholder-type { font-size: 0.7rem; color: var(--text-muted); }
.card-placeholder-stats { font-size: 0.78rem; color: var(--accent); font-weight: 600; }
/* Cost must be inline-flex so icons don't fill the flex column's cross-axis */
.card-placeholder-cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
  max-width: 100%;
  flex-wrap: wrap;
}
.card-placeholder-cost .fow-icon { width: 16px; height: 16px; margin: 0; }
.card-placeholder-code { font-size: 0.65rem; color: var(--text-dim); font-family: monospace; margin-top: auto; }

/* Larger detail view gets slightly bigger text + padding */
.card-image-col .card-placeholder { padding: 20px 16px; gap: 8px; }
.card-image-col .card-placeholder-name { font-size: 1rem; }
.card-image-col .card-placeholder-type { font-size: 0.8rem; }
.card-image-col .card-placeholder-stats { font-size: 0.88rem; }
.card-image-col .card-placeholder-cost .fow-icon { width: 18px; height: 18px; }


/* ─── FORCE OF WILL FONT ─── */
@font-face {
  font-family: 'Force of Will';
  src: url('/assets/fonts/ForceofWill001.0-Regular.otf') format('opentype'),
       url('/assets/fonts/ForceofWill002.0-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
.fow-font { font-family: 'Force of Will', serif; }

/* ─── BASE VARIABLES (dark theme default) ─── */
:root {
  --bg: #0f0f14;
  --bg-secondary: #1a1a24;
  --bg-tertiary: #22222e;
  --bg-hover: #2a2a38;
  --text: #e0e0e0;
  --text-muted: #a0a0a0;
  --text-dim: #666;
  --accent: #c9a84c;
  --accent-dim: #a08838;
  --border: #2a2a3a;
  --link: #7aadff;
  --ban-red: #d44040;
  --wgp-gold: #e8c44a;
  --card-radius: 10px;
}

/* ─── LIGHT THEME OVERRIDES ───
   Uses html[data-theme="light"] for higher specificity than :root,
   so subsite :root overrides (timeline.css, home.css) don't clobber light values. */
html[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eaeaea;
  --text: #1a1a1a;
  --text-muted: #555;
  --text-dim: #888;
  --accent: #9e7c2e;
  --accent-dim: #7a5f22;
  --border: #d0d0d0;
  --link: #2a5db0;
  --bg-hover: #e0e0e0;
  --ban-red: #c0392b;
  --wgp-gold: #9e7c2e;
}

/* ─── RESET & BASE ─── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── ADMIN NAV (shared across /admin/* pages via admin-nav.js) ─── */
.admin-nav {
  display: flex; gap: 2px; padding: 0 16px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  position: sticky; top: var(--site-header-height, 52px); z-index: 90;
  flex-wrap: wrap;
}
.admin-nav-link {
  padding: 10px 16px; color: var(--text-dim); text-decoration: none;
  font-size: 0.86rem; border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.admin-nav-link:hover { color: var(--text); }
.admin-nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-nav-badge {
  display: inline-block; min-width: 18px; padding: 1px 6px;
  background: var(--accent); color: var(--bg); border-radius: 9px;
  font-size: 0.68rem; font-weight: 600; text-align: center;
}

/* ─── SITE HEADER (db, decks) ─── */
.site-header {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.site-logo {
  font-size: 1.1rem; font-weight: 700; color: var(--accent);
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }
.header-search { flex: 1; max-width: 600px; display: flex; gap: 0; }
.search-toggle {
  padding: 8px 10px; font-size: 0.72rem; font-weight: 600;
  background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border);
  border-right: none; border-radius: 6px 0 0 6px; cursor: pointer;
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.3px;
}
.search-toggle:hover { color: var(--accent); }
.header-search input {
  flex: 1; padding: 8px 14px;
  background: var(--bg-tertiary); color: var(--text);
  border: 1px solid var(--border); border-radius: 0 6px 6px 0;
  font-size: 0.9rem; outline: none;
}
.header-search input:focus { border-color: var(--accent); }
.search-suggest {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 6px 6px; z-index: 1000;
  max-height: 280px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.search-suggest-item {
  padding: 8px 12px; cursor: pointer; font-size: 0.86rem;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.search-suggest-item:hover, .search-suggest-item.active {
  background: var(--bg-tertiary); color: var(--accent);
}
.search-suggest-type {
  font-size: 0.72rem; color: var(--text-dim); width: 16px; text-align: center; flex-shrink: 0;
}
.header-nav { display: flex; gap: 16px; margin-left: auto; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.header-nav a {
  color: var(--text-muted); font-size: 0.85rem;
  display: flex; align-items: center; gap: 4px;
}
.header-nav a:hover { color: var(--text); text-decoration: none; }
#auth-indicator { font-size: 0.82rem; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
#auth-indicator a { color: var(--accent); text-decoration: none; }
#auth-indicator a:hover { text-decoration: underline; }
.auth-admin-badge {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.3px;
  padding: 2px 6px; border-radius: 3px; font-weight: 600;
  background: rgba(var(--accent-rgb, 200,170,80), 0.15);
  border: 1px solid var(--accent);
}

/* ─── SITE NAVIGATION (theme.css shared nav) ─── */
#site-nav {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.site-nav-link {
  padding: 4px 12px; border-radius: 4px; font-size: 0.82rem;
  color: var(--text-muted); text-decoration: none; transition: all 0.12s;
}
.site-nav-link:hover { color: var(--text); background: var(--bg-tertiary); text-decoration: none; }
.site-nav-link.active { color: var(--accent); font-weight: 600; }
.site-nav-link.disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ─── THEME TOGGLE ─── */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); cursor: pointer; font-size: 0.82rem;
  padding: 3px 8px; transition: all 0.15s; margin-left: 4px;
}
.theme-toggle:hover { border-color: var(--text-muted); color: var(--text); }

/* ─── FoW COST / ATTRIBUTE ICONS ─── */
.fow-icon {
  width: 20px; height: 20px; vertical-align: middle;
  margin: 0 1px; display: inline-block;
}

/* ─── CARD FACE HIGHLIGHT/DIM ─── */
.card-face-section, .modal-face-section { transition: opacity 0.2s; }
.card-face-active { opacity: 1; }
.card-face-dim { opacity: 0.45; }
.card-face-dim:hover { opacity: 0.7; }

/* ─── KEYWORD ABILITY STYLES ─── */
.kw {
  display: inline;
  color: #e6edf3; font-weight: 600; font-size: 0.82rem;
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid rgba(200,200,200,0.35);
  background: rgba(255,255,255,0.08);
  cursor: help;
}
html[data-theme="light"] .kw {
  color: #1a1a2e; border-color: rgba(0,0,0,0.2);
  background: rgba(0,0,0,0.05);
}
.kw-param {
  font-style: italic; color: #b8a0d8;
}
html[data-theme="light"] .kw-param {
  color: #6a4fa0;
}
.kw-stat {
  font-weight: 700; font-size: 0.84rem;
}
.kw-trigger {
  color: #f0883e; font-weight: 700; font-size: 1rem;
  margin: 0 2px;
}

/* ─── CARD DETAIL MODAL ─── */
/* Shared between timeline, bracket, build, admin pages — any page that calls
   setupCardModal() / setupCardInteractions() from common.js. */
.card-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 400; display: flex; align-items: center; justify-content: center; }
.card-modal.hidden { display: none; }
.card-modal-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); }
.card-modal-content {
  position: relative; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 12px; max-width: 750px; width: 90vw; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.card-modal-nav {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg-secondary); z-index: 2; border-radius: 12px 12px 0 0;
}
.card-modal-close-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 4px 12px; border-radius: 5px; cursor: pointer; font-size: 0.82rem;
}
.card-modal-close-btn:hover { color: var(--text); border-color: var(--text-muted); }
.card-modal-nav-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 14px; border-radius: 5px; cursor: pointer; font-size: 1rem;
  transition: all 0.15s;
}
.card-modal-nav-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); background: var(--bg-tertiary); }
.card-modal-nav-btn:disabled { opacity: 0.2; cursor: default; }
.card-modal-body { display: flex; gap: 24px; padding: 20px; }
.card-modal-left { flex-shrink: 0; width: 250px; }
.card-modal-image {
  width: 100%; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.card-modal-flip-label {
  font-size: 0.72rem; color: var(--text-dim); text-align: center;
  margin: 12px 0 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.card-modal-right { flex: 1; min-width: 0; }
.card-modal-right h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 2px; }
.card-modal-right h2 .fow-icon { width: 20px; height: 20px; }
.card-modal-type { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 8px; }
.card-modal-stats { font-size: 0.88rem; margin-bottom: 0; }

.card-info-table {
  width: 100%; border-collapse: collapse; margin-bottom: 12px;
  font-size: 0.88rem;
}
.card-info-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.card-info-label {
  color: var(--text-dim); font-style: italic; text-align: right;
  width: 90px; white-space: nowrap; font-size: 0.82rem;
}
.card-info-value { color: var(--text); }
.card-info-value strong { font-size: 1.1rem; }
.card-info-meta { margin-bottom: 14px; }
.card-info-meta .card-info-value { font-size: 0.82rem; color: var(--text-muted); }
.card-info-meta .card-info-value a { color: var(--accent); text-decoration: none; }

.card-modal-text {
  font-size: 0.88rem; line-height: 1.6; color: var(--text);
  padding: 14px; background: var(--bg-tertiary); border-radius: 6px;
  border: 1px solid var(--border); margin-bottom: 14px;
}
.card-modal-text:empty { display: none; }
.card-modal-meta { margin-bottom: 14px; }
.card-info-value .fow-icon { width: 22px; height: 22px; }
.card-modal-text .fow-icon { width: 18px; height: 18px; }

.card-modal-usage { font-size: 0.82rem; }
.card-modal-usage h4 { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; margin-bottom: 6px; }
.card-modal-usage-list { list-style: none; }
.card-modal-usage-list li { padding: 3px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.card-modal-usage-list li.usage-link { cursor: pointer; border-radius: 3px; padding: 4px 6px; }
.card-modal-usage-list li.usage-link:hover { background: var(--bg-tertiary); color: var(--accent); }

@media (max-width: 700px) {
  .card-modal-body { flex-direction: column; }
  .card-modal-left { width: 180px; margin: 0 auto; }
}

/* ─── CARD TOOLTIP ─── */
#card-tooltip { position: fixed; z-index: 500; pointer-events: none; }
#card-tooltip.hidden { opacity: 0; display: none; }
#card-tooltip img {
  width: 240px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.7);
  transition: opacity 0.1s;
}
#card-tooltip .card-placeholder { width: 240px; box-shadow: 0 8px 24px rgba(0,0,0,0.7); }


/* ─── BOUNTY NOTIFICATION BANNER ─── */
/* Injected by shared.js on any page with a <div id="bounty-banner"> placeholder. */
#bounty-banner:not(.bounty-banner-visible) { display: none; }
.bounty-banner-visible {
  background: linear-gradient(90deg, rgba(155,142,196,0.15), rgba(155,142,196,0.06));
  border-bottom: 1px solid rgba(155,142,196,0.4);
}
.bounty-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text);
  position: relative;
}
.bounty-banner-icon { font-size: 1rem; }
.bounty-banner-text { color: var(--text-dim); text-align: center; }
.bounty-banner-cta {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 10px;
  border: 1px solid rgba(155,142,196,0.5);
  border-radius: 3px;
  white-space: nowrap;
  transition: background 0.1s;
}
.bounty-banner-cta:hover { background: rgba(155,142,196,0.15); }
.bounty-banner-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
}
.bounty-banner-close:hover { color: var(--text); }
@media (max-width: 640px) {
  .bounty-banner-text { font-size: 0.78rem; }
  .bounty-banner-cta { font-size: 0.78rem; padding: 3px 8px; }
}
