/* =========================================================================
   MantaSys about page (about.html): the person behind it.
   Loaded after story.css and uses its tokens, bar, rail, cards, steps bar,
   contact scene and the --p / --a / --w timeline (see the top of story.css).
   As there, every animated rule is scoped to html.js, so without the script
   or with reduced motion each scene shows its finished state.
   ========================================================================= */

/* =======================================================================
   01 · Hello: three strands braid into one line and end in the mark
   ======================================================================= */

.s-hello .stage {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  --d: 1;
}
html.js .s-hello .stage { --d: clamp(0, (var(--p) - .4) / .2, 1); }
html.js .hello-copy .eyebrow { animation: fade-up .9s var(--ease) .05s both; }
html.js .hello-vis { animation: fade .9s ease .35s both; }

.strands { width: 100%; height: auto; max-height: 72vh; display: block; overflow: visible; }
.strands text { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; fill: var(--fg-3); }
.strands .vlabel.one { fill: var(--teal-hi); opacity: var(--d); }

html.js .braid { --t: clamp(0, (var(--p) - var(--a)) / var(--w), 1); }
/* the strands draw on load; the scroll braids them and lands the mark */
html.js .strand {
  stroke-dasharray: 1 1;
  animation: strand-draw 1.8s var(--ease) var(--dl) both;
}
@keyframes strand-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.strand { fill: none; stroke: var(--fg-3); stroke-width: 2; stroke-linejoin: round; }
.strand:nth-of-type(2) { stroke: var(--teal-hi); }
.braid { fill: none; stroke: var(--teal-hi); stroke-width: 4; stroke-linecap: round; }
.braid-flow {
  fill: none; stroke: var(--fg); stroke-width: 4; stroke-dasharray: 6 22;
  opacity: var(--d);
  animation: flow 1.4s linear infinite;
}
.hello-mark path { fill: var(--fg); }
.hello-mark .mark-dot { fill: var(--teal-hi); }
html.js .hello-mark {
  opacity: var(--d);
  filter: drop-shadow(0 0 calc(var(--d) * 16px) rgba(45, 212, 191, .35));
}

/* =======================================================================
   02 · Path: a horizontal timeline driven by vertical scroll
   ======================================================================= */

.s-path .stage { align-content: center; gap: clamp(28px, 6vh, 64px); }
.track-wrap { min-width: 0; }
html.js .track-wrap { clip-path: inset(-60px 0 -60px -100vw); }
.track {
  list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; gap: 20px;
}
html.js .track {
  flex-wrap: nowrap; width: max-content;
  --m: clamp(0, (var(--p) - .04) / .84, 1);
  /* slide by exactly the overflow; --shift (px, 0 or less) is measured in about.js */
  transform: translateX(calc(var(--shift, 0px) * var(--m)));
  will-change: transform;
}

.stop {
  position: relative; flex: none;
  width: clamp(250px, 24vw, 320px);
  margin-top: 30px; padding: 20px 22px 22px;
  background: var(--bg-2); border: 1px solid var(--line);
  display: grid; align-content: start; gap: 4px;
  --t: 1;
}
/* the line and the stop on it */
.stop::before {
  content: ""; position: absolute; left: -1px; right: -21px; top: -24px; height: 1px;
  background: var(--line);
}
.stop:last-child::before { right: 0; }
.stop::after {
  content: ""; position: absolute; left: -1px; top: -29px; width: 11px; height: 11px;
  border: 1px solid var(--teal-hi);
  background: color-mix(in srgb, var(--teal-hi) calc(var(--t) * 100%), var(--bg));
  transform: rotate(calc(var(--t) * 45deg));
}
html.js .stop {
  --t: clamp(0, (var(--p) - var(--a)) / .1, 1);
  opacity: calc(.3 + var(--t) * .7);
  transform: translateY(calc((1 - var(--t)) * 18px));
}
.stop-ic {
  width: 34px; height: 34px; margin-bottom: 8px;
  fill: none; stroke: var(--teal-hi); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.is-now .stop-ic { stroke: none; fill: var(--fg); }
.is-now .stop-ic circle { fill: var(--teal-hi); }
.is-now { border-color: var(--teal-hi); }
.stop-y { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-hi); }
.stop h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; }
.stop-o { color: var(--fg-2); font-size: .95rem; }
.stop-d { margin-top: 6px; color: var(--fg-3); font-size: .92rem; line-height: 1.5; }

/* =======================================================================
   03 · Toolkit
   ======================================================================= */

.s-kit .stage { align-content: center; gap: clamp(24px, 5vh, 48px); }
.kit-head .lede { margin-top: 14px; }
.kit {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(18px, 2.5vw, 36px);
  max-width: 1180px;
}
.kit-g { border-top: 2px solid var(--teal-hi); padding-top: 16px; }
.kit-k {
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-2); margin-bottom: 14px;
}
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 12px;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: .92rem; line-height: 1.3;
}
html.js .chips li {
  --t: clamp(0, (var(--p) - var(--a)) / .08, 1);
  opacity: var(--t);
  transform: translateY(calc((1 - var(--t)) * 12px)) scale(calc(.9 + var(--t) * .1));
}
.chips li:hover { border-color: var(--teal-hi); color: var(--teal-hi); }

.kit-wave {
  width: 100%; height: 60px; display: block;
  fill: none; stroke: var(--teal-hi); stroke-width: 2; opacity: .45;
  stroke-dasharray: 8 10;
  animation: flow 1.6s linear infinite;
}
html.js .kit-wave { transform: scaleY(calc(.1 + var(--p) * .9)); }

/* =======================================================================
   04 · Outside work: three vignettes, one per step
   ======================================================================= */

.s-outside .stage {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  --t2: 1; --t3: 1;
}
html.js .s-outside .stage {
  --t2: clamp(0, (var(--p) - .36) / .22, 1);   /* the crowd gathers */
  --t3: clamp(0, (var(--p) - .69) / .2, 1);    /* the scales come level */
}
.outside-copy { order: 2; }
.outside-vis { order: 1; }
.outside-vis svg { width: 100%; height: auto; max-height: 72vh; display: block; overflow: visible; }
.outside-vis .vlabel { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; fill: var(--teal-hi); }

html:not(.js) .vg:not([data-i="0"]) { display: none; }
html.js .vg { opacity: 0; transition: opacity .6s var(--ease); }
html.js .s-outside[data-step="0"] .vg[data-i="0"],
html.js .s-outside[data-step="1"] .vg[data-i="1"],
html.js .s-outside[data-step="2"] .vg[data-i="2"] { opacity: 1; }

/* the ride */
.road { stroke: var(--fg-3); stroke-width: 2; }
.road-dash { stroke: var(--fg-4); stroke-width: 2; stroke-dasharray: 26 30; }
html.js .road-dash { stroke-dashoffset: calc(var(--p) * 2400); }
.bike { fill: none; stroke: var(--fg-2); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.bike .frame { stroke: var(--teal-hi); stroke-width: 3.5; }
.bike .hub { fill: var(--bg); stroke: var(--teal-hi); }
.wheel-s path { stroke: var(--fg-4); stroke-width: 1.5; }
html.js .wheel-s { transform: rotate(calc(var(--p) * 2880deg)); }

/* the clean-up */
.coast { fill: none; stroke: var(--fg-3); stroke-width: 2; }
.sea { fill: none; stroke: var(--teal); stroke-width: 2; stroke-dasharray: 10 12; animation: flow 2.4s linear infinite; }
.crowd circle {
  --u: clamp(0, (var(--t2) - var(--k) * .7) / .3, 1);
  fill: var(--teal-hi);
  opacity: var(--u);
  transform-box: fill-box; transform-origin: center;
  transform: scale(var(--u));
}
.outside-vis .big-n {
  font-family: var(--display); font-size: 64px; font-weight: 600; letter-spacing: -.03em;
  fill: var(--fg);
}

/* F.E.M.: the beam tips toward the heavy side, then levels as books land on
   the light one. The pans stay upright and ride the beam's ends (±34px at 14deg). */
.scale-base, .cord { fill: none; stroke: var(--fg-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cord { stroke-width: 1.2; }
.beam path { stroke: var(--teal-hi); stroke-width: 4; stroke-linecap: round; }
.beam circle { fill: var(--bg); stroke: var(--teal-hi); stroke-width: 2; }
.dish { fill: var(--bg-3); stroke: var(--fg-2); stroke-width: 1.5; }
.book { fill: var(--bg-2); stroke: var(--fg-2); stroke-width: 1.2; }
.book.add { fill: var(--teal-tint); stroke: var(--teal-hi); }
html.js .beam {
  transform-box: view-box; transform-origin: 320px 150px;
  transform: rotate(calc((1 - var(--t3)) * -14deg));
}
html.js .pan-l { transform: translateY(calc((1 - var(--t3)) * 34px)); }
html.js .pan-r { transform: translateY(calc((1 - var(--t3)) * -34px)); }
html.js .book.add {
  --u: clamp(0, (var(--t3) - var(--k) * .5) / .5, 1);
  opacity: var(--u);
  transform: translateY(calc((1 - var(--u)) * -60px));
}


/* ---------- Contact ---------------------------------------------------- */

.contacts a { color: var(--teal-hi); text-decoration: none; border-bottom: 1px solid currentColor; }
.contacts a:hover { color: var(--fg); }

/* =======================================================================
   Smaller and shorter screens
   ======================================================================= */

@media (max-height: 820px) and (min-width: 721px) {
  .stop-d { font-size: .85rem; }
  .stop-ic { width: 26px; height: 26px; margin-bottom: 4px; }
  .kit-head .lede { display: none; }
}

@media (max-width: 1100px) {
  .kit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .s-hello .stage,
  .s-outside .stage { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 18px; }
  .strands { max-height: 30vh; max-height: 30svh; }
  .outside-vis svg { max-height: 34vh; max-height: 34svh; }
  .outside-copy { order: 0; }
}

@media (max-width: 720px) {
  /* The timeline and the toolkit scroll normally on phones. */
  html.js .s-path,
  html.js .s-kit { height: auto; }
  html.js .s-path .stage,
  html.js .s-kit .stage { position: relative; height: auto; overflow: visible; }
  html.js .track { flex-direction: column; width: auto; transform: none; }
  .stop { width: auto; }
  .stop::before { display: none; }
  .stop::after { left: -19px; top: 22px; }
  .track { padding-left: 18px; }
  html.js .stop { opacity: 1; transform: none; --t: 1; }
  html.js .chips li { opacity: 1; transform: none; }
  .kit { grid-template-columns: minmax(0, 1fr); }
  .kit-wave { display: none; }
}
