/* ==========================================================================
   KAI Landing Page — Figma file s67gajlTDsZAYPfaUElYtn, node 1:2

   Mobile-first. Every class and custom property is namespaced `kai-`
   so nothing can collide with the theme's 75 KB style.css.

   Typography follows the Figma exactly:
     Poppins      — section titles, CTA, "Book a demo"   (--kai-font-display)
     General Sans — card copy, labels, descriptions       (--kai-font-body)
     Inter        — links and the download button         (--kai-font-ui)
   Sailec stays in each stack as a fallback if the font CDNs are unreachable.
   ========================================================================== */

:root {
  /* Brand */
  --kai-yellow:        #FED719;  /* buttons */
  --kai-gold:          #FFC600;  /* section underlines, play button */
  --kai-orange:        #FF8601;  /* accent rules, "view all" */
  --kai-link-gold:     #D09636;  /* "download case study" */
  --kai-eyebrow:       #F5B90A;  /* CTA eyebrow */

  /* Text */
  --kai-ink:           #4A4A4A;  /* headings */
  --kai-muted:         #646464;  /* body copy */
  --kai-meta:          #414141;  /* category labels */
  --kai-ink-cta:       #1B1B1B;
  --kai-btn-ink:       #1E1B4B;
  --kai-cta-btn-ink:   #3C3939;

  /* Surfaces */
  --kai-white:         #FFFFFF;
  --kai-border:        #EAEAEA;
  --kai-band:          #FBF8F3;  /* success-stories band */
  --kai-cta-band:      #F6F5F1;  /* rgba(240,238,231,.6) over white */

  /* Elevation */
  --kai-shadow:        0 0 20px -2px rgba(0, 0, 0, 0.15);
  --kai-shadow-nav:    0 8px 12px rgba(0, 0, 0, 0.06);
  --kai-shadow-play:   0 8px 8px rgba(0, 0, 0, 0.25);

  /* Type */
  --kai-font-display:  'Poppins', 'Sailec Bold', 'Helvetica Neue', Arial, sans-serif;
  --kai-font-body:     'General Sans', 'Sailec Medium', 'Helvetica Neue', Arial, sans-serif;
  --kai-font-ui:       'Inter', 'Sailec Medium', 'Helvetica Neue', Arial, sans-serif;

  /* Geometry */
  --kai-radius-card:   15px;
  --kai-radius-hero:   20px;
  --kai-radius-btn:    8px;
  --kai-max:           1232px;
  --kai-gutter:        16px;
}

@font-face {
  font-family: 'Sailec Bold';
  src: url('../fonts/Sailec-Bold.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Sailec Medium';
  src: url('../fonts/Sailec-Medium.ttf') format('truetype');
  font-display: swap;
}

/* ==========================================================================
   PAGE SHELL
   ========================================================================== */

.kai-page,
.kai-page *,
.kai-page *::before,
.kai-page *::after {
  box-sizing: border-box;
}

/* padding-top clears the theme's position:fixed nav (76px tall; the theme's own
   templates clear it with margin-top: 85px). At >=1024 it opens out to 106px,
   which is the gap the Figma leaves below its header. */
.kai-page {
  padding-top: 85px;
  background: var(--kai-white);
  font-family: var(--kai-font-body);
  font-weight: 400;
  color: var(--kai-ink);
}

.kai-page > section + section { margin-top: 56px; }

.kai-container {
  width: 100%;
  max-width: var(--kai-max);
  margin: 0 auto;
  padding: 0 var(--kai-gutter);
}

.kai-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Shared: section headers
   -------------------------------------------------------------------------- */

.kai-page .kai-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.kai-page .kai-section-title-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kai-page .kai-section-title {
  margin: 0;
  font-family: var(--kai-font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.152;
  color: var(--kai-ink);
}

.kai-page .kai-section-rule {
  display: block;
  width: 54px;
  height: 4px;
  border-radius: 2px;
  background: var(--kai-gold);
}
.kai-page .kai-section-rule--sm { width: 40px; height: 3px; }

/* --------------------------------------------------------------------------
   Shared: meta strip (badge + label + rule)
   -------------------------------------------------------------------------- */

.kai-page .kai-meta {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.kai-page .kai-meta-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.kai-page .kai-meta-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--kai-border);
  border-radius: 50%;
}
.kai-page .kai-meta-badge--sm { width: 28px; height: 28px; }
.kai-page .kai-meta-badge img { display: block; }

/* Publisher marks vary in aspect ratio — cap them instead of hardcoding sizes. */
.kai-page .kai-meta-logo {
  max-width: 22px;
  max-height: 14px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.kai-page .kai-meta-text {
  font-family: var(--kai-font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.4;
  color: var(--kai-meta);
}

.kai-page .kai-meta-divider {
  flex-shrink: 0;
  width: 1px;
  height: 21px;
  background: var(--kai-border);
  margin: 0 4px;
}

.kai-page .kai-meta-rule {
  position: relative;
  display: block;
  width: 100%;
  height: 1px;
  margin-top: 14px;
  background: var(--kai-border);
}
.kai-page .kai-meta-rule::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 1px;
  background: var(--kai-orange);
}

/* --------------------------------------------------------------------------
   Shared: links and buttons
   -------------------------------------------------------------------------- */

.kai-page .kai-view-all,
.kai-page .kai-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--kai-font-ui);
  font-weight: 600;
  font-size: 14px;
  color: var(--kai-orange);
  text-decoration: none;
  white-space: nowrap;
}
.kai-page .kai-inline-link {
  font-size: 15px;
  color: var(--kai-link-gold);
}
.kai-page .kai-view-all img,
.kai-page .kai-inline-link img { display: block; flex-shrink: 0; }
.kai-page .kai-view-all:hover,
.kai-page .kai-inline-link:hover { text-decoration: underline; }

.kai-page .kai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--kai-yellow);
  border-radius: var(--kai-radius-btn);
  font-family: var(--kai-font-ui);
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.15s ease;
}
.kai-page .kai-btn:hover { filter: brightness(0.94); }
.kai-page .kai-btn img { display: block; flex-shrink: 0; }

.kai-page .kai-btn--download {
  padding: 14px 28px;
  font-size: 16px;
  color: var(--kai-btn-ink);
}

.kai-page .kai-btn--demo {
  padding: 14px 36px;
  border-radius: 5px;
  font-family: var(--kai-font-display);
  font-weight: 500;
  font-size: 17px;
  color: var(--kai-cta-btn-ink);
}

/* ==========================================================================
   1. HERO VIDEO
   ========================================================================== */

.kai-page .kai-hero-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--kai-radius-hero);
  overflow: hidden;
}

.kai-page .kai-hero-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kai-page .kai-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(89, 89, 89, 0.3) 0%, rgba(9, 9, 9, 0.6) 100%);
}

.kai-page .kai-hero-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--kai-gold);
  box-shadow: var(--kai-shadow-play);
  transition: transform 0.15s ease;
}
.kai-page .kai-hero-play:hover { transform: translate(-50%, -50%) scale(1.06); }
.kai-page .kai-hero-play img { display: block; width: 30px; height: 30px; }

/* ==========================================================================
   2. FRANKFURT BOOK FAIR (brochure)
   ========================================================================== */

.kai-page .kai-brochure {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.kai-page .kai-brochure-media {
  flex-shrink: 0;
  border-radius: var(--kai-radius-card);
  overflow: hidden;
}
.kai-page .kai-brochure-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 492 / 338;
  object-fit: cover;
}

.kai-page .kai-brochure-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.kai-page .kai-brochure-heading {
  margin: 0;
  font-family: var(--kai-font-body);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.5;
  color: var(--kai-ink);
}

.kai-page .kai-brochure-snippet {
  margin: 0;
  font-family: var(--kai-font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.75;
  color: var(--kai-muted);
}

/* ==========================================================================
   3. PUBLISHING SUCCESS STORIES
   ========================================================================== */

.kai-page .kai-stories {
  padding: 56px 0;
  background: var(--kai-band);
}

.kai-page .kai-stories-intro {
  max-width: 955px;
  margin: 0 0 28px;
  font-family: var(--kai-font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.75;
  color: var(--kai-muted);
}

.kai-page .kai-stories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
}

.kai-page .kai-story-card {
  display: flex;
  flex-direction: column;
  background: var(--kai-white);
  border-radius: var(--kai-radius-card);
  box-shadow: var(--kai-shadow);
  overflow: hidden;
}

.kai-page .kai-story-graphic { position: relative; }
.kai-page .kai-story-graphic-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 587 / 305;
  object-fit: cover;
  opacity: 0.9;
}

.kai-page .kai-story-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
}

.kai-page .kai-story-title {
  margin: 0;
  font-family: var(--kai-font-body);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.45;
  color: var(--kai-ink);
}

.kai-page .kai-story-desc {
  margin: 0;
  font-family: var(--kai-font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--kai-muted);
}

.kai-page .kai-story-body .kai-inline-link { margin-top: auto; }

/* ==========================================================================
   4. EXPLORE OUR VIDEO INSIGHTS
   ========================================================================== */

.kai-page .kai-carousel {
  display: flex;
  align-items: center;
  gap: 19px;
}

.kai-page .kai-carousel-nav {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--kai-border);
  border-radius: 50%;
  background: var(--kai-white);
  box-shadow: var(--kai-shadow-nav);
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.kai-page .kai-carousel-nav img { display: block; }
.kai-page .kai-carousel-nav--next img { transform: rotate(180deg); }
.kai-page .kai-carousel-nav:hover:not(:disabled) { background: #FAFAFA; }

/* script.js disables an arrow once the track can go no further that way.
   Without JS both stay enabled and the track is still swipe/scrollable. */
.kai-page .kai-carousel-nav:disabled {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

.kai-page .kai-videos-track {
  display: flex;
  gap: 19px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* The vertical padding stops the horizontal scroller clipping the card
     shadow; the matching negative margin takes that space back out of the
     layout, so the section keeps the spacing the Figma specifies. */
  padding: 22px 4px;
  margin-top: -22px;
  margin-bottom: -22px;
  /* Matches the inline padding so a snapped card lines up with the content
     box; without it mandatory snapping parks the track 4px off at rest. */
  scroll-padding: 0 4px;
  /* The arrows are the control here — a native scrollbar would sit under
     the cards and fight the card shadows. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.kai-page .kai-videos-track::-webkit-scrollbar { display: none; }

.kai-page .kai-video-card {
  display: flex;
  flex: 0 0 288px;
  flex-direction: column;
  scroll-snap-align: start;
  background: var(--kai-white);
  border-radius: var(--kai-radius-card);
  box-shadow: var(--kai-shadow);
  overflow: hidden;
}

.kai-page .kai-video-thumb { display: block; }
.kai-page .kai-video-thumb-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 352 / 202;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.kai-page .kai-video-thumb:hover .kai-video-thumb-img { opacity: 1; }

.kai-page .kai-video-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
}
.kai-page .kai-video-body .kai-meta-rule::before { width: 30px; }

.kai-page .kai-video-title {
  margin: 0;
  font-family: var(--kai-font-body);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.4;
  color: var(--kai-ink);
}

/* ==========================================================================
   5. CTA
   ========================================================================== */

.kai-page .kai-cta {
  position: relative;
  padding: 56px 0;
  background-color: var(--kai-cta-band);
  overflow: hidden;
  text-align: center;
}

.kai-page .kai-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../images/kai-landing/cta-texture.jpg');
  background-size: cover;
  background-position: center bottom;
  opacity: 0.2;
  pointer-events: none;
}

.kai-page .kai-cta > .kai-container {
  position: relative;
  z-index: 1;
}

.kai-page .kai-cta-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
  font-family: var(--kai-font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--kai-eyebrow);
}

.kai-page .kai-cta-rule {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--kai-orange);
}

.kai-page .kai-cta-heading {
  max-width: 801px;
  margin: 0 auto 14px;
  font-family: var(--kai-font-display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  color: var(--kai-ink);
}

.kai-page .kai-cta-desc {
  max-width: 586px;
  margin: 0 auto 26px;
  font-family: var(--kai-font-display);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  color: var(--kai-ink-cta);
}

/* ==========================================================================
   6. YOUTUBE POPUP

   Lives outside .kai-page, so the box-sizing reset up top does not reach it
   and each rule sets its own.
   ========================================================================== */

/* Freezing the page behind the popup removes the scrollbar, which would shift
   the layout left. --kai-scrollbar is measured in script.js and pays that
   width back as padding. */
html.kai-modal-open { overflow: hidden; }
html.kai-modal-open body { padding-right: var(--kai-scrollbar, 0px); }

.kai-video-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.kai-video-modal[hidden] { display: none; }

.kai-video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 2, 27, 0.86);
  animation: kai-modal-fade 0.18s ease both;
}

.kai-video-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 1100px;
  box-sizing: border-box;
  animation: kai-modal-rise 0.22s ease both;
}

.kai-video-modal-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--kai-radius-hero);
  overflow: hidden;
  background: #000000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.kai-video-modal-frame iframe,
.kai-video-modal-frame video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Shown instead of the iframe when a card has no data-youtube-id yet. */
.kai-video-modal-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--kai-font-body);
  font-size: 15px;
  line-height: 1.6;
  color: #D8D8D8;
}
.kai-video-modal-empty strong {
  font-weight: 700;
  font-size: 17px;
  color: var(--kai-gold);
}
.kai-video-modal-empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 3px 7px;
}

.kai-video-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #FFFFFF;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.kai-video-modal-close:hover { background: rgba(0, 0, 0, 0.75); }
.kai-video-modal-close svg { display: block; }

/* Once there is room, the close button moves off the video onto the backdrop. */
@media (min-width: 900px) {
  .kai-video-modal-close {
    top: -52px;
    right: 0;
    background: rgba(255, 255, 255, 0.14);
  }
  .kai-video-modal-close:hover { background: rgba(255, 255, 255, 0.26); }
}

@keyframes kai-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes kai-modal-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .kai-video-modal-backdrop,
  .kai-video-modal-dialog { animation: none; }
}

/* ==========================================================================
   BREAKPOINT: 480px
   ========================================================================== */

@media (min-width: 480px) {
  .kai-page .kai-section-title { font-size: 26px; }
}

/* ==========================================================================
   BREAKPOINT: 768px
   ========================================================================== */

@media (min-width: 768px) {
  :root { --kai-gutter: 24px; }

  .kai-page { padding-top: 95px; }
  .kai-page > section + section { margin-top: 72px; }

  .kai-page .kai-section-title { font-size: 29px; }
  .kai-page .kai-section-head { margin-bottom: 28px; }

  .kai-page .kai-hero-play { width: 84px; height: 84px; }
  .kai-page .kai-hero-play img { width: 40px; height: 40px; }

  .kai-page .kai-brochure-heading { font-size: 21px; }
  .kai-page .kai-brochure-snippet { font-size: 17px; }

  .kai-page .kai-stories { padding: 72px 0; }
  .kai-page .kai-stories-intro { font-size: 17px; margin-bottom: 32px; }
  .kai-page .kai-stories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
  }
  .kai-page .kai-story-body { padding: 28px; }
  .kai-page .kai-story-title { font-size: 20px; }

  /* Six cards no longer fit a tablet row, so the arrows earn their place
     here rather than waiting for 1024px. */
  .kai-page .kai-carousel-nav { display: flex; }
  .kai-page .kai-video-card { flex-basis: 320px; }

  .kai-page .kai-cta { padding: 72px 0; }
  .kai-page .kai-cta-heading { font-size: 29px; }
  .kai-page .kai-cta-desc { font-size: 16px; }
}

/* ==========================================================================
   BREAKPOINT: 1024px
   ========================================================================== */

@media (min-width: 1024px) {
  .kai-page { padding-top: 106px; }
  .kai-page > section + section { margin-top: 96px; }

  .kai-page .kai-section-title { font-size: 35px; }
  .kai-page .kai-section-head { margin-bottom: 32px; }

  /* Hero */
  .kai-page .kai-hero-card { aspect-ratio: 1200 / 614; }
  .kai-page .kai-hero-play { width: 110px; height: 110px; }
  .kai-page .kai-hero-play img { width: 54px; height: 54px; }

  /* Brochure — side by side */
  .kai-page .kai-brochure {
    flex-direction: row;
    align-items: flex-start;
    gap: 45px;
  }
  .kai-page .kai-brochure-media { width: 492px; }
  .kai-page .kai-brochure-info { flex: 1 1 0; min-width: 0; gap: 22px; }
  .kai-page .kai-brochure-heading { font-size: 22px; }
  .kai-page .kai-brochure-snippet { font-size: 18px; line-height: 1.78; }

  /* Success stories */
  .kai-page .kai-stories { padding: 96px 0; }
  .kai-page .kai-stories-intro { font-size: 18px; line-height: 1.78; margin-bottom: 36px; }
  .kai-page .kai-story-body { gap: 20px; padding: 28px; }
  .kai-page .kai-story-title { font-size: 22px; line-height: 1.45; }
  .kai-page .kai-story-desc { font-size: 18px; line-height: 1.56; }

  /* Videos — exactly 3 in view, the rest reachable through the arrows.
     100% here is the track's content box, so subtracting the two 19px
     gaps and dividing by three lands the third card flush with the edge. */
  .kai-page .kai-video-card { flex: 0 0 calc((100% - 38px) / 3); min-width: 0; }
  .kai-page .kai-video-body { padding: 28px; }
  .kai-page .kai-video-title { font-size: 20px; line-height: 1.4; }

  /* CTA */
  .kai-page .kai-cta { padding: 100px 0; }
  .kai-page .kai-cta-eyebrow { font-size: 17px; margin-bottom: 16px; }
  .kai-page .kai-cta-heading { font-size: 35px; line-height: 1.43; }
  .kai-page .kai-cta-desc { font-size: 16px; margin-bottom: 30px; }
  .kai-page .kai-btn--demo { font-size: 18px; padding: 14px 40px; }
}

/* ==========================================================================
   BREAKPOINT: 1280px
   ========================================================================== */

@media (min-width: 1280px) {
  .kai-page .kai-meta-text { font-size: 16px; }
}
