/* ============================================================
   TC Sentinel — Mobile / Responsive CSS
   ============================================================ */

/* ── Screen-only: sticky nav ────────────────────────────── */
@media screen {
  nav.no-print {
    position: sticky;
    top: 0;
    z-index: 200;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
}

/* ── Logo image / text fallback ─────────────────────────── */
.nav-logo-img {
  height: 32px;
  width: auto;
  display: block;
}
/* Text fallback hidden by default; shown via onerror JS */
.nav-logo-text {
  display: none;
}

/* ── Mobile nav top row (hidden on desktop) ─────────────── */
.mobile-nav-top {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--page-pad);
  border-bottom: 1px solid var(--rule-light);
  background: linear-gradient(to bottom, #F5F2EC, var(--bg));
  position: relative;
}

/* Brand centered absolutely so icon sizes don't push it */
.mobile-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
}
.mobile-brand .nav-logo-img { height: 28px; }
.mobile-brand .nav-logo-text {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Hamburger button ────────────────────────────────────── */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 19px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  z-index: 1;
}

.hamburger-btn .bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
  transform-origin: center;
}

/* Animate to X when open */
.hamburger-btn.open .bar:nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
}
.hamburger-btn.open .bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger-btn.open .bar:nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
}

/* ── Mobile search icon (right side) ────────────────────── */
.mobile-search-btn {
  flex-shrink: 0;
  z-index: 1;
  color: var(--ink);
  padding: 4px;
  display: flex;
  align-items: center;
}

/* ── Drawer overlay ──────────────────────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
}
.drawer-overlay.open { display: block; }

/* ── Mobile drawer ───────────────────────────────────────── */
.mobile-drawer {
  display: none;  /* hidden until breakpoint */
  position: fixed;
  top: 0;
  left: 0;
  width: min(320px, 85vw);
  height: 100dvh;
  background: var(--bg, #F5F2EC);
  z-index: 195;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-right: 1px solid var(--rule-light);
}
.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-inner {
  padding: 56px 0 40px;
}

.drawer-section-label {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-light, #888);
  padding: 16px 24px 6px;
}

.drawer-link {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  padding: 12px 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.drawer-link:hover,
.drawer-link:focus {
  background: rgba(139,26,26,0.06);
  color: var(--accent, #8B1A1A);
  outline: none;
}

.drawer-subscribe {
  color: var(--accent, #8B1A1A);
  font-weight: 700;
}

.drawer-divider {
  height: 1px;
  background: var(--rule-light);
  margin: 8px 0;
}

.drawer-tagline {
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--ink-light, #888);
  padding: 20px 24px 0;
  margin: 0;
  line-height: 1.5;
}

/* ── Tablet (≤ 900px) ─────────────────────────────────────── */
@media (max-width: 900px) {
  .col-left {
    display: none;
  }

  .main-grid {
    grid-template-columns: 3fr 2fr;
  }

  .col-center {
    border-right: 1px solid var(--rule-light);
    padding: 0 20px;
  }

  .col-right {
    padding-left: 20px;
  }

  .web-nav-sections {
    font-size: 0.65rem;
  }
}

/* ── Small Tablet (≤ 768px) ───────────────────────────────── */
@media (max-width: 768px) {
  .video-card { flex: 0 0 180px; }
  :root {
    --page-pad: 16px;
    --col-gap: 14px;
  }

  .main-grid {
    grid-template-columns: 1fr;
    padding-bottom: 16px;
  }

  .col-center {
    border: none;
    padding: 0;
  }

  .col-right {
    padding: 0;
    margin-top: 24px;
    border-top: 1px solid var(--rule-light);
    padding-top: 20px;
  }

  .lower-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lower-card {
    padding: 12px 12px 20px 0;
  }

  .lower-card + .lower-card {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--rule-light);
  }

  .strip-body,
  .strip-body--reversed {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .strip-left {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--rule-light);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  /* Reversed strip: reset order and borders at mobile */
  .strip-body--reversed .strip-feature { order: 0; }
  .strip-body--reversed .strip-left {
    border-left: none;
    padding-left: 0;
    border-bottom: 1px solid var(--rule-light);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  /* More News: collapse to single column */
  .more-news-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .more-news-col-left {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--rule-light);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .more-news-col-right {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--rule-light);
    padding-top: 16px;
    margin-top: 16px;
  }

  .right-small-grid {
    grid-template-columns: 1fr;
  }

  .web-nav-sections {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .web-nav-sections a {
    white-space: nowrap;
  }

  .masthead-slim {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Masthead: scale down owl + text so nothing overflows ── */
  .masthead-inner {
    gap: 12px;
    padding: 16px var(--page-pad);
  }
  .masthead-owl {
    height: 130px;
    top: 8px;
  }
  .masthead-tc,
  .masthead-sentinel {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }
  .masthead-tagline {
    font-size: 0.52rem;
    letter-spacing: 0.14em;
  }

  .article-page-headline {
    font-size: clamp(1.8rem, 5vw, 2.5rem) !important;
  }

  .article-page-body {
    font-size: 0.95rem;
  }

  .article-page-deck {
    font-size: 0.95rem;
  }
}

/* ── Mobile nav breakpoint (≤ 768px) — show hamburger, hide section links ── */
@media (max-width: 768px) {
  /* Hide desktop section links */
  .web-nav-sections { display: none !important; }
  .nav-archive      { display: none !important; }

  /* Show hamburger button */
  .hamburger-btn    { display: flex; }

  /* Drawer is shown/hidden via JS — display controlled in script, not CSS */

  /* Center brand in nav using space-between trick */
  .web-nav-bar {
    justify-content: space-between;
    gap: 8px;
  }
  .nav-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  #site-nav { position: relative; }
}

/* ── Desktop: hamburger hidden ── */
@media (min-width: 769px) {
  .hamburger-btn { display: none !important; }
}

/* ── Phone (≤ 480px) ──────────────────────────────────────── */
@media (max-width: 480px) {
  .video-card { flex: 0 0 150px; }
  .video-card-headline { font-size: 0.75rem; }
  :root {
    --page-pad: 12px;
    --col-gap: 10px;
  }

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

  .lower-card {
    padding: 12px 0 20px;
  }

  .lower-card + .lower-card {
    border-left: none;
    padding-left: 0;
  }

  .strip-feat-headline { font-size: 1rem !important; }
  .strip-text-headline { font-size: 0.82rem !important; }
  .mn-feat-headline { font-size: 1.1rem !important; }
  .mn-headline { font-size: 0.88rem !important; }

  .stack-headline {
    font-size: 0.9rem !important;
  }

  .feat-headline {
    font-size: 0.95rem !important;
  }

  .lower-headline {
    font-size: 0.85rem !important;
  }

  .hero-deck {
    display: none;
  }

  .article-page {
    padding: 0 0 48px;
  }

  .article-page-headline {
    font-size: clamp(1.4rem, 5vw, 2rem) !important;
  }

  .article-page-body {
    font-size: 0.9rem;
    line-height: 1.65;
  }

  .page-footer {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  /* ── Masthead: compact owl + text for phone screens ── */
  .masthead-inner {
    gap: 10px;
    padding: 10px var(--page-pad) 8px;
  }
  .masthead-owl {
    height: 75px;
    top: 4px;
  }
  .masthead-tc,
  .masthead-sentinel {
    font-size: clamp(1.2rem, 7vw, 1.8rem);
  }
  .masthead-tc { margin-right: 0.1em; }
  .masthead-tagline {
    font-size: 0.44rem;
    letter-spacing: 0.12em;
  }
  .masthead-meta {
    font-size: 0.58rem;
    flex-wrap: wrap;
    gap: 2px 5px;
  }

  /* Nav: hide PDF link on tiny screens to save space */
  .nav-pdf { display: none !important; }

  /* Utility strip: hide alerts col, show tides + weather 2-up */
  .utility-strip {
    grid-template-columns: 1fr 1fr;
    font-size: 0.68rem;
  }
  .utility-alerts { display: none; }
  .utility-box { padding: 6px 10px 7px; }
  .utility-box:last-child { border-right: none; }

  /* Section pages: reduce hero image height */
  .sec-hero-img img { height: 180px !important; }

  /* Footer: 1 column on very small screens */
  .footer-main { grid-template-columns: 1fr !important; gap: 20px !important; }

  /* Data stats: 1 column on tiny screens */
  .data-stat-strip { grid-template-columns: 1fr !important; }

  /* Archive grid: single column */
  .archive-grid { grid-template-columns: 1fr !important; }
}
