/* ==========================================================================
   SAJ Dental Clinic — "Our Journey" section
   Scope: every selector is under .our-journey-section. Visual values are
   CSS custom properties so they can map to future CMS / widget controls.
   ========================================================================== */

/* Standalone preview page only (our-journey.html): extra room below so the
   whole timeline can be scrolled through. */
.our-journey-preview {
  margin: 0;
  padding-bottom: 50vh;
  background: #FFFFFF;
}

.our-journey-section {
  /* ---- Brand ---- */
  --oj-navy: #0B2340;
  --oj-navy-soft: #1A3557;
  --oj-blue: #1269A8;
  --oj-orange: #F4511E;
  --oj-orange-strong: #D6400F;
  --oj-text: #4A5770;
  --oj-pale: #D5E5F5;

  /* ---- Type ---- */
  --oj-font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --oj-font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --oj-heading-size: clamp(2.25rem, 3.7vw, 4.1rem);
  --oj-year-size: clamp(2rem, 2.9vw, 2.9rem);

  /* ---- Timeline layout ---- */
  --oj-max: 1140px;
  --oj-spine-gap: clamp(72px, 8vw, 120px);   /* width of the centre column */
  --oj-row-gap: 22px;
  --oj-media-w: 190px;
  --oj-card-radius: 22px;
  --oj-node: 26px;
  --oj-wave-h: clamp(110px, 13vw, 230px);

  --oj-ease: cubic-bezier(0.22, 1, 0.36, 1);

  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
  padding: clamp(72px, 8vw, 120px) 0 calc(var(--oj-wave-h) + clamp(24px, 4vw, 64px));
  background:
    radial-gradient(70% 50% at 50% 0%, #FFFFFF 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #F9FBFE 0%, #F1F6FC 45%, #EAF2FB 100%);
  font-family: var(--oj-font-body);
  color: var(--oj-text);
  -webkit-font-smoothing: antialiased;
}

.our-journey-section *,
.our-journey-section *::before,
.our-journey-section *::after {
  box-sizing: border-box;
}

/* Outer element: scroll parallax. Inner layer: mouse parallax / idle drift. */
.our-journey-section .our-journey__layer {
  display: block;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   1. Background
   -------------------------------------------------------------------------- */
.our-journey__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.our-journey__blob,
.our-journey__curves,
.our-journey__backdrop,
.our-journey__patient {
  position: absolute;
}

.our-journey__blob .our-journey__layer {
  border-radius: 62% 38% 55% 45% / 45% 55% 45% 55%;
}

.our-journey__blob--a {
  left: -14%;
  top: 6%;
  width: 48vw;
  height: 42vw;
}

.our-journey__blob--a .our-journey__layer {
  background: radial-gradient(closest-side, rgba(196, 220, 244, 0.65), rgba(196, 220, 244, 0));
}

.our-journey__blob--b {
  right: -12%;
  top: 44%;
  width: 42vw;
  height: 40vw;
}

.our-journey__blob--b .our-journey__layer {
  border-radius: 41% 59% 47% 53% / 58% 42% 58% 42%;
  background: radial-gradient(closest-side, rgba(205, 226, 247, 0.7), rgba(205, 226, 247, 0));
}

.our-journey__blob--c {
  left: 26%;
  bottom: 10%;
  width: 46vw;
  height: 26vw;
}

.our-journey__blob--c .our-journey__layer {
  border-radius: 55% 45% 38% 62% / 50% 60% 40% 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
}

.our-journey__curves {
  inset: 0;
}

/* Soft-focus clinic photograph, top right */
.our-journey__backdrop {
  top: -2%;
  right: -4%;
  width: 50%;
  height: 64%;
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 72% 32%, #000 30%, rgba(0, 0, 0, 0.5) 52%, transparent 76%);
  mask-image: radial-gradient(ellipse 72% 70% at 72% 32%, #000 30%, rgba(0, 0, 0, 0.5) 52%, transparent 76%);
}

.our-journey__backdrop-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 40%;
  opacity: 0.45;
  filter: blur(1.5px) saturate(0.75);
  transform: scale(1.06);
}

/* --------------------------------------------------------------------------
   7. Foreground patient — organic, softly feathered, behind the cards
   -------------------------------------------------------------------------- */
.our-journey__patient {
  z-index: 1;
  left: -9vw;
  bottom: calc(var(--oj-wave-h) * 0.15);
  width: clamp(360px, 36vw, 680px);
  aspect-ratio: 1312 / 1199;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 62% 62% at 46% 52%, #000 58%, transparent 74%);
  mask-image: radial-gradient(ellipse 62% 62% at 46% 52%, #000 58%, transparent 74%);
}

.our-journey__patient .our-journey__layer {
  border-radius: 46% 54% 58% 42% / 52% 46% 54% 48%;
  overflow: hidden;
}

.our-journey__patient-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   Container + header
   -------------------------------------------------------------------------- */
.our-journey__container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: calc(var(--oj-max) + 48px);
  margin: 0 auto;
  padding: 0 24px;
}

.our-journey__header {
  max-width: 760px;
  margin: 0 auto clamp(40px, 4.5vw, 64px);
  text-align: center;
}

.our-journey__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 clamp(16px, 1.6vw, 24px);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--oj-navy-soft);
}

.our-journey__eyebrow-line {
  display: block;
  width: 48px;
  height: 2px;
  border-radius: 2px;
  background: var(--oj-orange);
  transform-origin: right center;
}

.our-journey__heading {
  margin: 0 0 clamp(16px, 1.6vw, 24px);
  font-family: var(--oj-font-display);
  font-size: var(--oj-heading-size);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--oj-navy);
}

/* Line masks; padding leaves room for italic overhang + descenders */
.our-journey__heading-line {
  display: block;
  overflow: hidden;
  padding: 0 0.1em 0.1em;
  margin-bottom: -0.1em;
}

.our-journey__heading-text,
.our-journey__heading-highlight {
  display: inline-block;
}

.our-journey__heading-highlight {
  font-style: italic;
  color: var(--oj-orange);
}

.our-journey__intro {
  max-width: 34em;
  margin: 0 auto;
  font-size: clamp(1rem, 1.05vw, 1.0625rem);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   4. Timeline
   Two content columns + a centre "spine" column. Each item spans two grid
   rows and starts one row after the previous item, so left and right
   cards interleave like the design.
   -------------------------------------------------------------------------- */
.our-journey__timeline-wrap {
  position: relative;
  max-width: var(--oj-max);
  margin: 0 auto;
}

.our-journey__line {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.our-journey__line path {
  fill: none;
  stroke-linecap: round;
}

.our-journey__line-track {
  stroke: var(--oj-pale);
  stroke-width: 2;
}

.our-journey__line-progress {
  stroke-width: 2.25;
}

/* No-JS fallback: a plain centred line (hidden once JS draws the path) */
.our-journey__timeline-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--oj-pale);
}

.our-journey-section.has-path .our-journey__timeline-wrap::before {
  display: none;
}

.our-journey__timeline {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--oj-spine-gap) minmax(0, 1fr);
  grid-auto-rows: auto;
  row-gap: var(--oj-row-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.our-journey__item {
  position: relative;
  grid-row-end: span 2;
  align-self: center;
}

.our-journey__item--left  { grid-column: 1; }
.our-journey__item--right { grid-column: 3; }

/* Row starts (supports up to 10 milestones) */
.our-journey__item:nth-child(1)  { grid-row-start: 1; }
.our-journey__item:nth-child(2)  { grid-row-start: 2; }
.our-journey__item:nth-child(3)  { grid-row-start: 3; }
.our-journey__item:nth-child(4)  { grid-row-start: 4; }
.our-journey__item:nth-child(5)  { grid-row-start: 5; }
.our-journey__item:nth-child(6)  { grid-row-start: 6; }
.our-journey__item:nth-child(7)  { grid-row-start: 7; }
.our-journey__item:nth-child(8)  { grid-row-start: 8; }
.our-journey__item:nth-child(9)  { grid-row-start: 9; }
.our-journey__item:nth-child(10) { grid-row-start: 10; }

/* --------------------------------------------------------------------------
   Nodes (sit on the spine; the JS path is drawn through their centres)
   -------------------------------------------------------------------------- */
.our-journey__node {
  position: absolute;
  z-index: 3;
  top: calc(var(--oj-node-y, 30%) - var(--oj-node) / 2);
  width: var(--oj-node);
  height: var(--oj-node);
  border-radius: 50%;
  border: 2px solid var(--oj-pale);
  background: #FFFFFF;
  box-shadow: 0 0 0 0 rgba(244, 81, 30, 0);
  transform: scale(0.85);
  transition:
    transform 0.6s var(--oj-ease),
    border-color 0.6s ease,
    box-shadow 0.6s ease;
}

/* Small organic offsets so the line flows instead of running dead straight */
.our-journey__item--left .our-journey__node {
  left: calc(100% + var(--oj-spine-gap) / 2 - var(--oj-node) / 2 + 6px);
}

.our-journey__item--right .our-journey__node {
  left: calc(var(--oj-spine-gap) / -2 - var(--oj-node) / 2 - 6px);
}

.our-journey__node-dot {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8DB6DE;
  transition: background-color 0.5s ease, transform 0.6s var(--oj-ease);
}

.our-journey__node-ripple {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--oj-orange);
  opacity: 0;
}

.our-journey__item.is-active .our-journey__node {
  transform: scale(1);
  border-color: rgba(18, 105, 168, 0.55);
  box-shadow: 0 0 0 6px rgba(244, 81, 30, 0.08), 0 6px 16px -6px rgba(244, 81, 30, 0.45);
}

.our-journey__item.is-active .our-journey__node-dot {
  background: var(--oj-orange);
  transform: scale(1.15);
}

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */
.our-journey__card {
  position: relative;
  display: grid;
  grid-template-columns: var(--oj-media-w) minmax(0, 1fr);
  gap: clamp(18px, 1.8vw, 26px);
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--oj-card-radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 44px -28px rgba(11, 35, 64, 0.28), 0 2px 6px rgba(11, 35, 64, 0.03);
  will-change: transform;
}

.our-journey__media {
  position: relative;
  margin: 0;
  min-height: 150px;
  overflow: hidden;
  border-radius: calc(var(--oj-card-radius) - 8px);
  background: #E6EFF8;
}

.our-journey__image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.our-journey__body {
  position: relative;
  align-self: center;
  padding: 14px 18px 14px 0;
}

.our-journey__year {
  margin: 0 64px 6px 0;
  font-family: var(--oj-font-display);
  font-size: var(--oj-year-size);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--oj-navy);
  transform-origin: left bottom;
}

.our-journey__title {
  margin: 0 0 8px;
  font-size: clamp(1.0625rem, 1.25vw, 1.1875rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--oj-navy);
}

.our-journey__text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--oj-text);
}

.our-journey__icon {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #E7F1FB;
  color: var(--oj-blue);
}

.our-journey__icon--orange {
  background: #FDEBE3;
  color: var(--oj-orange-strong);
}

.our-journey__icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   "Today" — same family, slightly stronger presence
   -------------------------------------------------------------------------- */
.our-journey__item--today {
  --oj-media-w: 220px;
  margin-top: 12px;
}

.our-journey__item--today .our-journey__card {
  border-color: rgba(244, 81, 30, 0.18);
  box-shadow: 0 28px 54px -30px rgba(11, 35, 64, 0.34), 0 2px 6px rgba(11, 35, 64, 0.04);
}

.our-journey__item--today .our-journey__media {
  min-height: 180px;
}

/* Thin orange accent along the top edge */
.our-journey__item--today .our-journey__card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 32px;
  width: 96px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--oj-orange), rgba(244, 81, 30, 0));
}

/* Warm highlight that fades in when "Today" activates (opacity only) */
.our-journey__item--today .our-journey__card::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 24px 60px -24px rgba(244, 81, 30, 0.32);
  opacity: 0;
  transition: opacity 0.9s ease;
}

.our-journey__item--today.is-active .our-journey__card::after {
  opacity: 1;
}

.our-journey__item--today .our-journey__year {
  font-style: italic;
}

/* --------------------------------------------------------------------------
   8. Bottom wave
   -------------------------------------------------------------------------- */
.our-journey__wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  z-index: 1;
  height: var(--oj-wave-h);
  pointer-events: none;
}

.our-journey__wave-svg {
  position: absolute;
  left: -5%;
  bottom: 0;
  width: 110%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Reveal pre-state + fail-safe (see header comment in the HTML)
   -------------------------------------------------------------------------- */
.our-journey-section:not(.is-animated) [data-oj-reveal] {
  opacity: 0;
  animation: our-journey-failsafe 0.8s ease 1.8s forwards;
}

@keyframes our-journey-failsafe {
  to { opacity: 1; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* iPad landscape / small laptop: keep the alternating layout, tighter */
@media (max-width: 1199px) {
  .our-journey-section {
    --oj-spine-gap: 72px;
    --oj-media-w: 150px;
  }

  .our-journey__item--today {
    --oj-media-w: 170px;
  }

  .our-journey__text {
    font-size: 0.875rem;
  }

  .our-journey__icon {
    width: 40px;
    height: 40px;
  }

  .our-journey__icon svg {
    width: 20px;
    height: 20px;
  }

  .our-journey__year {
    margin-right: 48px;
  }

  .our-journey__backdrop {
    width: 54%;
    height: 52%;
  }

  .our-journey__backdrop-image {
    opacity: 0.45;
  }

  .our-journey__patient {
    width: 34vw;
    left: -12vw;
  }

  .our-journey__blob--c {
    display: none;
  }
}

/* iPad portrait: alternating, but cards become vertical (image on top) */
@media (max-width: 1023px) {
  .our-journey-section {
    --oj-spine-gap: 52px;
    --oj-row-gap: 18px;
  }

  .our-journey__card {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .our-journey__media,
  .our-journey__item--today .our-journey__media {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .our-journey__body {
    padding: 18px 10px 10px;
  }

  .our-journey__icon {
    top: -22px;
    right: 14px;
    border: 3px solid #FFFFFF;
  }

  .our-journey__year {
    margin-right: 0;
  }


  .our-journey__patient {
    width: 46vw;
    left: -18vw;
    bottom: 2%;
    opacity: 0.4;
  }
}

/* Mobile: one vertical timeline on the left, cards to the right */
@media (max-width: 767px) {
  .our-journey-section {
    --oj-heading-size: clamp(2rem, 8.4vw, 2.6rem);
    --oj-year-size: 2.125rem;
    --oj-rail: 40px;                     /* left gutter that holds the line */
    --oj-node: 22px;
  }

  .our-journey__container {
    padding: 0 20px;
  }

  .our-journey__eyebrow {
    font-size: 0.75rem;
  }

  .our-journey__timeline {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
    padding-left: var(--oj-rail);
  }

  .our-journey__item,
  .our-journey__item--left,
  .our-journey__item--right {
    grid-column: 1;
    grid-row: auto;
    align-self: stretch;
  }

  .our-journey__item:nth-child(n) {
    grid-row-start: auto;
  }

  .our-journey__item--left .our-journey__node,
  .our-journey__item--right .our-journey__node,
  .our-journey__item--today .our-journey__node {
    top: 26px;
    left: calc(var(--oj-rail) / -2 - var(--oj-node) / 2);
  }

  .our-journey__item--today {
    margin-top: 0;
  }

  .our-journey__timeline-wrap::before {
    left: 20px;
  }

  .our-journey__text {
    font-size: 0.9375rem;
  }

  /* Backgrounds become much quieter */
  .our-journey__backdrop {
    width: 100%;
    height: 34%;
    right: -20%;
  }

  .our-journey__backdrop-image {
    opacity: 0.28;
  }

  .our-journey__patient,
  .our-journey__curves path + path + path {
    display: none;
  }

  .our-journey__blob--a { width: 90vw; height: 80vw; }
  .our-journey__blob--b { width: 90vw; height: 90vw; }
}

/* Reduced motion: nothing hidden for long, no CSS transitions */
@media (prefers-reduced-motion: reduce) {
  .our-journey-section:not(.is-animated) [data-oj-reveal] {
    animation-delay: 0.6s;
  }

  .our-journey__node,
  .our-journey__node-dot,
  .our-journey__item--today .our-journey__card::after {
    transition: none;
  }
}
