/* ==========================================================================
   PokéLoop Wiki - Official Encyclopedia Theme
   ========================================================================== */

:root {
  /* PokéLoop's colors: the night-indigo of the game icon, its gold, and the menus' gold-rimmed panels. */
  --bg-dark: #100b19;
  --bg-main: #181124;
  --bg-surface: #1f172e;
  --bg-surface-elevated: #2a2040;
  --bg-header: #0d0915;
  --border-subtle: #352a4a;
  --border-strong: #4d3f66;
  --border-gold: #b18a42;
  --border-gold-dark: #6e4a14;
  --gold-primary: #ffcc3e;
  --gold-hover: #fff4a8;
  --text-main: #f1e6cc;
  --text-muted: #b6a9c9;
  --text-bright: #fff8e6;
  --link-color: #7cc4ff;
  --link-hover: #b8e0ff;
  --link-visited: #c6a8ff;
  --ui-red: #cc3333;
  --ui-green: #33aa33;
  --ui-blue: #3388cc;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

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

/* Header & Navigation Bar */
.wiki-header {
  background: linear-gradient(180deg, #1d1530 0%, #0d0915 100%);
  border-bottom: 2px solid var(--border-gold-dark);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.header-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--gold-primary);
  text-shadow: 0 0 10px rgba(255, 204, 62, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The PokéLoop logo (assets/logo.png) in place of a text title. */
.brand-logo img {
  height: 38px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.brand-logo:hover img {
  filter: drop-shadow(0 0 8px rgba(255, 204, 62, 0.55));
}

.brand-logo:hover {
  text-decoration: none;
  color: var(--gold-hover);
}

.wiki-badge {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  background: #3a2710;
  color: var(--gold-primary);
  border: 1px solid var(--border-gold-dark);
  padding: 2px 6px;
  border-radius: 3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  list-style: none;
}

.nav-links a {
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--gold-primary);
  text-decoration: none;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background-color: #140e1f;
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  padding: 7px 12px 7px 32px;
  border-radius: 4px;
  font-size: 13px;
  width: 240px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-gold);
  width: 300px;
  background-color: #1f172e;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Page Layout */
.page-wrapper {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 20px 60px 20px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  width: 100%;
}

/* Left Sidebar Navigation */
.wiki-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.sidebar-header {
  background: linear-gradient(180deg, #2d2142 0%, #1d1530 100%);
  border-bottom: 1px solid var(--border-gold-dark);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-content {
  padding: 8px 0;
  list-style: none;
}

.sidebar-content li a {
  display: block;
  padding: 6px 14px;
  font-size: 13.5px;
  color: var(--text-main);
}

.sidebar-content li a:hover {
  background-color: rgba(255, 204, 62, 0.08);
  color: var(--gold-primary);
  text-decoration: none;
}

/* Main Content Area */
.wiki-main {
  background-color: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 28px 32px;
  min-width: 0;
}

/* Headings */
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
  margin: 32px 0 16px 0;
  clear: both;
}

.subsection-heading {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 20px 0 10px 0;
}

/* Table of Contents (TOC) */
.toc {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 12px 18px;
  margin: 16px 0 24px 0;
  display: inline-block;
  min-width: 260px;
}

.toc-title {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--gold-primary);
}

.toc ol {
  padding-left: 20px;
  font-size: 13.5px;
}

.toc ol li {
  margin: 4px 0;
}

.toc ol li a {
  color: var(--link-color);
}

/* Signature Infobox */
.infobox {
  float: right;
  width: 320px;
  margin: 0 0 20px 24px;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-gold-dark);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.infobox-header {
  background: linear-gradient(180deg, #33244b 0%, #1d1530 100%);
  color: var(--gold-primary);
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-gold-dark);
  letter-spacing: 0.5px;
}

.infobox-image {
  text-align: center;
  padding: 16px;
  background-color: #140e1f;
  border-bottom: 1px solid var(--border-subtle);
}

.infobox-image img {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.infobox-subheading {
  background-color: #2a1f3c;
  color: var(--gold-primary);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.infobox th {
  text-align: left;
  padding: 6px 10px;
  font-weight: 600;
  color: var(--text-muted);
  width: 45%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(0, 0, 0, 0.15);
}

.infobox td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.infobox-examine {
  padding: 10px;
  background-color: #150f21;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
  font-style: italic;
  color: #d9cdb2;
}

/* Wikitables */
.wikitable {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 14px;
}

.wikitable th {
  background: linear-gradient(180deg, #2d2142 0%, #1d1530 100%);
  color: var(--gold-primary);
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  text-align: left;
  font-weight: 700;
}

.wikitable td {
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
}

.wikitable tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.wikitable tr:hover {
  background-color: rgba(255, 204, 62, 0.05);
}

/* Notice & Warning Boxes */
.messagebox {
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  background-color: var(--bg-surface);
  border-left: 4px solid var(--border-gold);
}

.messagebox-icon {
  font-size: 20px;
  line-height: 1;
}

.messagebox.info {
  border-left-color: var(--ui-blue);
  background: #16203a;
}

.messagebox.success {
  border-left-color: var(--ui-green);
  background: #142a24;
}

.messagebox.warning {
  border-left-color: var(--border-gold);
  background: #2c2114;
}

.messagebox.danger {
  border-left-color: var(--ui-red);
  background: #2c1424;
}

/* Navigation Box (Navbox / Footer) */
.navbox {
  margin-top: 48px;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-gold-dark);
  border-radius: 4px;
  width: 100%;
  clear: both;
}

.navbox-title {
  background: linear-gradient(180deg, #33244b 0%, #1d1530 100%);
  color: var(--gold-primary);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  padding: 8px;
  border-bottom: 1px solid var(--border-gold-dark);
}

.navbox-group {
  display: grid;
  grid-template-columns: 140px 1fr;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13.5px;
}

.navbox-group:last-child {
  border-bottom: none;
}

.navbox-header {
  background-color: #241a36;
  color: var(--gold-primary);
  font-weight: 600;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border-subtle);
}

.navbox-list {
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
}

.navbox-list span.dot {
  color: var(--border-strong);
  user-select: none;
}

/* Category Badges */
.category-box {
  margin-top: 32px;
  padding: 10px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 13px;
}

.category-box span.label {
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 8px;
}

/* Portal Grid (Main Page) */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.portal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.portal-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
}

.portal-card-header {
  background: linear-gradient(180deg, #2d2142 0%, #1d1530 100%);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-gold-dark);
  color: var(--gold-primary);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-card-body {
  padding: 14px;
  font-size: 13.5px;
}

.portal-card-body ul {
  list-style: none;
  margin-top: 8px;
}

.portal-card-body ul li {
  margin: 5px 0;
}

.portal-card-body ul li a {
  display: inline-block;
}

/* Code & Keys */
code {
  font-family: var(--font-mono);
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: #ffd86b;
}

/* Footer */
.wiki-footer {
  margin-top: auto;
  background-color: var(--bg-header);
  border-top: 1px solid var(--border-subtle);
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Responsive */
/* Header: menu labels never break mid-label; the bar tightens, then the menu gets its own scrollable row. */
.nav-links a {
  white-space: nowrap;
}

@media (max-width: 1320px) {
  .nav-links {
    gap: 12px;
  }
  .nav-links a {
    font-size: 13px;
  }
  .search-input {
    width: 180px;
  }
  .search-input:focus {
    width: 220px;
  }
}

@media (max-width: 1240px) {
  .header-container {
    height: auto;
    flex-wrap: wrap;
    padding-top: 8px;
    gap: 6px 16px;
  }
  .nav-links {
    order: 3;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 2px 0 8px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links a {
    display: block;
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    background-color: var(--bg-surface);
  }
  .nav-links a:hover {
    border-color: var(--border-gold);
  }
}

@media (max-width: 600px) {
  .header-container {
    padding-left: 12px;
    padding-right: 12px;
  }
  .brand-logo img {
    height: 30px;
  }
  .search-box {
    flex: 1;
    min-width: 0;
  }
  .search-input,
  .search-input:focus {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .page-wrapper {
    grid-template-columns: 1fr;
  }
  .wiki-sidebar {
    display: none;
  }
  .infobox {
    float: none;
    width: 100%;
    margin: 16px 0;
  }
}


/* AI-assistance note at the end of each article */
.ai-note {
  clear: both;
  margin-top: 28px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}
