/* Wilderness Wiki — Dark Theme */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-infobox: #1a1f2b;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --red: #f85149;
  --green: #3fb950;
  --orange: #d29922;
  --purple: #bc8cff;
  --gold: #f0c040;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* Navigation */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
}
.navbar .logo span { color: var(--text-primary); }
.navbar nav { display: flex; gap: 1.5rem; }
.navbar nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.navbar nav a:hover,
.navbar nav a.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  text-decoration: none;
}
.discord-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #5865F2;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 0.375rem;
  transition: background 0.2s;
  white-space: nowrap;
}
.discord-btn:hover {
  background: #4752c4;
  color: #fff;
  text-decoration: none;
}
.discord-btn svg { width: 16px; height: 16px; fill: currentColor; }
.add-bot-btn { background: #23a559; margin-left: 0.4rem; }
.add-bot-btn:hover { background: #1a7a43; }

/* Main Content */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

/* Page Header */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* NPC Page Layout */
.npc-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) {
  .npc-layout { grid-template-columns: 1fr; }
  .infobox { order: -1; }
}

/* Infobox */
.infobox {
  background: var(--bg-infobox);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: sticky;
  top: 70px;
}
.infobox-image {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}
.infobox-image img {
  max-width: 220px;
  max-height: 220px;
}
.infobox-name {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.infobox-stats {
  padding: 0;
}
.infobox-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.infobox-row:last-child { border-bottom: none; }
.infobox-label { color: var(--text-secondary); }
.infobox-value { font-weight: 600; }
.infobox-value.danger { color: var(--red); }
.infobox-value.moderate { color: var(--orange); }
.infobox-value.safe { color: var(--green); }
.infobox-value.legendary { color: var(--purple); }

/* Content Sections */
.content h2 {
  font-size: 1.4rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.content h3 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}
.content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.content ul, .content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
.content li {
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
th {
  background: var(--bg-secondary);
  text-align: left;
  padding: 0.6rem 1rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
}
td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
tr:hover td { background: var(--bg-tertiary); }
.drop-unique { color: var(--gold); font-weight: 600; }
.drop-special { color: var(--red); font-weight: 600; }
.drop-pet { color: var(--purple); font-weight: 600; }

/* Ability Box */
.ability-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.ability-box .ability-name {
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 0.35rem;
}
.ability-box p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

/* NPC Grid */
.npc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.npc-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  text-decoration: none;
  display: block;
}
.npc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.npc-card-image {
  background: var(--bg-tertiary);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 160px;
  overflow: hidden;
}
.npc-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.75rem;
  box-sizing: border-box;
}
.npc-card-info {
  padding: 0.75rem 1rem;
}
.npc-card-info .name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.npc-card-info .meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}
.npc-card-name {
  padding: 0.75rem 1rem 0;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.npc-card-tier {
  padding: 0.2rem 1rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Command Sections */
.command-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.command-block h3 {
  margin-top: 0;
  color: var(--text-primary);
}
.command-block code {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--accent);
}
.command-block .aliases {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.command-block p {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Command Grid */
.cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.cmd-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.2s;
  display: block;
}
.cmd-card:hover { border-color: var(--accent); text-decoration: none; }
.cmd-card .title { font-weight: 600; color: var(--text-primary); font-size: 1rem; }
.cmd-card .desc { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.35rem; }

/* Home Page */
.hero {
  text-align: center;
  padding: 3rem 0;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero h1 span { color: var(--gold); }
.hero p { color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; margin: 0 auto 2rem; }
.hero-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-links a {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1.05rem;
  transition: all 0.2s;
  min-width: 175px;
  text-align: center;
  white-space: nowrap;
}
.hero-links a:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
  text-decoration: none;
}

/* Breadcrumb */
.breadcrumb {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 0.4rem; }

/* Tier Badges */
.tier { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.tier-1 { background: #1a3d1a; color: #3fb950; }
.tier-2 { background: #2d2a1a; color: #d29922; }
.tier-3 { background: #2d1a1a; color: #f85149; }
.tier-4 { background: #1a1a2d; color: #bc8cff; }
.tier-5 { background: #2d1a2d; color: #f778ba; }

code {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--accent);
}

/* Search */
.search-wrapper {
  position: relative;
}
.search-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 220px;
  outline: none;
  transition: border-color 0.2s, width 0.2s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent);
  width: 280px;
}
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}
.search-item {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover,
.search-item.active {
  background: var(--bg-tertiary);
  text-decoration: none;
}
.search-item-title { font-weight: 500; }
/* Search mobile overrides are in the responsive section at the bottom */

/* Collapsible Sections */
details.drop-section {
  margin-top: 2rem;
}
details.drop-section summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.drop-section summary::-webkit-details-marker {
  display: none;
}
details.drop-section summary::marker {
  display: none;
  content: '';
}
details.drop-section summary h2 {
  margin-top: 0;
  padding-left: 1.2rem;
  position: relative;
}
details.drop-section summary h2::before {
  content: '\25B8';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}
details.drop-section[open] summary h2::before {
  content: '\25BE';
}
details.drop-inner {
  margin-top: 1.25rem;
}
details.drop-inner summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.drop-inner summary::-webkit-details-marker {
  display: none;
}
details.drop-inner summary::marker {
  display: none;
  content: '';
}
details.drop-inner summary h3 {
  margin-top: 0;
  padding-left: 1rem;
  position: relative;
}
details.drop-inner summary h3::before {
  content: '\25B8';
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-size: 0.85em;
}
details.drop-inner[open] summary h3::before {
  content: '\25BE';
}

/* Infobox Stat Sections */
.infobox-header {
  background: var(--bg-secondary);
  padding: 0.4rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-pos { color: var(--green); }
.stat-neg { color: var(--red); }
.stat-zero { color: var(--text-muted); }

/* Grand Exchange */
.ge-search-container {
  margin-bottom: 1.5rem;
}
.ge-search-wrapper {
  position: relative;
  max-width: 500px;
}
.ge-search-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.ge-search-input::placeholder { color: var(--text-muted); }
.ge-search-input:focus { border-color: var(--accent); }
.ge-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}
.ge-suggestion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}
.ge-suggestion:last-child { border-bottom: none; }
.ge-suggestion:hover,
.ge-suggestion.active { background: var(--bg-tertiary); text-decoration: none; }
.ge-suggestion-price { color: var(--gold); font-size: 0.85rem; font-weight: 600; }

.ge-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.ge-filter-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.ge-filter-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.ge-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ge-summary {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.ge-table {
  width: 100%;
  border-collapse: collapse;
}
.ge-table thead th {
  position: sticky;
  top: 52px;
  z-index: 10;
  background: var(--bg-secondary);
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
}
.ge-th-price { text-align: right; }
.ge-row {
  cursor: pointer;
  transition: background 0.15s;
}
.ge-row:hover td { background: var(--bg-tertiary); }
.ge-cell-item {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
.ge-cell-item a { color: var(--text-primary); }
.ge-cell-item a:hover { color: var(--accent); }
.ge-row-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.ge-cell-price {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.ge-buy { color: var(--green); }
.ge-sell { color: var(--red); }

.ge-note {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.ge-note p { margin: 0; }
.ge-note code {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--accent);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Mobile Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  /* Navbar: wrap into rows */
  .navbar {
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
    gap: 0.5rem 1rem;
  }
  .navbar .logo { font-size: 1.1rem; }
  .navbar nav { gap: 1rem; }
  .navbar nav a { font-size: 0.85rem; }
  .discord-btn {
    margin-left: auto;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    order: 10;
  }
  .search-wrapper {
    margin-left: 0;
    flex: 1 1 100%;
    order: 11;
  }
  .search-input { width: 100% !important; }
  .search-input:focus { width: 100% !important; }
  .search-dropdown { width: 100%; right: 0; left: 0; }

  /* Container */
  .container { padding: 1rem; }

  /* Hero */
  .hero { padding: 1.5rem 0; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 0.95rem; margin-bottom: 1.25rem; }
  .hero-links { gap: 0.6rem; }
  .hero-links a { padding: 0.75rem 1.25rem; font-size: 0.9rem; }

  /* Page Header */
  .page-header h1 { font-size: 1.5rem; }

  /* Tables: horizontal scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 0.4rem 0.65rem; white-space: nowrap; }

  /* NPC Grid */
  .npc-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .npc-card-image { height: 120px; }
  .npc-card-info { padding: 0.5rem 0.75rem; }
  .npc-card-info .name { font-size: 0.85rem; }
  .npc-card-info .meta { font-size: 0.7rem; }

  /* Command Grid */
  .cmd-grid { grid-template-columns: 1fr; }

  /* Infobox */
  .infobox { position: static; }

  /* Content */
  .content h2 { font-size: 1.2rem; }

  /* Ability box */
  .ability-box { padding: 0.75rem 1rem; }

  /* GE */
  .ge-search-wrapper { max-width: 100%; }
  .ge-filters { gap: 0.35rem; }
  .ge-filter-btn { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  .ge-table thead th { font-size: 0.75rem; padding: 0.4rem 0.5rem; }
  .ge-cell-item { padding: 0.4rem 0.5rem; font-size: 0.85rem; }
  .ge-cell-price { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
  .ge-row-img { width: 22px; height: 22px; }
}

@media (max-width: 480px) {
  .navbar .logo { flex: 1 1 auto; }
  .navbar nav { flex: 1 1 100%; order: 5; }
  .discord-btn { order: 10; margin-left: auto; }

  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 0.85rem; }
  .hero-links { flex-direction: column; align-items: stretch; }
  .hero-links a { text-align: center; padding: 0.65rem 1rem; }

  .npc-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .npc-card-image { height: 100px; }
}
