/* =====================================================================
   Marketing Lessons — carousel cards + full-screen lightbox
   Dark + brand-yellow theme; leans on the tokens defined in style.css.
   ===================================================================== */

/* ---- section rhythm ---------------------------------------------- */
.lessons .section-head{ margin-bottom: clamp(26px, 4vw, 44px); }

/* ---- horizontal card slider -------------------------------------- */
.lessons-slider{ position: relative; }

.lessons-viewport{
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: max(22px, calc((100vw - var(--maxw)) / 2 + 22px));
  scrollbar-width: none;
}
.lessons-viewport::-webkit-scrollbar{ display: none; }

.lessons-track{
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 8px max(22px, calc((100vw - var(--maxw)) / 2 + 22px));
  list-style: none;
}

.lesson-card{
  flex: 0 0 clamp(240px, 72vw, 292px);
  scroll-snap-align: start;
}

/* ---- card --------------------------------------------------------- */
.lesson-open{
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lesson-cover{
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform .5s var(--ease), border-color .3s var(--ease), box-shadow .5s var(--ease);
}
.lesson-cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .6s var(--ease);
}
.lesson-open:hover .lesson-cover,
.lesson-open:focus-visible .lesson-cover{
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: 0 34px 60px -26px rgba(0,0,0,.75), 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent);
}
.lesson-open:hover .lesson-cover img{ transform: scale(1.05); }
.lesson-open:focus-visible{ outline: none; }

/* stacked-slides badge (top-right) */
.lesson-stack{
  position: absolute;
  top: 10px; right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  color: #0a0a0c;
  background: var(--grad);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.6);
}
/* open hint (bottom-right, appears on hover / focus) */
.lesson-open-hint{
  position: absolute;
  bottom: 10px; right: 10px;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  color: #0a0a0c;
  background: var(--grad);
  opacity: 0;
  transform: translateY(8px) scale(.85);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.lesson-open:hover .lesson-open-hint,
.lesson-open:focus-visible .lesson-open-hint{ opacity: 1; transform: none; }

/* meta */
.lesson-meta{ display: block; padding: 18px 0 6px; }
.lesson-detail{ display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.lesson-detail svg{ margin-left: auto; color: var(--gold); }
.lesson-title{
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--text);
  line-height: 1.25;
}
.lesson-by{
  display: block;
  margin-top: 3px;
  font-size: .86rem;
  color: var(--muted);
}

/* ---- slider nav buttons (desktop) -------------------------------- */
.les-nav{
  position: absolute;
  top: calc(50% - 24px);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease), opacity .3s var(--ease);
}
.les-nav:hover{
  border-color: color-mix(in srgb, var(--gold) 60%, transparent);
  color: var(--gold);
  transform: scale(1.06);
}
.les-nav[hidden]{ display: none; }
.les-prev{ left: 12px; }
.les-next{ right: 12px; }

@media (max-width: 900px){
  .les-nav{ display: none !important; }   /* native swipe on touch */
}

/* Three balanced columns aligned to the section heading on larger screens.
   Phones retain their native swipe carousel and a glimpse of the next card. */
@media (min-width: 901px){
  .lessons-slider{ width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
  .lessons-viewport{ scroll-padding-left: 0; }
  .lessons-track{ display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 48px) / 3); gap: 24px; padding: 8px 0 14px; }
  .lesson-card{ min-width: 0; }
  .lesson-cover{ border-radius: 14px; box-shadow: 0 16px 35px -24px rgba(0,0,0,.7); }
  .lesson-open:hover .lesson-cover, .lesson-open:focus-visible .lesson-cover{ transform: translateY(-4px); }
  .les-prev{ left: 0; }
  .les-next{ right: 0; }
}
@media (max-width: 600px){
  .lessons-track{ gap: 16px; }
  .lesson-card{ flex-basis: min(78vw, 320px); }
  .lesson-cover{ border-radius: 12px; }
  .lesson-title{ font-size: 16px; }
}

/* ===================================================================
   Lightbox
   =================================================================== */
.les-lightbox{
  position: fixed;
  inset: 0;
  z-index: 1000;                 /* above the sticky header + mobile contact bar */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
  background: rgba(6, 6, 9, .82);
  backdrop-filter: blur(14px) saturate(1.1);
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.les-lightbox[hidden]{ display: none; }
.les-lightbox.is-open{ opacity: 1; }

.les-stage{
  position: relative;
  width: min(94vw, 560px);
  max-height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
}
.les-slides{
  display: flex;
  height: 100%;
  transition: transform .38s var(--ease);
  will-change: transform;
  touch-action: pan-y;
}
.les-slide{
  position: relative;
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.les-slide img{
  max-width: 100%;
  max-height: min(78vh, 860px);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  user-select: none;
  -webkit-user-drag: none;
}
.les-slide.is-loading::before{
  content: "";
  position: absolute;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  animation: lesSpin .8s linear infinite;
}
@keyframes lesSpin{ to{ transform: rotate(360deg); } }

/* controls */
.les-close{
  position: absolute;
  top: clamp(10px, 2.5vw, 22px);
  right: clamp(10px, 2.5vw, 22px);
  z-index: 5;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  cursor: pointer;
  transition: color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.les-close:hover{ color: var(--gold); border-color: color-mix(in srgb, var(--gold) 60%, transparent); transform: rotate(90deg); }
.les-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: color .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease), opacity .25s var(--ease);
}
.les-arrow:hover{ color: var(--gold); border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.les-arrow-prev{ left: clamp(8px, 3vw, 30px); }
.les-arrow-next{ right: clamp(8px, 3vw, 30px); }
.les-arrow[disabled]{ opacity: .28; cursor: default; }

/* HUD: caption + dots */
.les-hud{
  position: absolute;
  left: 0; right: 0; bottom: clamp(12px, 3vw, 26px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.les-caption{ text-align: center; pointer-events: auto; }
.les-cap-title{
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
}
.les-cap-by{
  display: block;
  margin-top: 2px;
  font-size: .84rem;
  color: var(--muted);
}
.les-cap-by:empty{ display: none; }
.les-dots{
  display: flex;
  gap: 7px;
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 80vw;
}
.les-dot{
  width: 8px; height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 34%, transparent);
  cursor: pointer;
  transition: width .3s var(--ease), background .3s var(--ease);
}
.les-dot.is-active{ width: 22px; background: var(--grad); }

@media (max-width: 640px){
  .les-arrow{ display: none; }            /* swipe instead */
  .les-stage{ width: 100vw; }
  .les-hud{ bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* body scroll-lock while the lightbox is open */
body.les-lock{ overflow: hidden; }
/* hide the phones-only pinned contact bar while the lightbox is open
   (it's fixed to the bottom and would otherwise cover the HUD/dots) */
body.les-lock .mobile-bar{ display: none; }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .lessons-viewport{ scroll-behavior: auto; }
  .lesson-cover, .lesson-cover img, .lesson-open-hint,
  .les-lightbox, .les-slides, .les-close, .les-arrow{ transition: none; }
  .les-slide.is-loading::before{ animation: none; }
}
