/**
 * Hero Banner Component
 */

.doghouse-hero-banner {
  position: relative;
  overflow: hidden;
  padding: var(--site-space-3xl) 0;
  min-height: 50vh;
  display: flex;
  align-items: center;
}

.doghouse-hero-banner--dark {
  background-color: var(--site-color-bg-primary);
}

.doghouse-hero-banner--default {
  background-color: var(--site-color-bg-primary);
}

.doghouse-hero-banner--light {
  background-color: var(--site-color-bg-surface);
}

.doghouse-hero-banner__container {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: var(--site-space-2xl);
}

@media (min-width: 992px) {
  /* Media only — content left, media right */
  .doghouse-hero-banner--has-media:not(.doghouse-hero-banner--has-components) .doghouse-hero-banner__container {
    grid-template-columns: 1fr 1fr;
  }

  /* Components only OR has-both — content left, component rail right.
   * In has-both, the image renders as an absolutely positioned background. */
  .doghouse-hero-banner--has-components .doghouse-hero-banner__container {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  /* Image + components, image-as-background OFF — content + image share
   * the top row (2 columns), component rail drops to a full-width row below. */
  .doghouse-hero-banner--components-below .doghouse-hero-banner__container {
    grid-template-columns: 1fr 1fr;
  }

  .doghouse-hero-banner--components-below .doghouse-hero-banner__aside {
    grid-column: 1 / -1;
    margin-top: var(--site-space-2xl);
  }
}

/* Container needs to sit above the background image */
.doghouse-hero-banner--has-both .doghouse-hero-banner__container {
  position: relative;
  z-index: 1;
}

/* Background image — fills the section, with a left-heavy gradient veil
 * so heading/body text stays legible. Mirrors the article variant. */
.doghouse-hero-banner__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.doghouse-hero-banner__background div,
.doghouse-hero-banner__background picture {
  width: 100%;
  height: 100%;
  display: block;
}

.doghouse-hero-banner__background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.doghouse-hero-banner__background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--site-color-bg-primary) 72%, transparent);
}

@media (min-width: 992px) {
  .doghouse-hero-banner__background::after {
    background: linear-gradient(
      to right,
      var(--site-color-bg-primary) 0%,
      color-mix(in srgb, var(--site-color-bg-primary) 92%, transparent) 35%,
      color-mix(in srgb, var(--site-color-bg-primary) 40%, transparent) 60%,
      transparent 90%
    );
  }
}

/* Component rail — neutralise stats_section's own section padding so it
 * sits flush in the grid cell (matches the article variant). */
.doghouse-hero-banner__aside {
  align-self: center;
  width: 100%;
}

.doghouse-hero-banner__aside .doghouse-stats-section {
  padding: 0;
  max-width: none;
  margin: 0;
  border: 0;
}

/* When the hero has a background image AND a stats section in the rail,
 * give the rail a frosted panel so the numbers stay readable against the
 * image. Project meta has its own treatment, so we scope this to stats. */
.doghouse-hero-banner--has-both .doghouse-hero-banner__aside:has(.doghouse-stats-section) {
  background: color-mix(in srgb, var(--site-color-bg-primary) 55%, transparent);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid color-mix(in srgb, var(--site-color-text-white) 12%, transparent);
  border-radius: var(--site-radius-lg);
  padding: var(--site-space-xl);
}

/* Project Meta — constrain to the right rail at ≥992px, but only when the
 * aside actually sits in the right column (components-below puts it on a
 * full-width row, where 340px right-aligned would look stranded). */
@media (min-width: 992px) {
  .doghouse-hero-banner--has-components:not(.doghouse-hero-banner--components-below) .doghouse-hero-banner__aside .doghouse-project-meta {
    max-width: 340px;
    margin-left: auto;
    margin-right: 0;
  }
}

/* Award badge — case study hero only, surfaced when the node's
   field_won_award is set. Matches the teaser pill style. */
.doghouse-hero-banner__award-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid var(--site-color-amber, #d99540);
  border-radius: 3px;
  color: var(--site-color-amber, #d99540);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  padding: 0.3em 0.65em;
  margin-bottom: var(--site-space-md);
  text-transform: uppercase;
  font-weight: var(--site-fw-semibold, 600);
  line-height: 1.4;
}

.doghouse-hero-banner__award-badge i {
  font-size: 1rem;
  line-height: 0;
}

/* Badge */
.doghouse-hero-banner__badge {
  color: var(--dh-accent, var(--site-color-primary));
  font-family: var(--site-font-mono);
  font-size: var(--site-label-font-size);
  font-weight: var(--site-fw-semibold);
  letter-spacing: 0.15em;
  margin-bottom: var(--site-space-lg);
  text-transform: uppercase;
}

.doghouse-hero-banner__badge::before {
  content: '';
  display: inline-block;
  width: 2rem;
  height: 1px;
  background-color: currentColor;
  vertical-align: middle;
  margin-right: var(--site-space-sm);
}

/* Heading */
.doghouse-hero-banner__heading {
  color: var(--site-color-text-white);
  font-size: clamp(2.25rem, 4.5vw, 3.75rem);
  font-weight: var(--site-fw-extrabold);
  line-height: 1.05;
  margin-bottom: var(--site-space-lg);
}

/* Accent the last word — color controlled by field_accent_color.
   Falls through to node-level --dh-accent if the hero banner has no accent set. */
.doghouse-hero-banner__heading .doghouse-hero-accent {
  color: var(--hero-accent-color, var(--dh-accent, var(--site-color-coral)));
}

.doghouse-hero-banner--accent-coral  { --hero-accent-color: var(--site-color-coral); }
.doghouse-hero-banner--accent-amber  { --hero-accent-color: var(--site-color-amber); }
.doghouse-hero-banner--accent-pink   { --hero-accent-color: var(--site-color-pink); }
.doghouse-hero-banner--accent-teal   { --hero-accent-color: var(--site-color-primary); }
.doghouse-hero-banner--accent-purple { --hero-accent-color: var(--site-color-secondary); }

/* Gradient accent presets — applied via background-clip: text */
.doghouse-hero-banner--accent-amber_glow .doghouse-hero-accent,
.doghouse-hero-banner--accent-coral_to_pink .doghouse-hero-accent,
.doghouse-hero-banner--accent-teal_to_sky .doghouse-hero-accent {
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.doghouse-hero-banner--accent-amber_glow .doghouse-hero-accent {
  background-image: linear-gradient(135deg, var(--site-color-amber) 0%, #FFD93D 100%);
}

.doghouse-hero-banner--accent-coral_to_pink .doghouse-hero-accent {
  background-image: linear-gradient(135deg, var(--site-color-coral) 0%, var(--site-color-pink) 100%);
}

.doghouse-hero-banner--accent-teal_to_sky .doghouse-hero-accent {
  background-image: linear-gradient(135deg, var(--site-color-primary) 0%, #5FD4E0 100%);
}

/* Body */
.doghouse-hero-banner__body {
  color: var(--site-color-text-body);
  font-size: var(--site-body-font-size);
  line-height: var(--site-body-line-height);
  margin-bottom: var(--site-space-xl);
  max-width: 540px;
}

/* Inline <code> inherits the node accent when one is set, falls back to default. */
.doghouse-hero-banner__body code {
  color: var(--dh-accent, var(--site-color-secondary));
  border-color: var(--dh-accent, var(--site-color-border-subtle));
  display: inline-block;
  margin: 0.25em;
}

/* Logo — sits beneath the body. Wrapped in <a> when field_logo_link is set. */
.doghouse-hero-banner__logo {
  margin-bottom: var(--site-space-xl);
}

.doghouse-hero-banner__logo img,
.doghouse-hero-banner__logo svg {
  display: block;
  height: auto;
}

.doghouse-hero-banner__logo-link {
  display: inline-block;
  transition: opacity var(--site-transition-base, 200ms ease);
}

.doghouse-hero-banner__logo-link:hover,
.doghouse-hero-banner__logo-link:focus-visible {
  opacity: 0.7;
}

/* Action links — buttons use .dh-button utility.
   Override --dh-btn-accent here so primary picks up the hero's accent
   before falling through to the node-level --dh-accent. */
.doghouse-hero-banner__actions {
  --dh-btn-accent: var(--hero-accent-color, var(--dh-accent, var(--site-color-coral)));
  display: flex;
  gap: var(--site-space-base);
  flex-wrap: wrap;
}

@media (max-width: 576px) {
  .doghouse-hero-banner {
    padding: var(--site-space-2xl) 0;
    min-height: auto;
  }
}

/* ============================================
   HERO MEDIA — RHS image/SVG display
   ============================================ */

.doghouse-hero-banner__media {
  width: 100%;
  height: 100%;
  justify-content: center;
  margin: 0 auto;
  display: flex;
}

.doghouse-hero-banner__media--svg {
  align-items: center;
}

.doghouse-hero-banner__media > div {
  width: 100%;
}

/* Raster image — cover the cell, cropping if needed. */
.doghouse-hero-banner__media .hero-banner--image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: var(--site-radius-lg);
}

/* SVG — preserve aspect ratio, don't crop. */
.doghouse-hero-banner__media .hero-banner--svg {
  width: 100%;
  height: auto;
  max-height: 100%;
  display: block;
  align-self: center;
  margin: auto;
}

@media (min-width: 992px) {
  .doghouse-hero-banner__media {
    margin: 0;
  }
}

/* ──────────────────────────────────────────────────────────────
 * Article Variant
 * Editorial layout: serif heading with italic accent word,
 * breadcrumbs, meta row, optional right-rail component or
 * full-bleed cover image.
 * ────────────────────────────────────────────────────────────── */

.doghouse-hero-banner--article {
  --article-serif: 'DM Serif Display', 'Fraunces', Georgia, serif;
  --article-accent: var(--dh-accent, var(--site-color-coral));
  --ac-dim: color-mix(in srgb, var(--article-accent) 18%, transparent);
  position: relative;
  display: block;
  min-height: 0;
  padding: var(--site-space-2xl) 0;
  overflow: hidden;
  background: radial-gradient(ellipse 70% 60% at 60% 0%, var(--ac-dim), transparent 70%);
}

.doghouse-hero-banner--article .doghouse-hero-banner__container {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: start;
  max-width: var(--site-container-max-width);
  margin: 0 auto;
  padding: 0 var(--site-container-padding);
}

.doghouse-hero-banner--article-with-image .doghouse-hero-banner__container {
  padding: 0 var(--site-space-sm);
}

@media (min-width: 992px) {
  .doghouse-hero-banner--article-with-component .doghouse-hero-banner__container {
    gap: 0 var(--site-space-2xl);
    grid-template-columns: minmax(0, 1fr) 280px;
  }
}

/* Breadcrumbs — span the full container width so the right-rail component
 * lines up with the eyebrow row, not the crumb row. */
.doghouse-hero-banner--article .doghouse-hero-banner__breadcrumbs {
  grid-column: 1 / -1;
  font-family: var(--site-font-mono);
  font-size: 0.8rem;
  color: var(--site-color-text-label);
  margin-bottom: var(--site-space-lg);
}

.doghouse-hero-banner--article .doghouse-hero-banner__breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.doghouse-hero-banner--article .doghouse-hero-banner__breadcrumbs li {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0;
}

.doghouse-hero-banner--article .doghouse-hero-banner__breadcrumbs li + li::before {
  content: '/';
  margin: 0 var(--site-space-sm);
  color: var(--site-color-text-label);
  opacity: 0.6;
}

.doghouse-hero-banner--article .doghouse-hero-banner__breadcrumbs a {
  color: var(--site-color-text-label);
  text-decoration: none;
  transition: color 150ms ease;
}

.doghouse-hero-banner--article .doghouse-hero-banner__breadcrumbs a:hover {
  color: var(--site-color-text-lead);
}

/* Eyebrow — reuse __badge, strip the default horizontal rule */
.doghouse-hero-banner--article .doghouse-hero-banner__eyebrow {
  font-family: var(--site-font-mono);
  font-size: 0.75rem;
  font-weight: var(--site-fw-semibold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--article-accent);
  margin-bottom: var(--site-space-md);
}

/* Heading — serif, editorial scale */
.doghouse-hero-banner--article .doghouse-hero-banner__heading {
  font-family: var(--article-serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--site-color-text-white);
  margin: 0 0 var(--site-space-lg);
  max-width: 18ch;
}

.doghouse-hero-banner--article .doghouse-hero-banner__heading-accent {
  font-family: var(--article-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--article-accent);
}

/* Body */
.doghouse-hero-banner--article .doghouse-hero-banner__body {
  color: var(--site-color-text-body);
  font-size: var(--site-body-font-size);
  line-height: var(--site-body-line-height);
  margin-bottom: var(--site-space-xl);
  max-width: 42rem;
}

.doghouse-hero-banner--article .doghouse-hero-banner__body p {
  margin: 0 0 var(--site-space-sm);
}

.doghouse-hero-banner--article .doghouse-hero-banner__body p:last-child {
  margin-bottom: 0;
}

/* Meta row */
.doghouse-hero-banner--article .doghouse-hero-banner__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--site-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--site-color-text-label);
  margin-bottom: var(--site-space-xl);
}

.doghouse-hero-banner--article .doghouse-hero-banner__meta-item {
  display: inline-flex;
  align-items: center;
}

.doghouse-hero-banner--article .doghouse-hero-banner__meta-item + .doghouse-hero-banner__meta-item::before {
  content: '•';
  margin: 0 var(--site-space-md);
  color: var(--article-accent);
}

/* Back button */
.doghouse-hero-banner--article .doghouse-hero-banner__back {
  font-family: var(--site-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  padding: 0.75rem 1.25rem;
}

/* Component column (right rail) — neutralise the stats_section's own
 * container padding/max-width so it sits flush in the grid cell. */
.doghouse-hero-banner--article .doghouse-hero-banner__aside {
  align-self: start;
  width: 100%;
}

.doghouse-hero-banner--article .doghouse-hero-banner__aside .doghouse-stats-section {
  padding: 0;
  max-width: none;
  margin: 0;
  border: 0;
}

/* ── Image-fill variant ─────────────────────────────────────── */

/* Subtle rounded frame around the whole hero, mirroring design 2. */
.doghouse-hero-banner--article-with-image {
  border: 1px solid var(--site-color-border-subtle);
  border-radius: var(--site-radius-lg);
  margin: var(--site-space-xl) var(--site-container-padding);
  padding: var(--site-space-base);
  background: var(--site-color-bg-primary);
}

@media (min-width: 1280px) {
  .doghouse-hero-banner--article-with-image {
    margin-left: auto;
    margin-right: auto;
    max-width: calc(var(--site-container-max-width) - var(--site-container-padding) * 2);
    padding: var(--site-space-2xl) var(--site-space-xl);
  }
}

/* Background image fills the frame (clipped by the rounded container). */
.doghouse-hero-banner--article .doghouse-hero-banner__background {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.doghouse-hero-banner--article .doghouse-hero-banner__background :is(.field, .field__item, picture) {
  width: 100%;
  height: 100%;
  display: block;
}

.doghouse-hero-banner--article .doghouse-hero-banner__background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Dark veil over the image so text stays legible across every breakpoint.
 * Mobile: a flat scrim; ≥992px: a left-heavy gradient that lets the image
 * show through on the right (matching design 2). */
.doghouse-hero-banner--article-with-image .doghouse-hero-banner__background::after {
  content: '';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--site-color-bg-primary) 72%, transparent);
}

@media (min-width: 992px) {
  .doghouse-hero-banner--article-with-image .doghouse-hero-banner__background::after {
    background: linear-gradient(
      to right,
      var(--site-color-bg-primary) 0%,
      color-mix(in srgb, var(--site-color-bg-primary) 92%, transparent) 35%,
      color-mix(in srgb, var(--site-color-bg-primary) 40%, transparent) 60%,
      transparent 90%
    );
  }
}

