/* ==========================================================================
   Captiv website
   Structure: 1. Tokens  2. Base  3. Layout  4. Header  5. Sections
              6. Hero chart  7. Orbit framework  8. Logo band  9. Cases
              10. Contact & footer  11. Utilities  12. Responsive & motion
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Captiv colours (final: Indigo auf Hell) */
  --c-bg: #F8F6F2;
  --c-bg-raised: #F8F6F2;
  --c-text: #706C7E;
  --c-text-soft: #434054;
  --c-text-strong: #16122D;
  --c-line: rgba(22, 18, 45, 0.14);
  --c-line-strong: rgba(22, 18, 45, 0.36);
  --c-accent: #402EC3;
  --c-overlay: rgba(248, 246, 242, 0.9);

  --font: Arial, Helvetica, sans-serif;

  --header-h: 77px;
  --rail-w: 200px;
  --gutter: 48px;

  /* Vertical position of pinned visuals (centered between header and viewport bottom) */
  --chart-h: 502px;
  --orbit-h: 520px;
  --chart-top: clamp(90px, calc(50vh - 212px), 420px);
  --orbit-top: clamp(90px, calc(50vh - 222px), 420px);
}

/* 2. Base ------------------------------------------------------------------ */
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--c-bg); }
a { color: var(--c-text-strong); }

.page {
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
}

/* 3. Layout: left rail + main column ---------------------------------------- */
.row { display: flex; flex-wrap: wrap; }
section[id] { scroll-margin-top: var(--header-h); }
.section--bordered { border-top: 1px solid var(--c-line); }

.rail {
  flex: 0 0 var(--rail-w);
  box-sizing: border-box;
  padding: 40px 24px;
}

.main {
  flex: 999 1 560px;
  min-width: 0;
  box-sizing: border-box;
  border-left: 1px solid var(--c-line);
  padding: 40px var(--gutter) 120px var(--gutter);
}

.label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--c-text-strong);
  font-weight: 700;
}
.rail .label { position: sticky; top: 110px; }

/* 4. Header ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
}
.site-header__bar { align-items: center; }
.site-header__brand {
  flex: 0 0 var(--rail-w);
  box-sizing: border-box;
  padding: 20px 24px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c-text-strong);
  text-decoration: none;
}

.topnav {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  align-items: center;
  gap: 8px 28px;
  padding: 16px var(--gutter);
  box-sizing: border-box;
  border-left: 1px solid var(--c-line);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }

.topnav__link {
  color: var(--c-text-soft);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.topnav__link--current {
  gap: 6px;
  color: var(--c-text-strong);
  font-weight: 700;
}
.topnav__cta {
  margin-left: auto;
  padding: 0 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  background: rgba(152, 148, 134, 0.15);
  color: var(--c-text-strong);
  text-decoration: none;
  font-weight: 700;
}

/* 5. Sections -------------------------------------------------------------- */

/* Hero */
.main--hero { padding-top: 0; }
.hero-band {
  position: relative;
  margin: 0 calc(var(--gutter) * -1);
  padding: 120px var(--gutter) 96px;
  min-height: 640px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: var(--c-bg-raised);
  background-image: repeating-linear-gradient(135deg, rgba(252, 250, 243, 0.035) 0 1px, transparent 1px 14px);
  border-bottom: 1px solid var(--c-line);
}
.hero-band__placeholder {
  position: absolute;
  top: 24px;
  right: var(--gutter);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--c-text-soft);
}
.hero-title {
  margin: 0;
  font-size: 72px;
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--c-text-strong);
}
.hero-lead {
  margin: 32px 0 0 0;
  max-width: 760px;
  font-size: 20px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--c-text-soft);
}

/* Headings & statements */
.h-section {
  margin: 0;
  max-width: 980px;
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--c-text-strong);
}
.h-section--approach { max-width: none; line-height: 1.1; }
.h-section__sub { color: var(--c-text); }

.statements {
  display: flex;
  flex-direction: column;
  gap: 56px;
  margin-top: 96px;
  max-width: 920px;
}
.statement {
  margin: 0;
  max-width: 920px;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--c-text);
}
.statement--spaced { margin-top: 96px; }
.statement__highlight { color: var(--c-text-soft); }

/* Sources toggle */
.sources {
  margin-top: 32px;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.sources__toggle {
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--c-text-soft);
}
.sources__list {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-text-soft);
}
.sources__list[hidden] { display: none; }
.sources__list p { margin: 0; }

/* 6. Hero chart (scroll-driven, pinned) -------------------------------------- */
@keyframes reveal { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.chart-wrap {
  margin-top: 96px;
  height: 1240px;
}
.chart-pin { position: sticky; top: var(--chart-top); }
.chart {
  display: block;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  height: auto;
  max-height: calc(100vh - 160px);
}
.chart__accent-stroke { stroke: var(--c-accent); }
.chart__accent-fill { fill: var(--c-accent); }

/* The chart and the framework are built while scrolling; main.js sets each step's progress
   directly from the scroll position (same timing as before, works the same in every browser) */

.chart__labels { opacity: 0; }

/* 7. Orbit framework (scroll-driven, pinned) --------------------------------- */
@keyframes nodein { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes centerfill {
  from { background-color: var(--c-bg); color: var(--c-text-strong); }
  to { background-color: var(--c-text-strong); color: var(--c-bg); }
}
@keyframes tipin { from { opacity: 0; scale: .96; } to { opacity: 1; scale: 1; } }

.orbit-wrap {
  margin-top: 48px;
  height: 1450px;
}
.orbit-pin { position: sticky; top: var(--orbit-top); }
.orbit-stage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 48px 72px;
}
.orbit {
  position: relative;
  flex: 0 1 520px;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
}
.orbit__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.orbit__center {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 140px;
  height: 140px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid var(--c-text-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  font-size: 24px;
  line-height: 1.15;
  text-align: center;
  letter-spacing: -0.01em;
  color: var(--c-text-strong);
  background: var(--c-bg);
}

.node {
  position: absolute;
  translate: -50% -44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font);
}
.node__icon {
  width: 88px;
  height: 88px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid var(--c-text-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  color: var(--c-text-strong);
  transition: background-color .2s, color .2s;
}
.node.is-active .node__icon { background: var(--c-text-strong); color: var(--c-bg); }
.node__label {
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--c-text-strong);
  white-space: nowrap;
  background: var(--c-bg);
  padding: 3px 8px;
}

/* Node positions on the ring (clockwise from top) */
.node--0 { left: 50%;    top: 11.54%; }
.node--1 { left: 86.58%; top: 38.12%; }
.node--2 { left: 72.62%; top: 81.12%; }
.node--3 { left: 27.38%; top: 81.12%; }
.node--4 { left: 13.42%; top: 38.12%; }

/* Hover / focus overlay */
.tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  box-sizing: border-box;
  width: 280px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 16px;
  background: rgba(55, 53, 47, 0.62);
  border: 1px solid rgba(252, 250, 243, 0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  animation: tipin .18s ease both;
}
.tip[hidden] { display: none; }
.tip__title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--c-text-strong);
}
.tip__icon { display: flex; }
.tip__text { margin: 0; font-size: 15px; line-height: 1.4; color: var(--c-text-strong); }

/* Interaction hint below the center */
@keyframes nudge { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(2px, 2px); } }
.orbit__hint {
  position: absolute;
  left: 50%;
  top: 77%;
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  line-height: 1.3;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--c-text-soft);
  white-space: nowrap;
  pointer-events: none;
}
.orbit__hint-cursor { animation: nudge 1.6s ease-in-out infinite; }

.orbit__line { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.orbit__ring, .orbit__center, .node, .orbit__hint { opacity: 0; }
}

/* 8. Logo band ------------------------------------------------------------- */
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.main--team { padding-right: 0; }
.h-lead {
  margin: 0;
  max-width: 920px;
  padding-right: var(--gutter);
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--c-text-soft);
}
.logo-band { margin-top: 72px; overflow: hidden; padding: 24px 0; }
.logo-band__track {
  display: flex;
  width: max-content;
  /* Duration per logo set; main.js scales it when it adds sets for wide screens */
  animation: marquee 16s linear infinite;
  will-change: transform;
}
.logo-band__item { display: flex; align-items: center; height: 80px; padding: 0 36px; }
.logo-band__item img { display: block; width: auto; }

/* Individual logo heights so all marks carry similar visual weight */
.logo--mckinsey { height: 40px; }
.logo--bain { height: 38px; }
.logo--tum { height: 34px; }
.logo--oxford { height: 48px; }
.logo--rwth { height: 42px; }
.logo--uc-davis { height: 72px; }
.logo--ucl { height: 40px; }

/* 9. Cases (sticky stacking cards) ------------------------------------------ */
.main--cases { padding-top: 0; padding-bottom: 0; }
.cases { display: flex; flex-direction: column; }

.card {
  position: sticky;
  /* 1px less than the header, so a stuck card's top border hides behind the header border */
  top: calc(var(--header-h) - 1px);
  box-sizing: border-box;
  min-height: 640px;
  gap: 32px 48px;
  align-content: flex-start;
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
  padding: 48px var(--gutter) 72px var(--gutter);
  background: var(--c-bg);
  /* Opaque line, and no photo under it: the semi-transparent --c-line would
     otherwise pick up the un-darkened photo edge and look brighter and thicker */
  border-top: 1px solid color-mix(in srgb, var(--c-text) 35%, var(--c-bg));
  background-clip: padding-box;
}
.card:first-child { border-top: 0; }

.card--ecommerce,
.card--fashion,
.card--retail,
.card--life-science {
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat;
  background-clip: padding-box;
}
.card--ecommerce { background-image: linear-gradient(var(--c-overlay), var(--c-overlay)), url("../img/cases/case-ecommerce-motion.webp?v=11"); }
.card--fashion { background-image: linear-gradient(var(--c-overlay), var(--c-overlay)), url("../img/cases/case-fashion-motion.webp?v=11"); background-position: center, 50% 20%; }
.card--retail { background-image: linear-gradient(var(--c-overlay), var(--c-overlay)), url("../img/cases/case-retail-motion.webp?v=11"); }
.card--life-science { background-image: linear-gradient(var(--c-overlay), var(--c-overlay)), url("../img/cases/case-life-science-motion.webp?v=11"); }

.card__title {
  flex: 1 1 260px;
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 400;
  color: var(--c-text);
}
.card__body {
  flex: 2 1 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 720px;
}
.card__text { margin: 0; font-size: 16px; line-height: 1.45; color: var(--c-text-soft); }

.impact { margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--c-line); }
.impact__value {
  margin: 12px 0 0 0;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--c-text-strong);
}
.impact__text { margin: 8px 0 0 0; font-size: 16px; line-height: 1.45; color: var(--c-text-soft); }

/* 10. Contact & footer ------------------------------------------------------ */
.contact-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 1px dashed var(--c-line-strong);
  font-size: 14px;
  color: var(--c-text-soft);
}

.site-footer__rail { padding-top: 24px; padding-bottom: 24px; }
.site-footer__brand { font-size: 16px; font-weight: 700; color: var(--c-text-strong); }
.site-footer__main {
  padding-top: 24px;
  padding-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--c-text-soft);
}

/* 11. Utilities ------------------------------------------------------------ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* 12. Responsive & motion -------------------------------------------------- */
@media (max-width: 760px) {
  .hero-band { margin: 0 -16px; padding: 72px 16px 48px; min-height: 440px; }
  .hero-band__placeholder { right: 16px; }

  .card {
    min-height: 0;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .orbit-wrap { height: auto; }
  .orbit-pin { position: static; }
  .node__icon { width: 60px; height: 60px; }
  .node { translate: -50% -30px; }
  .orbit__center { width: 96px; height: 96px; font-size: 16px; padding: 8px; }
  .node__label { font-size: 10px; }
  .orbit__hint { font-size: 9px; }

  .chart-wrap { height: auto; }
  .chart-pin { position: static; }

  .rail { flex-basis: 100%; padding: 24px 16px 0 16px; }
  .main { border-left: 0; padding: 40px 16px 80px 16px; }

  /* Section-specific spacing keeps priority over the generic mobile padding */
  .main--hero { padding-top: 0; }
  .main--team { padding-right: 0; }
  .main--cases { padding-top: 0; padding-bottom: 0; }
  .site-footer__rail { padding-top: 24px; padding-bottom: 24px; }
  .site-footer__main { padding-top: 24px; padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .chart__reveal,
  .chart__labels,
  .logo-band__track,
  .node,
  .orbit__line,
  .orbit__ring,
  .orbit__center,
  .orbit__hint,
  .orbit__hint-cursor,
  .tip { animation: none; }
}
