/* =====================================================================
   Sling Pilot Academy — shared layout + responsive system
   Loaded by every redesigned page, BEFORE that page's own <style>, so a
   page can still override anything here.

   Two rules the pages rely on:

   1. One container. Every page wraps its content in .spa-in (the 529
      band grid uses .spa-band-in). This file is the only place that
      sets the measure and the gutter, so in-flow sections and the
      full-bleed bands put their text on exactly the same two edges.
      --spa-max is the CONTENT measure; the box is the measure plus
      both gutters.

   2. One breakpoint scale:
        1024  tablet — wide grids drop a column, side-by-side stacks
         900  stack  — multi-column becomes single column
         600  phone  — gutter 20 -> 16, compressed spacing
         480  small  — buttons full width, tightest spacing

   Selectors are deliberately scope-agnostic (.spa-in rather than
   .spa-fin .spa-in) so a new page only has to use the same class names.
   ===================================================================== */

:root {
  --spa-max: 1100px;   /* content measure, shared by all pages */
  --spa-gut: 20px;     /* the only horizontal padding on the page */
  --spa-tap: 44px;     /* minimum touch target */
}

@media (max-width: 600px) {
  :root { --spa-gut: 16px; }
}

/* Full-bleed bands break out with width:100vw. 100vw includes the
   classic scrollbar, so clip the overflow that would otherwise create.
   `clip` rather than `hidden`: it does not create a scroll container,
   so position:sticky keeps working. */
html { overflow-x: clip; }
body { overflow-x: clip; }

/* ---------------------------------------------------------------------
   The one container

   The theme wrapper puts 20px of side padding on in-flow content, which
   the full-bleed bands escape. Zero it on pages that use the container,
   and let .spa-in be the single source of the gutter.
   ------------------------------------------------------------------ */
#main .wf-wrap:has(.spa-in, .spa-band-in, .spa-page),
#main .wf-container-main:has(.spa-in, .spa-band-in, .spa-page),
#main #content.content:has(.spa-in, .spa-band-in, .spa-page) {
  padding-inline: 0;
}

/* .spa-page is a second kit with its own class names. Its containers are
   aliased onto the shared measure so every page in the build lines up on
   the same two edges (the brief: one container for all pages). */
.spa-in,
.spa-band-in,
.spa-page .container,
.spa-page .hero-inner,
.spa-page .proof-grid,
.spa-page .feature-strip {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--spa-max) + 2 * var(--spa-gut));
  margin-inline: auto;
  padding-inline: var(--spa-gut);
}

/* ---------------------------------------------------------------------
   Nothing may push the page wider than the viewport
   ------------------------------------------------------------------ */
/* No blanket max-width here: the full-bleed bands are meant to be wider
   than their wrapper (width:100vw), and a blanket cap would shrink them
   back. Overflow safety comes from overflow-x:clip plus the media caps
   below. */

:where([class*="spa-"]) img,
:where([class*="spa-"]) svg,
:where([class*="spa-"]) iframe,
:where([class*="spa-"]) video {
  max-width: 100%;
}

/* Long unbroken strings (URLs, phone numbers, figures) wrap, never scroll. */
[class*="spa-"] h1, [class*="spa-"] h2, [class*="spa-"] h3,
[class*="spa-"] p, [class*="spa-"] li,
[class*="spa-"] td, [class*="spa-"] th {
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------------
   Touch targets, forms, focus
   ------------------------------------------------------------------ */
a.spa-btn,
[class*="spa-"] button {
  min-height: var(--spa-tap);
}

[class*="spa-"] input,
[class*="spa-"] select,
[class*="spa-"] textarea {
  font-size: 16px;   /* anything smaller makes iOS zoom on focus */
  max-width: 100%;
}

[class*="spa-"] :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Anchor targets clear the theme's sticky header when jumped to. */
[class*="spa-"] [id] {
  scroll-margin-top: 90px;
}

/* ---------------------------------------------------------------------
   Wide tables: scroll the table, never the page. The first column stays
   put so the row label is always readable.
   ------------------------------------------------------------------ */
.spa-table-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

@media (max-width: 900px) {
  .spa-table-wrap table th:first-child,
  .spa-table-wrap table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 1px 0 0 0 #e2e2e4;
  }
  /* the sticky cell paints over the scrolled columns, so it has to
     carry the same background its row does */
  .spa-table-wrap table thead th:first-child {
    background: var(--red, #B62925);
  }
  .spa-table-wrap table tbody tr:nth-child(even) th:first-child,
  .spa-table-wrap table tbody tr:nth-child(even) td:first-child {
    background: var(--alt, #f7f7f7);
  }
}

/* ---------------------------------------------------------------------
   Preview build: links to pages that have not been designed yet keep
   their label but go nowhere.
   ------------------------------------------------------------------ */
a.spa-locked {
  cursor: default;
  opacity: .55;
  text-decoration: none;
}

a.spa-locked > * {
  pointer-events: none;
}

/* A menu item that only opens a submenu is a toggle, not a destination.
   Its own page may not exist yet, but the children it reveals do, so it
   must not look disabled. */
li.menu-item-has-children > a.spa-locked,
li.menu-item-has-children > a.spa-locked > * {
  opacity: 1;
  cursor: pointer;
  pointer-events: auto;
}

/* ---------------------------------------------------------------------
   Motion: respect the OS setting on every page.
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  [class*="spa-"] * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------------
   Gallery + photo viewer — shared component.

   Markup: a .spa-gal grid of <button class="spa-gal-btn"> each wrapping
   an <img data-full="<original>">. /wp-content/spa-lightbox.js builds
   the viewer dialog itself, so a page only ships the grid.
   Generalised from the /redbird-simulators/ gallery.
   ------------------------------------------------------------------ */
.spa-gal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 30px;
}

.spa-gal button.spa-gal-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #ebebee;
  cursor: zoom-in;
  appearance: none;
  /* kept tight on purpose: blur minus spread is the sideways reach, so the
     penumbra stays inside the grid gap and never darkens the next thumbnail */
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 16px -12px rgba(0, 0, 0, .3);
  transition: box-shadow .25s ease, transform .25s ease;
}

.spa-gal button.spa-gal-btn img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2, .6, .2, 1);
}

/* zoom affordance — the "click to enlarge" cue */
.spa-gal button.spa-gal-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, .34) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E") center no-repeat;
  background-size: auto 40px;
  opacity: 0;
  transition: opacity .25s ease;
}

.spa-gal .spa-gal-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 26px 14px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  text-align: center;
  background: linear-gradient(to top, rgba(8, 8, 10, .7), rgba(8, 8, 10, 0));
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .spa-gal button.spa-gal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 22px -14px rgba(0, 0, 0, .4);
  }

  .spa-gal button.spa-gal-btn:hover img {
    transform: scale(1.06);
  }

  .spa-gal button.spa-gal-btn:hover::after,
  .spa-gal button.spa-gal-btn:hover .spa-gal-hint {
    opacity: 1;
  }
}

.spa-gal button.spa-gal-btn:focus-visible {
  outline: 3px solid var(--red, #B62925);
  outline-offset: 3px;
}

.spa-gal button.spa-gal-btn:focus-visible::after,
.spa-gal button.spa-gal-btn:focus-visible .spa-gal-hint {
  opacity: 1;
}

/* a single enlargeable photo outside a grid */
.spa-gal-one {
  display: inline-block;
  max-width: 100%;
}

@media (max-width: 900px) {
  .spa-gal { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .spa-gal { grid-template-columns: 1fr; gap: 12px; }
  /* no hover on touch — the cue is always on, quietly */
  .spa-gal .spa-gal-hint { opacity: .9; }
}

/* ---------- the viewer ---------- */
html.spa-lb-open,
html.spa-lb-open body { overflow: hidden !important; }

.spa-lb {
  font-family: "Lexend Deca", sans-serif;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  z-index: 100000;
  background: rgba(8, 8, 10, .93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  box-sizing: border-box;
}

.spa-lb[hidden] { display: none; }

.spa-lb-stage {
  margin: 0;
  max-width: 1280px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.spa-lb-img {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  width: auto;
  border-radius: 12px;
  box-shadow: 0 16px 36px -22px rgba(0, 0, 0, .85);
  cursor: default;
}

.spa-lb-cap {
  font-size: 15px;
  font-weight: 300;
  color: rgba(255, 255, 255, .82);
  text-align: center;
}

.spa-lb-count {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .7);
  font-variant-numeric: tabular-nums;
}

.spa-lb button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  appearance: none;
  transition: background .2s ease, transform .2s ease;
}

.spa-lb button:hover { background: rgba(255, 255, 255, .24); }
.spa-lb button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.spa-lb button svg { width: 22px; height: 22px; }
.spa-lb button[hidden] { display: none; }
.spa-lb-close { top: 18px; right: 18px; width: 46px; height: 46px; }
.spa-lb-nav { top: 50%; transform: translateY(-50%); width: 50px; height: 50px; }
.spa-lb-prev { left: 18px; }
.spa-lb-next { right: 18px; }

@media (max-width: 600px) {
  .spa-lb { padding: 64px 12px; }
  .spa-lb-nav { width: 42px; height: 42px; }
  .spa-lb-prev { left: 8px; }
  .spa-lb-next { right: 8px; }
  .spa-lb-img { max-height: calc(100vh - 190px); }
}

/* artwork rather than a photo — show all of it, on its own white field */
.spa-gal button.spa-gal-btn.spa-gal-contain { background: #fff; }
.spa-gal button.spa-gal-btn.spa-gal-contain img { object-fit: contain; padding: 10px; }
