/*
Theme Name:  mETaLpress
Theme URI:   https://mETaLmuSicRaDio.com
Description: Music-centric WordPress theme for mETaLmuSicRaDio. Full-viewport station card homepage, hamburger nav, sidebar/modal page navigation, deep mETaLpress plugin integration.
Version:     1.0.0
Author:      ApoCaLypSe / w3K LLC
License:     GPL-3.0+
Text Domain: mETaLpress-theme
Tags:        music, radio, dark, full-width, custom-menu, custom-footer
*/

/* ────────────────────────────────────────────────────────────────
   Design system — inherits from mETaLpress plugin CSS vars when
   plugin is active; also works standalone.
──────────────────────────────────────────────────────────────── */

/* Dark mode (default) */
:root {
  --mpt-bg:          #0a0a0a;
  --mpt-surface:     #111;
  --mpt-border:      #2a2a2a;
  --mpt-accent:      #cc3300;
  --mpt-accent2:     #ff4400;
  --mpt-text:        #ddd;
  --mpt-muted:       #777;
  --mpt-nav-bg:      rgba(10,10,10,0.97);
  --mpt-modal-bg:    #fff;
  --mpt-modal-text:  #222;
  --mpt-modal-border:#e8e8e8;
  --mpt-nav-width:   320px;
  --mpt-header-h:    54px;
  --mpt-z-header:    9000;
  --mpt-z-nav:       9500;
  --mpt-z-overlay:   9200;
  --mpt-z-sidebar:   9600;
  --mpt-z-pagemodal: 9700;
  --mpt-font:        'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mpt-radius:      6px;
}

/* Light mode vars */
:root[data-mpt-color-scheme="light"],
body.mpt-light {
  --mpt-bg:          #f4f4f4;
  --mpt-surface:     #fff;
  --mpt-border:      #ddd;
  --mpt-text:        #111;
  --mpt-muted:       #888;
  --mpt-nav-bg:      rgba(255,255,255,0.98);
  --mpt-modal-bg:    #fff;
  --mpt-modal-text:  #222;
  --mpt-modal-border:#e8e8e8;
}

/* System preference — dark */
@media (prefers-color-scheme: dark) {
  :root[data-mpt-color-scheme="system"] {
    --mpt-bg:       #0a0a0a;
    --mpt-surface:  #111;
    --mpt-border:   #2a2a2a;
    --mpt-text:     #ddd;
    --mpt-muted:    #777;
    --mpt-nav-bg:   rgba(10,10,10,0.97);
  }
}

/* System preference — light */
@media (prefers-color-scheme: light) {
  :root[data-mpt-color-scheme="system"] {
    --mpt-bg:       #f4f4f4;
    --mpt-surface:  #fff;
    --mpt-border:   #ddd;
    --mpt-text:     #111;
    --mpt-muted:    #888;
    --mpt-nav-bg:   rgba(255,255,255,0.98);
  }
}

/* ── Reset & base ─────────────────────────────────────────────── */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--mpt-bg);
  color: var(--mpt-text);
  font-family: var(--mpt-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden; /* no scroll on the root — canvas IS the viewport */
}

a { color: var(--mpt-accent); text-decoration: none; }
a:hover { color: var(--mpt-accent2); text-decoration: underline; }

/* WP admin bar offset */
body.admin-bar { --mpt-admin-bar: 32px; }
@media screen and (max-width: 782px) { body.admin-bar { --mpt-admin-bar: 46px; } }

/* ── Site layout ─────────────────────────────────────────────── */

#mpt-site {
  display: flex;
  flex-direction: column;
  height: 100vh;        /* exactly the viewport — no overflow */
  overflow: hidden;
}

/* ── Fixed header ─────────────────────────────────────────────── */

#mpt-header {
  position: fixed;
  top: var(--mpt-admin-bar, 0);
  left: 0;
  right: 0;
  height: var(--mpt-header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: var(--mpt-z-header);
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0));
  pointer-events: none;
}

#mpt-header > * { pointer-events: all; }

/* Site title / logo */
#mpt-logo {
  flex: 1;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mpt-text);
}
#mpt-logo a { color: inherit; text-decoration: none; }
#mpt-logo img { max-height: 36px; width: auto; vertical-align: middle; }
#mpt-logo .mpt-logo-text em {
  color: var(--mpt-accent);
  font-style: normal;
}

/* Hamburger button */
#mpt-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--mpt-text);
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}
#mpt-hamburger .bar {
  display: block;
  height: 2px;
  background: var(--mpt-text);
  border-radius: 2px;
  transition: width 0.2s, transform 0.2s, opacity 0.2s;
}
#mpt-hamburger .bar-1 { width: 24px; }
#mpt-hamburger .bar-2 { width: 24px; }
#mpt-hamburger .bar-3 { width: 24px; }
#mpt-hamburger:hover .bar { background: var(--mpt-accent); }

/* Hamburger → X animation when nav open */
body.mpt-nav-open #mpt-hamburger .bar-1 { transform: translateY(7px) rotate(45deg); width: 24px; }
body.mpt-nav-open #mpt-hamburger .bar-2 { opacity: 0; width: 0; }
body.mpt-nav-open #mpt-hamburger .bar-3 { transform: translateY(-7px) rotate(-45deg); width: 24px; }

/* ── Slide-out nav panel ──────────────────────────────────────── */

#mpt-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: var(--mpt-z-overlay);
  backdrop-filter: blur(2px);
}
body.mpt-nav-open #mpt-nav-overlay { display: block; }

#mpt-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--mpt-nav-width);
  max-width: 100vw;
  background: var(--mpt-nav-bg);
  border-left: 1px solid var(--mpt-border);
  z-index: var(--mpt-z-nav);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  padding: calc(var(--mpt-header-h) + 20px) 0 40px;
  display: flex;
  flex-direction: column;
}
body.mpt-nav-open #mpt-nav { transform: translateX(0); }

/* Nav menu list */
#mpt-nav .mpt-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
#mpt-nav .mpt-menu li {
  border-bottom: 1px solid var(--mpt-border);
}
#mpt-nav .mpt-menu > li:first-child { border-top: 1px solid var(--mpt-border); }
#mpt-nav .mpt-menu li a {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  color: var(--mpt-text);
  text-decoration: none;
  font-size: 0.92em;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s, background 0.15s;
  gap: 10px;
}
#mpt-nav .mpt-menu li a:hover,
#mpt-nav .mpt-menu li.current-menu-item > a {
  color: var(--mpt-accent);
  background: rgba(204,51,0,0.06);
}
#mpt-nav .mpt-menu li a .mpt-menu-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Nav sub-menu items (second level) */
#mpt-nav .mpt-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0 0 4px 36px;
  display: none;
}
#mpt-nav .mpt-menu li.open > .sub-menu { display: block; }
#mpt-nav .mpt-menu .sub-menu li a {
  font-size: 0.84em;
  padding: 9px 16px 9px 0;
  border-bottom: none;
  color: var(--mpt-muted);
}
#mpt-nav .mpt-menu .sub-menu li a:hover { color: var(--mpt-accent); background: none; }

/* Nav footer area (volume / social / version) */
#mpt-nav-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--mpt-border);
  font-size: 0.75em;
  color: var(--mpt-muted);
}
#mpt-nav-footer a { color: var(--mpt-muted); }
#mpt-nav-footer a:hover { color: var(--mpt-accent); }

/* ── Main content area ─────────────────────────────────────────── */

#mpt-main {
  flex: 1;
  display: flex;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  /* NO padding-top — header is fixed and layered ON TOP of this */
}

/* Station card centered on the "homepage" canvas */
.mpt-home-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative; /* stacking context for overlay + mascot */
}

/* Background image fills the canvas */
.mpt-home-canvas.has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Inner pages rendered as regular WP content — hidden by default
   until a page-modal or sidebar opens them */
#mpt-page-content {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 30px 24px 60px;
  display: none; /* only shown in sidebar/pagemodal */
}

/* ── Page Sidebar — built-in fallback (only rendered when w3K MOD is absent) ── */
/*
 * These rules are scoped to body:not(.w3k-sidebar-active) so they never
 * conflict with the w3K MOD when it's active. The w3K MOD adds
 * .w3k-sidebar-active to <body> via a body_class filter.
 *
 * Both implementations share --w3k-sb-* tokens (defined by the MOD, or by
 * the :root block below as fallback when the MOD is absent).
 */

/* Token fallbacks for when w3K MOD is NOT loaded */
body:not(.w3k-sidebar-active) {
  --w3k-sb-bg:     var(--mpt-surface, #111);
  --w3k-sb-text:   var(--mpt-text,    #ddd);
  --w3k-sb-border: var(--mpt-border,  #2a2a2a);
  --w3k-sb-accent: var(--mpt-accent,  #cc3300);
}

body:not(.w3k-sidebar-active) #mpt-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: var(--mpt-z-sidebar);
  transition: opacity 0.25s;
}
body:not(.w3k-sidebar-active).mpt-sidebar-open #mpt-sidebar-overlay { display: block; }

body:not(.w3k-sidebar-active) #mpt-sidebar-wrap {
  position: fixed;
  top: var(--mpt-admin-bar, 0);
  right: 0;
  bottom: 0;
  width: min(825px, 100vw);
  z-index: calc(var(--mpt-z-sidebar) + 1);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  display: flex;
}
body:not(.w3k-sidebar-active).mpt-sidebar-open #mpt-sidebar-wrap { transform: translateX(0); }

body:not(.w3k-sidebar-active) #mpt-sidebar-close {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--w3k-sb-bg);
  border: 1px solid var(--w3k-sb-border);
  color: var(--w3k-sb-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}
body:not(.w3k-sidebar-active).mpt-sidebar-open #mpt-sidebar-close {
  opacity: 1;
  pointer-events: all;
}
body:not(.w3k-sidebar-active) #mpt-sidebar-close:hover {
  background: var(--w3k-sb-accent);
  border-color: var(--w3k-sb-accent);
  color: #fff;
}

body:not(.w3k-sidebar-active) #mpt-sidebar {
  flex: 1;
  background: var(--w3k-sb-bg);
  border-left: 1px solid var(--w3k-sb-border);
  overflow-y: auto;
  padding: 28px 32px 60px;
  min-width: 0;
  color: var(--w3k-sb-text);
}
body:not(.w3k-sidebar-active) #mpt-sidebar .w3k-sb-title {
  font-size: 1.4em;
  font-weight: 700;
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--w3k-sb-border);
}

@media (max-width: 600px) {
  body:not(.w3k-sidebar-active) #mpt-sidebar { padding: 20px 18px 60px; }
  body:not(.w3k-sidebar-active) #mpt-sidebar-close { position: fixed; left: 10px; top: 10px; margin-top: 0; opacity: 1; pointer-events: all; }
}

/* ── Page Modal (full-screen light modal, mETaLcast style) ──────── */

#mpt-pagemodal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: var(--mpt-z-pagemodal);
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px 80px;
  overflow-y: auto;
}
#mpt-pagemodal.open { display: flex; }

#mpt-pagemodal-box {
  background: var(--mpt-modal-bg);
  color: var(--mpt-modal-text);
  border-radius: 10px;
  width: 100%;
  max-width: 760px;
  box-shadow: 0 16px 80px rgba(0,0,0,0.5);
  overflow: hidden;
  font-family: var(--mpt-font);
  min-height: 200px;
}

#mpt-pagemodal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--mpt-modal-border);
  position: sticky;
  top: 0;
  background: var(--mpt-modal-bg);
  z-index: 1;
}
#mpt-pagemodal-header h2 { margin: 0; font-size: 1.05em; font-weight: 600; color: var(--mpt-modal-text); }
#mpt-pagemodal-close {
  background: none;
  border: none;
  font-size: 1.5em;
  line-height: 1;
  cursor: pointer;
  color: var(--mpt-muted);
  padding: 0 4px;
}
#mpt-pagemodal-close:hover { color: var(--mpt-modal-text); }

#mpt-pagemodal-body {
  padding: 24px;
  font-size: 0.93em;
  line-height: 1.65;
  color: var(--mpt-modal-text);
}
#mpt-pagemodal-body h1,
#mpt-pagemodal-body h2,
#mpt-pagemodal-body h3 { color: var(--mpt-modal-text); margin-top: 0; }
#mpt-pagemodal-body p  { color: var(--mpt-modal-text); margin-top: 0; opacity: 0.85; }
#mpt-pagemodal-body a  { color: var(--mpt-accent); }
#mpt-pagemodal-body img { max-width: 100%; height: auto; border-radius: 4px; }
.mpt-page-loading { text-align: center; padding: 60px 0; color: #999; }
.mpt-page-spinner {
  display: inline-block;
  width: 28px; height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #cc3300;
  border-radius: 50%;
  animation: mpt-spin 0.7s linear infinite;
  margin-bottom: 12px;
}
@keyframes mpt-spin { to { transform: rotate(360deg); } }

/* ── Footer ────────────────────────────────────────────────────── */

#mpt-footer {
  background: var(--mpt-surface);
  border-top: 1px solid var(--mpt-border);
  padding: 28px 24px 100px; /* bottom pad for sticky player */
  font-size: 0.8em;
  color: var(--mpt-muted);
}
#mpt-footer .mpt-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
#mpt-footer .mpt-footer-col { flex: 1 1 200px; }
#mpt-footer .mpt-footer-heading {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mpt-muted);
  margin: 0 0 10px;
}
#mpt-footer .widget { margin: 0; }
#mpt-footer .widget a { color: var(--mpt-muted); }
#mpt-footer .widget a:hover { color: var(--mpt-accent); text-decoration: none; }
#mpt-footer .widget ul { list-style: none; margin: 0; padding: 0; }
#mpt-footer .widget ul li { padding: 3px 0; }

#mpt-footer-bar {
  border-top: 1px solid var(--mpt-border);
  margin-top: 20px;
  padding-top: 14px;
  text-align: center;
  font-size: 0.9em;
}
#mpt-footer-bar p { margin: 0; }

/* ── Generic inner-page style (used in sidebar + modal) ────────── */

.mpt-entry-content {
  font-size: 0.93em;
  line-height: 1.7;
}
.mpt-entry-content h1, .mpt-entry-content h2, .mpt-entry-content h3 { margin-top: 0; }
.mpt-entry-content img { max-width: 100%; border-radius: 4px; }
.mpt-entry-content ul, .mpt-entry-content ol { padding-left: 20px; }

/* ── 404 / No-homepage state ───────────────────────────────────── */

.mpt-404-wrap {
  text-align: center;
  padding: 60px 20px;
  color: var(--mpt-muted);
}
.mpt-404-wrap h1 { font-size: 3em; color: var(--mpt-accent); margin: 0 0 10px; }

/* ── Mascot / logo overlay on canvas ───────────────────────────── */

.mpt-mascot {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  max-width: 40%;
}
.mpt-mascot img {
  max-height: 70vh;
  width: auto;
  display: block;
  object-fit: contain;
}
.mpt-mascot--bottom-left  { bottom: 0;   left: 0;   }
.mpt-mascot--bottom-right { bottom: 0;   right: 0;  transform: scaleX(-1); }
.mpt-mascot--top-left     { top: 60px;   left: 0;   }
.mpt-mascot--top-right    { top: 60px;   right: 0;  transform: scaleX(-1); }

.mpt-station-card-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  padding: 0 16px;
}

/* canvas overlay layer */
.mpt-canvas-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.mpt-home-canvas {
  position: relative; /* establish stacking context for overlay + mascot */
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 520px) {
  :root { --mpt-nav-width: 100vw; }
  #mpt-sidebar-wrap { width: 100vw; }
}
