/* ==========================================================================
   PvZH Vault — Top 10 Decks Guide
   Design system: night-lawn base · sun-gold accent · plant/zombie factions
   ========================================================================== */
:root {
  /* Core surface palette (night lawn) */
  --bg-color: #0e1413;
  --bg-deep: #0a0f0e;
  --card-bg: #1b2420;
  --card-bg-2: #161e1b;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);

  /* Text */
  --text-primary: #f2f5ef;
  --text-secondary: #9fb0a3;

  /* Accent: PvZ sun currency */
  --sun: #ffc83d;
  --sun-soft: rgba(255, 200, 61, 0.14);
  --sun-glow: rgba(255, 200, 61, 0.35);

  /* Factions */
  --plant: #7be04f;
  --plant-soft: rgba(123, 224, 79, 0.14);
  --zombie: #b388ff;
  --zombie-soft: rgba(179, 136, 255, 0.14);

  /* Grades */
  --grade-a: #7be04f;
  --grade-b: #ffc83d;

  /* Type */
  --font-display: 'Titan One', 'Arial Black', system-ui, sans-serif;
  --font-sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --transition: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  --max-width: 1100px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body.guide-page {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text-primary); text-decoration: none; transition: color var(--transition); }

h1, h2, h3 { line-height: 1.15; letter-spacing: 0.01em; }
h1, h2 { font-family: var(--font-display); font-weight: 400; }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--sun); color: #1a1407; }

/* ==========================================================================
   Reading progress bar
   ========================================================================== */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: transparent;
  z-index: 1000;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--plant), var(--sun));
  box-shadow: 0 0 12px var(--sun-glow);
}

/* ==========================================================================
   Hero — the mowed night lawn
   ========================================================================== */
.guide-hero {
  position: relative;
  padding: 90px 20px 70px;
  background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-color) 100%);
  border-bottom: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
}

/* Signature: alternating mowed-lawn stripes */
.lawn-stripes {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    100deg,
    rgba(123, 224, 79, 0.045) 0px,
    rgba(123, 224, 79, 0.045) 90px,
    rgba(123, 224, 79, 0.012) 90px,
    rgba(123, 224, 79, 0.012) 180px
  );
  pointer-events: none;
}

/* Rising sun glow */
.sun-glow {
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 420px;
  background: radial-gradient(ellipse at center, var(--sun-glow) 0%, transparent 65%);
  opacity: 0.55;
  pointer-events: none;
  animation: sunPulse 7s ease-in-out infinite alternate;
}
@keyframes sunPulse {
  from { opacity: 0.4; transform: translateX(-50%) scale(1); }
  to   { opacity: 0.65; transform: translateX(-50%) scale(1.06); }
}

.guide-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.breadcrumbs {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
}
.breadcrumbs a { color: var(--text-secondary); font-weight: 600; }
.breadcrumbs a:hover { color: var(--sun); }
.breadcrumbs span[aria-current] { color: var(--text-primary); font-weight: 700; }
.breadcrumbs span[aria-hidden] { opacity: 0.4; }

.hero-pill-row { display: flex; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; justify-content: center; }

.hero-pill {
  padding: 7px 16px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-radius: 100px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.hero-pill-accent {
  background: var(--sun-soft);
  color: var(--sun);
  border-color: rgba(255, 200, 61, 0.35);
  box-shadow: 0 0 24px rgba(255, 200, 61, 0.12);
}

.guide-hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4rem);
  margin-bottom: 22px;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.5);
}
.title-plants {
  color: var(--plant);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 26px rgba(123, 224, 79, 0.45);
}
.title-zombies {
  color: var(--zombie);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 26px rgba(179, 136, 255, 0.45);
}

.hero-subtitle {
  font-size: 1.12rem;
  color: var(--text-secondary);
  max-width: 660px;
  margin: 0 auto 18px;
}

.hero-byline {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 38px;
}
.hero-byline strong { color: var(--text-primary); }

.hero-stats {
  display: flex;
  gap: 36px;
  padding: 22px 44px;
  background: rgba(27, 36, 32, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.hero-stat strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--sun);
}
.hero-stat span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ==========================================================================
   Layout & sidebar
   ========================================================================== */
.guide-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px 20px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: start;
}

.guide-sidebar {
  position: sticky;
  top: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}

.toc-card {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.toc-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--sun);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.toc-nav { display: flex; flex-direction: column; gap: 10px; }

.toc-nav a {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding-left: 12px;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}
.toc-nav a:hover { color: var(--sun); border-left-color: var(--sun); transform: translateX(4px); }
.toc-nav a.is-current { color: var(--sun); border-left-color: var(--sun); font-weight: 800; }

.deck-jump a { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.jump-rank {
  font-family: var(--font-display);
  font-size: 0.75rem;
  min-width: 28px;
  color: var(--text-secondary);
}
.deck-jump a.jump-plants:hover { color: var(--plant); border-left-color: var(--plant); }
.deck-jump a.jump-zombies:hover { color: var(--zombie); border-left-color: var(--zombie); }

/* ==========================================================================
   Article content
   ========================================================================== */
.guide-article { display: flex; flex-direction: column; gap: 56px; min-width: 0; }

.content-card { scroll-margin-top: 40px; }

.content-card h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.content-card h2::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 72px; height: 3px;
  background: linear-gradient(90deg, var(--plant), var(--sun));
  border-radius: 2px;
}

.content-card p { color: var(--text-secondary); margin-bottom: 20px; font-size: 1.05rem; }
.content-card p a { color: var(--sun); font-weight: 700; border-bottom: 1px dotted rgba(255,200,61,0.5); }
.content-card p a:hover { color: #fff; border-bottom-color: #fff; }
.content-card p strong { color: var(--text-primary); }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Methodology grid
   ========================================================================== */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.method-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: var(--radius-md);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.method-box:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 200, 61, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}
.method-icon { font-size: 1.4rem; display: block; margin-bottom: 10px; }
.method-box h3 { color: var(--text-primary); font-size: 1.05rem; margin-bottom: 8px; font-weight: 800; }
.method-box p { font-size: 0.9rem; margin: 0; }

/* ==========================================================================
   Deck toolbar — filters & search
   ========================================================================== */
.section-header { margin-bottom: 24px; }
.section-note { font-size: 0.92rem !important; color: var(--sun) !important; margin-top: -14px !important; }

.deck-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
  padding: 14px 16px;
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: sticky;
  top: 8px;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 100px;
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.chip:hover { color: var(--text-primary); border-color: rgba(255, 255, 255, 0.25); }
.chip.is-active { background: var(--sun); color: #1a1407; border-color: var(--sun); box-shadow: 0 4px 14px var(--sun-glow); }
.chip-plants.is-active { background: var(--plant); border-color: var(--plant); color: #0c2003; box-shadow: 0 4px 14px rgba(123, 224, 79, 0.35); }
.chip-zombies.is-active { background: var(--zombie); border-color: var(--zombie); color: #1d0f3a; box-shadow: 0 4px 14px rgba(179, 136, 255, 0.35); }

.search-wrap { flex: 1; min-width: 220px; max-width: 320px; }
#deckSearch {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  padding: 9px 14px;
  border-radius: 100px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}
#deckSearch::placeholder { color: var(--text-secondary); opacity: 0.7; }
#deckSearch:focus { outline: none; border-color: var(--sun); box-shadow: 0 0 0 3px var(--sun-soft); }

.filter-empty {
  color: var(--text-secondary);
  font-style: italic;
  padding: 24px;
  text-align: center;
  background: var(--card-bg-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

/* ==========================================================================
   Deck cards
   ========================================================================== */
.deck-list { list-style: none; display: flex; flex-direction: column; gap: 26px; }

.deck-card {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}
.deck-card.is-hidden { display: none; }

.deck-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

/* Faction encoding — the stripe tells you the side at a glance */
.deck-card.faction-plants { border-left-color: var(--plant); }
.deck-card.faction-zombies { border-left-color: var(--zombie); }
.deck-card.faction-plants:hover { border-color: rgba(123, 224, 79, 0.35); border-left-color: var(--plant); }
.deck-card.faction-zombies:hover { border-color: rgba(179, 136, 255, 0.35); border-left-color: var(--zombie); }

.deck-topline { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* Rank badge styled as a sun token */
.rank-badge {
  font-family: var(--font-display);
  background: var(--text-primary);
  color: #14110a;
  font-size: 1.1rem;
  padding: 5px 13px;
  border-radius: 100px;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.08);
}
.deck-list > .deck-card:first-child .rank-badge {
  background: radial-gradient(circle at 35% 30%, #ffe18a, var(--sun) 70%);
  box-shadow: 0 0 22px var(--sun-glow), 0 4px 14px rgba(0, 0, 0, 0.4);
}

.faction-tag {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 11px;
  border-radius: 100px;
}
.faction-tag-plants { background: var(--plant-soft); color: var(--plant); border: 1px solid rgba(123, 224, 79, 0.3); }
.faction-tag-zombies { background: var(--zombie-soft); color: var(--zombie); border: 1px solid rgba(179, 136, 255, 0.3); }

.deck-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.deck-label-best { color: var(--sun); text-shadow: 0 0 14px var(--sun-glow); }

.deck-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  margin-bottom: 14px;
}

.deck-stat-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }

.stat-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.score-badge { font-weight: 800; }
.score-badge.grade-a { background: rgba(123, 224, 79, 0.16); color: var(--grade-a); border-color: rgba(123, 224, 79, 0.4); }
.score-badge.grade-b { background: rgba(255, 200, 61, 0.14); color: var(--grade-b); border-color: rgba(255, 200, 61, 0.4); }
.card-count:empty { display: none; }

/* Deck card image grid */
.deck-image-container {
  margin: 4px 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.visual-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.visual-card-item { position: relative; width: 100%; aspect-ratio: 3 / 4; }

.card-image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  transition: transform var(--transition), z-index 0s;
  cursor: zoom-in;
}
.card-image-wrapper:hover,
.card-image-wrapper:focus-visible {
  transform: scale(1.9);
  z-index: 20;
}
.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.card-quantity {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.88);
  color: var(--sun);
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.72rem;
  line-height: 1;
  border: 1px solid rgba(255, 200, 61, 0.35);
}

.deck-summary { font-size: 1.04rem; margin-bottom: 20px !important; }

/* Actions row */
.deck-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.copy-btn {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 100px;
  background: var(--sun-soft);
  color: var(--sun);
  border: 1px solid rgba(255, 200, 61, 0.4);
  cursor: pointer;
  transition: all var(--transition);
}
.copy-btn:hover { background: var(--sun); color: #1a1407; box-shadow: 0 4px 16px var(--sun-glow); }
.copy-btn.copied { background: var(--plant); border-color: var(--plant); color: #0c2003; }

.deck-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 1rem;
}
.deck-link:hover { color: var(--sun); }

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq-grid { display: flex; flex-direction: column; gap: 14px; }

.faq-item {
  background: var(--card-bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition);
}
.faq-item:hover { border-color: rgba(255, 200, 61, 0.3); }
.faq-item[open] { border-color: rgba(255, 200, 61, 0.4); }

.faq-item summary {
  padding: 18px 56px 18px 22px;
  font-weight: 800;
  font-size: 1.04rem;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--sun);
  transition: transform 0.3s ease;
}
.faq-item[open] summary::after { content: "−"; }

.faq-item p { padding: 0 22px 20px; margin: 0; font-size: 0.96rem; color: var(--text-secondary); }
.faq-item p a { color: var(--sun); font-weight: 700; }

/* ==========================================================================
   Back to top — a little sun
   ========================================================================== */
.back-to-top {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe18a, var(--sun) 70%);
  color: #6b4d00;
  font-size: 1.4rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 22px var(--sun-glow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 900;
}
.back-to-top.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px) scale(1.06); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .guide-layout { grid-template-columns: 1fr; gap: 32px; }
  .guide-sidebar { position: relative; top: 0; max-height: none; flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .toc-card { flex: 1; min-width: 250px; }
  .jump-card { display: none; }
  .hero-stats { flex-wrap: wrap; justify-content: center; gap: 20px 32px; padding: 20px 24px; }
  .deck-card { padding: 22px; }
  .deck-toolbar { position: static; }
}

@media (max-width: 600px) {
  .guide-hero { padding: 64px 16px 44px; }
  .hero-pill-row { flex-direction: column; align-items: center; }
  .visual-deck-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
  .card-image-wrapper:hover, .card-image-wrapper:focus-visible { transform: scale(1.5); }
  .deck-actions { flex-direction: column; align-items: flex-start; gap: 12px; }
  .back-to-top { width: 46px; height: 46px; bottom: 18px; right: 18px; }
}

/* --- Deck Card Hero Layout Upgrades --- */
.deck-main-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.deck-hero-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  max-height: 200px;
  overflow: hidden;
}

.deck-hero-avatar {
  width: auto;
  height: 100%;
  max-height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.deck-card:hover .deck-hero-avatar {
  transform: scale(1.05) translateY(-4px);
}

.deck-details-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* --- Desktop Layout Enhancements (Viewports above 768px) --- */
@media (min-width: 768px) {
  .deck-main-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .deck-hero-wrapper {
    width: 160px;
    height: 220px;
    max-height: none;
    position: sticky;
    top: 1rem;
    flex-shrink: 0;
  }

  .deck-hero-avatar {
    max-height: 200px;
    width: 100%;
  }
}