/* ==========================================================
   MOON HOME MEDIA - main stylesheet
   Brand palette lives in :root below.
   ========================================================== */

:root {
  /* Moon Home Media brand palette */
  --bg: #0B0D0F;          /* Deep Charcoal */
  --bg-soft: #14161a;
  --card: #1a1b1c;        /* between charcoal and Warm Graphite */
  --card-hover: #2A2A2A;  /* Warm Graphite */
  --line: rgba(201, 184, 147, 0.18);
  --stone: #6B6659;       /* borders/decoration only, not small text */
  --text: #E8D7B7;        /* Warm Ivory */
  --muted: #C9B893;       /* Muted Sand */
  --accent: #D4AF7C;      /* Champagne Gold */
  --accent-2: #E8D7B7;
  --font-heading: "Montserrat", "Avenir Next", Arial, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 14px;
  --max: 1120px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(212, 175, 124, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(var(--max), 92%); margin: 0 auto; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 13, 15, 0.82);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo .mark { width: 40px; height: 40px; flex: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1; font-family: var(--font-heading); text-transform: uppercase; }
.wordmark b { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.2em; color: var(--text); }
.wordmark i { font-style: normal; font-weight: 500; font-size: 0.6rem; letter-spacing: 0.62em; color: var(--accent); margin-top: 6px; }

.nav-links { display: flex; gap: 6px; list-style: none; }

.nav-links a {
  display: block;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: 0.2s;
}

.nav-links a:hover { color: var(--text); background: rgba(212, 175, 124, 0.1); }
.nav-links a.active { color: var(--bg); background: var(--accent); }

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: center;
  padding: 80px 0 90px;
  background:
    linear-gradient(90deg, rgba(11,13,15,.92) 0%, rgba(11,13,15,.55) 45%, rgba(11,13,15,0) 75%),
    linear-gradient(180deg, rgba(11,13,15,0) 70%, var(--bg) 100%),
    url("../images/brand/moon-dunes-hero.jpg") 70% center / cover no-repeat,
    var(--bg);
  border-bottom: 1px solid var(--line);
}

.hero .container { width: min(var(--max), 92%); }
.hero > .container > * { max-width: 560px; }

.eyebrow {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.hero h1 span { color: var(--accent); }

.hero p { color: var(--muted); margin: 0 0 30px; font-size: 1.05rem; }
.hero p.eyebrow { color: var(--accent); font-size: 0.72rem; margin-bottom: 18px; }

.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: 0.2s;
  border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); background: var(--accent-2); box-shadow: 0 8px 24px rgba(212, 175, 124, 0.3); }
.btn-ghost { border-color: var(--accent); color: var(--accent); margin-left: 8px; }
.btn-ghost:hover { background: rgba(212, 175, 124, 0.12); color: var(--text); }

/* ---------- Sections ---------- */
.section { padding: 50px 0; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 16px;
}

.section-head h2 { font-family: var(--font-heading); font-weight: 600; font-size: 1.25rem; letter-spacing: 0.12em; text-transform: uppercase; }
.section-head p { color: var(--muted); font-size: 0.95rem; }
.section-head a { color: var(--accent); font-size: 0.95rem; font-weight: 500; white-space: nowrap; }

/* ---------- Category tiles (home) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: 0.25s;
}

.tile:hover { background: var(--card-hover); transform: translateY(-4px); border-color: rgba(212, 175, 124, 0.55); }
.tile .icon { color: var(--accent); margin-bottom: 16px; }
.line-icon { width: 34px; height: 34px; display: block; }
.tile h3 { font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.tile p { color: var(--muted); font-size: 0.92rem; }

/* ---------- Page title ---------- */
.page-title { padding: 56px 0 10px; }
.page-title h1 { font-family: var(--font-heading); font-weight: 600; font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: 0.1em; text-transform: uppercase; }
.page-title h1::after { content: ""; display: block; width: 56px; height: 2px; background: var(--accent); margin-top: 14px; }
.page-title p { color: var(--muted); margin-top: 6px; }

/* ---------- Toolbar (search + chips) ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: 26px 0 8px;
}

.search {
  flex: 1 1 240px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  outline: none;
  transition: 0.2s;
}

.search:focus { border-color: var(--accent); }

.sort {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.sort:focus { border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
}

.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }

/* ---------- Media grid + cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
  padding: 20px 0 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: 0.25s;
  display: flex;
  flex-direction: column;
}

.grid .card { content-visibility: auto; contain-intrinsic-size: auto 380px; }

.card:hover { transform: translateY(-5px); background: var(--card-hover); border-color: rgba(212, 175, 124, 0.55); }

/* Cover: swap the gradient for a real image by adding
   <img src="images/yourfile.jpg" alt=""> inside .cover */
.cover {
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

.cover .ct {
  color: var(--text);
  font-family: var(--font-heading);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.cover .ct small { font-size: 0.78rem; font-weight: 500; color: var(--muted); }

.g1 { background: linear-gradient(160deg, #3a3326, #121110); }
.g2 { background: linear-gradient(160deg, #2e2f2a, #0e1011); }
.g3 { background: linear-gradient(160deg, #3d2f27, #131110); }
.g4 { background: linear-gradient(160deg, #2a2d2b, #0d0f10); }
.g5 { background: linear-gradient(160deg, #4a3d2a, #15130f); }
.g6 { background: linear-gradient(160deg, #343331, #101112); }

.card-body { padding: 14px 16px 18px; }
.card-body h3 { font-size: 1rem; line-height: 1.3; margin-bottom: 4px; }
.card-body .meta { color: var(--muted); font-size: 0.82rem; }

.tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 124, 0.14);
  color: var(--accent);
}

.empty { display: none; text-align: center; color: var(--muted); padding: 40px 0 80px; }

/* ---------- Calibre library banner (books page) ---------- */
.library-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 18px 22px;
  background: linear-gradient(90deg, rgba(212, 175, 124, 0.14), rgba(212, 175, 124, 0.03));
  border: 1px solid rgba(212, 175, 124, 0.4);
  border-radius: var(--radius);
  transition: 0.25s;
}

.library-banner:hover { transform: translateY(-2px); border-color: var(--accent); }
.library-banner .lb-icon { color: var(--accent); }
.library-banner .lb-text { flex: 1; display: flex; flex-direction: column; }
.library-banner small { color: var(--muted); font-size: 0.85rem; }
.library-banner .lb-arrow { color: var(--accent); font-size: 1.4rem; }

/* ---------- Fun page cards ---------- */
.fun-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 24px 0 70px;
}

.fun-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.fun-card h3 { font-family: var(--font-heading); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.fun-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 18px; }
.fun-card .output {
  font-size: 1.1rem;
  min-height: 56px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px dashed var(--line);
}

.fun-card button { cursor: pointer; font-family: inherit; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 30px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .menu-btn { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 14px 4%;
    background: rgba(11, 13, 15, 0.98);
    border-bottom: 1px solid var(--line);
  }

  .nav-links.open { display: flex; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .hero { min-height: 480px; padding: 60px 0 70px; background-position: 70% center, center, 78% center, center; }
  .wordmark b { font-size: 0.82rem; letter-spacing: 0.16em; }
  .btn-ghost { margin: 10px 0 0; }
}

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* MUSIC:START (added by add_music.py) */
.grid.albums { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.grid.albums .card { contain-intrinsic-size: auto 300px; }
.cover.sq { aspect-ratio: 1 / 1; }
.card-body .meta + .meta { margin-top: 2px; }
@media (max-width: 720px) { .grid.albums { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
/* MUSIC:END */
