/* ═══════════════════════════════════════════════════════════
   global.css — Exit Strategy shared styles
   All 8 pages link this. Page-specific palette vars and
   unique-to-that-page elements stay in each page's <style>.
   ═══════════════════════════════════════════════════════════ */

/* ── COMMON TOKENS ── */
:root {
  --bg: #EAE0CF;
  --surface: #ffffff;
  --surface-soft: #F5EFE6;
  --surface2: #F0E8DB;
  --hairline: #C0D2DA;
  --border: #C0D2DA;
  --ink-1: #213448;
  --ink-2: #2D4560;
  --ink-3: #547792;
  --ink-4: #94B4C1;
  --ink-5: #C8D8E0;
  --text: #213448;
  --muted: #547792;
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-pill: 999px;
  --radius: 12px;
  --font: 'Rethink Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0D1A26;
  --surface: #213448;
  --surface-soft: #2A3F56;
  --surface2: #2A3F56;
  --hairline: #3A5A72;
  --border: #3A5A72;
  --ink-1: #EAE0CF;
  --ink-2: #C8D8E0;
  --ink-3: #94B4C1;
  --ink-4: #547792;
  --ink-5: #2D4560;
  --text: #EAE0CF;
  --muted: #94B4C1;
  color-scheme: dark;
}

/* ── MATERIAL SYMBOLS ── */
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-size: 1.1em; line-height: 1; vertical-align: -0.15em; user-select: none; font-style: normal; }
.medal-gold   { color: #c9a227; }
.medal-silver { color: #8a9bb0; }
.medal-bronze { color: #a0522d; }

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink-1); font-family: var(--font); min-height: 100vh; padding: 0 0 60px; -webkit-font-smoothing: antialiased; transition: background 0.25s, color 0.25s; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 3px; }

/* ── HEADER ── */
header { background: var(--bg); border-bottom: 1px solid var(--hairline); padding: 12px 40px; position: sticky; top: 0; z-index: 100; transition: background 0.2s; }
.header-inner { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.header-row1 { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.header-row2 { width: 100%; display: flex; justify-content: center; }
.logo-group { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.logo-lockup { height: 34px; width: auto; display: block; }
[data-theme="dark"] .logo-lockup { filter: brightness(0) invert(1); }
.nav-pill { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 4px 6px; display: flex; align-items: center; gap: 2px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.nav-link { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 600; color: var(--ink-3); text-decoration: none; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.nav-link:hover { background: var(--surface-soft); color: var(--ink-1); }
.nav-link.active { background: var(--page-color); color: #fff; }
.nav-icon { font-size: 16px; font-family: 'Material Symbols Outlined'; line-height: 1; vertical-align: -0.2em; user-select: none; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.theme-toggle { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 20px; padding: 5px 10px; cursor: pointer; font-size: 16px; transition: background 0.15s; }
.theme-toggle:hover { background: var(--surface-soft); }
.theme-toggle-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }

/* ── MAIN LAYOUT ── */
main { max-width: 1000px; margin: 0 auto; padding: 40px 40px 0; }

/* ── SECTION INTRO ── */
.section-intro { margin-bottom: 72px; }
.section-eyebrow { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; color: var(--page-color); margin-bottom: 10px; }
.section-title { font-size: 2.4rem; font-weight: 900; margin-bottom: 14px; color: var(--ink-1); letter-spacing: -0.5px; line-height: 1.1; }
.section-description { font-size: 1.05rem; color: var(--muted); line-height: 1.65; max-width: 700px; }

/* ── DIRECTORY GRID ── */
.directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 40px; }

/* ── CARDS ── */
.card { background: var(--surface-soft); border: 2px solid #213448; border-radius: var(--r-md); padding: 22px; box-shadow: 4px 4px 0 0 #213448; transition: border-color 0.2s, box-shadow 0.15s, transform 0.15s; display: flex; flex-direction: column; gap: 14px; }
.card:hover { border-color: var(--page-color); box-shadow: 2px 2px 0 0 var(--page-color); transform: translate(2px, 2px); }
[data-theme="dark"] .card { border-color: var(--hairline); box-shadow: 4px 4px 0 0 var(--hairline); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-name { font-size: 17px; font-weight: 800; color: var(--ink-1); }
.card-icon { font-size: 22px; line-height: 1; font-family: 'Material Symbols Outlined'; user-select: none; }
.card-meta { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.card-meta-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--ink-2); }
.card-meta-label { font-weight: 700; color: var(--ink-1); }
.card-desc { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-link { display: inline-flex; align-items: center; gap: 4px; color: var(--page-color); font-weight: 600; font-size: 14px; margin-top: auto; }
.card-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── TAGS ── */
.tag { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; border: 1px solid; line-height: 1.4; cursor: pointer; user-select: none; transition: opacity 0.15s; background: var(--chip-page-bg); color: var(--chip-page-fg); border-color: var(--chip-page-bd); }
.tag:hover { opacity: 0.8; }
.tag.tag-active { opacity: 1; box-shadow: 0 0 0 2px var(--page-color); }
.tag-pink, .tag-purple, .tag-green { background: var(--chip-page-bg); color: var(--chip-page-fg); border-color: var(--chip-page-bd); }
.tag.new { background: var(--chip-page-bg); color: var(--chip-page-fg); border-color: var(--chip-page-bd); }
.active-filter-bar { display: none; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.active-filter-bar.visible { display: flex; }
.active-filter-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--chip-page-bg); color: var(--chip-page-fg); border-radius: var(--r-pill); padding: 4px 12px; font-size: 13px; font-weight: 700; }
.active-filter-clear { background: none; border: none; cursor: pointer; color: var(--chip-page-fg); font-size: 14px; line-height: 1; padding: 0 0 0 2px; opacity: 0.7; }
.active-filter-clear:hover { opacity: 1; }
.active-filter-clear-all { background: none; border: 1px solid var(--chip-page-bd); border-radius: var(--r-pill); cursor: pointer; color: var(--chip-page-fg); font-size: 12px; font-weight: 700; padding: 3px 10px; opacity: 0.7; }
.active-filter-clear-all:hover { opacity: 1; }

/* ── TOOLBAR + SEARCH ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-4); pointer-events: none; }
.search-wrap input { width: 100%; background: var(--surface-soft); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 11px 14px 11px 42px; font-size: 14px; color: var(--ink-1); font-family: var(--font); transition: border-color 0.2s; }
.search-wrap input:focus { outline: none; border-color: var(--page-color); box-shadow: 0 0 0 3px rgba(84,119,146,0.15); background: var(--surface); }
.search-wrap input::placeholder { color: var(--ink-4); }
.sort-select { padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid var(--hairline); background: var(--surface); font-family: var(--font); font-size: 13px; color: var(--ink-2); cursor: pointer; flex-shrink: 0; }
.sort-select:focus { outline: none; border-color: var(--page-color); }

/* ── SUBMISSION SECTION ── */
.submission-section { background: var(--surface-soft); border: 2px solid #213448; padding: 32px; margin-bottom: 40px; border-radius: var(--r-md); box-shadow: 4px 4px 0 0 #213448; }
[data-theme="dark"] .submission-section { border-color: var(--hairline); box-shadow: 4px 4px 0 0 var(--hairline); }
.submission-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; color: var(--ink-1); }
.submission-text { color: var(--ink-3); line-height: 1.6; margin-bottom: 24px; font-size: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
label { font-size: 14px; font-weight: 700; color: var(--ink-1); }
input, textarea, select { background: var(--surface-soft); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 11px 14px; font-family: var(--font); color: var(--ink-1); font-size: 14px; transition: border-color 0.2s; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--page-color); box-shadow: 0 0 0 3px rgba(84,119,146,0.22); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-submit { background: var(--page-color); border: none; color: white; padding: 12px 24px; border-radius: var(--r-md); font-weight: 700; font-size: 14px; cursor: pointer; font-family: var(--font); display: inline-flex; align-items: center; gap: 8px; transition: filter 0.2s; }
.btn-submit:hover { filter: brightness(1.06); }
.btn-submit:active { filter: brightness(0.96); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--ink-3); border: 1px dashed var(--hairline); border-radius: var(--r-md); background: var(--surface); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; font-family: 'Material Symbols Outlined'; line-height: 1; user-select: none; }

/* ── LEADERBOARD ── */
.leaderboard-section { margin-bottom: 40px; }
.leaderboard-heading { font-size: 16px; font-weight: 700; color: var(--ink-1); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.leaderboard-heading span { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-soft); border: 1px solid var(--hairline); border-radius: var(--r-pill); padding: 2px 10px; }
.leaderboard-list { display: flex; flex-direction: column; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 14px; background: var(--surface-soft); border: 2px solid #213448; border-radius: var(--r-sm); padding: 14px 18px; transition: border-color 0.2s; box-shadow: 4px 4px 0 0 #213448; }
[data-theme="dark"] .lb-row { border-color: var(--hairline); box-shadow: 4px 4px 0 0 var(--hairline); }
.lb-row:hover { border-color: var(--page-color); }
.lb-medal { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; font-family: 'Material Symbols Outlined'; line-height: 1; }
.lb-rank { width: 28px; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-3); flex-shrink: 0; }
.lb-name { font-weight: 700; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-1); }
.lb-bar-wrap { flex: 2; background: var(--hairline); border-radius: 4px; height: 6px; overflow: hidden; }
.lb-bar { height: 100%; border-radius: 4px; background: var(--page-color); transition: width 0.4s ease; }
.lb-count { font-size: 14px; font-weight: 700; color: var(--page-color); white-space: nowrap; flex-shrink: 0; min-width: 60px; text-align: right; }
@media (max-width: 700px) { .lb-bar-wrap { display: none; } }

/* ── FOOTER ── */
footer { max-width: 1000px; margin: 40px auto 0; padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--hairline); }
.footer-right { color: var(--ink-4); text-align: right; }
.footer-right a { color: inherit; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  header { padding: 10px 16px; }
  .header-right > a { display: none !important; }
  .theme-toggle-label { display: none; }
  .header-row2 { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; justify-content: flex-start; }
  .header-row2::-webkit-scrollbar { display: none; }
  main { padding: 28px 20px 0; }
  footer { padding: 20px 20px; flex-direction: column; gap: 10px; text-align: center; align-items: center; }
  footer > a { margin: 10px 0 !important; }
  .section-title { font-size: 1.8rem; }
  .form-row { grid-template-columns: 1fr; }
  .directory { grid-template-columns: 1fr; }
}
