/* ─────────────────────────────────────────
   THE BUBBERT TIMES — Stylesheet
   NYT-inspired editorial design
───────────────────────────────────────── */

/* ── VARIABLES ────────────────────────── */

:root {
  --black: #121212;
  --ink: #1a1a1a;
  --gray-dark: #333;
  --gray-mid: #666;
  --gray-light: #999;
  --rule: #ccc;
  --paper: #f9f7f2;
  --white: #ffffff;
  --accent: #b5282a;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-masthead: 'UnifrakturMaguntia', serif;
  --font-body: 'EB Garamond', Georgia, serif;

  --max-width: 1160px;
  --col-gap: 2rem;
}

/* ── RESET ────────────────────────────── */

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

html { font-size: 18px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ── MASTHEAD ─────────────────────────── */

.masthead {
  border-top: 4px solid var(--black);
  border-bottom: 1px solid var(--black);
  padding: 0.75rem 2rem 0;
  max-width: var(--max-width);
  margin: 0 auto;
}

.masthead-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  gap: 1rem;
}

.masthead-meta {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--gray-mid);
  letter-spacing: 0.02em;
}

.masthead-meta--right { text-align: right; }

.masthead-title-wrap { text-align: center; }

.masthead-title {
  font-family: var(--font-masthead);
  font-size: clamp(2.8rem, 6vw, 5rem);
  color: var(--black);
  line-height: 1;
  display: block;
  letter-spacing: 0.01em;
}

.masthead-title:hover { text-decoration: none; }

.masthead-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--gray-mid);
  margin-top: 0.2rem;
  letter-spacing: 0.05em;
}

/* ── NAV ──────────────────────────────── */

.masthead-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem 0;
}

.masthead-nav a {
  font-family: var(--font-body);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink);
  font-weight: 500;
}

.masthead-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── MAIN LAYOUT ──────────────────────── */

.site-main {
  max-width: var(--max-width);
  margin: 2.5rem auto;
  padding: 0 2rem;
}

/* ── FRONT PAGE ───────────────────────── */

.featured-story {
  border-top: 3px solid var(--black);
  padding-top: 1.5rem;
  max-width: 720px;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.featured-story__kicker {
  font-family: var(--font-body);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.featured-story__headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.featured-story__headline a:hover {
  text-decoration: none;
  color: var(--accent);
}

.featured-story__subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--gray-dark);
  margin-bottom: 0.75rem;
}

.featured-story__meta {
  font-size: 0.78rem;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.featured-story__meta .byline { margin-right: 1rem; }

.featured-story__summary {
  font-size: 1.05rem;
  color: var(--gray-dark);
  max-width: 580px;
  margin: 0 auto 1rem;
}

.read-more {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-family: var(--font-body);
}

.divider-ornament {
  text-align: center;
  color: var(--rule);
  font-size: 0.9rem;
  letter-spacing: 0.5em;
  margin: 1.5rem 0;
}

/* ── ARTICLE GRID ─────────────────────── */

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
}

.article-card {
  padding: 1.5rem var(--col-gap) 1.5rem 0;
  border-right: 1px solid var(--rule);
}

.article-card:last-child { border-right: none; }
.article-card:nth-child(3n) { border-right: none; }
.article-card:nth-child(n+4) { border-top: 1px solid var(--rule); }

.article-card__kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.article-card__headline {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.article-card__headline a:hover {
  text-decoration: none;
  color: var(--accent);
}

.article-card__meta {
  font-size: 0.72rem;
  color: var(--gray-light);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.6rem;
}

.article-card__meta .byline { margin-right: 0.75rem; }

.article-card__summary {
  font-size: 0.92rem;
  color: var(--gray-dark);
  line-height: 1.6;
}

/* ── SINGLE ARTICLE ───────────────────── */

.article-single {
  max-width: 680px;
  margin: 0 auto;
}

.article-single__header {
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.5rem;
}

.article-single__kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.article-single__headline {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.article-single__subtitle {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gray-dark);
  margin-bottom: 0.75rem;
}

.article-single__meta {
  font-size: 0.78rem;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-single__meta .byline { margin-right: 1rem; }

.article-single__rule {
  border: none;
  border-top: 3px double var(--black);
  margin-bottom: 1.5rem;
}

.article-single__body {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--ink);
  max-width: 65%;
}

.article-single__body p { margin-bottom: 1.2rem; }

.article-single__body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
}

.article-single__body blockquote {
  border-left: 3px solid var(--black);
  padding-left: 1.2rem;
  font-style: italic;
  color: var(--gray-dark);
  margin: 1.5rem 0;
}

.article-single__body .more { display: none; }

/* ── TABLES ───────────────────────────── */

.article-single__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.article-single__body th {
  border-bottom: 2px solid var(--black);
  padding: 0.5rem 1rem;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
}

.article-single__body td {
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 1rem;
}

.article-single__body tr:last-child td { border-bottom: none; }

/* ── TABLE OF CONTENTS ────────────────── */

nav#TableOfContents {
  border: 1px solid var(--rule);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

nav#TableOfContents ul {
  list-style: none;
  padding-left: 1rem;
}

nav#TableOfContents a { color: var(--accent); }

/* ── SUMMARY FADE ─────────────────────── */

.featured-story__summary,
.article-card__summary {
  position: relative;
  max-height: 4.5rem;
  overflow: hidden;
}

.featured-story__summary::after,
.article-card__summary::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5rem;
  background: linear-gradient(transparent, var(--paper));
  pointer-events: none;
}

/* ── FOOTER ───────────────────────────── */

.site-footer {
  border-top: 3px double var(--black);
  margin-top: 4rem;
  padding: 2rem;
  text-align: center;
}

.footer-title {
  font-family: var(--font-masthead);
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--gray-light);
  letter-spacing: 0.05em;
}

/* ── THEME TOGGLE ─────────────────────── */

.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: background 0.2s;
}

.theme-toggle:hover { opacity: 0.85; }

/* ── INSTALL BUTTON ───────────────────── */

.install-btn {
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 0.4rem 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.install-btn:hover { opacity: 0.85; }

/* ── BAND PAGE ────────────────────────── */

.band-card__inner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.band-card__photo {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

.band-card__content { flex: 1; }

/* ── READING TIME ─────────────────────── */

.readtime {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-mid);
}

/* ── SEARCH ───────────────────────────── */

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--black);
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 1.5rem;
  outline: none;
}

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

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.search-result {
  display: block;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}

.search-result:hover .search-result__title { color: var(--accent); }

.search-result__category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.search-result__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.search-result__date {
  font-size: 0.78rem;
  color: var(--gray-mid);
}

.search-empty {
  font-style: italic;
  color: var(--gray-mid);
}

/* ── BREAKING NEWS BANNER ─────────────── */

.breaking-banner {
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  position: relative;
}

.breaking-banner__label {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.4);
  padding-right: 0.75rem;
}

.breaking-banner__text { flex: 1; }

.breaking-banner__close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.25rem;
  opacity: 0.7;
}

.breaking-banner__close:hover { opacity: 1; }

/* ── RELATED ARTICLES ─────────────────── */

.related-articles { margin-top: 2rem; }

.related-articles__heading {
  font-family: var(--font-display);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

/* ── SPLASH SCREEN ────────────────────── */

.splash {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: splashFade 0.8s ease 2.8s forwards;
}

.splash-title {
  font-family: var(--font-masthead);
  font-size: clamp(3rem, 10vw, 7rem);
  color: #f0ece0;
  opacity: 0;
  transform: scale(0.3);
  animation: splashZoom 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
  letter-spacing: 0.02em;
  text-align: center;
}

.splash-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: #a09890;
  opacity: 0;
  transform: translateY(10px);
  animation: splashReveal 0.6s ease 1.1s forwards;
  letter-spacing: 0.1em;
}

.splash-mobile { display: none; }
.splash-desktop { display: block; }

.splash-logo {
  width: 85%;
  max-width: 500px;
  height: auto;
  opacity: 0;
  transform: translateY(20px);
  animation: splashReveal 0.8s ease 0.3s forwards;
}

@keyframes splashZoom {
  0%   { opacity: 0; transform: scale(0.3); }
  60%  { opacity: 1; transform: scale(1.08); }
  80%  { transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes splashReveal {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashFade {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); pointer-events: none; visibility: hidden; }
}

/* ── DARK MODE ────────────────────────── */

[data-theme="dark"] {
  --black: #f0ece0;
  --ink: #e8e0d0;
  --gray-dark: #c8bfb0;
  --gray-mid: #a09890;
  --gray-light: #706860;
  --rule: #444;
  --paper: #1a1a1a;
  --white: #222;
  --accent: #e05555;
}

[data-theme="dark"] .article-single__rule  { border-top-color: var(--accent); }
[data-theme="dark"] .article-single__header { border-bottom-color: var(--accent); }
[data-theme="dark"] .featured-story        { border-top-color: var(--accent); }
[data-theme="dark"] .masthead              { border-top-color: var(--accent); border-bottom-color: var(--accent); }
[data-theme="dark"] .site-footer           { border-top-color: var(--accent); }

/* ── MOBILE ───────────────────────────── */

@media (max-width: 768px) {

  :root {
    --black: #f0ece0;
    --ink: #e8e0d0;
    --gray-dark: #c8bfb0;
    --gray-mid: #a09890;
    --gray-light: #706860;
    --rule: #444;
    --paper: #000000;
    --white: #111;
    --accent: #e05555;
  }

  [data-theme="dark"] {
    --paper: #000000;
    --white: #0a0a0a;
    --rule: #333;
  }

  .splash { background: #533549; }
  .splash-mobile { display: block; }
  .splash-desktop { display: none; }

  .masthead {
    padding: 0.75rem 1rem 0;
    border-top: 3px solid var(--ink);
  }

  .masthead-top {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    text-align: center;
    padding-bottom: 0.75rem;
  }

  .masthead-meta,
  .masthead-meta--right {
    text-align: center;
    font-size: 0.7rem;
  }

  .masthead-title { font-size: clamp(2.2rem, 10vw, 3rem); }
  .masthead-tagline { font-size: 0.75rem; }

  .masthead-nav {
    gap: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--rule);
  }

  .masthead-nav a {
    padding: 0.6rem 0;
    text-align: center;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    font-size: 0.72rem;
  }

  .masthead-nav a:nth-child(2n) { border-right: none; }

  .site-main {
    padding: 0 1rem;
    margin: 1.5rem auto;
  }

  .featured-story { padding-top: 1.2rem; }
  .featured-story__headline { font-size: clamp(1.6rem, 7vw, 2.2rem); }

  .article-grid { grid-template-columns: 1fr; }

  .article-card {
    border-right: none;
    border-top: 1px solid var(--rule);
    padding: 1.2rem 0;
  }

  .article-single { padding: 0; }
  .article-single__headline { font-size: clamp(1.5rem, 6vw, 2rem); }

  .article-single__body {
    font-size: 1rem;
    max-width: 100%;
  }

  .theme-toggle {
    width: 3rem;
    height: 3rem;
    font-size: 1.3rem;
    bottom: 1rem;
    right: 1rem;
  }

  .site-footer {
    padding: 1.5rem 1rem;
    margin-top: 2rem;
  }
}

/* ── PRINT ────────────────────────────── */

@media print {

  .masthead,
  .site-footer,
  .theme-toggle,
  .install-btn,
  .breaking-banner,
  .related-articles,
  .read-more,
  .print-btn,
  .share-btn,
  #splash {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .article-single__headline,
  .article-single__body,
  .byline,
  .dateline,
  .readtime {
    color: #000 !important;
  }

  .article-single__header::before {
    content: "The Bubbert Times";
    display: block;
    font-family: var(--font-masthead);
    font-size: 2rem;
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
  }

  a[href]::after {
    display: none !important;
    content: "" !important;
  }

  .article-single__body {
    column-count: 1 !important;
    max-width: 100% !important;
  }

  p, blockquote, table, figure {
    page-break-inside: avoid;
  }

  @page { margin: 1cm; }
}

/* ── WRITER BADGES & ARTICLES ─────────── */

.band-card__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.band-card__badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--accent);
  color: #fff;
  padding: 0.15rem 0.5rem;
  font-family: var(--font-body);
}

.band-card__articles {
  margin-top: 0.75rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.75rem;
}

.band-card__articles-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-mid);
  margin-bottom: 0.4rem;
}

.band-card__article-link {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.band-card__article-link:hover {
  text-decoration: underline;
}

/* ── BACK TO TOP ──────────────────────── */

.back-to-top {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 50%;
  width: 5rem;
  height: 2.5rem;
  font-size: 0.7rem;
  font-family: var(--font-body);
  cursor: pointer;
  z-index: 998;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover { opacity: 0.85; }

/* ── PRINT BUTTON ─────────────────────── */

.print-btn {
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: none;
  color: var(--gray-mid);
  border: 1px solid var(--rule);
  padding: 0.4rem 1rem;
  cursor: pointer;
  margin-top: 1.5rem;
  display: block;
}

.print-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ── PROGRESS BAR ─────────────────────── */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 9998;
  transition: width 0.1s linear;
}

/* ── SHARE BUTTON ─────────────────────── */

.share-btn {
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: none;
  color: var(--gray-mid);
  border: 1px solid var(--rule);
  padding: 0.4rem 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  display: block;
}

.share-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ── ARTICLE CARD HOVER EFFECTS ──────── */

.article-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.article-card__headline a {
  transition: color 0.2s ease;
}

.article-card:hover .article-card__headline a {
  color: var(--accent);
}

/* ── FADE IN ON SCROLL ────────────────── */

.fade-in-hidden {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── ANIMATED MASTHEAD ────────────────── */

.masthead-title {
  animation: masthead-fade-in 1.2s ease forwards;
  opacity: 0;
}

.masthead-tagline {
  animation: masthead-fade-in 1.2s ease 0.3s forwards;
  opacity: 0;
}

.masthead-meta {
  animation: masthead-fade-in 1.2s ease 0.15s forwards;
  opacity: 0;
}

.masthead-nav {
  animation: masthead-expand 0.8s ease 0.4s forwards;
  transform: scaleX(0);
  transform-origin: left;
}

@keyframes masthead-fade-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes masthead-expand {
  to {
    transform: scaleX(1);
  }
}

/* ── JAZZ HISTORY WIDGET ──────────────── */

.jazz-widget {
  border-top: 2px solid var(--black);
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0;
  margin-top: 2rem;
  text-align: center;
}

.jazz-widget__label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.jazz-widget__fact {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink);
  max-width: 600px;
  margin: 0 auto 0.5rem;
  line-height: 1.6;
}

.jazz-widget__date {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-mid);
}