/* =============================================================
   BBI - Reusable components
   assets/css/components.css

   Brand-aligned building blocks consumed by every template:
     - .bbi-category-label   (solid blue pill, white uppercase text)
     - .bbi-button           (primary black, --green CTA modifier)
     - .bbi-meta             (author / date small caps)
     - .bbi-section-heading  (uppercase eyebrow + rule)
     - .bbi-card             (base card; full layouts live in
                              template-specific CSS in Phase 5+)
     - .bbi-input            (form field, used by newsletter)
     - .bbi-trending-heading (Trending eyebrow in accent blue)
     - .bbi-link             (text link variants)
     - .bbi-chrome-btn      (MENU / CHARTS — global header + home intro)

   Section / template-specific compositions go in the matching
   home.css, single.css, etc.
   ============================================================= */

/* -------------------------------------------------------------
   Chrome actions — MENU + CHARTS (Figma: Neue Haas Grotesk Display Pro 18px / 700,
   line-height 100%, letter-spacing 0%). Shared by .site-header and
   .bbi-intro topbar via the same class on the element.
   ------------------------------------------------------------- */

.bbi-chrome-btn {
  display: inline-block;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  /* Strict typography requested by design team */
  font-family: var(--font-chrome) !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  line-height: 100% !important;
  letter-spacing: 0% !important;
  text-transform: uppercase;
  text-align: center;
}

/* -------------------------------------------------------------
   Category label - small black pill
   Figma: 122x27 black rectangle, "TOP STORY" / "MUSIC NEWS" in
   Eroika Slab Regular 12px, white, letter-spacing 2.4px (0.2em),
   centred vertically. Used for hero + every card.
   ------------------------------------------------------------- */

.bbi-category-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 7px;
  box-sizing: border-box;
  background-color: var(--color-category);
  color: var(--color-category-text);
  font-family: var(--font-slab);
  font-size: var(--font-size-xs);
  /* 12px */
  font-weight: var(--font-weight-regular);
  font-style: normal;
  letter-spacing: var(--letter-spacing-widest);
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--button-radius);
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.bbi-category-label--outline {
  background-color: transparent;
  color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-text);
}

/* Category label rendered ON TOP of the article hero image (used in
   the home hero section); the pill itself is the same black square. */
.bbi-category-label--on-image {
  position: absolute;
  z-index: 2;
}

/* -------------------------------------------------------------
   Meta line (article byline + date)
   Figma: 12px Azeret Mono Regular, uppercase, tracking 1.2px (0.1em),
   colour #6b6b6b (--color-byline).
   ------------------------------------------------------------- */

.bbi-meta {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  /* 12px */
  font-weight: var(--font-weight-regular);
  letter-spacing: var(--letter-spacing-wider);
  /* 0.1em ~ 1.2px */
  text-transform: uppercase;
  color: var(--color-byline);
  line-height: 1.4;
  margin: 0;
}

.bbi-meta a {
  color: inherit;
  text-decoration: none;
}

/* Article card author lines — fixed 12px on desktop, tablet, and mobile. */
.bbi-hero__author,
.bbi-card--latest .bbi-card__meta,
.bbi-card--global .bbi-card__byline,
.bbi-card--category .bbi-card__author,
.bbi-card--author .bbi-card__author,
.bbi-card--similar .bbi-card__author {
  font-size: var(--bbi-card-author-size);
}

.bbi-meta__sep::before {
  content: "\2022";
  margin-inline: var(--space-2);
  color: var(--color-byline);
}

/* -------------------------------------------------------------
   Section heading (Latest News, Global News, YouTube Shorts...).
   Figma: 50px Neue Haas Grotesk Display Pro 75 Bold uppercase,
   black, tracking -1px (~ -0.02em). No bottom border by default
   to match the design.
   ------------------------------------------------------------- */

.bbi-section-heading {
  font-family: var(--font-display);
  font-size: var(--font-size-3xl);
  /* 50px desktop, scales via tokens.css */
  font-weight: var(--font-weight-bold);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-tighter);
  margin: 0 0 var(--space-8);
  padding-block-end: 0;
  border-block-end: 0;
  color: var(--color-text);
  /* Allow long category names to wrap rather than overflow on small
     viewports. */
  overflow-wrap: break-word;
}

.bbi-section-heading--center {
  text-align: center;
}

.bbi-section-heading--plain {
  border-block-end: 0;
  padding-block-end: 0;
}

@media (max-width: 767px) {
  .bbi-section-heading {
    margin: 0 0 var(--space-6);
  }
}

/* -------------------------------------------------------------
   Trending heading (sidebar on single.php) - accent blue
   ------------------------------------------------------------- */

.bbi-trending-heading {
  font-family: var(--type-trending-heading-font);
  font-size: var(--type-trending-heading-size);
  font-weight: var(--type-trending-heading-weight);
  line-height: var(--type-trending-heading-line-height);
  letter-spacing: var(--type-trending-heading-letter-spacing);
  text-transform: uppercase;
  color: var(--color-trending);
  margin: 0;
  font-synthesis: none;
}

/* -------------------------------------------------------------
   Buttons
   Default = black background, white text.
   --green modifier = neon green background, black text (newsletter).
   --ghost modifier = transparent, current-colour outline.
   --link modifier = inline-text-like.
   ------------------------------------------------------------- */

.bbi-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-text);
  color: var(--color-background);
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  border-radius: var(--button-radius);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  min-height: 44px;
  /* touch target */
}

.bbi-button:active {
  transform: translateY(1px);
}

.bbi-button:disabled,
.bbi-button[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.bbi-button--green {
  background-color: var(--color-cta);
  color: var(--color-cta-text);
}

.bbi-button--ghost {
  background-color: transparent;
  color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-text);
}

.bbi-button--block {
  width: 100%;
}

.bbi-button--small {
  padding: var(--space-2) var(--space-4);
  min-height: 36px;
}

/* "Show more" / "Show less" toggle used on Latest News. */
.bbi-button--toggle {
  margin: var(--space-8) auto 0;
  display: flex;
}

/* -------------------------------------------------------------
   Form inputs (newsletter, search, theme-options-front)
   ------------------------------------------------------------- */

.bbi-input {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--font-size-base);
  line-height: 1.4;
  border: 1px solid var(--color-text);
  border-radius: var(--button-radius);
  min-height: 44px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.bbi-input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.bbi-input:focus {
  outline: 0;
  border-color: var(--color-accent-blue);
  box-shadow: inset 0 0 0 1px var(--color-accent-blue);
}

.bbi-input--inverse {
  background-color: transparent;
  color: var(--color-background);
  border-color: var(--color-background);
}

.bbi-input--inverse::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.bbi-input--inverse:focus {
  border-color: var(--color-accent-green);
  box-shadow: inset 0 0 0 1px var(--color-accent-green);
}

/* Form field cluster: input flush against button. */
.bbi-field-group {
  display: flex;
  width: 100%;
}

.bbi-field-group>.bbi-input {
  flex: 1 1 auto;
  min-width: 0;
}

.bbi-field-group>.bbi-button {
  flex: 0 0 auto;
}

@media (max-width: 479px) {
  .bbi-field-group {
    flex-direction: column;
    gap: var(--space-2);
  }
}

/* -------------------------------------------------------------
   Social icons (footer rail + article byline)
   Equal box size; SVG glyphs share a normalized 24×24 viewBox.
   ------------------------------------------------------------- */

.site-footer__social-link,
.bbi-article-social-rail__link,
.site-header__col--right .bbi-article-social-rail--header-bar .bbi-article-social-rail__link {
  flex-shrink: 0;
}

.site-footer__social-link .bbi-icon-svg,
.bbi-article-social-rail__link .bbi-icon-svg,
.site-header__col--right .bbi-article-social-rail--header-bar .bbi-article-social-rail__link .bbi-icon-svg {
  display: block;
  flex-shrink: 0;
  overflow: visible;
  width: var(--bbi-social-icon-size) !important;
  height: var(--bbi-social-icon-size) !important;
  max-width: none;
  max-height: none;
}

/* Article byline rail (mobile) — slightly smaller, still optically matched. */
.bbi-article-header__byline .bbi-article-social-rail--byline .bbi-article-social-rail__link .bbi-icon-svg {
  width: var(--bbi-social-icon-size-compact) !important;
  height: var(--bbi-social-icon-size-compact) !important;
}

/* Ensure interactive controls meet the 44×44 touch-target guideline on
   touch devices. Desktop hover-capable browsers are unaffected. The
   `.bbi-chrome-btn` is text-only, so use min-height/min-width via
   padding rather than overriding the strict typography from Figma. */
@media (hover: none) and (pointer: coarse) {
  .bbi-button,
  .bbi-icon-button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Large tap target; glyph size stays on the --bbi-social-icon-* tokens. */
  .site-footer__social-link,
  .bbi-article-social-rail__link {
    min-height: 44px;
    min-width: 44px;
  }

  /*
   * Mobile social rows — 8px icon spacing (single.css, footer.css).
   * Do not inflate flex items to 44px or gap visually grows without bound.
   */
  @media (max-width: 767px) {
    .bbi-article-header__byline .bbi-article-social-rail--byline .bbi-article-social-rail__link,
    .site-footer__col--social .site-footer__social-link {
      min-width: 0;
      min-height: 0;
    }
  }

  /* Tablet footer: 10px vertical icon gap — do not inflate links to 44px. */
  @media (min-width: 768px) and (max-width: 1199px) {
    .site-footer__col--social .site-footer__social-link {
      min-width: 0;
      min-height: 0;
    }
  }

  /* Header social rail — keep 10px horizontal gap; glyph size stays on tokens. */
  .site-header__col--right .bbi-article-social-rail--header-bar .bbi-article-social-rail__link {
    min-width: 0;
    min-height: 0;
  }

  .bbi-button--small {
    min-height: 40px;
  }

  .bbi-chrome-btn,
  .site-footer__list a {
    /* Expand the click box without changing the visible text size. */
    padding-block: 8px;
  }
}

/* -------------------------------------------------------------
   Card base
   Generic card primitives. Each card variant (latest-news,
   global-news, similar, author-grid) extends this in its own
   template-part stylesheet.
   ------------------------------------------------------------- */

.bbi-card {
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  border: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
  height: 100%;
}

.bbi-card__media {
  position: relative;
  background-color: var(--color-gray-100);
  overflow: hidden;
}

/* Black stripe on image top (Figma 113:610) — global news cards only.
   z-index 1 sits above the photo but behind the category pill (card z-index 3). */
.bbi-card--global .bbi-card__media::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 9px;
  background-color: var(--color-black);
  z-index: 1;
  pointer-events: none;
}

.bbi-card__media img,
.bbi-thumbnail-focus {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

/* Focal point defaults to centre when not set inline on the element. */
.bbi-thumbnail-focus:not([style*="object-position"]) {
  object-position: 50% 50%;
}

.bbi-card:hover .bbi-card__media img,
.bbi-card:focus-within .bbi-card__media img {
  transform: scale(1.04);
}

.bbi-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-block-start: var(--space-3);
}

.bbi-card__title {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  /* 24px */
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--color-text);
  margin: 0;
}

.bbi-card__title a {
  color: inherit;
  text-decoration: none;
}

.bbi-card__title a:hover,
.bbi-card__title a:focus-visible {
  color: inherit;
}

.bbi-card__excerpt {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-muted);
  margin: 0;
}

/* -------------------------------------------------------------
   Links
   ------------------------------------------------------------- */

.bbi-link {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color var(--transition-fast);
}

.bbi-link--reset {
  text-decoration: none;
}

.bbi-link--ui {
  font-family: var(--font-ui);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  text-decoration: none;
}

.bbi-link--ui::after {
  content: "\2192";
  display: inline-block;
  margin-inline-start: var(--space-1);
  transition: transform var(--transition-fast);
}

.bbi-link--ui:hover::after,
.bbi-link--ui:focus-visible::after {
  transform: translateX(4px);
}

/* -------------------------------------------------------------
   Icon button (Menu, Charts, social, carousel arrows)
   ------------------------------------------------------------- */

.bbi-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: transparent;
  color: var(--color-text);
  border: 0;
  border-radius: var(--button-radius);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.bbi-icon-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background-color: transparent !important;
  color: var(--color-text) !important;
}

.bbi-icon-button--inverse {
  color: var(--color-background);
}

/* -------------------------------------------------------------
   Divider with neon-green tick (used in ticker + section breaks)
   ------------------------------------------------------------- */

.bbi-divider {
  display: inline-block;
  width: 1px;
  height: 1em;
  background-color: var(--color-ticker-divider);
  vertical-align: middle;
  margin-inline: var(--space-3);
}