/* ---------- The Problem: a pinned list on the left, text that scrolls, a picture that changes on the right ---------- */
.problem {
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pt: 9rem;                                   /* how far from the top the pinned parts sit (under the header) */
  --ch: calc(100vh - var(--pt) - 2.4rem);       /* height of one step: what is left of the screen, with a gap at the bottom */
  --ch: calc(100svh - var(--pt) - 2.4rem);
  padding: 9rem 0 0;
}

/* title + short lead */
.problem__head {
  max-width: 160rem;                            /* same width and side padding as the scrolling section below, so the title sits on the same left edge */
  margin: 0 auto 1rem;
  padding: 0 2.4rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: end;
}
.problem__kicker { margin: 0; font-weight: 400; font-size: clamp(2.6rem, 6vw, 7rem); line-height: 0.98; letter-spacing: -0.045em; }

/* ---- the scrolling section ---- */
/* a black strip that stays at the top of the screen: the text scrolls up behind it instead of running all the way to the top */
.pmask { position: sticky; top: 0; z-index: 4; height: var(--pt); margin-bottom: calc(var(--pt) * -1); background: #000; pointer-events: none; }

.pscroll {
  position: relative;
  display: grid;
  grid-template-columns: 22rem minmax(0, 1fr) minmax(0, 1.5fr);
  column-gap: 3rem;
  max-width: 160rem;
  margin: 0 auto;
  padding: var(--pt) 2.4rem 0;                   /* room for the strip above */
}

/* left: the numbered list, pinned; the dotted grid fills the rest of the height */
.pnav {
  position: sticky; top: var(--pt); z-index: 5;
  align-self: start;
  height: var(--ch);
  background-image: radial-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1.5px);
  background-size: 0.9rem 0.9rem;
}
.pnav ul { margin: 0; padding: 0.4rem 0 1.2rem; list-style: none; background: #000; }
.pnav a { display: flex; align-items: flex-start; padding: 0.3rem 0; font: 500 1.2rem/1.35 var(--mono); letter-spacing: 0.03em; text-transform: uppercase; color: #fff; }
.pnav__n { flex: none; padding: 0.7rem 0.9rem; margin-right: 0.2rem; transition: background 0.25s ease, color 0.25s ease; }
.pnav__t { padding: 0.7rem 0.6rem 0.7rem 0.8rem; }
.pnav a:hover .pnav__n { background: var(--accent, #ff4a12); color: #000; }
.pnav a.is-active .pnav__n { background: #fff; color: #000; }
.pnav a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* middle: one step per screen; the text sits at the top of each */
.pitem { min-height: calc(var(--ch) + 14rem); scroll-margin-top: var(--pt); }   /* extra room between one step and the next */
.pitem__title { margin: 0.8rem 0 0; font-size: clamp(2.8rem, 3.2vw, 5.2rem); font-weight: 500; line-height: 1.02; letter-spacing: -0.045em; text-wrap: pretty; }
.pitem__body { margin-top: 3rem; display: grid; gap: 2.4rem; }
.pitem__desc { margin: 0; max-width: 40rem; font-size: clamp(1.5rem, 1.25vw, 2.1rem); font-weight: 500; line-height: 1.3; letter-spacing: -0.02em; text-wrap: pretty; }
.plist { margin: 0; padding: 0 0 0 1.6rem; list-style: disc; display: grid; gap: 1.1rem; font-size: clamp(1.4rem, 1.05vw, 1.9rem); line-height: 1.3; letter-spacing: -0.01em; color: #e6e6e6; }
.plist--2 { grid-template-columns: 1fr 1fr; column-gap: 2.4rem; }
.plist li::marker { color: #8a8a8a; }
.pbtn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 4.4rem; padding: 0 2.6rem; margin-top: 3rem;
  border: 1px solid #fff; border-radius: 62.4375rem;
  font: 500 1.2rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #fff;
  transition: background 0.25s ease, color 0.25s ease;
}
.pbtn:hover, .pbtn:focus-visible { background: #fff; color: #000; outline: none; }

/* right: the picture, pinned; every step has its own layer and they cross-fade */
.pvis { position: sticky; top: var(--pt); align-self: start; height: var(--ch); border-radius: 0.6rem; overflow: hidden; background: #0c0c0c; }
.pitem__vis { display: none; }

.pvis__l {
  position: absolute; inset: 0; overflow: hidden;
  container-type: inline-size;
  display: flex; flex-direction: column; justify-content: center; gap: 3.2cqw;
  padding: 0 6cqw;
  opacity: 0; pointer-events: none;
  transition: opacity 600ms linear;
  --parallax: 0px;
  background:
    radial-gradient(60% 46% at 88% 104%, rgba(255, 74, 18, 0.5), rgba(255, 74, 18, 0) 72%),
    radial-gradient(55% 40% at 8% 4%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 70%),
    linear-gradient(165deg, #202020 0%, #0d0d0d 100%);
}
.pvis__l.is-on { opacity: 1; pointer-events: auto; }
.pvis__l::before {                              /* faint dotted grid */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1.5px);
  background-size: 5cqw 5cqw;
}

/* a cluster of square blocks behind the cards, like a pixelated picture; it drifts a little as you scroll */
.pvis__mos { position: absolute; left: 6%; top: 8%; width: 86%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(10, 1fr); transform: translateY(var(--parallax)); }
.pvis__mos i { opacity: 0; transition: opacity 0.5s ease; transition-delay: var(--t, 0s); }
.pvis__l.is-on .pvis__mos i { opacity: var(--o, 1); }

/* cards */
.pc {
  position: relative; z-index: 1;
  width: 62%;
  padding: 2.6cqw 2.8cqw;
  border: 1px solid #2c2c2c; border-radius: 1.6cqw;
  background: rgba(14, 14, 14, 0.94);
  font-size: 1.95cqw; line-height: 1.35; color: #fff;
  box-shadow: 0 3cqw 8cqw rgba(0, 0, 0, 0.5);
  transform: translateY(calc(var(--parallax) * -0.5));
}
.pc--r { align-self: flex-end; }
.pc--w { width: 74%; }
.pvis__l .pc { opacity: 0; translate: 0 3cqw; transition: opacity 0.7s ease, translate 0.8s cubic-bezier(0.22, 1, 0.36, 1); transition-delay: calc(0.15s + var(--d, 0) * 0.15s); }
.pvis__l.is-on .pc { opacity: 1; translate: 0 0; }

.pc__k { display: block; font: 500 0.85em/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #8a8a8a; }
.pc b { font-weight: 600; }

/* a message that just came in */
.pc--note { display: grid; grid-template-columns: auto 1fr; gap: 0.5em 1.1em; width: 66%; background: #1d1d1d; border-color: #2f2f2f; }
.pc__av { grid-row: 1 / span 2; display: grid; place-items: center; overflow: hidden; width: 2.9em; height: 2.9em; border-radius: 50%; background: linear-gradient(140deg, #ff7a45, #b53c10); font-weight: 700; font-size: 1.1em; }
.pc__av img { width: 100%; height: 100%; object-fit: cover; }
.pc__top { display: flex; justify-content: space-between; gap: 1em; font-size: 0.95em; }
.pc__top i { font-style: normal; color: #a9a9a9; }
.pc--note p { margin: 0; font-size: 1.1em; font-weight: 500; line-height: 1.3; }
.pc em { font-style: normal; color: var(--accent, #ff4a12); }

/* 01: a core task with everything wrapped around it */
.orb { position: relative; width: 100%; aspect-ratio: 1.12; margin-top: 0.8em; }
.orb__ring { position: absolute; left: 50%; top: 50%; border: 1px dashed #3a3a3a; border-radius: 50%; transform: translate(-50%, -50%); }
.orb__ring.r1 { width: 36%; aspect-ratio: 1; }
.orb__ring.r2 { width: 66%; aspect-ratio: 1; }
.orb__ring.r3 { width: 94%; aspect-ratio: 1; }
.orb__core { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 0.55em 1.1em; border-radius: 3em; background: #fff; color: #000; font: 600 0.9em/1 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.orb__c { position: absolute; transform: translate(-50%, -50%); padding: 0.4em 0.9em; border: 1px solid #3a3a3a; border-radius: 3em; background: #151515; font-size: 0.95em; white-space: nowrap; color: #e6e6e6; }
.orb__c.hot { border-color: var(--accent, #ff4a12); color: #ffb096; }

/* 02: salaries climb, output stays at the ceiling */
.chart { display: block; width: 100%; height: auto; margin-top: 0.9em; overflow: visible; }
.chart .sal, .chart .out { fill: none; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; transition: stroke-dashoffset 1.6s cubic-bezier(0.4, 0, 0.2, 1) 0.5s; }
.chart .sal { stroke: var(--accent, #ff4a12); stroke-width: 3; }
.chart .out { stroke: #fff; stroke-width: 2.2; }
.pvis__l.is-on .chart .sal, .pvis__l.is-on .chart .out { stroke-dashoffset: 0; }
.chart .grid { stroke: #262626; stroke-width: 1; }
.chart text { fill: #a9a9a9; font: 500 11px "JetBrains Mono", monospace; letter-spacing: 0.04em; }
.legend { display: flex; gap: 1.6em; margin-top: 0.8em; font-size: 0.95em; color: #cfcfcf; }
.legend i { display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.5em; border-radius: 50%; background: #fff; vertical-align: -0.05em; }
.legend i.o { background: var(--accent, #ff4a12); }
.steps { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6em 0.8em; }
.steps span { padding: 0.5em 1em; border: 1px solid #3a3a3a; border-radius: 3em; font-size: 1em; }
.steps span.hot { border-color: var(--accent, #ff4a12); color: #ffb096; }
.steps b { color: #666; font-weight: 400; }

/* 03: the same customer in five places */
.src { display: grid; gap: 0; margin: 0.7em 0 0; padding: 0; list-style: none; }
.src li { display: grid; grid-template-columns: auto 1fr; column-gap: 0.9em; align-items: center; padding: 0.7em 0; border-bottom: 1px solid #222; }
.src li:last-child { border-bottom: 0; }
.src li:nth-child(even) { padding-left: 1.2em; }
.src i { grid-row: 1 / span 2; width: 0.8em; height: 0.8em; border-radius: 50%; background: var(--c, #666); }
.src small { font: 400 0.82em/1.2 var(--mono); color: #8a8a8a; }
.src span { font-size: 1.05em; font-weight: 500; }
.pc--q { display: flex; align-items: center; gap: 1.2em; border-style: dashed; border-color: #4a4a4a; background: rgba(14, 14, 14, 0.8); }
.pc--q .q { display: grid; place-items: center; flex: none; width: 3em; height: 3em; border-radius: 50%; background: var(--accent, #ff4a12); font-size: 1.3em; font-weight: 700; }
.pc--q p { margin: 0; font-weight: 500; font-size: 1.1em; }

/* 04: the founder's day, with nothing left for growth */
.day { display: grid; gap: 0.9em; margin-top: 0.9em; }
.day div { display: grid; grid-template-columns: 1fr auto; row-gap: 0.4em; font-size: 1em; }
.day span { color: #e6e6e6; }
.day b { font: 500 0.95em/1 var(--mono); color: #a9a9a9; }
.day .bar { grid-column: 1 / -1; display: block; height: 0.5em; border-radius: 1em; background: #242424; overflow: hidden; }
.day .bar::after { content: ""; display: block; height: 100%; width: 0; border-radius: 1em; background: #fff; transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.5s; }
.pvis__l.is-on .day .bar::after { width: var(--w); }
.day .hot span, .day .hot b { color: #ffb096; }
.day .hot .bar::after { background: var(--accent, #ff4a12); }

/* ---- tablets and phones: the list becomes a strip along the top, and each step carries its own picture ---- */
@media (max-width: 1023px) {
  .problem { --pt: 7.4rem; padding-top: 7rem; }
  .problem__head { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 0; padding: 0 1rem; }
  .problem__kicker { font-size: 3rem; }

  .pscroll { display: block; padding: calc(var(--pt) - 3rem) 1rem 0; }
  .pnav { height: auto; padding: 0; background-position: 0 0; }
  .pnav ul { display: flex; gap: 1.2rem; overflow-x: auto; padding: 0.4rem 0; scrollbar-width: none; }
  .pnav ul::-webkit-scrollbar { display: none; }
  .pnav li { flex: none; }
  .pnav a { padding: 0; }
  .pnav__t { padding: 0.7rem 0.6rem 0.7rem 0.6rem; white-space: nowrap; }

  .pvis { display: none; }
  .pitem { min-height: 0; padding: 3.2rem 0 2.4rem; scroll-margin-top: calc(var(--pt) + 5.4rem); }
  .pitem__title { font-size: clamp(2.3rem, 9.6vw, 3.4rem); }
  .pitem__body { margin-top: 1.8rem; gap: 1.5rem; }
  .pitem__desc { font-size: clamp(1.25rem, 3.2vw, 1.7rem); max-width: none; }
  .pbtn { height: 3.8rem; padding: 0 2rem; margin-top: 2rem; font-size: 0.85rem; }
  .plist { font-size: clamp(1rem, 2.6vw, 1.4rem); gap: 0.9rem; }
  .pitem__vis { display: block; margin-top: 2.6rem; }
  .pitem__vis .pvis__l { position: relative; inset: auto; aspect-ratio: 1 / 1.12; border-radius: 0.6rem; opacity: 1; pointer-events: auto; }
}
@media (max-width: 480px) {
  .plist--2 { grid-template-columns: 1fr 1fr; column-gap: 1.4rem; }
  .plist { font-size: 1rem; }
  .pc { font-size: 2.3cqw; }
}
@media (prefers-reduced-motion: reduce) {
  .pvis__l, .pvis__l .pc, .pvis__mos i, .chart .sal, .chart .out, .day .bar::after { transition: none; }
  .chart .sal, .chart .out { stroke-dashoffset: 0; }
  .day .bar::after { width: var(--w); }
}
