/* ===========================================================================
 * Home page — masthead hero, "at a glance" strip, magazine story block and
 * the phone quick-link chips. Loaded only by templates/home.html, after
 * site.css. Colours come from the site.css tokens (dark mode included).
 * Desktop first; the two max-width blocks at the end adapt it for tablet
 * (<= 991px, Bootstrap lg) and phone (<= 767px).
 * =========================================================================== */

/* How far the "at a glance" strip overlaps the hero; the hero reserves the
   same space at its foot. Shared by both, so it lives on :root. */
:root { --hero-overlap: 56px; }

.hero {
  --hero-edge: max(var(--s-md), calc((100vw - 1100px) / 2 + var(--s-md)));
  position: relative;
}

/* ---------- Carousel as the masthead's photograph --------------------- */
.hero .hero-carousel .carousel-item {
  height: 78vh;
  min-height: 540px;
  max-height: 760px;
}
.hero .hero-carousel .carousel-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hero-scrim);
  pointer-events: none;
}

/* Caption: a quiet photo credit line, bottom right above the arrows. */
.hero .hero-carousel .carousel-caption {
  left: auto;
  right: var(--hero-edge);
  bottom: calc(var(--hero-overlap) + 84px);
  z-index: 4;
  max-width: 320px;
  padding: 0;
  text-align: right;
  background: none;
  backdrop-filter: none;
  border: 0;
}
.hero .hero-carousel .carousel-caption a { color: inherit; text-decoration: none; }
.hero .hero-carousel .carousel-caption h5 {
  margin: 0 0 2px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-style: italic;
  font-weight: 600;
  color: var(--on-photo);
  text-shadow: var(--photo-text-shadow);
}
.hero .hero-carousel .carousel-caption p {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--on-photo-soft);
  text-shadow: var(--photo-text-shadow);
}

/* Arrows: two round glass buttons, bottom right, clear of the headline. */
.hero .carousel-control-prev,
.hero .carousel-control-next {
  top: auto;
  bottom: calc(var(--hero-overlap) + 24px);
  z-index: 5;
  width: 44px;
  height: 44px;
  border: 1px solid var(--on-photo-rule);
  border-radius: 50%;
  background: var(--photo-glass);
  backdrop-filter: blur(4px);
  opacity: 1;
}
.hero .carousel-control-next { right: var(--hero-edge); }
.hero .carousel-control-prev { left: auto; right: calc(var(--hero-edge) + 54px); }
.hero .carousel-control-prev-icon,
.hero .carousel-control-next-icon { width: 14px; height: 14px; }
.hero .carousel-control-prev:hover,
.hero .carousel-control-next:hover { background: var(--photo-glass-hover); border-color: var(--on-photo); }
.hero .carousel-control-prev:focus-visible,
.hero .carousel-control-next:focus-visible { outline: 2px solid var(--on-photo); outline-offset: 3px; }

/* ---------- Masthead overlay ------------------------------------------ */
.hero-masthead {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  padding-bottom: calc(var(--hero-overlap) + var(--s-lg));
  pointer-events: none;
}
.hero-masthead-inner { width: 100%; }
.hero-masthead-inner > * { max-width: 640px; }
.hero-masthead a { pointer-events: auto; }

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 var(--s-xs);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--on-photo-gold);
  text-shadow: var(--photo-text-shadow);
}
.hero-eyebrow::before {
  content: '';
  width: 36px;
  height: 1px;
  background: var(--on-photo-gold);
}
.hero .hero-title {
  margin: 0 0 var(--s-xs);
  font-size: clamp(2.7rem, 5.4vw + 0.6rem, 5rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--on-photo);
  text-shadow: var(--photo-text-shadow);
}
.hero .hero-title em {
  display: block;
  font-style: italic;
  font-weight: 400;
  color: var(--on-photo-gold);
}
.hero-lede {
  max-width: 36ch;
  margin: 0 0 var(--s-sm);
  font-size: 1.18rem;
  line-height: 1.5;
  color: var(--on-photo-soft);
  text-shadow: var(--photo-text-shadow);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.hero .hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  min-height: 48px;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}
.hero .hero-btn--primary,
.hero .hero-btn--primary:focus {
  background: var(--on-photo);
  color: var(--on-photo-ink);
}
.hero .hero-btn--primary:hover {
  background: var(--on-photo-gold);
  color: var(--on-photo-ink);
  text-decoration: none;
}
.hero .hero-btn--ghost,
.hero .hero-btn--ghost:focus {
  background: var(--photo-glass);
  border-color: var(--on-photo-rule);
  color: var(--on-photo);
  backdrop-filter: blur(4px);
}
.hero .hero-btn--ghost:hover {
  background: var(--photo-glass-hover);
  border-color: var(--on-photo);
  color: var(--on-photo);
  text-decoration: none;
}
.hero .hero-link,
.hero .hero-link:hover,
.hero .hero-link:focus {
  color: var(--on-photo);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--on-photo-gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-shadow: var(--photo-text-shadow);
}
.hero .hero-link:hover { text-decoration-thickness: 2px; }
.hero .hero-btn:focus-visible,
.hero .hero-link:focus-visible {
  outline: 2px solid var(--on-photo-gold);
  outline-offset: 3px;
}

/* ---------- At a glance ------------------------------------------------ */
.glance {
  position: relative;
  z-index: 6;
  margin-top: calc(-1 * var(--hero-overlap));
}
.glance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift);
}
.glance-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px;
  background: var(--surface);
}
.glance-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
}
.glance-tile:hover { background: var(--surface-2); }
.glance-tile:hover::before,
.glance-tile:focus-within::before { transform: scaleX(1); }
.glance-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.glance-label i { margin-right: 4px; }
.glance-tile--alert .glance-label { color: var(--danger); }
.glance-value {
  display: -webkit-box;
  margin: 0 0 6px;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.14rem;
  font-weight: 500;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.glance .glance-link { color: var(--ink); text-decoration: none; }
.glance .glance-link::after { content: ''; position: absolute; inset: 0; }
.glance .glance-tile:hover .glance-link { color: var(--accent); }
.glance-link:focus-visible { outline: none; }
.glance-tile:focus-within { outline: 2px solid var(--accent); outline-offset: -4px; }
.glance-meta {
  position: relative;
  z-index: 1;
  margin: auto 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.glance-meta a { position: relative; z-index: 1; }

/* ---------- Magazine story block --------------------------------------- */
.magazine {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-sm) var(--s-md);
  margin: var(--s-sm) 0 0;
  padding: 0;
  list-style: none;
}
.magazine > .article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 0;
}
.magazine .article-card-media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  background: var(--paper-edge);
  text-decoration: none;
}
.magazine .article-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  object-fit: cover;
}
.article-card-body { padding-top: 14px; }
.magazine .article-card h3 { margin: 0 0 6px; font-size: 1.08rem; line-height: 1.3; }
.magazine .article-card h3 a { color: var(--ink); text-decoration: none; }
.magazine .article-card h3 a:hover { color: var(--accent); }
.magazine .article-card .meta { margin: 0; font-size: 0.82rem; }
.magazine .article-card h3 a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.magazine > .article-card > .badge-members.badge-overlay { top: 10px; left: 10px; }

/* Lead: the big story on the left, spanning the three briefs' height. */
.magazine > .article-card--lead { grid-column: 1 / span 2; grid-row: 1 / span 3; }
.article-card-kicker {
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.magazine .article-card--lead .article-card-body { padding-top: var(--s-xs); }
.magazine .article-card--lead h3 {
  font-size: clamp(1.5rem, 1.2vw + 1.1rem, 2rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
}
.article-card-excerpt {
  margin: 10px 0 0;
  font-size: 1.02rem;
  color: var(--ink-soft);
}

/* Briefs: small picture beside the headline, hairline between them. */
.magazine > .article-card--brief {
  grid-column: 3 / span 2;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: var(--s-sm);
  border-bottom: 1px solid var(--rule);
}
.magazine > .article-card--brief:nth-child(4) { padding-bottom: 0; border-bottom: 0; }
.magazine .article-card--brief .article-card-media {
  flex: 0 0 120px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
}
.article-card--brief .article-card-body { padding-top: 0; }
.magazine > .article-card--brief > .badge-members.badge-overlay { top: 6px; left: 6px; }

/* Tiles: the bottom row of four raised cards. */
.magazine > .article-card--tile {
  overflow: hidden;
  margin-top: var(--s-2xs);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.magazine .article-card--tile .article-card-media { border-radius: 0; }
.article-card--tile .article-card-body { padding: 12px 16px 16px; }
.magazine .article-card--tile h3 a::after { content: ''; position: absolute; inset: 0; }

/* ---------- Phone / tablet quick-link chips --------------------------- */
.quick-chips { margin: var(--s-md) 0 0; }
.quick-chips-title {
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.quick-chips-list {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 2px 2px 10px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.quick-chips-list li { flex: 0 0 auto; scroll-snap-align: start; }
.quick-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
  font-size: 0.92rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.quick-chips .chip i { color: var(--accent); }
.quick-chips .chip:hover { border-color: var(--accent); color: var(--ink); text-decoration: none; }
.quick-chips .chip--accent,
.quick-chips .chip--accent:hover,
.quick-chips .chip--accent:focus {
  color: var(--on-fill);
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}
.quick-chips .chip--accent i { color: var(--on-fill); }
.quick-chips .chip--accent:hover { background: var(--accent-fill-hover); }
.quick-chips .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Motion (only when the reader allows it) ------------------- */
@media (prefers-reduced-motion: no-preference) {
  .glance-tile,
  .glance-tile::before,
  .magazine .article-card-media img,
  .magazine > .article-card--tile,
  .hero .hero-btn,
  .quick-chips .chip {
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
  }
  .magazine .article-card:hover .article-card-media img { transform: scale(1.04); }
  .magazine > .article-card--tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
  .hero .hero-btn:hover { transform: translateY(-1px); }
}

/* ---------- Tablet ----------------------------------------------------- */
@media (max-width: 991px) {
  .glance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .magazine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .magazine > .article-card--lead {
    grid-column: 1 / -1;
    grid-row: auto;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--s-sm);
    align-items: center;
  }
  .magazine .article-card--lead .article-card-body { padding-top: 0; }
  .magazine > .article-card--brief { grid-column: 1 / -1; }
  .magazine > .article-card--brief:nth-child(4) { padding-bottom: var(--s-sm); border-bottom: 1px solid var(--rule); }

  /* Below lg the hero actions reach the right half, so the caption can no
     longer sit above the arrows: it becomes a one-line credit bottom left,
     beside the arrows, under a taller reserve for the masthead. */
  .hero-masthead { padding-bottom: calc(var(--hero-overlap) + 76px); }
  .hero .hero-carousel .carousel-caption {
    left: var(--hero-edge);
    right: calc(var(--hero-edge) + 112px);
    bottom: calc(var(--hero-overlap) + 20px);
    max-width: none;
    text-align: left;
    border: 0;
  }
  .hero .hero-carousel .carousel-caption h5 {
    overflow: hidden;
    font-size: 0.78rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .hero .hero-carousel .carousel-caption p { display: none; }
  .hero .carousel-control-prev,
  .hero .carousel-control-next { bottom: calc(var(--hero-overlap) + 10px); }
}

/* site.css narrows .editorial to --s-xs at 768px; keep the credit line and
   arrows on the same edge as the headline and the glance strip. */
@media (max-width: 768px) {
  .hero { --hero-edge: var(--s-xs); }
}

/* ---------- Phone ------------------------------------------------------ */
@media (max-width: 767px) {
  :root { --hero-overlap: 28px; }
  .hero .hero-carousel .carousel-item {
    height: 76vh;
    min-height: 540px;
    max-height: 680px;
  }
  .hero .hero-carousel .carousel-item::after { background: var(--hero-scrim-narrow); }
  .hero .hero-title { font-size: clamp(2.35rem, 9vw + 0.4rem, 3.2rem); }
  .hero-lede { font-size: 1.02rem; }
  .hero-eyebrow { gap: 10px; font-size: 0.7rem; letter-spacing: 0.16em; }
  .hero-eyebrow::before { width: 24px; }
  .hero .hero-btn { padding: 0 1.2rem; }
  /* Phone edges are tighter than the tablet credit line's. */
  .hero .hero-carousel .carousel-caption { left: var(--s-xs); right: 120px; }
  .hero .carousel-control-next { right: var(--s-xs); }
  .hero .carousel-control-prev { right: calc(var(--s-xs) + 54px); }

  .glance-tile { padding: 14px 14px 12px; }
  .glance-tile::before { left: 14px; right: 14px; }
  .glance-label { font-size: 0.64rem; letter-spacing: 0.12em; }
  .glance-value { font-size: 1rem; }
  .glance-meta { font-size: 0.8rem; }

  .magazine { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .magazine > .article-card--lead { display: flex; align-items: stretch; margin-bottom: var(--s-sm); }
  .magazine .article-card--lead .article-card-body { padding-top: var(--s-xs); }
  .magazine > .article-card--brief,
  .magazine > .article-card--tile {
    grid-column: auto;
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
    margin: 0;
    padding: 14px 0;
    overflow: visible;
    background: none;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
  }
  .magazine > .article-card--brief:nth-child(4) { padding-bottom: 14px; border-bottom: 0; }
  .magazine .article-card--brief .article-card-media,
  .magazine .article-card--tile .article-card-media {
    flex: 0 0 96px;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
  }
  .article-card--tile .article-card-body { padding: 0; }
  .magazine .article-card h3 { font-size: 1.02rem; }
  .magazine .article-card--lead h3 { font-size: 1.45rem; line-height: 1.2; }
  .magazine > .article-card--tile > .badge-members.badge-overlay { top: 20px; left: 6px; }
}
