/* ============================================================
   Tom's Horn Band — site.css
   Mobile-first. Adjust variables to tweak the whole scheme.
   ============================================================ */

/* --- Color & type variables -------------------------------- */
:root {
  --bg:          #1a1a1a;
  --bg-rail:     #111111;
  --bg-card:     #242424;
  --accent:      #c8a44a;   /* brass/gold — adjust if it reads too yellow */
  --accent-dim:  #8a6f2e;
  --text:        #e8e8e8;
  --text-muted:  #888888;
  --border:      #333333;
  --nav-height:  56px;
  --font-body:   'Georgia', serif;
  --font-ui:     'Helvetica Neue', Arial, sans-serif;
}

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

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }

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

/* --- Top rail ---------------------------------------------- */
.top-rail {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-rail);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  z-index: 1000;
}

.site-logo {
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}
.site-logo:hover { color: #fff; }

.main-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;      /* allow flex shrink below content size */
  overflow: hidden;  /* clip links before they push .nav-right off screen */
}

.main-nav a {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.4rem 0.65rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--text);
  background: var(--bg-card);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-user {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-auth {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.nav-auth:hover { color: var(--text); border-color: var(--text-muted); }

/* Player's Corner icon — always visible */
.nav-pc {
  font-size: 1.25rem;
  color: var(--accent);
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  transition: color 0.15s;
}
.nav-pc:hover { color: #fff; }

/* Hamburger — hidden on wide screens */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: auto;
}

/* --- Main canvas ------------------------------------------- */
.canvas {
  margin-top: var(--nav-height);
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem 1rem;
}

/* Full-bleed canvas (home page slideshow) */
.canvas.full-bleed {
  max-width: none;
  padding: 0;
  margin-top: var(--nav-height);
}

/* --- Slideshow --------------------------------------------- */
.slideshow {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
  background: #000;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
  transform: translateX(100%);
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Clickable slide link — must fill the slide */
.slide-link { display: block; width: 100%; height: 100%; }
.slide-link img { width: 100%; height: 100%; object-fit: contain; }

/* Caption overlay at bottom of slide */
.slide-caption {
  position: absolute;
  bottom: 3rem;   /* above the dots */
  left: 0; right: 0;
  text-align: center;
  padding: 0.45rem 3rem;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  z-index: 8;
  pointer-events: none;
}

.slide.active {
  opacity: 1;
  transform: translateX(0);
}

.slide.exit-left {
  opacity: 0;
  transform: translateX(-100%);
}

.slide-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  z-index: 10;
  border-radius: 3px;
  transition: background 0.2s;
  user-select: none;
}
.slide-arrow:hover { background: rgba(0,0,0,0.75); }
.slide-arrow.prev { left: 1rem; }
.slide-arrow.next { right: 1rem; }

.slide-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.slide-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background 0.2s;
}
.slide-dot.active { background: var(--accent); }

/* --- Content sections -------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-ui);
  color: var(--text);
  line-height: 1.2;
}
h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; margin-bottom: 0.75rem; color: var(--accent); }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

/* --- Footer ------------------------------------------------ */
.site-footer {
  background: var(--bg-rail);
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Forms ------------------------------------------------- */
.form-group { margin-bottom: 1.25rem; }
label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=date], textarea, select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 1rem;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 120px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #111;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: #dbb95a; color: #111; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-ghost:hover { background: var(--accent); color: #111; }

/* --- Utility ----------------------------------------------- */
.muted  { color: var(--text-muted); }
.accent { color: var(--accent); }
.mt1 { margin-top: 1rem; }
.mt2 { margin-top: 2rem; }

/* --- Notices / alerts -------------------------------------- */
.notice {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.notice p { margin: 0; }
.notice-ok    { background: #1e3a1e; border-left: 3px solid #4caf50; color: #a5d6a7; }
.notice-error { background: #3a1e1e; border-left: 3px solid #f44336; color: #ef9a9a; }

/* --- Auth box (login, register, etc.) ---------------------- */
.auth-box {
  max-width: 480px;
  margin: 2rem auto;
}
.auth-box h1 { margin-bottom: 1.5rem; }

/* --- Error overlay (modal) --------------------------------- */
.err-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}
.err-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid #f44336;
  border-radius: 6px;
  padding: 1.5rem 2rem;
  max-width: 420px;
  width: 90%;
}
.err-dialog p  { margin: 0 0 1rem; }

/* --- Cookie banner ----------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-rail);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 2000;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.cookie-banner p { margin: 0; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

/* --- News posts -------------------------------------------- */
.post-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}
.post-date { font-size: 0.85rem; margin-bottom: 0.5rem; }
.post-body  { white-space: pre-wrap; }

/* --- Gig calendar ------------------------------------------ */
.gig-list { display: flex; flex-direction: column; gap: 1.5rem; }
.gig-item {
  display: flex;
  gap: 1.5rem;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
}
.gig-img img { width: 200px; height: 140px; object-fit: cover; }
.gig-info    { padding: 1rem; }
.gig-date    { font-family: var(--font-ui); margin-bottom: 0.25rem; }
.gig-venue   { margin-bottom: 0.5rem; font-family: var(--font-ui); }

/* --- Inquiry form ------------------------------------------ */
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.inquiry-form { max-width: 700px; }

/* --- Gallery ----------------------------------------------- */
.gallery-table {
  width: 100%;
  border-collapse: collapse;
}
.gallery-td-thumb {
  width: 180px;
  padding: 0 1.25rem 1rem 0;
  vertical-align: top;
}
.gallery-thumb-img {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gallery-thumb-img:hover { opacity: 0.75; }
.gallery-td-caption {
  vertical-align: top;
  padding-bottom: 1rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}
.gallery-td-caption p { margin: 0 0 0.4rem; }

/* --- Lightbox ---------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  flex-direction: column;
  z-index: 2000;
}
.lightbox.hidden { display: none; }

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.6);
  flex-shrink: 0;
}
.lightbox-hint {
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  font-family: var(--font-ui);
}
.lightbox-hint kbd {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 0 0.3em;
  font-family: inherit;
}
.lightbox-close {
  background: var(--accent);
  color: #111;
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: opacity 0.15s;
}
.lightbox-close:hover { opacity: 0.85; }

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  overflow: hidden;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: default;
  border-radius: 3px;
}
.lightbox-caption {
  padding: 0.6rem 1.5rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  background: rgba(0,0,0,0.6);
  flex-shrink: 0;
}

/* --- Links page -------------------------------------------- */
.link-list { display: flex; flex-direction: column; gap: 0.75rem; max-width: 500px; }
.link-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.link-card:hover { border-color: var(--accent); color: var(--text); }
.link-card strong { color: var(--text); }

/* --- EPK --------------------------------------------------- */
.epk-section { margin-bottom: 2.5rem; }

/* --- Player's Corner (3-panel layout) ---------------------- */

/* Strip the canvas padding/width for PC pages.
   Height + flex column live on .pc-wrapper below, not on the canvas —
   this avoids conflicts with the canvas's own flex:1 behaviour.          */
body.pc-page .canvas {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

/* Self-contained full-height wrapper — always works regardless of canvas */
.pc-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

/* Gold title bar — scrolls with page on mobile, not fixed */
.pc-titlebar {
  background: var(--accent);
  color: #111;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  flex-shrink: 0;
  user-select: none;
}

/* Outer panels container (flex row on desktop) */
.pc-panels {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* pc-bottom wraps Panel 1 + nav handle + Panel 2; stays flex-row on BOTH desktop and mobile */
.pc-bottom {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* Inner wrapper for Panel 2 alone */
.pc-main-panels {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

/* ---- Panel 1: Navigation ---- */
.pc-nav {
  width: 160px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--bg-rail);
  border-right: 1px solid var(--border);
  padding: 0.5rem 0 1rem;
}

.pc-nav-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  padding: 0.65rem 0.75rem 0.25rem;
}

.pc-nav a {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.28rem 0.75rem;
  line-height: 1.35;
  transition: color 0.12s, background 0.12s;
  border-left: 2px solid transparent;
}
.pc-nav a:hover {
  color: var(--text);
  background: var(--bg-card);
}
.pc-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-card);
}

/* ---- Panel 2: Content ---- */
.pc-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 0.85rem 1.1rem;
}

.pc-view-title {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

/* Action block (player or ZIP button) above the list */
.pc-action {
  margin-bottom: 0.75rem;
}
.pc-action audio {
  width: 100%;
  display: block;
}

/* Compact numbered tune list — same look for ALL views */
.pc-tune-list {
  list-style: decimal;
  padding-left: 1.65rem;
  margin: 0;
}

/* Items with direct text content (mp3 jukebox) */
.pc-tune-list li.juke {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.28rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1.35;
  transition: color 0.1s, background 0.1s;
}
.pc-tune-list li.juke:hover,
.pc-tune-list li.juke.playing {
  color: var(--text);
  background: var(--bg-card);
}

/* Items with anchor links (all other views) */
.pc-tune-list li a {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.28rem 0.5rem;
  border-radius: 3px;
  color: var(--text-muted);
  line-height: 1.35;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
}
.pc-tune-list li a:hover {
  color: var(--text);
  background: var(--bg-card);
}

/* ---- Resize handle (between Panel 2 and Panel 3) ---- */
.pc-resize-handle {
  width: 5px;
  flex-shrink: 0;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.15s;
}
.pc-resize-handle:hover,
.pc-resize-handle.dragging {
  background: var(--accent-dim);
}

/* ---- Panel 3: Info document (resizable) ---- */
/* Default: Panel 3 = 60% of the P2+P3 space (≈ viewport minus 165px of nav+handle).
   Algebra: 60% × (100vw - 165px) = 60vw - 99px.
   JS overrides this with a saved pixel value when the user has dragged the handle. */
.pc-info {
  width: calc(60vw - 99px);
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--bg-card);
  font-size: 0.85rem;
}

/* Mobile toggle bar — hidden on desktop */
.pc-info-toggle { display: none; }

/* Info body styles (dark panel context) */
.pc-info-body {
  padding: 1rem 1.1rem;
}
.pc-info-body h2 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.65rem;
  margin-top: 0;
}
.pc-info-body h3 {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
.pc-info-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.6rem;
}
.pc-info-body a { color: var(--accent); }
.pc-info-body strong { color: var(--text); }

/* File list (used in tune.py) */
.file-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.file-list a {
  display: block;
  font-family: var(--font-ui);
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.15s;
}
.file-list a:hover { border-color: var(--accent); }

/* --- Mobile breakpoint ------------------------------------- */
@media (max-width: 680px) {
  .nav-toggle { display: block; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg-rail);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 0;
    gap: 0;
  }
  .main-nav.open { display: flex; }
  .main-nav a {
    padding: 0.75rem 1.25rem;
    border-radius: 0;
    font-size: 1rem;
  }

  /* Keep Player's Corner icon rightmost; hamburger's margin-left:auto already pushes it right */
  .nav-user  { display: none; }
  .nav-auth  { display: none; }

  h1 { font-size: 1.5rem; }

  /* --- Player's Corner mobile layout ---
     Panel 3 on top (full width, collapsible)
     Panel 1 + Panel 2 side by side below                */
  .pc-wrapper {
    height: auto;
    overflow: visible;
  }
  .pc-panels {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }
  /* Stick Panel 3 on top */
  .pc-info {
    width: 100%;
    order: -1;
    border-left: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  /* Mobile toggle bar */
  .pc-info-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--text-muted);
    user-select: none;
  }
  .pc-toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s;
  }
  /* Collapsed state: hide the body */
  .pc-info-body { display: none; }
  .pc-info.expanded .pc-info-body { display: block; }
  .pc-info.expanded .pc-toggle-icon { transform: rotate(180deg); }

  /* Hide only the RIGHT resize handle (between Panel 2 and Panel 3).
     The LEFT handle (#pc-nav-handle, between Panel 1 and Panel 2) stays visible
     because .pc-bottom remains flex-row on mobile — Panel 1 and Panel 2 sit side by side. */
  #pc-resize-handle { display: none; }

  /* pc-bottom is already flex-row from the desktop style; no override needed.
     Just reset flex-grow so it doesn't try to stretch in the flex-column .pc-panels. */
  .pc-bottom {
    flex: none;
    border-top: 1px solid var(--border);
  }
  .pc-nav {
    width: 120px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
  }
  .pc-nav a { font-size: 0.72rem; padding: 0.28rem 0.5rem; }
  .pc-nav-label { font-size: 0.62rem; padding: 0.5rem 0.5rem 0.2rem; }
  .pc-content {
    flex: 1;
    padding: 0.65rem 0.75rem;
    overflow-y: auto;
  }
}
