/* === FILE: assets/css/components.css === */

/* ============================================================
   components.css — Shared UI components
   Trimble Aviation
   ============================================================ */

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  font-family: var(--font-body);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background  var(--dur-fast) ease,
    color       var(--dur-fast) ease,
    box-shadow  var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform   var(--dur-fast) ease;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-sm  { padding: 8px 18px;  font-size: .8rem; }
.btn-lg  { padding: 16px 36px; font-size: .9375rem; }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  box-shadow: 0 8px 24px rgba(232, 151, 26, .32);
  transform: translateY(-1px);
}

.btn-dark {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-dark:hover,
.btn-dark:focus-visible {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px rgba(232, 151, 26, .28);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-border-mid);
}
.btn-outline:hover,
.btn-outline:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-outline-light {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
}
.btn-outline-light:hover,
.btn-outline-light:focus-visible {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.65);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
}
.btn-ghost:hover { color: var(--color-accent-dark); }

/* ─── SECTION WRAPPER ────────────────────────────────────────── */
.section        { padding: clamp(var(--space-8), 10vw, var(--space-16)) 0; }
.section--sm    { padding: clamp(var(--space-4), 6vw, var(--space-8)) 0; }
.section--lg    { padding: clamp(var(--space-10), 12vw, calc(var(--space-16) + var(--space-4))) 0; }
.section--dark  { background: var(--color-primary); color: #fff; }
.section--soft  { background: var(--color-bg-soft); }
.section--white { background: var(--color-bg); }

/* ─── SECTION EYEBROW ────────────────────────────────────────────
   Canonical accent label that sits above a section heading. Single
   source of truth so every page renders it identically — page CSS
   should not redefine the type treatment, only contextual color when
   sitting on a dark background. */
.section-eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 1rem;
}

/* ─── IMAGE PLACEHOLDER ──────────────────────────────────────── */
.img-placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-soft);
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

/* Subtle diagonal hatching */
.img-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(17, 24, 39, 0.028) 8px,
      rgba(17, 24, 39, 0.028) 9px
    );
  pointer-events: none;
}

.img-placeholder-label {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, .88);
  padding: 8px 18px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  backdrop-filter: blur(4px);
}

/* ─── REUSABLE IMAGE GALLERY ─────────────────────────────────── */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  margin: 1.75rem 0 2.5rem;
}

.media-gallery--tight { gap: .5rem; }
.media-gallery--wide  { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }

.media-gallery-item {
  position: relative;
  margin: 0;
  border-radius: var(--radius-lg, 10px);
  overflow: hidden;
  background: var(--color-bg-soft);
  aspect-ratio: 4 / 3;
}

.media-gallery-item--tall { aspect-ratio: 3 / 4; }
.media-gallery-item--wide { aspect-ratio: 16 / 10; }

.media-gallery-trigger {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
}

.media-gallery-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 600ms cubic-bezier(.2, .7, .2, 1), filter 300ms ease;
}

.media-gallery-trigger::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 12, 20, .55), rgba(8, 12, 20, 0) 45%);
  opacity: 0;
  transition: opacity 280ms ease;
  pointer-events: none;
}

.media-gallery-trigger:hover img,
.media-gallery-trigger:focus-visible img { transform: scale(1.06); }
.media-gallery-trigger:hover::after,
.media-gallery-trigger:focus-visible::after { opacity: 1; }

.media-gallery-trigger:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-lg, 10px);
}

.media-gallery-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1rem 1.125rem;
  font-size: .85rem;
  line-height: 1.4;
  color: #fff;
  z-index: 2;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 280ms ease, transform 280ms ease;
  pointer-events: none;
}

.media-gallery-item:hover .media-gallery-caption,
.media-gallery-trigger:focus-visible ~ .media-gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

/* ─── LIGHTBOX (auto-injected <dialog>) ──────────────────────── */
.media-lightbox {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #fff;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
}

.media-lightbox::backdrop {
  background: rgba(6, 9, 16, .94);
  backdrop-filter: blur(10px);
  animation: media-lightbox-fade 260ms ease-out;
}

.media-lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: media-lightbox-fade 260ms ease-out;
}

@keyframes media-lightbox-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.media-lightbox-figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(94vw, 1400px);
  margin: 0;
}

.media-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  animation: media-lightbox-rise 360ms cubic-bezier(.2, .7, .2, 1);
}

@keyframes media-lightbox-rise {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.media-lightbox-caption {
  font-size: .9375rem;
  color: rgba(255, 255, 255, .82);
  text-align: center;
  max-width: 720px;
  margin: 0;
  line-height: 1.55;
}

.media-lightbox-btn {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
  z-index: 10;
}
.media-lightbox-btn:hover {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .26);
}
.media-lightbox-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.media-lightbox-close { top: 1.25rem;  right: 1.25rem; }
.media-lightbox-prev  { top: 50%; left: 1.25rem;  transform: translateY(-50%); }
.media-lightbox-next  { top: 50%; right: 1.25rem; transform: translateY(-50%); }
.media-lightbox-prev:hover,
.media-lightbox-next:hover { transform: translateY(-50%) scale(1.06); }

.media-lightbox-counter {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  font-size: .75rem;
  color: rgba(255, 255, 255, .55);
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0;
}

@media (max-width: 540px) {
  .media-lightbox-prev,
  .media-lightbox-next { display: none; }
  .media-lightbox-img  { max-height: 72vh; }
}

@media (prefers-reduced-motion: reduce) {
  .media-gallery-trigger img,
  .media-gallery-trigger::after,
  .media-gallery-caption,
  .media-lightbox[open],
  .media-lightbox::backdrop,
  .media-lightbox-img {
    transition: none !important;
    animation: none !important;
  }
}

/* ─── GALLERY — FEATURED VARIANT ─────────────────────────────
   One cinematic cover image opens the full lightbox-driven gallery.
   The CTA overlay + count badge are auto-injected by main.js.
   Usage: <div class="media-gallery media-gallery--featured" data-gallery>...
   ──────────────────────────────────────────────────────────── */
.media-gallery--featured {
  display: block;
  grid-template-columns: none;
}

.media-gallery--featured .media-gallery-item:not(:first-child) {
  display: none;
}

.media-gallery--featured .media-gallery-item:first-child {
  aspect-ratio: 16 / 9;
  max-height: 560px;
  box-shadow: 0 12px 38px rgba(8, 12, 20, .14);
}

.media-gallery--featured .media-gallery-trigger {
  cursor: pointer;
}

.media-gallery--featured .media-gallery-trigger img {
  transition: transform 800ms cubic-bezier(.2, .7, .2, 1), filter 360ms ease;
}

.media-gallery--featured .media-gallery-trigger:hover img,
.media-gallery--featured .media-gallery-trigger:focus-visible img {
  transform: scale(1.05);
  filter: brightness(.78);
}

/* Subtle baseline scrim — replaced visually by hover CTA */
.media-gallery--featured .media-gallery-trigger::after {
  background: linear-gradient(to top, rgba(8, 12, 20, .42), transparent 70%);
  opacity: 1;
}

/* Hide the regular per-item caption; lightbox shows it. */
.media-gallery--featured .media-gallery-caption { display: none; }

/* ─── HOVER "VIEW GALLERY" CTA ───────────────────────────────── */
.media-gallery-cta {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .875rem;
  color: #fff;
  opacity: 0;
  transition: opacity 320ms cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
  z-index: 3;
}

.media-gallery-cta-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .26);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: scale(.86);
  transition: transform 360ms cubic-bezier(.2, .7, .2, 1),
              background 240ms ease,
              border-color 240ms ease;
}

.media-gallery-cta-icon svg {
  width: 26px;
  height: 26px;
  color: #fff;
}

.media-gallery-cta-label {
  font-family: var(--font-body);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-shadow: 0 1px 16px rgba(0, 0, 0, .45);
  transform: translateY(10px);
  opacity: 0;
  transition: transform 360ms cubic-bezier(.2, .7, .2, 1), opacity 280ms ease;
}

@media (hover: hover) {
  .media-gallery--featured .media-gallery-trigger:hover .media-gallery-cta,
  .media-gallery--featured .media-gallery-trigger:focus-visible .media-gallery-cta {
    opacity: 1;
  }
  .media-gallery--featured .media-gallery-trigger:hover .media-gallery-cta-icon,
  .media-gallery--featured .media-gallery-trigger:focus-visible .media-gallery-cta-icon {
    transform: scale(1);
    background: rgba(232, 151, 26, .92);
    border-color: rgba(255, 255, 255, .42);
  }
  .media-gallery--featured .media-gallery-trigger:hover .media-gallery-cta-label,
  .media-gallery--featured .media-gallery-trigger:focus-visible .media-gallery-cta-label {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ─── ALWAYS-VISIBLE PHOTO COUNT BADGE ───────────────────────── */
.media-gallery-count-badge {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .875rem;
  background: rgba(8, 12, 20, .68);
  color: #fff;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .14);
  z-index: 4;
  pointer-events: none;
  transition: transform 320ms cubic-bezier(.2, .7, .2, 1),
              background 240ms ease,
              border-color 240ms ease;
}

.media-gallery-count-badge svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.media-gallery--featured .media-gallery-trigger:hover .media-gallery-count-badge,
.media-gallery--featured .media-gallery-trigger:focus-visible .media-gallery-count-badge {
  transform: translateY(-4px);
  background: rgba(232, 151, 26, .92);
  border-color: rgba(255, 255, 255, .3);
}

@media (max-width: 540px) {
  .media-gallery--featured .media-gallery-item:first-child { aspect-ratio: 4 / 3; }
  .media-gallery-cta-icon { width: 52px; height: 52px; }
  .media-gallery-cta-icon svg { width: 22px; height: 22px; }
  .media-gallery-count-badge { bottom: .75rem; right: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .media-gallery-cta,
  .media-gallery-cta-icon,
  .media-gallery-cta-label,
  .media-gallery-count-badge {
    transition: none !important;
  }
}

/* ============================================================
   GLOBAL VIDEO MODAL  (includes/video-modal.php)
   Opened from anywhere via window 'jth-video' event.
   ============================================================ */
html.modal-open { overflow: hidden; }

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, .82);
  backdrop-filter: blur(6px);
}

.video-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 1000px;
}

.video-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
  color: #fff;
}
.video-modal-title {
  font-family: var(--font-display, serif);
  font-size: clamp(1.125rem, 1vw + .9rem, 1.5rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}
.video-modal-sub {
  margin: .15rem 0 0;
  font-size: .8125rem;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .6);
}

.video-modal-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}
.video-modal-close:hover,
.video-modal-close:focus-visible {
  background: rgba(255, 255, 255, .18);
  transform: rotate(90deg);
}

.video-modal-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: var(--radius-lg, 10px);
  overflow: hidden;
  background: #000;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7);
}
.video-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Entrance */
.vm-enter { transition: opacity 220ms ease, transform 220ms cubic-bezier(.2, .7, .2, 1); }
.vm-enter-start { opacity: 0; transform: translateY(12px) scale(.98); }
.vm-enter-end   { opacity: 1; transform: translateY(0) scale(1); }

@media (prefers-reduced-motion: reduce) {
  .vm-enter { transition: none; }
  .video-modal-close { transition: none; }
}
/* ───────────────────────────────────────────────────────────────────
   "WATCH THE FILM" NAME LINK  (jt_video_name() — includes/jth-helpers.php)
   An in-text reference to Jerry Trimble that opens the global
   "A Passion for Instruction" modal, with a tiny play-icon affordance.
   ─────────────────────────────────────────────────────────────────── */
.jt-video-name {
  display: inline-flex;
  align-items: center;
  gap: .32em;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  vertical-align: baseline;
  -webkit-tap-highlight-color: transparent;
}

.jt-video-name-text {
  text-decoration: underline;
  text-decoration-color: rgba(232, 151, 26, .55);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}

/* Tiny play triangle in an amber disc, sized to the surrounding text. */
.jt-video-name-icon {
  flex: none;
  width: 1.05em;
  height: 1.05em;
  padding: .24em .22em .24em .26em;  /* nudge triangle to optical center */
  box-sizing: border-box;
  color: #fff;
  background: var(--color-accent);
  border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

.jt-video-name:hover .jt-video-name-text,
.jt-video-name:focus-visible .jt-video-name-text {
  text-decoration-color: var(--color-accent);
}

.jt-video-name:hover .jt-video-name-icon,
.jt-video-name:focus-visible .jt-video-name-icon {
  transform: scale(1.12);
  box-shadow: 0 0 0 4px rgba(232, 151, 26, .18);
}

.jt-video-name:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .jt-video-name-icon { transition: none; }
  .jt-video-name:hover .jt-video-name-icon,
  .jt-video-name:focus-visible .jt-video-name-icon { transform: none; }
}
