:root {
  --green: #4a7c59;
  --green-dark: #3a6347;
  --green-light: #5e9b6f;
  --brown: #8B6F47;
  --brown-dark: #6e5638;
  --brown-light: #a8885b;
  --bg: #f7f4ef;
  --bg-card: #ffffff;
  --bg-sidebar: #2d2a24;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --text-light: #f0ebe4;
  --border: #d4cdc0;
  --shadow: rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
  --sidebar-width: 260px;
  --header-h: 60px;
  --ad-bg: #e8e3da;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-card: #252525;
    --bg-sidebar: #1e1e1e;
    --text: #e0ddd8;
    --text-muted: #9a948a;
    --text-light: #d4d0c8;
    --border: #3a3a3a;
    --shadow: rgba(0, 0, 0, 0.3);
    --ad-bg: #2a2a2a;
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--green);
  text-decoration: none;
  transition: color 0.2s;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; border-bottom: 2px solid var(--green); padding-bottom: 0.3em; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1em; }

ul, ol { margin: 0 0 1em 1.5em; }

li { margin-bottom: 0.3em; }

/* ─── HEADER ─── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1000;
  box-shadow: 0 2px 8px var(--shadow);
}

.site-header .logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}

.site-header .logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-light);
  overflow-y: auto;
  z-index: 900;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  padding: 1rem 0;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
}

.sidebar-heading {
  padding: 0.75rem 1.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brown-light);
  font-weight: 700;
}

.sidebar a {
  padding: 0.6rem 1.25rem;
  color: var(--text-light);
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--green-light);
  text-decoration: none;
}

.sidebar a.active {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--green);
  color: #fff;
  font-weight: 600;
}

/* ─── LAYOUT ─── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-h);
}

.main-content {
  flex: 1;
  padding: 1.5rem 1rem;
  max-width: 100%;
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

/* ─── GRID ─── */
.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-2 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(1, 1fr);
}

/* ─── CARDS ─── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  padding: 1.25rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px var(--shadow);
  transform: translateY(-2px);
}

.card-img {
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -1.25rem -1.25rem 1rem;
  width: calc(100% + 2.5rem);
  max-width: none;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-body {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ─── ARTICLES ─── */
.article {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.article-header {
  margin-bottom: 1.25rem;
}

.article-header h1 {
  margin-bottom: 0.25rem;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.article img {
  border-radius: var(--radius-sm);
  margin: 1.25rem 0;
}

.article blockquote {
  border-left: 4px solid var(--green);
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  background: rgba(74, 124, 89, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}

.article blockquote p:last-child {
  margin-bottom: 0;
}

.article code {
  background: rgba(74, 124, 89, 0.1);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas,
    monospace;
}

.article pre {
  background: var(--bg-sidebar);
  color: var(--text-light);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.article pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

.article th,
.article td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.article th {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.article tr:nth-child(even) {
  background: rgba(74, 124, 89, 0.04);
}

.article ul,
.article ol {
  margin-bottom: 1em;
}

.article .toc {
  background: rgba(74, 124, 89, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.article .toc-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--green-dark);
}

.article .toc ul {
  list-style: none;
  margin: 0;
}

.article .toc li {
  margin-bottom: 0.2rem;
}

.article .toc a {
  font-size: 0.9rem;
}

/* ─── ADS ─── */
.ad-spot {
  background: var(--ad-bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  min-height: 90px;
  padding: 1rem;
  margin: 1.25rem 0;
}

.ad-spot-inline {
  min-height: 60px;
  margin: 1rem 0;
}

.ad-spot-sidebar {
  min-height: 250px;
  margin: 1rem;
}

.ad-spot-banner {
  min-height: 120px;
  margin: 1.5rem 0;
}

.ad-spot-footer {
  min-height: 100px;
  margin-top: 2rem;
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

/* ─── BREADCRUMBS ─── */
.breadcrumbs {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--green);
}

.breadcrumbs .sep {
  color: var(--border);
}

/* ─── SEARCH ─── */
.search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 0 0.6rem;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  padding: 0.5rem;
  font-size: 0.85rem;
  width: 120px;
  font-family: var(--font);
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* ─── STATS / BADGES ─── */
.badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-green {
  background: var(--green);
  color: #fff;
}

.badge-brown {
  background: var(--brown);
  color: #fff;
}

.badge-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  font-size: 0.75rem;
  background: rgba(74, 124, 89, 0.1);
  color: var(--green-dark);
  margin-right: 0.3em;
  margin-bottom: 0.3em;
}

@media (prefers-color-scheme: dark) {
  .tag {
    background: rgba(74, 124, 89, 0.2);
    color: var(--green-light);
  }
}

/* ─── PAGINATION ─── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-card);
  transition: background 0.2s, border-color 0.2s;
}

.pagination a:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  text-decoration: none;
}

.pagination .current {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

/* ─── FOOTER ─── */
.site-footer {
  background: var(--bg-sidebar);
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
  margin-top: auto;
}

.site-footer a {
  color: var(--brown-light);
}

.site-footer a:hover {
  color: var(--green-light);
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

/* ─── SKELETON LOADING ─── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--ad-bg) 25%,
    var(--bg-card) 50%,
    var(--ad-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.6em;
  width: 100%;
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 0.8em;
}

.skeleton-img {
  width: 100%;
  height: 180px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── UTILITY ─── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── PAL LIST (guide-specific) ─── */
.pal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.pal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  padding: 0.75rem;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.pal-card:hover {
  box-shadow: 0 4px 16px var(--shadow);
  transform: translateY(-2px);
}

.pal-card img {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  object-fit: cover;
}

.pal-card .pal-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.pal-card .pal-type {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.type-icon {
  display: inline-block;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.type-neutral { background: #9e9e9e; color: #fff; }
.type-fire { background: #e57338; color: #fff; }
.type-water { background: #4285f4; color: #fff; }
.type-grass { background: #4caf50; color: #fff; }
.type-electric { background: #fbc02d; color: #333; }
.type-ice { background: #81d4fa; color: #333; }
.type-ground { background: #8d6e63; color: #fff; }
.type-dark { background: #5d4037; color: #fff; }
.type-dragon { background: #7e57c2; color: #fff; }

/* ─── RESPONSIVE ─── */

/* Mobile first — sidebar off-canvas, single column */

/* ≥ 640px */
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .pal-grid { grid-template-columns: repeat(3, 1fr); }
  .article { padding: 2rem; }
  .main-content { padding: 2rem 1.5rem; }
}

/* ≥ 768px (sidebar visible) */
@media (min-width: 768px) {
  .menu-toggle { display: none; }

  .sidebar {
    transform: translateX(0);
    position: fixed;
  }

  .main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
  }

  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .pal-grid { grid-template-columns: repeat(4, 1fr); }

  .search-box input {
    width: 180px;
  }

  .ad-spot-sidebar {
    display: flex;
  }
}

/* ≥ 1024px */
@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .pal-grid { grid-template-columns: repeat(5, 1fr); }
  .main-content { padding: 2.5rem; }
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.75rem; }
}

/* ≥ 1280px */
@media (min-width: 1280px) {
  .pal-grid { grid-template-columns: repeat(6, 1fr); }
  .container { padding: 0 2rem; }
}

/* ─── PRINT ─── */
@media print {
  .site-header,
  .sidebar,
  .menu-toggle,
  .ad-spot,
  .ad-spot-sidebar,
  .ad-spot-banner,
  .ad-spot-footer,
  .site-footer {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .article {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }
}
