/**
 * Housing & Property Times — Default Theme 2026
 * Finalized design: Hybrid Split · Story Deck · Immersive Published · Dark Mode
 * Light: Indigo + Sand + Electric Blue
 * Dark:  Deep Teal + Coral
 */

/* ========== CSS VARIABLES ========== */
:root {
  --bg: #f7f4ef;
  --bg-card: #ffffff;
  --fg: #0f172a;
  --fg-muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --indigo: #1e3a5f;
  --sand: #f7f4ef;
  --electric: #2563eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --nav-bg: #0f172a;
  --nav-fg: #e2e8f0;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1120px;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-card: #111827;
  --fg: #e5e7eb;
  --fg-muted: #94a3b8;
  --border: #1f2937;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.15);
  --indigo: #14b8a6;
  --sand: #0b1220;
  --electric: #2dd4bf;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --nav-bg: #020617;
  --nav-fg: #cbd5e1;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

/* ========== SKIP LINK ========== */
.hpt-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 10000;
}
.hpt-skip-link:focus { left: 0; }

/* ========== HEADER / NAV ========== */
.hpt-topbar {
  background: var(--nav-bg);
  color: var(--nav-fg);
  position: sticky;
  top: 0;
  z-index: 900;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.hpt-topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.hpt-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.hpt-brand:hover { text-decoration: none; color: #fff; }
.hpt-brand span { color: #60a5fa; }
html[data-theme="dark"] .hpt-brand span { color: #2dd4bf; }

/* Mode switch — always visible */
.hpt-mode-switch {
  display: inline-flex;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.hpt-mode-switch a {
  color: var(--nav-fg);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.hpt-mode-switch a:hover { background: rgba(255,255,255,0.12); text-decoration: none; color: #fff; }
.hpt-mode-switch a.is-active {
  background: var(--electric);
  color: #fff;
}
html[data-theme="dark"] .hpt-mode-switch a.is-active {
  background: #f97316;
  color: #fff;
}

.hpt-top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hpt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--nav-fg);
  cursor: pointer;
  text-decoration: none;
  font-size: 1rem;
}
.hpt-icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }

/* Secondary nav (admin menu items) */
.hpt-nav-secondary {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}
.hpt-nav-secondary a {
  color: #94a3b8;
  font-size: 0.85rem;
  text-decoration: none;
}
.hpt-nav-secondary a:hover { color: #fff; }

/* Mobile menu toggle */
.hpt-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

/* ========== CONTAINER ========== */
.hpt-container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

/* ========== HOMEPAGE — SPLIT INTELLIGENCE (Hybrid) ========== */
.hpt-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 900px) {
  .hpt-split {
    grid-template-columns: 0.95fr 1.15fr;
    gap: 1.75rem;
    align-items: start;
  }
}

.hpt-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}
.hpt-panel-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin: 0 0 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.hpt-panel-title a {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* Published side — page strip */
.hpt-edition-pages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hpt-page-row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hpt-page-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.hpt-page-row img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  background: #e2e8f0;
  flex-shrink: 0;
}
.hpt-page-meta { font-size: 0.88rem; }
.hpt-page-meta strong { display: block; margin-bottom: 0.15rem; }
.hpt-page-meta span { color: var(--fg-muted); font-size: 0.8rem; }

.hpt-flip-cta {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  text-align: center;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff !important;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  border: none;
  cursor: pointer;
}
.hpt-flip-cta:hover { filter: brightness(1.08); }

/* Web stories side */
.hpt-story-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hpt-story-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.85rem;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hpt-story-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.hpt-story-item img {
  width: 88px;
  height: 66px;
  object-fit: cover;
  object-position: left top; /* ALWAYS show top-left of cover */
  border-radius: 6px;
  background: #0f172a;
}
.hpt-story-item h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
}
.hpt-story-item .meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.hpt-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ========== STORY DECK (Search / mixed grid) ========== */
.hpt-deck {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 560px) {
  .hpt-deck { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .hpt-deck { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .hpt-deck { grid-template-columns: repeat(4, 1fr); }
}

.hpt-deck-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: var(--fg);
  height: 100%;
}
.hpt-deck-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.hpt-deck-card .thumb {
  aspect-ratio: 4 / 3;
  background: #e2e8f0;
  overflow: hidden;
}
.hpt-deck-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hpt-deck-card .body {
  padding: 0.85rem 0.95rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.hpt-deck-card .type-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.hpt-deck-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  flex: 1;
}
.hpt-deck-card .meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* ========== PUBLISHED — IMMERSIVE NEWSPAPER ROOM ========== */
.hpt-immersive {
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: #0b1220;
  color: #e5e7eb;
}
.hpt-immersive-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1rem;
  gap: 0.5rem;
}
.hpt-immersive-page {
  max-width: min(720px, 92vw);
  max-height: calc(100vh - 180px);
  background: #f8f5f0;
  color: #111;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  border-radius: 4px;
  overflow: auto;
}
.hpt-immersive-page img {
  width: 100%;
  height: auto;
  display: block;
}
.hpt-nav-arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hpt-nav-arrow:hover { background: rgba(255,255,255,0.18); }
.hpt-nav-arrow:disabled { opacity: 0.3; cursor: default; }

.hpt-tool-dock {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem 1.25rem;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
}
.hpt-tool-dock button,
.hpt-tool-dock a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #e5e7eb;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.hpt-tool-dock button:hover,
.hpt-tool-dock a:hover {
  background: rgba(255,255,255,0.14);
  text-decoration: none;
  color: #fff;
}
.hpt-page-indicator {
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
  padding: 0.35rem;
}

.hpt-recent-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.25);
}
.hpt-recent-strip a {
  flex: 0 0 auto;
  width: 64px;
  text-align: center;
  color: #cbd5e1;
  font-size: 0.7rem;
  text-decoration: none;
}
.hpt-recent-strip img {
  width: 64px;
  height: 86px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  margin-bottom: 0.25rem;
}
.hpt-recent-strip a.is-active img,
.hpt-recent-strip a:hover img {
  border-color: var(--electric);
}

/* ========== FORMS / SEARCH ========== */
.hpt-search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.hpt-search-bar input[type="search"],
.hpt-search-bar input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--fg);
  min-height: 44px;
}
.hpt-search-bar button {
  padding: 0.65rem 1.15rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
}
.hpt-search-bar button:hover { filter: brightness(1.06); }

.hpt-results-meta {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}

/* ========== FOOTER ========== */
.hpt-footer {
  background: var(--nav-bg);
  color: var(--nav-fg);
  padding: 2rem 1rem 2.5rem;
  margin-top: 2rem;
}
.hpt-footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 700px) {
  .hpt-footer-inner {
    grid-template-columns: 1.2fr 1fr 1fr;
  }
}
.hpt-footer a { color: #94a3b8; }
.hpt-footer a:hover { color: #fff; }
.hpt-footer h4 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.hpt-footer nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.hpt-footer-brand {
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.35rem;
}
.hpt-footer-copy {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 1.5rem;
  text-align: center;
}
#newsletter-signup {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#newsletter-signup form {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
#newsletter-signup input[type="email"] {
  flex: 1;
  min-width: 160px;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  min-height: 42px;
}
#newsletter-signup button {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--electric);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
html[data-theme="dark"] #newsletter-signup button {
  background: #f97316;
}

/* ========== CMS PAGE ========== */
.hpt-cms-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow);
  max-width: 760px;
  margin: 0 auto;
}
.hpt-cms-content h1 {
  margin-top: 0;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}
.hpt-cms-content p { margin: 0.75rem 0; }

/* ========== GENERIC CARDS (fallback) ========== */
.hpt-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 560px) {
  .hpt-home-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .hpt-home-grid { grid-template-columns: repeat(3, 1fr); }
}
.hpt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hpt-card a { color: inherit; text-decoration: none; display: block; }
.hpt-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #e2e8f0; }
.hpt-card-body { padding: 0.85rem 1rem; }
.hpt-category-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}
@media (min-width: 700px) {
  .hpt-category-tiles { grid-template-columns: repeat(4, 1fr); }
}
.hpt-category-tile {
  display: block;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}
.hpt-category-tile:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ========== ADS ========== */
.hpt-ad-banner {
  margin: 1rem 0;
  text-align: center;
}
.hpt-ad-banner img {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* ========== FOCUS ========== */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ========== MOBILE NAV ========== */
@media (max-width: 760px) {
  .hpt-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .hpt-mode-switch { order: 3; width: 100%; justify-content: stretch; }
  .hpt-mode-switch a { flex: 1; text-align: center; padding: 0.45rem 0.4rem; font-size: 0.75rem; }
  .hpt-nav-secondary {
    display: none;
    flex-direction: column;
    padding-bottom: 0.85rem;
  }
  .hpt-nav-secondary.is-open { display: flex; }
  .hpt-story-item { grid-template-columns: 72px 1fr; }
  .hpt-story-item img { width: 72px; height: 54px; }
}

/* ========== PRINT ========== */
@media print {
  .hpt-topbar, .hpt-footer, .hpt-ad-banner, .hpt-skip-link,
  .hpt-tool-dock, .hpt-nav-arrow, .hpt-recent-strip, #newsletter-signup {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .hpt-immersive { background: #fff; color: #000; }
}

/* ========== ARTICLE INTERACTIONS ========== */
.hpt-article { max-width: 720px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.hpt-article-title { font-size: 1.65rem; line-height: 1.25; margin: 0.75rem 0 0.35rem; color: var(--fg, #0f172a); }
.hpt-meta-line { color: var(--fg-muted, #64748b); font-size: 0.9rem; margin-bottom: 1rem; }
.hpt-hero-img { margin: 0 0 1rem; border-radius: 12px; overflow: hidden; }
.hpt-hero-img img { width: 100%; display: block; }
.hpt-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent, #2563eb); z-index: 10000; transition: width .1s linear; }

.hpt-tldr { background: var(--bg-card, #fff); border-left: 4px solid var(--accent, #2563eb); border-radius: 0 10px 10px 0; padding: 0.85rem 1rem; margin: 1rem 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.hpt-tldr ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.hpt-impact { color: var(--fg-muted, #64748b); font-size: 0.95rem; margin: 0.75rem 0 1rem; }

.hpt-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0 1rem; }
.hpt-lang-toggle { display: inline-flex; background: var(--bg-card, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 999px; overflow: hidden; }
.hpt-lang-toggle button { border: 0; background: transparent; padding: 0.45rem 0.9rem; font-size: 0.9rem; cursor: pointer; color: var(--fg-muted, #64748b); }
.hpt-lang-toggle button.is-active { background: var(--accent, #2563eb); color: #fff; }

.hpt-btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--border, #e2e8f0); background: var(--bg-card, #fff); color: var(--fg, #0f172a); font-size: 0.9rem; cursor: pointer; }
.hpt-btn-primary { background: var(--accent, #2563eb); color: #fff; border-color: transparent; }
.hpt-btn-listen { background: #0f172a; color: #fff; border: 0; }
.hpt-btn-listen:hover { opacity: 0.9; }
.hpt-btn-ghost { background: transparent; }

.hpt-body { font-size: 1.05rem; line-height: 1.7; color: var(--fg, #0f172a); margin: 1rem 0 1.5rem; }
.hpt-body p { margin: 0 0 1rem; }
.hpt-source-box { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 0.85rem 1rem; margin: 1.25rem 0; background: var(--bg-card, #fff); font-size: 0.92rem; }
.hpt-verified { color: #059669; font-weight: 600; margin-left: 0.35rem; }

/* Reactions */
.hpt-reactions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin: 1.25rem 0; padding: 0.75rem 0; border-top: 1px solid var(--border, #e2e8f0); border-bottom: 1px solid var(--border, #e2e8f0); }
.hpt-react-label { font-size: 0.8rem; font-weight: 600; color: var(--fg-muted, #64748b); margin-right: 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; }
.hpt-react-btn { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.4rem 0.75rem; border-radius: 999px; border: 1px solid var(--border, #e2e8f0); background: var(--bg-card, #fff); cursor: pointer; font-size: 0.85rem; color: var(--fg, #0f172a); transition: all .15s; }
.hpt-react-btn:hover, .hpt-react-btn.is-active { border-color: var(--accent, #2563eb); background: rgba(37,99,235,.08); color: var(--accent, #2563eb); }
.hpt-react-count { font-weight: 600; opacity: 0.75; }

/* Share bar */
.hpt-share-bar { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1rem 0 1.5rem; }
.hpt-share-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem; border-radius: 10px; border: 1px solid var(--border, #e2e8f0); background: var(--bg-card, #fff); color: var(--fg, #0f172a); text-decoration: none; font-size: 0.85rem; cursor: pointer; }
.hpt-share-btn:hover { border-color: var(--accent, #2563eb); }
.hpt-share-btn.hpt-wa { background: #25d366; color: #fff; border-color: transparent; }
.hpt-share-btn.hpt-fb { background: #1877f2; color: #fff; border-color: transparent; }
.hpt-share-btn.hpt-x { background: #0f172a; color: #fff; border-color: transparent; }

/* Poll */
.hpt-poll { background: var(--bg-card, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 14px; padding: 1.1rem 1.15rem; margin: 1.5rem 0; }
.hpt-poll-q { margin: 0 0 0.35rem; font-size: 1.05rem; }
.hpt-poll-disc { font-size: 0.8rem; color: var(--fg-muted, #64748b); margin: 0 0 0.85rem; }
.hpt-poll-opt { display: block; width: 100%; text-align: left; margin: 0.4rem 0; padding: 0.7rem 0.9rem; border-radius: 10px; border: 1px solid var(--border, #e2e8f0); background: var(--bg, #f7f4ef); cursor: pointer; font-size: 0.95rem; }
.hpt-poll-opt:hover { border-color: var(--accent, #2563eb); background: rgba(37,99,235,.06); }
.hpt-poll-result { position: relative; margin: 0.4rem 0; padding: 0.65rem 0.9rem; border-radius: 10px; background: var(--bg, #f7f4ef); overflow: hidden; display: flex; justify-content: space-between; gap: 0.5rem; }
.hpt-poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(37,99,235,.18); z-index: 0; }
.hpt-poll-text, .hpt-poll-pct { position: relative; z-index: 1; font-size: 0.92rem; }
.hpt-poll-result.is-yours { outline: 2px solid var(--accent, #2563eb); }
.hpt-poll-total { font-size: 0.8rem; color: var(--fg-muted, #64748b); margin: 0.5rem 0 0; }

/* Comments */
.hpt-comments { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border, #e2e8f0); }
.hpt-comment { padding: 0.75rem 0; border-bottom: 1px solid var(--border, #e2e8f0); }
.hpt-comment small { color: var(--fg-muted, #64748b); margin-left: 0.5rem; }
.hpt-comment-form { display: grid; gap: 0.65rem; margin-top: 1rem; }
.hpt-comment-form label { display: grid; gap: 0.25rem; font-size: 0.9rem; }
.hpt-comment-form input, .hpt-comment-form textarea { width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; background: var(--bg-card, #fff); color: var(--fg, #0f172a); font: inherit; }
.hpt-hint { font-size: 0.8rem; color: var(--fg-muted, #64748b); }
.hpt-msg.ok { color: #059669; } .hpt-msg.err { color: #dc2626; }

/* Zoom */
.hpt-zoom-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 9999; display: none; align-items: center; justify-content: center; }
.hpt-zoom-overlay[hidden] { display: none !important; }
.hpt-zoom-overlay img { max-width: 95%; max-height: 92vh; }
.hpt-zoom-close { position: fixed; top: 12px; right: 16px; font-size: 2rem; background: transparent; border: 0; color: #fff; cursor: pointer; }

/* Toast */
.hpt-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; padding: 0.65rem 1.1rem; border-radius: 999px; font-size: 0.9rem; opacity: 0; transition: .2s; z-index: 10001; }
.hpt-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Hide legacy naked dark-mode toggle if any theme still outputs it */
#dark-mode-toggle { display: none !important; }

/* Immersive flip / newspaper room polish */
.hpt-immersive { min-height: 100vh; background: #0b1220; color: #e5e7eb; padding-bottom: 2rem; }
.hpt-immersive-stage { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 1rem 0.5rem; max-width: 1100px; margin: 0 auto; }
.hpt-immersive-page { flex: 1; max-width: 900px; background: #111827; border-radius: 8px; overflow: auto; max-height: 78vh; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.hpt-immersive-page img { width: 100%; display: block; transition: transform .2s; }
.hpt-nav-arrow { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #1e293b; color: #fff; font-size: 1.4rem; cursor: pointer; flex-shrink: 0; }
.hpt-nav-arrow:disabled { opacity: 0.35; cursor: default; }
.hpt-tool-dock { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; padding: 0.75rem; }
.hpt-tool-dock button, .hpt-tool-dock a { min-height: 40px; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; text-decoration: none; font-size: 0.85rem; cursor: pointer; }
.hpt-recent-strip { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.75rem 1rem; max-width: 1100px; margin: 0 auto; }
.hpt-recent-strip a { flex: 0 0 72px; text-align: center; font-size: 0.7rem; color: #94a3b8; text-decoration: none; }
.hpt-recent-strip img { width: 72px; height: 96px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; display: block; margin-bottom: 0.25rem; }
.hpt-recent-strip a.is-active img { border-color: #3b82f6; }

html[data-theme="dark"] .hpt-tldr,
html[data-theme="dark"] .hpt-poll,
html[data-theme="dark"] .hpt-source-box,
html[data-theme="dark"] .hpt-react-btn,
html[data-theme="dark"] .hpt-share-btn:not(.hpt-wa):not(.hpt-fb):not(.hpt-x),
html[data-theme="dark"] .hpt-poll-opt,
html[data-theme="dark"] .hpt-poll-result,
html[data-theme="dark"] .hpt-comment-form input,
html[data-theme="dark"] .hpt-comment-form textarea {
  background: #111827; border-color: #1f2937; color: #e5e7eb;
}
html[data-theme="dark"] .hpt-article-title,
html[data-theme="dark"] .hpt-body { color: #e5e7eb; }
html[data-theme="dark"] .hpt-btn-listen { background: #f97316; }

/* ========== IMMERSIVE NEWSPAPER ROOM ========== */
.hpt-immersive-body, .hpt-room {
  background: #0b1220;
  color: #e5e7eb;
  min-height: 100vh;
  margin: 0;
}
.hpt-room { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 88px; }
.hpt-room-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.65rem 1rem;
  background: rgba(15,23,42,.9); border-bottom: 1px solid #1e293b;
  position: sticky; top: 0; z-index: 20;
}
.hpt-room-brand { display: flex; align-items: center; gap: 0.4rem; color: #f5e8c7; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.hpt-room-modes { display: flex; background: #1e293b; border-radius: 999px; padding: 3px; }
.hpt-room-modes a, .hpt-room-modes span {
  padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.8rem;
  color: #94a3b8; text-decoration: none;
}
.hpt-room-modes .is-active, .hpt-room-modes span.is-active { background: #f5e8c7; color: #0f172a; font-weight: 600; }
.hpt-room-actions { display: flex; gap: 0.35rem; }
.hpt-room-icon {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #334155;
  background: #1e293b; color: #e2e8f0; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; cursor: pointer; font-size: 1rem;
}
.hpt-room-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.5rem 1rem; font-size: 0.85rem; color: #94a3b8;
}
.hpt-room-meta strong { color: #f8fafc; }
.hpt-pill {
  background: #1e3a5f; color: #93c5fd; padding: 0.15rem 0.55rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.hpt-page-count { margin-left: auto; color: #cbd5e1; }

.hpt-room-stage {
  display: flex; align-items: center; justify-content: center;
  gap: 0.35rem; padding: 0.5rem; flex: 1; max-width: 1100px; width: 100%; margin: 0 auto;
}
.hpt-room-arrow {
  width: 48px; min-height: 48px; border-radius: 50%; border: 0;
  background: #1e293b; color: #fff; font-size: 1.6rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
}
.hpt-room-arrow span { font-size: 0.55rem; letter-spacing: 0.06em; opacity: 0.8; margin-top: 2px; }
.hpt-room-arrow:disabled { opacity: 0.3; cursor: default; }
.hpt-room-paper {
  flex: 1; max-width: 820px; background: #111827; border-radius: 10px;
  overflow: hidden; box-shadow: 0 25px 60px rgba(0,0,0,.5);
  max-height: 72vh; display: flex; align-items: flex-start; justify-content: center;
}
.hpt-room-img {
  width: 100%; height: auto; display: block; cursor: zoom-in;
  transition: transform .2s ease;
}
.hpt-room-empty { padding: 4rem 1rem; text-align: center; color: #64748b; }
.hpt-room-caption {
  text-align: center; font-size: 0.9rem; color: #94a3b8;
  padding: 0.35rem 1rem 0.5rem; margin: 0;
}

/* Thumb strip */
.hpt-room-thumbs {
  display: flex; gap: 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 0.65rem 1rem; max-width: 1100px; width: 100%; margin: 0 auto;
  scrollbar-width: thin;
}
.hpt-thumb {
  flex: 0 0 64px; text-align: center; text-decoration: none; color: #94a3b8; font-size: 0.7rem;
}
.hpt-thumb img, .hpt-thumb-ph {
  width: 64px; height: 86px; object-fit: cover; border-radius: 6px;
  border: 2px solid transparent; display: block; margin-bottom: 0.2rem;
  background: #1e293b;
}
.hpt-thumb-ph { display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #64748b; }
.hpt-thumb.is-active img, .hpt-thumb.is-active .hpt-thumb-ph { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.35); }
.hpt-thumb.is-active { color: #93c5fd; font-weight: 600; }

/* Tool dock */
.hpt-room-dock {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center; gap: 0.25rem;
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
  background: rgba(15,23,42,.95); border-top: 1px solid #1e293b;
  backdrop-filter: blur(8px); z-index: 30;
}
.hpt-room-dock button, .hpt-room-dock a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; min-height: 52px; padding: 0.25rem;
  border: 0; background: transparent; color: #cbd5e1; text-decoration: none;
  font-size: 1rem; cursor: pointer; border-radius: 10px;
}
.hpt-room-dock small { font-size: 0.62rem; margin-top: 2px; opacity: 0.85; }
.hpt-room-dock button:hover, .hpt-room-dock a:hover { background: #1e293b; color: #fff; }

.hpt-share-menu { position: relative; }
.hpt-share-pop {
  display: none; position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: #1e293b; border: 1px solid #334155; border-radius: 12px;
  padding: 0.4rem; min-width: 160px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.hpt-share-menu.open .hpt-share-pop { display: flex; flex-direction: column; gap: 0.2rem; }
.hpt-share-pop a, .hpt-share-pop button {
  display: block !important; width: 100%; text-align: left; padding: 0.55rem 0.75rem !important;
  min-height: auto !important; min-width: auto !important; flex-direction: row !important;
  color: #e2e8f0; background: transparent; border: 0; border-radius: 8px;
  font-size: 0.9rem !important; cursor: pointer; text-decoration: none;
}
.hpt-share-pop a:hover, .hpt-share-pop button:hover { background: #334155; }

/* Enlarge */
.hpt-enlarge {
  position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.hpt-enlarge[hidden] { display: none !important; }
.hpt-enlarge img { max-width: 100%; max-height: 95vh; object-fit: contain; }
.hpt-enlarge-x {
  position: fixed; top: 12px; right: 16px; font-size: 2rem; background: transparent;
  border: 0; color: #fff; cursor: pointer;
}

html.hpt-room-light .hpt-room,
html.hpt-room-light .hpt-immersive-body { background: #e8e4dc; color: #0f172a; }
html.hpt-room-light .hpt-room-top,
html.hpt-room-light .hpt-room-dock { background: #f8fafc; border-color: #cbd5e1; }
html.hpt-room-light .hpt-room-brand { color: #0f172a; }
html.hpt-room-light .hpt-room-arrow,
html.hpt-room-light .hpt-room-icon { background: #e2e8f0; color: #0f172a; border-color: #cbd5e1; }
html.hpt-room-light .hpt-room-paper { background: #fff; }
html.hpt-room-light .hpt-room-meta strong { color: #0f172a; }

@media (max-width: 640px) {
  .hpt-room-arrow { width: 40px; min-height: 40px; font-size: 1.3rem; }
  .hpt-room-arrow span { display: none; }
  .hpt-room-paper { max-height: 62vh; }
  .hpt-thumb { flex: 0 0 52px; }
  .hpt-thumb img, .hpt-thumb-ph { width: 52px; height: 70px; }
  .hpt-room-dock button, .hpt-room-dock a { min-width: 44px; }
  .hpt-room-brand span:last-child { display: none; }
}

/* ========== STORY DECK — paper vs web ========== */
.hpt-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) {
  .hpt-deck { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (min-width: 900px) {
  .hpt-deck { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
.hpt-deck-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  background: var(--bg-card, #fff); border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s;
}
.hpt-deck-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.hpt-deck-card .thumb { position: relative; background: #e2e8f0; overflow: hidden; }
.hpt-deck-card.is-paper .thumb { aspect-ratio: 3 / 4; } /* full newspaper page */
.hpt-deck-card.is-web .thumb { aspect-ratio: 16 / 10; }
.hpt-deck-card .thumb img {
  width: 100%; height: 100%; object-fit: cover; object-position: left top; display: block;
}
.hpt-deck-card.is-paper .thumb img { object-fit: contain; object-position: top center; background: #f1f5f9; }
.thumb-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #94a3b8; letter-spacing: 0.08em;
}
.type-chip {
  position: absolute; left: 8px; top: 8px;
  background: rgba(15,23,42,.85); color: #fff; font-size: 0.65rem;
  font-weight: 600; padding: 0.2rem 0.45rem; border-radius: 6px; letter-spacing: 0.03em;
}
.hpt-deck-card.is-paper .type-chip { background: #1d4ed8; }
.hpt-deck-card.is-web .type-chip { background: #0f766e; }
.hpt-deck-card .body { padding: 0.65rem 0.75rem 0.85rem; }
.hpt-deck-card .body h3 {
  margin: 0 0 0.25rem; font-size: 0.92rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hpt-deck-card .meta { font-size: 0.75rem; color: var(--fg-muted, #64748b); }
.hpt-list-title { margin: 0 0 0.5rem; font-size: 1.45rem; }
.hpt-list-desc { color: var(--fg-muted); margin: 0 0 1rem; }
.hpt-results-meta { font-size: 0.85rem; color: var(--fg-muted); margin-bottom: 1rem; }
.hpt-pager { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 1.5rem 0; }
.hpt-pager a {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border); text-decoration: none; color: inherit; font-size: 0.9rem;
}
.hpt-pager a.is-active { background: var(--accent, #2563eb); color: #fff; border-color: transparent; }

/* Published mode home — taller page previews */
.hpt-edition-pages { display: flex; flex-direction: column; gap: 0.75rem; }
.hpt-page-row {
  display: grid; grid-template-columns: 96px 1fr; gap: 0.85rem; align-items: start;
  text-decoration: none; color: inherit; padding: 0.5rem; border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0); background: var(--bg-card, #fff);
}
.hpt-page-row img {
  width: 96px; height: 128px; object-fit: contain; object-position: top;
  background: #f1f5f9; border-radius: 6px; border: 1px solid var(--border);
}
.hpt-page-meta strong { display: block; font-size: 0.95rem; line-height: 1.3; margin-bottom: 0.25rem; }
.hpt-page-meta span { font-size: 0.8rem; color: var(--fg-muted); }

/* Paper article landing */
.hpt-hero-img.is-paper { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #f8fafc; }
.hpt-hero-img.is-paper img { width: 100%; max-height: 70vh; object-fit: contain; object-position: top; display: block; }
.hpt-open-flipbook { display: block; position: relative; text-decoration: none; color: inherit; }
.hpt-flip-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,.9); color: #fff; padding: 0.45rem 0.9rem;
  border-radius: 999px; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.hpt-paper-cta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1rem; }
.hpt-paper-first-note {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px;
  padding: 1.1rem 1.2rem; margin: 1rem 0; text-align: center;
}
.hpt-paper-first-note p { margin: 0 0 0.75rem; color: #1e3a5f; }
html[data-theme="dark"] .hpt-paper-first-note { background: #0f172a; border-color: #1e3a5f; }
html[data-theme="dark"] .hpt-paper-first-note p { color: #93c5fd; }
.hpt-corrected-badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  color: #b45309; background: #fffbeb; border: 1px solid #fde68a;
  padding: 0.15rem 0.55rem; border-radius: 999px; margin: 0 0 0.75rem;
}

/* ========== ARCHIVE ========== */
.hpt-archive-head { margin-bottom: 1.25rem; }
.hpt-year-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.hpt-year-tabs a {
  padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--border, #e2e8f0);
  text-decoration: none; color: inherit; font-size: 0.9rem;
}
.hpt-year-tabs a.is-active { background: var(--accent, #2563eb); color: #fff; border-color: transparent; }
.hpt-archive-month { margin: 1.5rem 0; }
.hpt-archive-month h2 { font-size: 1.1rem; margin: 0 0 0.75rem; color: var(--fg-muted); font-weight: 600; }
.hpt-archive-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.85rem;
}
.hpt-archive-card {
  text-decoration: none; color: inherit; background: var(--bg-card, #fff);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.hpt-archive-card .cover { aspect-ratio: 3/4; background: #f1f5f9; }
.hpt-archive-card .cover img { width: 100%; height: 100%; object-fit: contain; object-position: top; }
.hpt-archive-card .info { padding: 0.55rem 0.65rem 0.75rem; display: grid; gap: 0.15rem; }
.hpt-archive-card .info strong { font-size: 0.85rem; line-height: 1.25; }
.hpt-archive-card .info span { font-size: 0.72rem; color: var(--fg-muted); }

/* ========== LETTER FORM ========== */
.hpt-letter-form { display: grid; gap: 0.75rem; max-width: 560px; margin: 1.25rem 0 2rem; }
.hpt-letter-form label { display: grid; gap: 0.3rem; font-size: 0.9rem; }
.hpt-letter-form input, .hpt-letter-form textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-card, #fff); color: var(--fg); font: inherit;
}

/* ========== RELATED ========== */
.hpt-related { margin: 2rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.hpt-related h3 { margin: 0 0 0.85rem; font-size: 1.05rem; }
.hpt-related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem;
}
.hpt-related-card {
  position: relative; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--bg-card, #fff); display: flex; flex-direction: column;
}
.hpt-related-card img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: top; display: block; background: #f1f5f9;
}
.hpt-related-card.is-web img { aspect-ratio: 16/10; }
.hpt-related-card strong {
  display: block; padding: 0.45rem 0.55rem 0.65rem; font-size: 0.8rem; line-height: 1.3;
}
.hpt-related-card .type-chip { left: 6px; top: 6px; font-size: 0.6rem; }

/* Web story cards — show full image, no left-crop */
.hpt-deck-card.is-web .thumb {
  aspect-ratio: 16 / 10;
  background: #0f172a;
}
.hpt-deck-card.is-web .thumb img {
  object-fit: cover !important;
  object-position: left top !important;
  width: 100%;
  height: 100%;
  background: #0f172a;
}

/* Home / listing cards without is-web class still get safer crop */
.hpt-deck-card .thumb img,
.hpt-story-item img,
.hpt-card img {
  object-position: left top;
}

/* Branded cover images on article pages */
.hpt-hero-img:not(.is-paper) {
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
}
.hpt-hero-img:not(.is-paper) img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  object-position: left top;
  display: block;
  background: #0f172a;
}

html[data-theme="dark"] .hpt-deck-card.is-web .thumb,
html[data-theme="dark"] .hpt-hero-img:not(.is-paper),
html[data-theme="dark"] .hpt-hero-img:not(.is-paper) img {
  background: #020617;
}

/* ========== Cards: keep TOP-LEFT of image visible (text starts left) ========== */
.hpt-deck-card .thumb,
.hpt-related-card .thumb,
.hpt-story-item > img,
.hpt-card > img {
  background: #0f172a;
  overflow: hidden;
}
.hpt-deck-card .thumb img,
.hpt-related-card img,
.hpt-story-item img,
.hpt-card img {
  object-fit: cover !important;
  object-position: left top !important; /* hide right/bottom if needed, never crop left */
  width: 100%;
  height: 100%;
  background: #0f172a;
}
/* is-web explicit */
.hpt-deck-card.is-web .thumb img {
  object-fit: cover !important;
  object-position: left top !important;
}
/* Newspaper pages stay top-aligned full page */
.hpt-deck-card.is-paper .thumb img,
.hpt-related-card.is-paper img,
.hpt-page-row img {
  object-fit: contain !important;
  object-position: top center !important;
  background: #f1f5f9;
}
html[data-theme="dark"] .hpt-deck-card.is-paper .thumb img,
html[data-theme="dark"] .hpt-page-row img {
  background: #111827;
}
/* Related rail chips not overlapping titles */
.hpt-related-card {
  min-height: 0;
}
.hpt-related-card strong {
  padding: 0.5rem 0.55rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hpt-related-card .type-chip {
  position: absolute;
  z-index: 2;
}
.hpt-cms-content {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 1.25rem 1.35rem 1.5rem;
  margin: 1rem 0 2rem;
}
.hpt-cms-content h1 {
  margin: 0 0 1rem;
  font-size: 1.6rem;
}
.hpt-cms-body {
  font-size: 1rem;
  line-height: 1.65;
}
.hpt-cms-body p { margin: 0 0 0.9rem; }
.hpt-cms-body ul { margin: 0 0 1rem; padding-left: 1.2rem; }

/* Mobile menu — must open on ☰ */
@media (max-width: 760px) {
  .hpt-menu-toggle { display: inline-flex !important; align-items: center; justify-content: center; }
  .hpt-nav-secondary {
    display: none !important;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem 1rem 0.85rem;
    background: var(--nav-bg, #0f172a);
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .hpt-nav-secondary.is-open {
    display: flex !important;
  }
  .hpt-nav-secondary a {
    display: block;
    padding: 0.55rem 0.25rem;
    color: #e2e8f0 !important;
    font-size: 0.95rem;
  }
}

/* FINAL override — listing/search/hybrid thumbs keep LEFT+TOP */
.hpt-story-item img,
.hpt-deck-card .thumb img,
.hpt-deck-card.is-web .thumb img,
.hpt-related-card img,
.hpt-card img,
a.hpt-story-item > img {
  object-fit: cover !important;
  object-position: left top !important;
}
.hpt-deck-card.is-paper .thumb img,
.hpt-page-row img,
.hpt-related-card.is-paper img {
  object-fit: contain !important;
  object-position: top center !important;
}

/* ============================================================
   Story card badges + smart section headers (HPT 2026)
   ============================================================ */

.hpt-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.hpt-section-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--electric);
}
.hpt-section-sub {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
  max-width: 36rem;
}
.hpt-section-link {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.hpt-panel-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.hpt-panel-title a {
  font-size: 0.85rem;
  font-weight: 700;
}

.hpt-rail {
  margin: 1.75rem 0 0.5rem;
}
.hpt-rail[data-rail="breaking"] .hpt-section-kicker { color: #dc2626; }
.hpt-rail[data-rail="alert"] .hpt-section-kicker { color: #d97706; }
.hpt-rail[data-rail="market"] .hpt-section-kicker { color: #0891b2; }
.hpt-rail[data-rail="analysis"] .hpt-section-kicker { color: #4f46e5; }
.hpt-rail[data-rail="inspired"] .hpt-section-kicker { color: #059669; }
.hpt-rail[data-rail="top"] .hpt-section-kicker { color: var(--electric); }

/* ---- Badges ---- */
.hpt-story-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}
.hpt-story-badge--sm {
  font-size: 0.58rem;
  padding: 0.12rem 0.4rem;
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
.hpt-story-badge--top {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #fff;
}
.hpt-story-badge--breaking {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  color: #fff;
  animation: hpt-badge-pulse 2.2s ease-in-out infinite;
}
.hpt-story-badge--alert {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}
.hpt-story-badge--market {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}
.hpt-story-badge--analysis {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}
.hpt-story-badge--inspired {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

@keyframes hpt-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

html[data-theme="dark"] .hpt-story-badge--alert {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border-color: rgba(249, 115, 22, 0.35);
}
html[data-theme="dark"] .hpt-story-badge--market {
  background: rgba(34, 211, 238, 0.12);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.3);
}
html[data-theme="dark"] .hpt-story-badge--analysis {
  background: rgba(129, 140, 248, 0.15);
  color: #a5b4fc;
  border-color: rgba(129, 140, 248, 0.3);
}
html[data-theme="dark"] .hpt-story-badge--inspired {
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.3);
}

/* ---- Cards ---- */
.hpt-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.hpt-deck--compact {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.hpt-deck--compact .hpt-deck-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  min-height: auto;
}
.hpt-deck--compact .thumb {
  height: 88px;
  min-height: 88px;
}
.hpt-deck-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.hpt-deck-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--electric) 35%, var(--border));
  text-decoration: none;
  color: inherit;
}
.hpt-deck-card .thumb {
  position: relative;
  height: 148px;
  background: #e2e8f0;
  overflow: hidden;
}
.hpt-deck-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left top;
  display: block;
}
.hpt-deck-card.is-paper .thumb img {
  object-fit: cover;
  object-position: left top;
}
.hpt-deck-card .body {
  padding: 0.75rem 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.hpt-deck-card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  font-weight: 750;
  color: var(--fg);
}
.hpt-card-badge-row {
  margin-bottom: 0.15rem;
}
.hpt-card-take {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hpt-deck-card .meta {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.type-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

@media (max-width: 640px) {
  .hpt-deck {
    grid-template-columns: 1fr;
  }
  .hpt-deck-card .thumb {
    height: 180px;
  }
}
