/* ==========================================================
   QMIS Journey Timeline — scoped styles
   Everything is namespaced under .qmis-timeline-wrap so it
   cannot clash with GoodLayers / theme styles.
   Brand: navy #0a0f3d, maroon #af2025. Font: Poppins.

   RESPONSIVE STRATEGY — CONTAINER QUERIES (not @media)
   -----------------------------------------------------------
   This widget can be dropped into a narrow GoodLayers column
   (sidebar, 1/3 / 1/4 width column, etc). Using @media queries
   would respond to the BROWSER WINDOW width, not the actual
   width of the box the widget sits in — so on a wide desktop
   screen with a narrow column, the "desktop" 2-column layout
   would fire even though there's no room for it, forcing the
   text and image on top of each other.

   Container queries fix this: the breakpoints below respond to
   .qmis-timeline-wrap's own rendered width, wherever it's placed.

   Base rules  = < 481px container width  (single column, stacked)
   ≥ 481px     = large phones / phablets width (roomier stacked layout)
   ≥ 601px     = small tablets width (stacked, wider cards)
   ≥ 769px     = enough room for the 2-column zig-zag layout
   ≥ 1025px    = full desktop layout
   ≥ 1441px    = extra-wide layout
   ========================================================== */

.qmis-timeline-wrap{
  --qmis-navy: #0a0f3d;
  --qmis-navy-soft: #1b2260;
  --qmis-maroon: #af2025;
  --qmis-gold: #c9a24b;
  --qmis-paper: #f7f6f2;
  --qmis-ink: #14162b;
  --qmis-ink-dim: #5b5e78;
  --qmis-line: #dcdae2;
  --qmis-shadow: 0 14px 34px -18px rgba(10,15,61,0.35);

  font-family: 'Poppins', sans-serif;
  color: var(--qmis-ink);
  background:
    radial-gradient(circle at 15% 8%, rgba(175,32,37,0.06), transparent 40%),
    radial-gradient(circle at 85% 92%, rgba(10,15,61,0.06), transparent 40%),
    var(--qmis-paper);
  box-sizing: border-box;
  overflow-x: hidden;

  /* establishes this element as a query container for its own width */
  container-type: inline-size;
  container-name: qmis-timeline;
}
.qmis-timeline-wrap *,
.qmis-timeline-wrap *::before,
.qmis-timeline-wrap *::after{
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}
.qmis-timeline-wrap img{ max-width: 100%; height: auto; }

/* ==========================================================
   HERO
   ========================================================== */
.qmis-hero{
  position: relative;
  padding: 44px 16px 32px;
  text-align: center;
  overflow: hidden;
}
.qmis-hero::before{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(var(--qmis-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--qmis-line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity:0.35;
  -webkit-mask-image: radial-gradient(ellipse at center, black 10%, transparent 72%);
  mask-image: radial-gradient(ellipse at center, black 10%, transparent 72%);
  pointer-events:none;
}
.qmis-hero-eyebrow{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--qmis-maroon);
  margin-bottom: 16px;
}
.qmis-hero-eyebrow::before,
.qmis-hero-eyebrow::after{
  content:"";
  width: 20px;
  height: 1px;
  background: var(--qmis-maroon);
  opacity:0.6;
}
.qmis-hero-title{
  position:relative;
  font-weight: 700;
  font-size: clamp(1.6rem, 7cqi, 3.2rem);
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--qmis-navy);
  letter-spacing: -0.01em;
  word-wrap: break-word;
}
.qmis-hero-subtitle{
  position:relative;
  font-size: clamp(11px, 2.6cqi, 13px);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--qmis-ink-dim);
  margin: 0 0 22px;
  padding: 0 8px;
}
.qmis-hero-tagline{
  position:relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 20px;
  background: #fff;
  border: 1px solid var(--qmis-line);
  border-radius: 22px;
  font-size: clamp(13px, 3cqi, 15px);
  line-height: 1.5;
  color: var(--qmis-ink-dim);
  box-shadow: var(--qmis-shadow);
}

/* ==========================================================
   TIMELINE — base (single column, stacked)
   This is what renders in narrow columns/sidebars at ANY
   browser window size, and on phones.
   ========================================================== */
.qmis-timeline{
  position: relative;
  max-width: 1080px;
  margin: 20px auto 50px;
  padding: 24px 16px 10px 44px; /* room for spine + dots on the left */
}

/* spine sits on the left for the stacked layout */
.qmis-timeline::before{
  content:"";
  position:absolute;
  top:0;
  left: 20px;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--qmis-navy) 0%, var(--qmis-maroon) 55%, var(--qmis-gold) 100%);
  border-radius: 3px;
}

.qmis-entry{
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  margin-bottom: 34px;
}
.qmis-entry:last-child{ margin-bottom: 0; }

.qmis-node{
  grid-column: 1;
  grid-row: 1 / span 2;
  position: relative;
  display:flex;
  justify-content:center;
  padding-top: 4px;
}
.qmis-node-dot{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--qmis-paper);
  border: 3px solid var(--qmis-maroon);
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 5px var(--qmis-paper);
}
.qmis-node-year{
  position: static;
  transform: none;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--qmis-navy);
  background: var(--qmis-gold);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  text-align: center;
}

/*
 * Text ALWAYS row 1, image ALWAYS row 2 — explicit, unconditional,
 * identical for normal and reverse entries. This (not the `order`
 * property, and not relying on auto-placement) is what guarantees
 * the image never renders on top of / behind the heading.
 */
.qmis-entry .qmis-text-card,
.qmis-entry.qmis-reverse .qmis-text-card{
  grid-column: 2;
  grid-row: 1;
  text-align: left;
  padding: 0;
}
.qmis-entry .qmis-media-card,
.qmis-entry.qmis-reverse .qmis-media-card{
  grid-column: 2;
  grid-row: 2;
  padding: 0;
  margin-top: 14px;
  justify-content: flex-start;
}

.qmis-text-card{
  background: #fff;
  border: 1px solid var(--qmis-line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--qmis-shadow);
}
.qmis-text-card h3{
  font-weight: 600;
  font-size: clamp(1.02rem, 4cqi, 1.2rem);
  margin: 0 0 8px;
  color: var(--qmis-navy);
  line-height: 1.3;
}
.qmis-text-card p{
  margin: 0;
  font-size: clamp(13px, 3.4cqi, 14.5px);
  font-weight: 400;
  line-height: 1.6;
  color: var(--qmis-ink-dim);
}

.qmis-media-card{ display:flex; }
.qmis-media-frame{
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid #fff;
  outline: 1px solid var(--qmis-line);
  box-shadow: var(--qmis-shadow);
  background: #fff;
}
.qmis-media-frame img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

/* ==========================================================
   Container ≥ 481px — large phones / phablets width
   ========================================================== */
@container qmis-timeline (min-width: 481px){
  .qmis-hero{ padding: 56px 24px 40px; }
  .qmis-timeline{ padding: 30px 24px 10px 52px; }
  .qmis-timeline::before{ left: 24px; }
  .qmis-entry{ grid-template-columns: 34px 1fr; column-gap: 18px; margin-bottom: 40px; }
  .qmis-node-dot{ width: 18px; height: 18px; }
  .qmis-text-card{ padding: 18px 20px; }
  .qmis-media-frame{ max-width: 360px; }
}

/* ==========================================================
   Container ≥ 601px — small tablet width
   Still stacked (one column reads best at this width for
   text+image cards) but with wider cards / larger type
   ========================================================== */
@container qmis-timeline (min-width: 601px){
  .qmis-hero{ padding: 64px 32px 46px; }
  .qmis-timeline{ max-width: 640px; padding: 34px 16px 10px 56px; margin: 24px auto 64px; }
  .qmis-timeline::before{ left: 26px; }
  .qmis-entry{ grid-template-columns: 36px 1fr; column-gap: 20px; margin-bottom: 46px; }
  .qmis-media-frame{ max-width: 100%; }
}

/* ==========================================================
   Container ≥ 769px — enough room for the full two-column,
   alternating (zig-zag) timeline layout with a centred spine
   ========================================================== */
@container qmis-timeline (min-width: 769px){
  .qmis-hero{ padding: 72px 24px 52px; }

  .qmis-timeline{
    max-width: 900px;
    margin: 28px auto 72px;
    padding: 36px 20px 10px;
  }
  .qmis-timeline::before{
    left: 50%;
    transform: translateX(-50%);
  }

  .qmis-entry{
    grid-template-columns: 1fr 56px 1fr;
    grid-template-rows: auto;
    column-gap: 0;
    align-items: start;
    margin-bottom: 52px;
  }

  /*
   * All three children pinned to the SAME explicit row.
   * CSS Grid's sparse auto-placement cursor only moves forward
   * through columns, so on "reverse" entries (image reassigned to
   * column 1, i.e. before the node's column 2) the browser can't
   * backtrack within the row and will silently drop items to a new
   * row unless the row is fixed explicitly — breaking the
   * left-image alignment. This rule prevents that.
   */
  .qmis-entry .qmis-node,
  .qmis-entry .qmis-text-card,
  .qmis-entry .qmis-media-card{
    grid-row: 1;
  }

  .qmis-node{
    grid-column: 2;
    justify-content: center;
    padding-top: 6px;
  }
  .qmis-node-dot{ width: 20px; height: 20px; box-shadow: 0 0 0 6px var(--qmis-paper); }
  .qmis-node-year{
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0;
    font-size: 11px;
  }

  .qmis-entry .qmis-text-card{ grid-column: 1; text-align: right; padding-right: 30px; }
  .qmis-entry .qmis-media-card{ grid-column: 3; padding-left: 30px; margin-top: 0; justify-content: flex-start; }
  .qmis-entry.qmis-reverse .qmis-text-card{ grid-column: 3; text-align: left; padding-right: 0; padding-left: 30px; }
  .qmis-entry.qmis-reverse .qmis-media-card{ grid-column: 1; padding-left: 0; padding-right: 30px; justify-content: flex-end; }

  .qmis-media-frame{ max-width: 260px; }
}

/* ==========================================================
   Container ≥ 1025px — full desktop layout
   ========================================================== */
@container qmis-timeline (min-width: 1025px){
  .qmis-hero{ padding: 80px 24px 56px; }

  .qmis-timeline{
    max-width: 1080px;
    margin: 30px auto 80px;
    padding: 40px 24px 10px;
  }

  .qmis-entry{
    grid-template-columns: 1fr 64px 1fr;
    margin-bottom: 60px;
  }

  .qmis-entry .qmis-text-card{ padding-right: 34px; }
  .qmis-entry .qmis-media-card{ padding-left: 34px; }
  .qmis-entry.qmis-reverse .qmis-text-card{ padding-left: 34px; }
  .qmis-entry.qmis-reverse .qmis-media-card{ padding-right: 34px; }

  .qmis-text-card{ padding: 20px 22px; }
  .qmis-media-frame{ max-width: 300px; }
}

/* ==========================================================
   Container ≥ 1441px — extra-wide layout
   ========================================================== */
@container qmis-timeline (min-width: 1441px){
  .qmis-timeline{ max-width: 1200px; }
  .qmis-hero-title{ font-size: 3.4rem; }
  .qmis-media-frame{ max-width: 340px; }
  .qmis-text-card{ padding: 24px 26px; }
  .qmis-text-card h3{ font-size: 1.3rem; }
  .qmis-text-card p{ font-size: 15px; }
}

/* ==========================================================
   FALLBACK for browsers without container query support
   (very rare in 2026, but this keeps things safe: it forces
   the single-column stacked layout everywhere instead of
   ever risking the overlap bug on an unsupported browser)
   ========================================================== */
@supports not (container-type: inline-size){
  .qmis-entry,
  .qmis-entry.qmis-reverse{
    grid-template-columns: 34px 1fr !important;
  }
  .qmis-entry .qmis-node,
  .qmis-entry.qmis-reverse .qmis-node{
    grid-column: 1 !important;
  }
  .qmis-entry .qmis-text-card,
  .qmis-entry.qmis-reverse .qmis-text-card{
    grid-column: 2 !important;
    grid-row: 1 !important;
    text-align: left !important;
    padding: 0 !important;
  }
  .qmis-entry .qmis-media-card,
  .qmis-entry.qmis-reverse .qmis-media-card{
    grid-column: 2 !important;
    grid-row: 2 !important;
    padding: 0 !important;
    margin-top: 14px !important;
  }
}

/* ==========================================================
   MOTION
   ========================================================== */
@media (prefers-reduced-motion: no-preference){
  .qmis-entry{
    opacity: 0;
    transform: translateY(20px);
    animation: qmis-rise 0.7s ease forwards;
  }
  .qmis-entry:nth-child(1){ animation-delay: .05s; }
  .qmis-entry:nth-child(2){ animation-delay: .12s; }
  .qmis-entry:nth-child(3){ animation-delay: .19s; }
  .qmis-entry:nth-child(4){ animation-delay: .26s; }
  .qmis-entry:nth-child(5){ animation-delay: .33s; }
  .qmis-entry:nth-child(6){ animation-delay: .40s; }
  .qmis-entry:nth-child(7){ animation-delay: .47s; }
  .qmis-entry:nth-child(8){ animation-delay: .54s; }
  @keyframes qmis-rise{ to{ opacity:1; transform: translateY(0); } }
}