/* =========================================================
   Frame Craft Studio — video cards, hero video and player
   Loaded only on pages that show videos. Uses the tokens and
   dialog styles defined in styles.css.
   ========================================================= */

.video-section { background: var(--pearl); }
.video-block { padding: clamp(48px, 7vw, 88px) 0 0; }

.video-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.video-grid--single { max-width: 880px; margin: 0 auto; grid-template-columns: 1fr; }
.video-grid--pair { max-width: 1040px; margin: 0 auto; }
@media (min-width: 960px) { .video-grid--many { grid-template-columns: repeat(3, 1fr); } }
/* Three or more videos on a phone: a swipeable row rather than a long stack */
@media (max-width: 599.98px) {
  .video-grid--many {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 84%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    padding-bottom: 12px;
  }
  .video-grid--many > * { scroll-snap-align: start; }
}

.video-card {
  background: var(--pearl);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-section .video-card { background: var(--ivory); }

.video-card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--beige);
  overflow: hidden;
}
/* All-portrait sections use portrait thumbnails. In mixed sections every thumbnail shares one shape so rows
   stay level, and portrait posters are shown whole (on a dark ground) rather than cropped. */
.video-grid--portrait .video-card-media { aspect-ratio: 4 / 5; }
.video-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.video-card--portrait .video-card-media img { object-fit: contain; background: #1f1b15; }
.video-grid--portrait .video-card--portrait .video-card-media img { object-fit: cover; background: none; }
.video-card-media:hover img { transform: scale(1.03); }
.video-card-media:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--radius) var(--radius) 0 0; }

/* Branded panel when no poster image is supplied */
.video-art {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 12%;
  background: linear-gradient(160deg, #a48b6a, #2b2620);
}
.video-art span {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
  color: var(--ivory);
  text-align: center;
  transform: translateY(46px);
}

.video-play {
  position: absolute;
  left: 50%; top: 50%;
  width: 68px; height: 68px;
  margin: -34px 0 0 -34px;
  border-radius: 50%;
  background: rgba(43, 38, 32, 0.84);
  color: var(--ivory);
  display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(43, 38, 32, 0.3);
  transition: transform .25s ease, background .25s ease;
}
.video-play svg { width: 28px; height: 28px; margin-left: 4px; }
.video-card-media:hover .video-play,
.video-card-media:focus-visible .video-play { background: var(--deep-gold); transform: scale(1.06); }

.video-duration {
  position: absolute; right: 12px; bottom: 12px;
  background: rgba(31, 27, 21, 0.8);
  color: #fff;
  font-size: 12px;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.video-card-body { padding: 20px 22px 22px; }
.video-card-body h3 { font-size: 23px; margin-bottom: 8px; }
.video-card blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.55;
  color: var(--soft-charcoal);
  margin-bottom: 12px;
}
.video-client strong { font-size: 14px; font-weight: 600; }
.video-client span { font-size: 12.5px; color: var(--muted); }
.video-desc { font-size: 14.5px; color: var(--muted); line-height: 1.7; }
.video-frame { margin-top: 10px; font-size: 13.5px; }
.video-frame a { display: inline-block; padding: 6px 0; color: var(--charcoal); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--taupe); }

/* ---------- Player dialog: the video, a slim frame and a strip just tall enough for the close button ---------- */
.video-dialog {
  width: fit-content;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--charcoal);
  color: var(--ivory);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.video-dialog::backdrop { background: rgba(20, 17, 13, 0.82); }
.video-dialog[open] { animation: dialogIn .28s ease; }
.video-dialog-inner { position: relative; padding: 56px 8px 8px; }
/* Dark cross on a light button, so it stands out against the dark frame */
.video-dialog .dialog-close {
  top: 6px; right: 6px;
  background: var(--ivory);
  color: var(--charcoal);
  border-color: transparent;
}
.video-dialog .dialog-close:hover { background: var(--champagne); color: var(--charcoal); }
.video-dialog :focus-visible { outline-color: var(--champagne); }

.video-stage {
  --video-ar: 16 / 9;
  --video-ar-n: 1.7778;
  position: relative;
  aspect-ratio: var(--video-ar);
  /* As large as the screen allows without the player growing taller than the screen (portrait videos stay whole) */
  width: min(calc(100vw - 32px), calc((100vh - 96px) * var(--video-ar-n)), 1200px);
  width: min(calc(100vw - 32px), calc((100dvh - 96px) * var(--video-ar-n)), 1200px);
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.video-stage iframe,
.video-stage video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
  background: #000;
}
.video-stage video { object-fit: contain; }

.video-fallback {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--ivory);
  background: linear-gradient(160deg, #4a4138, #2b2620);
}
.video-fallback .btn-ghost { color: var(--ivory); border-color: rgba(248, 243, 234, 0.6); }
.video-fallback .btn-ghost:hover { background: var(--ivory); color: var(--charcoal); }

/* Only shown when a transcript is supplied */
.video-transcript { margin-top: 8px; max-width: 760px; }
.video-transcript summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--champagne); font-size: 14px; letter-spacing: .04em; }
.video-transcript div { white-space: pre-line; color: var(--beige); font-size: 14.5px; line-height: 1.7; padding-bottom: 8px; }

/* Phones held sideways: the close button sits beside the video instead of above it */
@media (orientation: landscape) and (max-height: 540px) {
  .video-dialog-inner { padding: 8px 58px 8px 8px; }
  .video-stage {
    width: min(calc(100vw - 82px), calc((100vh - 32px) * var(--video-ar-n)));
    width: min(calc(100vw - 82px), calc((100dvh - 32px) * var(--video-ar-n)));
  }
  .video-dialog .dialog-close { top: 8px; right: 7px; }
}

/* ---------- Hero: a video in place of the hero photograph ---------- */
/* Poster + play button that opens the player (used when the hero video isn't set to autoplay) */
.hero-video { position: absolute; inset: 0; display: block; }
.hero-video picture, .hero-video img { width: 100%; height: 100%; }
.hero-video img { object-fit: cover; transition: transform 1.2s ease; }
.hero-video:hover img { transform: scale(1.03); }
.video-play--hero { width: 84px; height: 84px; margin: -42px 0 0 -42px; z-index: 1; }
.video-play--hero svg { width: 34px; height: 34px; }
.hero-video:hover .video-play,
.hero-video:focus-visible .video-play { background: var(--deep-gold); transform: scale(1.06); }
.hero-video:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--radius-lg); }
@media (max-width: 479.98px) {
  .video-play--hero { width: 68px; height: 68px; margin: -34px 0 0 -34px; }
  .video-play--hero svg { width: 28px; height: 28px; }
}

/* Muted, looping hero video that plays as the page loads, with small icon buttons (pause, sound) */
.hero-loop { position: absolute; inset: 0; }
.hero-loop video { width: 100%; height: 100%; object-fit: cover; display: block; background-color: var(--beige); background-size: cover; background-repeat: no-repeat; }
.hero-loop-controls { position: absolute; right: 14px; bottom: 14px; z-index: 2; display: flex; gap: 8px; }
.hero-loop-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(248, 243, 234, 0.92);
  color: var(--charcoal);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  transition: background .2s ease;
}
.hero-loop-btn:hover { background: var(--ivory); }
.hero-loop-btn svg { width: 18px; height: 18px; }
.hero-loop-btn .i-b { display: none; }
.hero-loop-btn.is-alt .i-a { display: none; }
.hero-loop-btn.is-alt .i-b { display: block; }
