@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Barlow:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #ECE3CE;
  --card: #F4ECD6;
  --ink: #1c1714;
  --red: #B11217;
  --red-bright: #d01b21;
  --gold: #E8A33D;
  --muted: #5a5140;
  --line: #d9cca8;
  --code-bg: #1c1714;
}

* { box-sizing: border-box; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.6;
}

/* =====================
   Sticky Navigation
   ===================== */
.sticky-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--ink);
  border-bottom: 4px solid var(--red);
  padding: 0 24px;
  min-height: 60px;
}

.sticky-nav .nav-brand {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ECE3CE;
  text-decoration: none;
  padding: 14px 0;
}
.sticky-nav .nav-brand:hover { color: var(--gold); }

.nav-links {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #cabf9f;
  padding: 7px 11px;
  text-decoration: none;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--gold); }
.nav-links a.active {
  color: var(--ink);
  background: var(--gold);
  font-weight: 600;
}

/* =====================
   Home Hero (index)
   ===================== */
header.hero {
  position: relative;
  overflow: hidden;
  padding: 44px 40px 50px;
  background: radial-gradient(125% 150% at 72% 16%, var(--red-bright) 0%, var(--red) 46%, #8a0d11 100%);
  border-bottom: 4px solid var(--ink);
}
.hero-inner { position: relative; z-index: 2; max-width: 480px; }
.hero-badge {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.72rem;
  color: var(--ink);
  background: var(--gold);
  padding: 4px 12px;
  margin-bottom: 14px;
}
.hero-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 0.92;
  color: #F4ECD6;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.25);
}
.hero-sub {
  font-size: 1.08rem;
  color: #f3e6d6;
  max-width: 400px;
  margin: 16px 0 0;
}
.hero-cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.btn {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
  padding: 12px 24px;
  text-decoration: none;
  display: inline-block;
}
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #f0b257; }
.btn-ghost { color: #F4ECD6; border: 2px solid #F4ECD6; }
.btn-ghost:hover { background: rgba(244, 236, 214, 0.12); }

.hero-dice {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* =====================
   Page Hero (inner pages)
   ===================== */
header.page-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 40px 28px;
  background: radial-gradient(125% 160% at 82% 12%, var(--red-bright) 0%, var(--red) 50%, #8a0d11 100%);
  border-bottom: 4px solid var(--ink);
}
.page-hero-inner { position: relative; z-index: 2; }
.page-hero .crumb {
  font-family: 'Oswald', sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.page-hero .crumb a { color: #F4ECD6; text-decoration: none; }
.page-hero .crumb a:hover { color: var(--gold); }
.page-hero .crumb .sep { opacity: 0.55; color: #f1c69a; }
.page-hero .crumb .crumb-current { color: var(--gold); }
.page-hero h1 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  color: #F4ECD6;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.22);
}
.page-die { position: absolute; top: 18px; right: 38px; z-index: 1; }

/* legacy banner / in-main breadcrumb (replaced by heroes) */
header img.banner { display: none; }
main > .breadcrumb { display: none; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 24px 50px;
}

/* =====================
   Sections (help-index)
   ===================== */
section {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(28, 23, 20, 0.15);
  padding: 24px 26px;
  margin-bottom: 22px;
}
section h2 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
  margin: 0 0 12px;
}

/* =====================
   Collapsible Cards
   ===================== */
details {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(28, 23, 20, 0.15);
  margin-bottom: 22px;
  overflow: hidden;
}
details summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  cursor: pointer;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
  list-style: none;
  background: #efe3c6;
  border-bottom: 2px solid transparent;
}
details[open] summary { border-bottom-color: var(--ink); }
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: '';
  width: 10px;
  height: 22px;
  background: var(--red);
  flex-shrink: 0;
}
details summary::after {
  content: '+';
  margin-left: auto;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--red);
  line-height: 1;
}
details[open] summary::after { content: '\2212'; }
.details-content { padding: 18px 22px 22px; }

h3 {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--red);
  margin: 18px 0 8px;
}
p { margin: 0 0 12px; }
ul, ol { padding-left: 1.2rem; margin: 0 0 12px; }
li { margin-bottom: 0.5rem; }

a { color: var(--red); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

/* =====================
   Code
   ===================== */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: #e7dcc0;
  color: var(--red);
  padding: 2px 6px;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 12px;
  position: relative;
}
pre code {
  background: none;
  color: var(--gold);
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.7;
  display: block;
}

/* alias note */
.alias-note {
  background: rgba(177, 18, 23, 0.08);
  border-left: 4px solid var(--red);
  padding: 9px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 0.95rem;
  color: #5a3034;
  margin-top: 14px;
}
.alias-note code { background: transparent; color: var(--red); }

/* abbreviation tables */
.abbrev-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.abbrev-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--muted);
}
.abbrev-table tr:last-child td { border-bottom: none; }

/* search */
.search-box { margin: 14px 0 18px; }
.search-box input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: 'Barlow', sans-serif;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
}
.search-box input:focus { outline: none; border-color: var(--red); }
.search-box input::placeholder { color: #9a8f73; }

#command-list { list-style: none; padding: 0; }
#command-list li {
  padding: 11px 14px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

/* =====================
   Footer
   ===================== */
.footer, footer.footer {
  text-align: center;
  font-size: 0.85rem;
  color: #9a8f73;
  padding: 20px 16px;
  background: var(--ink);
}
.visit-counter { margin-bottom: 0.4rem; color: #9a8f73; }
.visit-counter #visit-count { color: var(--gold); font-weight: 700; }

/* =====================
   Copy buttons (script.js)
   ===================== */
.code-wrapper { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; }
.copy-btn {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #34291f;
  color: #e7dcc0;
  border: none;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.65rem;
}
.copy-btn:hover { background: #46382a; }
.copy-btn.copied { background: #2e7d32; color: #fff; }
pre.has-copy-btn .copy-btn { position: absolute; top: 8px; right: 8px; }

/* =====================
   Back to Top
   ===================== */
#back-to-top {
  position: fixed;
  bottom: 1.6rem;
  right: 1.6rem;
  width: 48px;
  height: 48px;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  z-index: 999;
}
#back-to-top:hover { background: #f0b257; }

/* =====================
   Mobile Menu
   ===================== */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span { display: block; width: 24px; height: 3px; background: var(--gold); transition: transform 0.2s, opacity 0.2s; }
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-links { display: none; width: 100%; flex-direction: column; padding-bottom: 10px; }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; }
  header.hero { padding: 34px 24px 40px; }
  .hero-title { font-size: 2.6rem; }
  header.page-hero { padding: 22px 24px 24px; }
  .page-hero h1 { font-size: 1.8rem; }
  .hero-dice, .page-die { display: none; }
}
