/* ============================================================
   LUPRUNE — WolvesFortress  |  style.css
   ============================================================
   Table of contents:
   1. CSS Custom Properties (tokens)
   2. Reset / Global
   3. Parallax background helper (fixes mobile fixed-bg bug)
   4. Header & Navigation
   5. Nav: collapsed/hamburger (details/summary)
   6. Hero section
   7. Features grid
   8. Buttons
   9. Decorative corners
   10. Light-mode overrides (prefers-color-scheme)
   ============================================================ */


/* ============================================================
   1. CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Colors — dark mode base */
  --bg-page:          #0a0820;
  --bg-header:        rgba(15, 10, 40, 0.72);
  --bg-features:      rgba(18, 15, 50, 0.72);
  --bg-card:          rgba(25, 18, 65, 0.55);

  --text-primary:     #e6e2ff;
  --text-muted:       #b8b0e0;
  --text-gold:        #fff3c0;

  --accent-purple:    rgba(120, 90, 255, 0.35);
  --accent-glow:      #4a3cff;
  --border-card:      rgba(140, 110, 255, 0.35);

  /* Layout */
  --header-height:    64px;
  --nav-gap:          clamp(12px, 2vw, 26px);
  --section-pad-x:    clamp(16px, 4vw, 48px);

  /* Typography */
  --font-display:     "Cinzel", serif;
  --font-body:        "Crimson Pro", Georgia, serif;
}

/* Light-mode token overrides — actual rules stay identical */
@media (prefers-color-scheme: light) {
  :root {
    --bg-page:        #f5f0e8;
    --bg-header:      rgba(245, 238, 220, 0.82);
    --bg-features:    rgba(235, 225, 200, 0.82);
    --bg-card:        rgba(255, 250, 235, 0.70);

    --text-primary:   #2a1f0a;
    --text-muted:     #5a4a2a;
    --text-gold:      #6b4800;

    --accent-purple:  rgba(140, 100, 40, 0.30);
    --accent-glow:    #8b5e00;
    --border-card:    rgba(160, 120, 60, 0.40);
  }
}


/* ============================================================
   2. RESET / GLOBAL
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-page);
  font-family: var(--font-body);
  color: var(--text-primary);
  line-height: 1.6;
  /* No background-image here — handled per-section via ::before */
}

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

a {
  color: inherit;
  text-decoration: none;
}


/* ============================================================
   3. FIXED BACKGROUND IMAGES
   ============================================================
   Using real <img> tags instead of background-attachment:fixed.
   On mobile (iOS Safari / Chrome), background-attachment:fixed
   clips when the element is inside flex/grid or has a transformed
   ancestor. A fixed-position <img> with object-fit:cover sidesteps
   all of that cleanly. Source: codegenes.net/blog/...
   ============================================================ */
.bg-img {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.bg-night  { z-index: 1; }
.bg-castle { z-index: 2; object-position: center 25%; }

/* Everything else sits above the backgrounds */
header, main, section, .decor { position: relative; z-index: 3; }


/* ============================================================
   4. HEADER & NAVIGATION
   ============================================================
   [logo] [nav: 1fr] [cta]
   Header has a max-width so nav links don't stretch to absurdity
   on ultrawide — padded symmetrically inside.
   ============================================================ */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-height);
  box-sizing: border-box;

  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  /* On ultrawide, grow padding so content stays within ~1400px */
  padding: 0 max(var(--section-pad-x), calc((100vw - 1400px) / 2 + var(--section-pad-x)));

  background: var(--bg-header);
  border-bottom: 1px solid var(--accent-purple);
}

.logo-link {
  flex-shrink: 0;
}

.logo {
  width: clamp(7rem, 2rem + 8vw, 11rem);
  height: auto;
}

/* Nav — fills the 1fr middle, centers and spaces links */
.nav-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 28px);
}

.nav-full a {
  font-family: var(--font-body);
  font-size: clamp(0.78rem, 0.6rem + 0.5vw, 0.95rem);
  color: var(--text-muted);
  white-space: nowrap;
  position: relative;
  padding-bottom: 3px;
  transition: color 0.2s;
}

.nav-full a:hover { color: var(--text-primary); }

.nav-full a.active {
  color: var(--text-gold);
  font-weight: 600;
}

.nav-full a.active::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 2px;
  background: radial-gradient(var(--text-gold), #d8a93c);
  border-radius: 40% 50%;
}

/* ============================================================
   5. NAV: COLLAPSED / HAMBURGER (details + summary, zero JS)
   ============================================================ */
.nav-collapsed {
  display: none;
  /* sits in the same 1fr middle cell as nav-full */
  text-align: center;
}

.nav-collapsed summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-gold);
  font-weight: 600;
  padding: 6px 28px 9px 10px; /* right padding reserves space for the arrow */
  border: 1px solid var(--border-card);
  border-radius: 6px;
  user-select: none;
  position: relative;
}

.nav-collapsed summary::-webkit-details-marker { display: none; }

.nav-collapsed summary::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 10px;
  right: 10px; /* matches the horizontal padding */
  height: 2px;
  background: radial-gradient(var(--text-gold), #d8a93c);
  border-radius: 40% 50%;
}

.nav-arrow {
  position: absolute;
  right: 10px;
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.nav-collapsed[open] .nav-arrow {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: fixed;
  top: var(--header-height);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 2 * var(--section-pad-x));
  max-width: 360px;
  max-height: calc(100dvh - var(--header-height) - 16px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  background: rgba(10, 8, 32, 0.82);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

.nav-dropdown a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 8px 4px;
  border-bottom: 1px solid rgba(140, 110, 255, 0.12);
  position: relative;
  transition: color 0.15s;
  text-align: center;
}

.nav-dropdown a:last-child { border-bottom: none; }
.nav-dropdown a:hover { color: var(--text-primary); }

.nav-dropdown a.active {
  color: var(--text-gold);
  font-weight: 600;
}

.nav-dropdown a.active::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 2px;
  /* background: linear-gradient(90deg, var(--text-gold), #d8a93c);
  border-radius: 2px; */
  background: radial-gradient(var(--text-gold), #d8a93c);
  border-radius: 40% 50%;
}

/* Breakpoint: swap nav-full for nav-collapsed in the 1fr middle slot */
@media (max-width: 700px) {
  .nav-full      { display: none; }
  .nav-collapsed { display: block; }
}


/* ============================================================
   6. HERO SECTION
   ============================================================ */
.hero {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-evenly;
  text-align: center;
  gap: 20px;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 60px;
  padding-bottom: 60px;
  min-height: 60svh;
}


.hero-content {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.hero h2 {
  font-family: var(--font-display);
  font-size: clamp(0.6rem, 1rem + 3vw, 1.2rem);
  line-height: 0.6rem;
  color: var(--text-primary);
}

.hero-title-accent {
  color: var(--text-gold);
  text-shadow: 0 0 20px var(--accent-glow), 0 2px 16px rgba(0,0,0,0.6);
  font-size: 2.5rem;
  line-height: 1.15rem;
}

.hero hr {
  content: "";
  width: 80%;
  height: 3px;
  background: radial-gradient(var(--text-gold), #d8a93c);
  border-radius: 40% 50%;
  z-index: -1;
  align-self: center;
  margin-top: 10px;
}

/* Spacer pushes the content left so the castle illustration breathes */
.hero-spacer {
  flex: 1;
  max-width: 50%;
}

@media (max-width: 600px) {
  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .hero-content { align-items: center; }
  .hero-spacer  { display: none; }
}


/* ============================================================
   7. FEATURES GRID
   ============================================================
   Uses minmax(min(260px, 100%), 1fr) — the min() prevents
   horizontal overflow on viewports narrower than 260px.
   ============================================================ */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 20px;
  padding: 32px var(--section-pad-x);

  position: relative;
  overflow: hidden;
  background: var(--bg-features);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 20px 32px;
  border: 1px solid var(--border-card);
  border-radius: 12px;
  background: var(--bg-card);
  text-align: center;
}

.feature-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.8rem + 1vw, 1.25rem);
  color: var(--text-primary);
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.8rem + 1vw, 1.2rem);
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Individual card backgrounds */
#explore {
  background-image: url("bg_exploration.jpg");
  background-size: cover;
  background-position: center;
}

#elements {
  background-image: url("bg_elements.jpg");
  background-size: cover;
  background-position: center;
}

#updates {
  border-image: url("bg_updates.jpg") 4 4 4 4 fill / 4px 4px 4px 4px;
  text-align: left;
}

#updates .update-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Indent past the thumbnail area if bg_updates has one on the left */
  padding-left: clamp(0px, 18vw, 130px);
}


/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  border-image: url("button_red.webp") 160 700 fill / 80px 350px;
  cursor: pointer;
  transition: filter 0.2s;
  margin-top: 1rem;
}

.btn:hover { filter: brightness(1.15); }

.small-btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(0.6rem, 0.4rem + 1.2vw, 0.82rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: clamp(60px, 25vw, 200px);
  color: #fff;
  padding: 6px 12px;
  border-radius: 5px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  border-image: url("button_green.webp") 80 350 fill / 10px 40px;
  cursor: pointer;
  transition: filter 0.2s;
}

.small-btn:hover { filter: brightness(1.15); }


/* ============================================================
   9. DECORATIVE CORNERS
   ============================================================ */
.decor {
  position: fixed;
  width: clamp(80px, 10vw, 140px);
  height: clamp(80px, 10vw, 140px);
  background: url("leaf_corner.webp") no-repeat center / contain;
  opacity: 0.85;
  pointer-events: none;
  z-index: 50;
}

.decor-top-left     { top: 0; left: 0; }
.decor-top-right    { top: 0; right: 0;  transform: scaleX(-1); }
.decor-bottom-left  { bottom: 0; left: 0;  transform: scaleY(-1); }
.decor-bottom-right { bottom: 0; right: 0; transform: scale(-1, -1); }

/* Hide on very small screens so they don't crowd content */
@media (max-width: 480px) {
  .decor { display: none; }
}