/*
 * BCA Champion - supplementary styles for markup the base stylesheet doesn't already cover.
 * Uses the same design tokens defined in theme.css.
 */

.bca-form { display: grid; gap: 1rem; max-width: 560px; margin-top: 2rem; }
.bca-form label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text); }
.bca-form input, .bca-form textarea { width: 100%; }
.form-success { padding: 1rem 1.25rem; margin-top: 1.5rem; background: var(--band); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; }
.form-errors { padding: 1rem 1.25rem; margin-top: 1.5rem; background: var(--band); border-left: 4px solid #c0392b; border-radius: 0 var(--radius) var(--radius) 0; color: #c0392b; }
.form-errors p { margin: 0.25rem 0; }

.legacy-image { max-width: 100%; height: auto; border-radius: var(--radius-lg); }

.none-found { text-align: center; padding-block: clamp(2rem, 5vw, 4rem); }
.none-found .search-form { margin: 1.5rem auto 0; }

/* Homepage stat tiles reuse .dates__value/.dates__label typography inside .stats/.stat */
.stat { text-align: center; }

/*
 * Safety net: theme.css only sizes the .chev icon inside specific parents it expects
 * (.btn, .arrow-link, .hero__facts, .category__go, ...). Any other context - notably the
 * breadcrumb separators added across single/archive templates - left the bare SVG unsized,
 * which browsers then blow up to a huge intrinsic size (visible as a giant diagonal shape).
 * This is the one global fallback so it can never happen again regardless of where bca_chev()
 * is called from.
 */
svg.chev { display: inline-block; width: 0.55em; height: 0.85em; vertical-align: -0.05em; flex: none; }
.breadcrumbs svg.chev { width: 0.45em; height: 0.7em; color: var(--text-dim); }

/*
 * Legacy SiteOrigin Page Builder content (see inc/legacy-content.php). A handful of pages -
 * Home, Judges, Why Sponsor, Meet the Team, Book Now, Why Enter and one event page - still carry
 * their content in this old builder's row/column markup (.panel-layout > .panel-grid >
 * .panel-grid-cell > .so-panel). The plugin itself isn't installed, so without these rules every
 * row's cells fall back to plain block stacking regardless of how many columns the row was
 * originally built with - readable, but visually rough (icons and text just piling up one under
 * another). This turns each row back into a proper flex row: cells that are just an icon/number
 * stay compact and centred, cells with body text take the remaining width.
 */
.panel-layout { display: flex; flex-direction: column; gap: clamp(1.75rem, 4vw, 2.75rem); margin: 0 0 clamp(2rem, 4vw, 3rem); }
/* SiteOrigin wraps a row's cells in an extra ".panel-row-style" div whenever the row has any
   background/style setting, so the flex row has to apply on whichever of these two actually
   holds the .panel-grid-cell children - it's .panel-grid for plain rows, .panel-row-style for
   styled ones - not on .panel-grid unconditionally (that div may only ever wrap that one child). */
.panel-grid, .panel-row-style { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem clamp(1.5rem, 3vw, 2.5rem); width: 100%; }
.panel-grid-cell { flex: 3 1 280px; min-width: 0; }
.panel-grid-cell:has(> .so-panel > .legacy-image) { flex: 0 1 auto; }
.panel-grid-cell:has(#large-h3) { flex: 0 1 auto; }
.panel-grid .legacy-image { max-width: 180px; margin: 0 auto; }
.panel-layout h2 { margin: 0 0 0.25em; }
.panel-layout h3 { margin: 0; font-size: var(--step-1); line-height: 1.35; }
#large-h3 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1; color: var(--accent); text-align: center; }
.we-etd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 48px; padding: 0.75em 1.5em;
  font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; letter-spacing: 0.01em;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap; background: var(--accent); color: var(--on-accent);
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.we-etd-btn:hover { background: var(--accent-hover); box-shadow: 0 0 28px var(--glow); }
@media (max-width: 640px) {
  .panel-grid-cell { flex-basis: 100%; }
  .panel-grid .legacy-image { max-width: 130px; }
}

/*
 * theme.css only constrains embedded iframes (YouTube etc, e.g. the judge-spotlight pages under
 * /awards/) to max-width:100% - the height stays at whatever fixed pixel value the embed code
 * saved (usually 315), so on a narrower screen the video shrinks in width but not height and
 * looks squashed. Every embed in this content is a 16:9 video, so lock that ratio and let the
 * height follow the width instead.
 */
.entry-content iframe { width: 100%; max-width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: var(--radius-lg); }

/*
 * theme.css caps every direct child of .entry-content to a readable text measure via
 * `max-width: var(--measure)`, which is a `ch`-unit value - `ch` is relative to the element's
 * OWN font-size, not the page's. NextGEN Gallery's frontend CSS sets `font-size: 0` on its
 * `.ngg-galleryoverview` wrapper (a standard trick to remove the whitespace gaps that appear
 * between inline-block thumbnail tiles), which makes that `ch`-based max-width resolve to 0 and
 * silently collapses the entire gallery to nothing - no error, the images are all still in the
 * DOM, just zero width. Exempt it so it can use the width NextGEN itself sets (100%).
 */
.entry-content > .ngg-galleryoverview { max-width: none; }
/* theme.css also caps .entry-content itself at a fixed 780px (its blog-post reading width) -
   that rule doesn't know or care what's inside, so a gallery page needs the same exemption. */
.entry-content:has(> .ngg-galleryoverview) { max-width: none; }

/*
 * Reskin NextGEN's own default thumbnail grid (Awards Highlights pages) to match this theme's
 * existing .gallery__item component instead of the plugin's bare, edge-to-edge 1990s-tribute-page
 * tiles - rounded corners, real gaps between tiles, the same hover-zoom every other photo grid on
 * the site uses. All scoped to NextGEN's own classes so the plugin itself is untouched.
 */
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail-box { padding: 0.4rem; }
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail { background: none; }
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail a {
  display: block; margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: none;
  background: var(--surface-2);
}
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail-img {
  transition: transform var(--slow) var(--ease); opacity: 1 !important;
}
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail a:hover .ngg-gallery-thumbnail-img,
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail a:focus-visible .ngg-gallery-thumbnail-img {
  transform: scale(1.04);
}
.ngg-galleryoverview.default-view .ngg-gallery-thumbnail a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Homepage blocks added from the client's content doc (template-parts/home/why-enter.php, judges.php, grand-final.php). */
.home-why__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.75rem); }
.home-why__cards .panel h3 { font-size: var(--step-1); margin: 0; }
@media (max-width: 860px) { .home-why__cards { grid-template-columns: minmax(0, 1fr); } }
/* One row of judges on desktop; 2 x 2 rather than 3 + 1 once it has to wrap. */
@media (max-width: 1000px) { .people--row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.section-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: clamp(1.5rem, 3vw, 2.5rem); }
.home-judges + .home-final { padding-top: 0; }
.event-panel .cta-panel__actions { margin-top: 1.5rem; }
.event-panel .facts__row { grid-template-columns: 5.5rem minmax(0, 1fr); }
