/**
 * detail.css — Harbour Brief article reading experience
 */

:root {
  --hb-cream: #FAF6F0;
  --hb-paper: #F3EBE0;
  --hb-ink: #1A1612;
  --hb-muted: #5C534A;
  --hb-terracotta: #C4654A;
  --hb-forest: #2D4A3E;
  --hb-gold: #B8956B;
  --hb-radius: 14px;
  --hb-font-display: 'Playfair Display', Georgia, serif;
  --hb-font-body: 'Source Serif 4', Georgia, serif;
  --hb-font-ui: 'DM Sans', system-ui, sans-serif;
  --hb-read: 680px;
  --hb-max: 1240px;
  --hb-radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.hb-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

body.hb-body--detail {
  font-family: var(--hb-font-body);
  background: var(--hb-cream);
  color: var(--hb-ink);
  line-height: 1.75;
}

img { max-width: 100%; height: auto; display: block; }

.hb-card-link { text-decoration: none; color: inherit; }

/* —— Site chrome (shared with index) —— */
.hb-site-header {
  position: static;
  top: auto;
  z-index: 100;
  background: rgba(250, 246, 240, 0.82);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  border-bottom: 1px solid rgba(26, 22, 18, 0.07);
}

.hb-site-header__inner {
  max-width: var(--hb-max);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  margin-right: auto;
}

.hb-brand__name {
  font-family: var(--hb-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--hb-forest);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.hb-edition-bar {
  max-width: var(--hb-max);
  margin: 0 auto;
  padding: 0.45rem 1.5rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid rgba(26, 22, 18, 0.06);
  font-family: var(--hb-font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--hb-muted);
}

.hb-edition-bar__tagline {
  text-transform: uppercase;
  font-weight: 500;
}

.hb-edition-bar__date {
  font-variant-numeric: tabular-nums;
}

.hb-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(26, 22, 18, 0.12);
  border-radius: var(--hb-radius-sm);
  background: var(--hb-paper);
  cursor: pointer;
}

.hb-nav-toggle__bar {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: var(--hb-ink);
  margin: 0 auto;
  box-shadow: 0 5px 0 var(--hb-ink), 0 -5px 0 var(--hb-ink);
}

.hb-site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-family: var(--hb-font-ui);
  font-size: 0.875rem;
  font-weight: 500;
}

.hb-site-nav a {
  text-decoration: none;
  padding: 0.25rem 0;
  color: var(--hb-muted);
  transition: color 0.2s;
}

.hb-site-nav a:hover { color: var(--hb-terracotta); }

.hb-site-nav a[aria-current="page"] {
  color: var(--hb-terracotta);
}

.hb-search {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(26, 22, 18, 0.1);
  border-radius: 999px;
  padding: 0.2rem 0.3rem 0.2rem 1rem;
  min-width: 210px;
}

.hb-search input {
  border: none;
  background: transparent;
  flex: 1;
  font-family: var(--hb-font-ui);
  font-size: 0.875rem;
  outline: none;
  min-width: 0;
}

.hb-search button {
  border: none;
  background: var(--hb-forest);
  color: var(--hb-cream);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hb-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--hb-terracotta), var(--hb-gold));
  z-index: 200;
  transition: width 0.1s linear;
}

/* Article */
.hb-detail-main {
  max-width: var(--hb-read);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.hb-ad-slot {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.hb-ad-slot > * {
  max-width: 100%;
  flex-shrink: 0;
}

.hb-ad-slot--top { margin-top: 0; }

.hb-article-head {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(26, 22, 18, 0.1);
}

.hb-kicker {
  font-family: var(--hb-font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hb-terracotta);
}

.hb-article-title {
  font-family: var(--hb-font-display);
  font-size: clamp(1.85rem, 5vw, 2.75rem);
  line-height: 1.15;
  margin: 0.85rem 0 1rem;
  color: var(--hb-forest);
}

.hb-article-byline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  font-family: var(--hb-font-ui);
  font-size: 0.85rem;
  color: var(--hb-muted);
}

.hb-byline-author { font-weight: 600; color: var(--hb-ink); }

.hb-article-hero {
  margin: 0 -1.25rem 2rem;
  border-radius: 0;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--hb-paper);
}

.hb-article-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hb-article-body {
  font-size: 1.12rem;
  color: var(--hb-ink);
}

.hb-article-body p {
  margin-bottom: 1.35rem;
}

.hb-dropcap::first-letter {
  float: left;
  font-family: var(--hb-font-display);
  font-size: 3.8rem;
  line-height: 0.85;
  padding: 0.08em 0.12em 0 0;
  color: var(--hb-terracotta);
  font-weight: 700;
}

.hb-article-foot {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--hb-gold);
  font-family: var(--hb-font-ui);
  font-size: 0.82rem;
  color: var(--hb-muted);
  font-style: italic;
}

/* Related */
.hb-related-section {
  background: var(--hb-paper);
  padding: 2.5rem 0 3rem;
  border-top: 1px solid rgba(26, 22, 18, 0.08);
}

.hb-related-head {
  max-width: 1100px;
  margin: 0 auto 1.25rem;
  padding: 0 1.25rem;
}

.hb-related-head h2 {
  font-family: var(--hb-font-display);
  font-size: 1.5rem;
  color: var(--hb-forest);
}

.hb-related-scroller {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 1.25rem 0.5rem;
}

.hb-related-track {
  display: flex;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hb-related-slide {
  flex: 0 0 240px;
  scroll-snap-align: start;
  background: #fff;
  border-radius: var(--hb-radius);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(26, 22, 18, 0.07);
}

.hb-related-slide img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
}

.hb-related-slide h3 {
  font-family: var(--hb-font-display);
  font-size: 0.95rem;
  padding: 0.75rem 0.85rem 0.25rem;
  line-height: 1.3;
}

.hb-related-slide .hb-meta {
  padding: 0 0.85rem 0.85rem;
  font-family: var(--hb-font-ui);
  font-size: 0.78rem;
  color: var(--hb-muted);
}

.hb-meta { font-family: var(--hb-font-ui); font-size: 0.82rem; color: var(--hb-muted); }

/* Search + footer */
.hb-search-results {
  max-width: var(--hb-read);
  margin: 1rem auto;
  padding: 0 1.25rem;
}

.hb-search-hit {
  background: #fff;
  border-radius: var(--hb-radius);
  margin-bottom: 0.75rem;
}

.hb-search-hit .hb-card-link {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.75rem;
  padding: 0.65rem;
}

.hb-search-hit img {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.hb-empty {
  text-align: center;
  padding: 2rem;
  font-family: var(--hb-font-ui);
  color: var(--hb-muted);
}

.hb-footer {
  background: var(--hb-ink);
  color: rgba(250, 246, 240, 0.88);
  padding: 2.5rem 1.5rem 1.5rem;
  margin-top: 1rem;
}

.hb-footer__top {
  max-width: var(--hb-max);
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: 1.1fr 2fr;
  gap: 2rem;
}

.hb-footer__brand {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.hb-footer__name {
  font-family: var(--hb-font-display);
  font-size: 1.25rem;
  color: var(--hb-cream);
  margin-bottom: 0.35rem;
}

.hb-footer__tagline {
  font-family: var(--hb-font-ui);
  font-size: 0.875rem;
  opacity: 0.75;
  line-height: 1.55;
}

.hb-footer__nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  font-family: var(--hb-font-ui);
  font-size: 0.875rem;
}

.hb-footer__col h3 {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hb-gold);
  margin-bottom: 0.75rem;
}

.hb-footer__col ul { list-style: none; }

.hb-footer__col a {
  color: rgba(250, 246, 240, 0.78);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  line-height: 1.45;
}

.hb-footer__col a:hover { color: var(--hb-terracotta); }

.hb-footer__bottom {
  max-width: var(--hb-max);
  margin: 0 auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--hb-font-ui);
  font-size: 0.8125rem;
}

.hb-footer__disclaimer { opacity: 0.55; }

@media (max-width: 768px) {
  .hb-nav-toggle { display: flex; }

  .hb-site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    padding: 0.25rem 0 0.75rem;
  }

  .hb-site-nav.is-open { display: flex; }

  .hb-search {
    width: 100%;
    order: 3;
  }

  .hb-footer__top { grid-template-columns: 1fr; }
  .hb-footer__nav { grid-template-columns: 1fr 1fr; }
  .hb-edition-bar { flex-direction: column; gap: 0.25rem; }

  .hb-ad-slot {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  .hb-related-scroller {
    overflow-x: visible;
    scroll-snap-type: none;
    padding: 0 1.25rem;
  }

  .hb-related-track {
    flex-direction: column;
    gap: 0;
    max-width: var(--hb-read);
  }

  .hb-related-slide {
    flex: none;
    width: 100%;
    scroll-snap-align: none;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid rgba(26, 22, 18, 0.08);
  }

  .hb-related-slide:last-child {
    border-bottom: none;
  }

  .hb-related-slide .hb-card-link {
    display: grid;
    grid-template-columns: 88px 1fr;
    grid-template-rows: auto auto;
    gap: 0.2rem 0.85rem;
    align-items: start;
    padding: 0.9rem 0;
  }

  .hb-related-slide img {
    grid-row: 1 / span 2;
    grid-column: 1;
    aspect-ratio: 1;
    border-radius: var(--hb-radius-sm);
  }

  .hb-related-slide h3 {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .hb-related-slide .hb-meta {
    grid-column: 2;
    grid-row: 2;
    padding: 0;
    font-size: 0.75rem;
  }
}

@media (max-width: 640px) {
  .hb-article-hero { margin-left: 0; margin-right: 0; border-radius: var(--hb-radius); }
  .hb-footer__nav { grid-template-columns: 1fr; }
}

@media (min-width: 900px) {
  .hb-article-hero {
    margin-left: calc(-1 * ((100vw - var(--hb-read)) / 2 - 1.25rem));
    margin-right: calc(-1 * ((100vw - var(--hb-read)) / 2 - 1.25rem));
    max-width: min(960px, 92vw);
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--hb-radius);
  }
}
