/*
Theme Name: IBN Insight
Theme URI: https://insurancebusiness.news
Author: Insurance Business News
Description: The blue-and-white newsroom design for Insurance Business News. Lead story with a three-post column, a live rating strip, adverts managed as image slots in the Customizer, and a Spotlight video reel.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: ibn
Tags: news, editorial, custom-colors, custom-menu, featured-images
*/

/* ------------------------------------------------------------------
   WordPress specifics layered on the shared design system.
   assets/css/design.css carries the visual system; this file adds
   only what the CMS needs.
   ------------------------------------------------------------------ */

/* Image adverts: the creative fills the reserved box, nothing else. */
/* A booked creative is shown at its sold size: no padding, no border, so the
   image is never resampled a pixel narrower than the space it was sold. */
.ad-slot .ad-card.has-art {
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  display: block;
  line-height: 0;
}

.ad-slot .ad-card.has-art:hover {
  border-color: var(--blue-500);
  background: transparent;
}

.ad-img {
  display: block;
  width: 100%;
  height: auto;
}

/* The sponsor name is carried by the creative and the "Advertisement" flag, so
   no second label strip is printed under the image. */
.ad-label {
  display: none;
}

/* Empty slots: only editors see the frame, and it names its own size. */
.ad-slot.is-empty .ad-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  min-height: 96px;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  background:
    repeating-linear-gradient(
      -45deg,
      var(--blue-wash),
      var(--blue-wash) 8px,
      #fff 8px,
      #fff 16px
    );
  text-align: center;
}

.ad-slot.is-empty.ad-tall .ad-empty {
  min-height: 200px;
}

.ad-slot.is-empty.ad-rail-bottom .ad-empty {
  min-height: 250px;
}

.ad-empty-size {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-700);
}

.ad-empty-note {
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--muted);
}

.ad-slot.ad-foot {
  margin: 0 auto 1.8rem;
  padding-inline: clamp(1rem, 3vw, 3.5rem);
}

/* Search overlay */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1rem, 6vh, 4rem) 1rem;
  background: rgba(7, 21, 71, 0.42);
  backdrop-filter: blur(6px);
}

.search-panel {
  width: min(640px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.search-bar input {
  flex: 1;
  border: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.search-bar kbd {
  font-family: var(--sans);
  font-size: 0.62rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0.08rem 0.3rem;
  color: var(--muted);
}

.search-results {
  max-height: 52vh;
  overflow-y: auto;
  padding: 0.4rem 0.9rem 0.8rem;
}

.search-hit {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.search-hit:last-child {
  border-bottom: 0;
}

.search-hit strong {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.search-hit:hover strong {
  color: var(--blue-700);
}

.search-hint {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.6rem 0;
}

/* Video lightbox */
.video-overlay[hidden],
.search-modal[hidden] {
  display: none !important;
}

.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(5, 12, 34, 0.82);
}

.video-panel {
  width: min(960px, 100%);
  background: #050c22;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-caption {
  padding: 0.7rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: #cfdaf5;
  cursor: pointer;
}

/* Newsletter success/error */
.form-note.is-success {
  color: #a8f0c8;
}

.form-note.is-error {
  color: #ffc2b0;
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-block: 1.6rem 2.2rem;
}

.pagination .page-numbers {
  font-family: var(--sans);
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--blue-800);
  border-color: var(--blue-800);
  color: #fff;
}

/* Screen reader utility used across templates */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: #fff;
  padding: 0.6rem 1rem;
  font-family: var(--sans);
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Article hero caption */
.article-hero figcaption {
  margin-top: 0.4rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--muted);
}

/* Block editor content inside a story */
.prose > * + * {
  margin-top: 1.05em;
}

.prose h2,
.prose h3 {
  margin-top: 1.6em;
}

.prose img {
  height: auto;
}

.prose blockquote {
  border-left: 2px solid var(--blue-800);
  padding-left: 1rem;
  font-family: var(--display);
  font-size: 1.08rem;
  color: var(--ink);
}

.prose figcaption {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--muted);
}

.prose .wp-block-image {
  margin-block: 1.4rem;
}

.prose a {
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Creatives are never upscaled beyond their booked width — a 970-wide banner
   stays crisp in a 1180 column and simply centres itself. */
.ad-leaderboard .ad-card,
.ad-archive .ad-card,
.ad-foot .ad-card {
  max-width: 970px;
  margin-inline: auto;
}

.ad-billboard .ad-card {
  max-width: 1180px;
  margin-inline: auto;
}

.ad-rail-top .ad-card,
.ad-rail-bottom .ad-card {
  max-width: 300px;
}

.ad-in-article .ad-card {
  max-width: 728px;
  margin-inline: auto;
}

/* A slim 728×90 unit needs less breathing room than a 250-high banner. */
.ad-slot.ad-in-article .ad-card.has-art {
  border: 1px solid var(--line);
}

.ad-slot.ad-in-article .ad-label {
  max-width: 728px;
  margin-inline: auto;
}

/* A picture-less row has no thumb column, so it runs full width instead of
   squeezing the headline into the empty 92px track. */
.story-row.story-row-line {
  grid-template-columns: minmax(0, 1fr);
}

.story-row.story-row-line .story-body {
  min-width: 0;
}

/* The rating strip shows one line at a time; the others are held back until
   the strip advances. */
.rw-lines {
  min-width: 0;
  overflow: hidden;
}

.rw-lines .rw-line {
  display: none;
  text-decoration: none;
}

.rw-lines .rw-line.is-active {
  display: flex;
}

/* A lead story without art gets a branded panel instead of an empty box: the
   wordmark, the desk and the promise of the text below it. */
.lead-figure .fallback-mark {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 100%;
  font-size: 0.68rem;
  background:
    radial-gradient(circle at 78% 18%, rgba(77, 178, 236, 0.5), transparent 58%),
    linear-gradient(150deg, var(--blue-800) 0%, var(--blue-600) 62%, var(--sky) 140%);
  color: #fff;
}

.lead-figure .fallback-wordmark {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.fallback-label {
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.72;
}

/* The mark fills its frame; the design aligns it to the bottom-left corner so
   it reads as a stamped placeholder, not a centred logo. */
.deck-thumb .fallback-mark,
.card-thumb .fallback-mark,
.story-thumb .fallback-mark,
.feature-card figure .fallback-mark {
  min-height: 100%;
}

/* The design already pinches the figure to the card edges; do not restate its
   position here or the image drops back into the flow and stretches the card.

   A lead story with no photograph gets this gradient span in the same place. */
.lead-fallback {
  position: absolute;
  inset: 0;
  display: block;
  background:
    radial-gradient(circle at 72% 22%, rgba(77, 178, 236, 0.55), transparent 60%),
    linear-gradient(150deg, var(--blue-800) 0%, var(--blue-600) 58%, var(--sky) 135%);
}

/* The search field is type="search", so browsers add their own clear button
   next to our close control. Hide the native one. */
.search-bar input[type="search"]::-webkit-search-cancel-button,
.search-bar input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-bar input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

/* ---- Search results page ------------------------------------------ */

.search-page-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-block: 0.4rem 1.4rem;
  max-width: 640px;
}

.search-page-form input[type="search"] {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.search-page-form input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-page-form input[type="search"]:focus {
  outline: 2px solid var(--sky);
  outline-offset: 1px;
}

/* The result count sits at the end of the page head on a desk page; on the
   search page it needs its own line under the form. */
.page-head .result-count {
  display: block;
  margin: 0.35rem 0 0;
}

/* ---- Footer ad sits inside the shell, so it needs vertical air ----- */

.ad-slot.ad-foot {
  padding-block: 0.6rem 1.4rem;
}

/* ---- Subscribe confirmation banner -------------------------------- */

.subscribe-banner {
  font-family: var(--sans);
  font-size: 0.82rem;
  padding: 0.6rem clamp(1rem, 3vw, 3.5rem);
  border-bottom: 1px solid var(--line);
}

.subscribe-banner.is-success {
  background: #eefaf3;
  color: #0f5b3c;
}

.subscribe-banner.is-error {
  background: #fdeee9;
  color: #8a2f14;
}

/* "Desk:" and the desk name are two elements so the gap survives every
   font and zoom level. */
.masthead-desk {
  display: flex;
  align-items: baseline;
  gap: 0.32rem;
}

.masthead-desk span {
  color: var(--ink-2);
}

/* ---- Newsletter box ------------------------------------------------- */
/* The design styles .newsletter and its direct children; the theme adds a
   wrapper so the compact rail version can hide the eyebrow. */

.newsletter-inner {
  display: block;
}

.newsletter-eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fb0ff;
  margin-bottom: 0.3rem;
}

.newsletter-copy p {
  margin-top: 0.4rem;
}

/* In the rail the box is narrow, so the eyebrow is dropped and the copy runs
   under the heading at full width. */
.newsletter-compact .newsletter-eyebrow {
  display: none;
}

.newsletter-compact h2 {
  font-size: 1.1rem;
}

/* ---- Footer -------------------------------------------------------- */
/* The design's footer-top is one four-column band holding the brand and the
   three link columns, so nothing extra is needed here beyond the smaller
   pieces it does not name. */

.footer-mark {
  justify-content: flex-start;
}

.footer-note {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: #8ea3d8;
}

@media (max-width: 720px) {
  .footer-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Page intro (desk and archive pages) --------------------------- */

.page-intro {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 58ch;
  margin-top: 0.6rem;
}

/* ---- A single article's rail --------------------------------------- */

.article-rail .rail-block h2 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.article-single {
  min-width: 0;
}

/* ---- Market band currency suffix ----------------------------------- */
/* The design prints the unit after the figure at a smaller size ("2.20L cr"),
   so the suffix trails the number rather than leading it. */

.risk-stat .currency {
  font-size: 0.62em;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-left: 0.14em;
  opacity: 0.78;
}

/* ---- Desk initial for a story row without a picture ----------------- */

.story-thumb .thumb-initial {
  display: grid;
  place-items: center;
  height: 100%;
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--sky);
  background: var(--sky-wash);
}

/* ---- Header utilities ---------------------------------------------- */

/* The date and secondary links in the top bar go on narrow screens; the
   subscribe button and market ticker stay. */
.hide-sm {
  display: inline-flex;
}

@media (max-width: 620px) {
  .topbar .hide-sm {
    display: none;
  }
}
