/*
 * mmoscripts.com - Millennial Media Offensive transcript search
 *
 * Purpose: dark minimalist styling matching mmo.show / namillennial.com
 * Colours: charcoal #28262C bg, cream #F5F0E5 text, muted #abb8c3,
 *          raised panel #45424A, <mark> = cream-on-charcoal
 * Type:    DM Sans, square corners, 2-3px cream borders
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #28262C;
  --panel: #45424A;
  --text: #F5F0E5;
  --muted: #abb8c3;
  --hi: #FFFFFF;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1.25rem;
}

a { color: var(--text); }
a:hover { color: var(--hi); }

/* ---- layout ---------------------------------------------------------- */
.container {
  max-width: 664px;
  margin: 0 auto;
  padding: 20px;
  transition: max-width 0.3s ease;
}
.container.has-results { max-width: 820px; }

/* ---- top nav ------------------------------------------------------------ */
.topnav {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  gap: 22px;
  padding: 14px 20px 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover, .topnav a.active { color: var(--text); }

/* ---- header / logo -------------------------------------------------- */
.header {
  text-align: center;
  margin: 30px auto;
  max-width: 1200px;
  transition: all 0.3s ease;
}
.header.compact { margin: 20px auto; }
.logo-link { display: block; margin-bottom: 20px; }
.banner-logo {
  max-width: 200px; max-height: 200px;
  width: auto; height: auto;
  display: block; margin: 0 auto;
  transition: opacity 0.2s ease;
}
.banner-logo:hover { opacity: 0.8; }
.header.compact .banner-logo { max-width: 100px; max-height: 100px; }
.logo {
  font-size: 2rem; font-weight: 700; color: var(--text);
  margin-bottom: 8px; line-height: 1.2;
  transition: font-size 0.3s ease;
}
.header.compact .logo { font-size: 1.25rem; }
.subtitle {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  line-height: 1.2; transition: font-size 0.3s ease;
}
.header.compact .subtitle { font-size: 1rem; }
.tagline { font-size: 1.05rem; color: var(--muted); font-weight: 400; }
.header.compact .tagline { opacity: 0; height: 0; overflow: hidden; }

@media (max-width: 768px) {
  .logo { font-size: 1.75rem; }
  .subtitle { font-size: 1.25rem; }
}

/* ---- search box --------------------------------------------------------- */
.search-wrapper { text-align: center; margin-bottom: 22px; }
.search-box {
  display: flex; align-items: center;
  max-width: 620px; margin: 0 auto;
  border: 2px solid var(--text); border-radius: 0;
  padding: 5px 15px; background: transparent;
  transition: border-color 0.2s ease;
}
.search-box:hover, .search-box:focus-within { border-color: var(--hi); }
.search-input {
  flex: 1; border: none; outline: none;
  font-size: 1.125rem; padding: 12px 10px;
  background: transparent; color: var(--text);
  font-family: inherit;
}
.search-input::placeholder { color: var(--muted); }
.search-button, .load-more-button, .btn {
  background-color: var(--text); color: var(--bg);
  border: 3px solid var(--text); border-radius: 0;
  padding: 0.55em 1.3em; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; line-height: 2; font-family: inherit;
  text-decoration: none; display: inline-block;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.search-button:hover, .load-more-button:hover, .btn:hover {
  background-color: var(--hi); border-color: var(--hi); color: var(--bg);
}
.search-button:active, .load-more-button:active { background-color: var(--muted); border-color: var(--muted); }

/* ---- controls row (sort + filters) ----------------------------------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center; justify-content: flex-end;
  margin-bottom: 18px; padding: 10px 0;
}
.controls .field { display: flex; align-items: center; gap: 8px; }
.controls label { font-size: 0.95rem; color: var(--muted); }
.controls select {
  background-color: var(--panel); color: var(--text);
  border: 2px solid var(--text); border-radius: 0;
  padding: 7px 11px; font-size: 0.95rem; font-family: inherit; cursor: pointer;
}
.controls select:hover, .controls select:focus { border-color: var(--hi); outline: none; }

/* ---- results ------------------------------------------------------------ */
.loading { text-align: center; color: var(--muted); font-size: 1rem; margin: 20px 0; }
.results-count { font-size: 1rem; color: var(--muted); margin-bottom: 16px; }
.result-item {
  margin-bottom: 26px; padding-bottom: 18px;
  border-bottom: 1px solid var(--panel);
}
.result-item:last-child { border-bottom: none; }
.result-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.result-source { font-size: 1rem; color: var(--text); }
.result-timestamp { font-size: 0.875rem; color: var(--muted); }
.result-play {
  font-size: 0.875rem; color: var(--muted);
  text-decoration: none; border-bottom: 1px dotted var(--muted);
}
.result-play:hover { color: var(--text); border-bottom-color: var(--text); }
.result-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.result-title a { color: var(--text); text-decoration: underline; cursor: pointer; }
.result-title a:hover { text-decoration: none; color: var(--hi); }
.result-snippet { font-size: 1rem; color: var(--muted); line-height: 1.7; margin-top: 4px; }

mark { background-color: var(--text); color: var(--bg); font-weight: 700; padding: 0 2px; }

.result-expanded {
  margin-top: 12px; padding: 16px;
  background-color: var(--panel); border-radius: 0;
  font-size: 1rem; color: var(--text); line-height: 1.8; display: none;
}
.result-expanded.visible { display: block; }
.result-expanded .ctx-line { display: block; }
.result-expanded .ctx-cur { color: var(--text); font-weight: 700; }
.result-expanded .ctx-line:not(.ctx-cur) { color: var(--muted); }

.no-results { text-align: center; color: var(--muted); font-size: 1.125rem; margin-top: 40px; }
.load-more-button { display: block; margin: 30px auto; }

/* ---- episodes browse grid -------------------------------------------- */
.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.ep-card {
  border: 2px solid var(--panel);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; color: var(--text);
  transition: border-color 0.2s ease;
}
.ep-card:hover { border-color: var(--text); }
.ep-card.no-transcript { opacity: 0.5; pointer-events: none; }
.ep-card .ep-num { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.08em; }
.ep-card .ep-name { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.ep-card .ep-sub { font-size: 0.85rem; color: var(--muted); margin-top: auto; }

/* ---- episode reader ------------------------------------------------------ */
.reader-head { margin: 10px 0 20px; }
.reader-head h1 { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.reader-head .meta { color: var(--muted); font-size: 0.95rem; margin-top: 6px; }
.reader-desc { color: var(--muted); font-size: 0.95rem; margin: 14px 0; white-space: pre-line; }

.audio-bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg); border-bottom: 2px solid var(--panel);
  padding: 12px 0; margin-bottom: 16px;
}
.audio-bar audio { width: 100%; }
.audio-missing { color: var(--muted); font-size: 0.9rem; }

.chapters { margin: 16px 0 24px; }
.chapters h2, .transcript h2 {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 10px;
}
.chapters ol { list-style: none; }
.chapters li { margin: 4px 0; }
.chapters button, .cue button {
  background: none; border: none; color: var(--muted);
  font-family: inherit; font-size: inherit; cursor: pointer;
  text-align: left; padding: 0; line-height: 1.6;
}
.chapters button:hover, .cue button:hover { color: var(--text); }
.chapters .ch-time, .cue .cue-time {
  color: var(--muted); font-variant-numeric: tabular-nums;
  margin-right: 10px; font-size: 0.85rem;
}

.transcript .cue { margin: 2px 0; }
.transcript .cue.active button { color: var(--text); font-weight: 700; }
.transcript .cue button { color: var(--text); display: flex; gap: 10px; }
.transcript .cue button:hover { color: var(--hi); }

@media (max-width: 768px) {
  body { font-size: 1.125rem; }
  .container { padding: 12px; }
  .controls { justify-content: flex-start; }
}
