/* ============================================
   SunnySev Minecraft Guide - Style Complet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Press+Start+2P&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-main: #FFF8F0;
  --bg-card: #FFE4E1;
  --bg-card-hover: #FFD6D1;
  --accent-pink: #F2A7B0;
  --accent-wood: #C4A882;
  --accent-green: #7EC87E;
  --accent-green-dark: #5B8731;
  --text-dark: #3E2723;
  --text-light: #6D4C41;
  --text-muted: #8D6E63;
  --difficulty-easy: #A8E6CF;
  --difficulty-medium: #FFD3B6;
  --difficulty-hard: #FF8B94;
  --shadow-soft: 0 2px 12px rgba(62, 39, 35, 0.08);
  --shadow-hover: 0 6px 24px rgba(62, 39, 35, 0.15);
  --shadow-card: 0 3px 15px rgba(62, 39, 35, 0.1);
  --border-pixel: 4px solid var(--accent-wood);
  --radius: 12px;
  --radius-sm: 8px;
  --font-pixel: 'Press Start 2P', monospace;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1200px;
  --nav-height: 70px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(196, 168, 130, 0.04) 31px,
      rgba(196, 168, 130, 0.04) 32px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 31px,
      rgba(196, 168, 130, 0.04) 31px,
      rgba(196, 168, 130, 0.04) 32px
    );
  pointer-events: none;
  z-index: -1;
}

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

a:hover {
  color: var(--accent-pink);
}

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

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-pixel);
  line-height: 1.4;
}

h1 {
  font-size: 1.3rem;
  color: var(--accent-green-dark);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 0.75rem;
  color: var(--accent-wood);
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 248, 240, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--accent-wood);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.nav-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-dark);
}

.nav-logo-icon {
  font-size: 1.8rem;
}

.nav-logo-text {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--accent-green-dark);
  line-height: 1.3;
}

.nav-logo-text span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 0.5rem 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-light);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--bg-card);
  color: var(--accent-green-dark);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dark);
  padding: 0.5rem;
}

.lang-toggle {
  background: var(--bg-card);
  border: 2px solid var(--accent-wood);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.lang-toggle:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* --- Mobile Nav --- */
@media (max-width: 768px) {
  .nav-hamburger {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(255, 248, 240, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 3px solid var(--accent-wood);
    padding: 1rem;
    gap: 0.25rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.75rem 1rem;
  }
}

/* --- Main Content --- */
.main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Hero Section (Homepage) --- */
.hero {
  text-align: center;
  padding: 2.5rem 1rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero-seed {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--accent-wood);
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s;
}

.hero-seed:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.hero-seed .copy-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-green-dark);
}

/* --- XP Progress Bar --- */
.xp-bar-container {
  max-width: 500px;
  margin: 1.5rem auto 0;
}

.xp-bar-label {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--text-light);
}

.xp-bar {
  height: 24px;
  background: #D7CCC8;
  border-radius: 4px;
  overflow: hidden;
  border: 3px solid var(--accent-wood);
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-green-dark) 100%);
  border-radius: 2px;
  transition: width 0.5s ease;
  position: relative;
}

.xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px 2px 0 0;
}

/* --- Category Cards (Homepage) --- */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.category-card {
  background: var(--bg-card);
  border: 3px solid var(--accent-wood);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  color: var(--text-dark);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-soft);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  background: var(--bg-card-hover);
  color: var(--text-dark);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.category-card h2 {
  color: var(--accent-green-dark);
  margin-bottom: 0.5rem;
}

.category-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.category-progress {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-wood);
}

/* --- Guide Cards Grid --- */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.guide-card {
  background: white;
  border: 3px solid var(--accent-wood);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text-dark);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
}

.guide-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  color: var(--text-dark);
}

.guide-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 3px solid var(--accent-wood);
}

.guide-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.guide-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.guide-card-episode {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  background: var(--accent-green-dark);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.badge-difficulty {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.badge-facile {
  background: var(--difficulty-easy);
  color: #2E7D32;
}

.badge-moyen {
  background: var(--difficulty-medium);
  color: #E65100;
}

.badge-avance {
  background: var(--difficulty-hard);
  color: #C62828;
}

.guide-card h3 {
  font-size: 0.7rem;
  color: var(--text-dark);
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.guide-card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.guide-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-card-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.guide-card-check {
  font-size: 1.2rem;
}

/* --- Guide Detail Page --- */
.guide-detail {
  max-width: 800px;
  margin: 0 auto;
}

.guide-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.guide-back:hover {
  color: var(--accent-green-dark);
}

.guide-header {
  margin-bottom: 2rem;
}

.guide-header h1 {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.guide-header-subtitle {
  font-size: 1.05rem;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 1rem;
}

.guide-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.guide-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Video embed */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--accent-wood);
  margin-bottom: 2rem;
  cursor: pointer;
  background: #000;
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 50px;
  background: rgba(255, 0, 0, 0.85);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.video-container:hover .video-play-btn {
  background: #FF0000;
  transform: translate(-50%, -50%) scale(1.1);
}

.video-play-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent white;
  margin-left: 3px;
}

.video-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Description */
.guide-description {
  font-size: 1.05rem;
  color: var(--text-dark);
  line-height: 1.7;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent-pink);
}

/* Sections */
.guide-section {
  margin-bottom: 2rem;
}

.guide-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-wood);
}

.guide-section-title .icon {
  font-size: 1.3rem;
}

/* Materials list */
.materials-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
  list-style: none;
}

.material-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 2px solid rgba(196, 168, 130, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.material-qty {
  font-weight: 800;
  color: var(--accent-green-dark);
  min-width: 40px;
  text-align: right;
}

.material-name {
  color: var(--text-dark);
}

/* Steps */
.steps-list {
  list-style: none;
  counter-reset: step-counter;
}

.step-item {
  counter-increment: step-counter;
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(196, 168, 130, 0.2);
  transition: all 0.2s;
}

.step-item:hover {
  border-color: var(--accent-green);
  box-shadow: var(--shadow-soft);
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--accent-green-dark);
  color: white;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.step-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dark);
  padding-top: 0.2rem;
}

/* Tips */
.tips-list {
  list-style: none;
}

.tip-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: #FFF9C4;
  border-radius: var(--radius-sm);
  border-left: 4px solid #FFB300;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.tip-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* Credits */
.guide-credits {
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-light);
  border: 2px solid rgba(196, 168, 130, 0.3);
}

.guide-credits strong {
  color: var(--text-dark);
}

/* Chapters / Sub-sections (for Ep10) */
.chapter-section {
  margin-bottom: 1.5rem;
  border: 3px solid var(--accent-wood);
  border-radius: var(--radius);
  overflow: hidden;
}

.chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--text-dark);
  user-select: none;
  transition: background 0.2s;
}

.chapter-header:hover {
  background: var(--bg-card-hover);
}

.chapter-header .timestamp {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-green-dark);
}

.chapter-toggle {
  font-size: 1.2rem;
  transition: transform 0.3s;
}

.chapter-section.open .chapter-toggle {
  transform: rotate(180deg);
}

.chapter-content {
  display: none;
  padding: 1rem;
}

.chapter-section.open .chapter-content {
  display: block;
}

/* Completion checkbox */
.guide-complete {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 3px solid var(--accent-wood);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 2rem;
}

.guide-complete:hover {
  background: var(--bg-card-hover);
}

.guide-complete.completed {
  background: var(--difficulty-easy);
  border-color: var(--accent-green);
}

.guide-complete-checkbox {
  width: 24px;
  height: 24px;
  border: 3px solid var(--accent-wood);
  border-radius: 4px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.guide-complete.completed .guide-complete-checkbox {
  background: var(--accent-green-dark);
  border-color: var(--accent-green-dark);
  color: white;
}

.guide-complete-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-dark);
}

/* Episode nav (prev/next) */
.guide-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(196, 168, 130, 0.3);
}

.guide-nav a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border: 2px solid var(--accent-wood);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
  transition: all 0.2s;
}

.guide-nav a:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  color: var(--text-dark);
}

/* --- Category page header --- */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--accent-wood);
}

.page-header h1 {
  margin-bottom: 0.3rem;
}

.page-header p {
  font-size: 1rem;
  color: var(--text-light);
}

/* --- Footer --- */
.footer {
  background: var(--text-dark);
  color: rgba(255, 255, 255, 0.8);
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  font-size: 0.85rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}

.footer-section h4 {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--accent-green);
  margin-bottom: 0.75rem;
}

.footer-section a {
  color: rgba(255, 255, 255, 0.7);
  display: block;
  margin-bottom: 0.3rem;
}

.footer-section a:hover {
  color: var(--accent-pink);
}

.footer-credit {
  width: 100%;
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
}

.footer-credit a {
  color: var(--accent-pink);
}

/* --- Utilities --- */
.container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: 3px solid var(--accent-wood);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-green-dark);
  color: white;
  border-color: var(--accent-green-dark);
}

.btn-primary:hover {
  background: var(--accent-green);
  color: white;
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  color: var(--text-dark);
}

/* --- Confetti Canvas --- */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  h1 { font-size: 1rem; }
  h2 { font-size: 0.8rem; }

  .hero { padding: 1.5rem 0.5rem; }
  .hero h1 { font-size: 1.1rem; }

  .categories {
    grid-template-columns: 1fr;
  }

  .guides-grid {
    grid-template-columns: 1fr;
  }

  .materials-list {
    grid-template-columns: 1fr;
  }

  .guide-nav {
    flex-direction: column;
  }

  .nav-logo-text {
    font-size: 0.55rem;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .categories {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 0.3s ease;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-dark);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 1000;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}
