/* TIG case study, part 2: the approval pipeline board (signature, case-tig.js).
   Four columns, Submitted > ESG Screened > Approved > Funded. Cards sit in a layer over
   the columns and move by --c (column) and --r (row); the script sets both as the pinned
   stage is scrolled. Without the script (or with reduced motion) the board shows its
   final state and the four stages read as a plain list. */

.tg-pipe { background: linear-gradient(180deg, var(--cs-bg), #e3eff0); }
.tg-pipe__stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px 72px; align-items: start; margin-top: 64px; }

/* captions */
.tg-caps { display: grid; gap: 40px; margin: 0; padding: 0; list-style: none; }
.tg-cap { display: grid; gap: 14px; }
.tg-cap__n { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--cs-faint); }
.tg-cap__n b { margin-left: 8px; font-family: var(--serif); font-style: italic; font-size: 17px; letter-spacing: 0; text-transform: none; color: var(--accent); }
.tg-cap .tg-h3 { margin: 0; }
.tg-cap p:not(.tg-cap__n) { margin: 0; font-size: 16px; line-height: 1.65; color: var(--cs-muted); }
.tg-cap b { font-weight: 600; color: var(--cs-ink); }

/* live, pinned mode */
.tg-pipe.is-live .tg-pipe__track { height: 440vh; }
.tg-pipe.is-live .tg-pipe__stage { position: sticky; top: 0; height: 100vh; height: 100svh; align-items: center; margin-top: 0; }
.tg-pipe.is-live .tg-caps { gap: 0; }
.tg-pipe.is-live .tg-cap { grid-area: 1 / 1; visibility: hidden; opacity: 0; transform: translate3d(0, 18px, 0); transition: opacity .5s ease, transform .7s var(--ease), visibility .5s; }
.tg-pipe.is-live .tg-cap.is-on { visibility: visible; opacity: 1; transform: none; }

/* board */
.tg-board { --gap: 12px; --cp: 10px; --hh: 22px; --ch: 92px; --rg: 10px; position: relative; padding: 18px; border-radius: 22px; background: var(--white); border: 1px solid var(--cs-line); box-shadow: 0 50px 90px -60px rgb(11 61 68 / 55%); }
.tg-board__top { display: flex; align-items: center; gap: 10px; padding: 0 4px 16px; font-size: 14px; font-weight: 600; color: var(--cs-ink); }
.tg-board__logo { width: 20px; height: 17px; background: var(--tg-teal); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tg-board__live { display: flex; align-items: center; gap: 7px; margin-left: auto; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.tg-board__live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tg-aqua); animation: tg-pulse 1.8s ease-in-out infinite; }
.tg-board__body { display: grid; }
.tg-board__cols, .tg-board__cards { grid-area: 1 / 1; }
.tg-board__cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.tg-col { min-height: calc(var(--hh) + 2 * var(--cp) + 8px + 4 * var(--ch) + 3 * var(--rg)); padding: var(--cp); border-radius: 14px; background: #f0f6f6; transition: background .4s, box-shadow .4s; }
.tg-col.is-on { background: #e0f3f1; box-shadow: inset 0 0 0 1.5px var(--tg-aqua); }
.tg-col p { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: var(--hh); margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--cs-ink); }
.tg-col i { display: grid; place-items: center; flex: none; min-width: 22px; height: 22px; border-radius: 11px; background: var(--white); font-size: 12px; font-style: normal; color: var(--tg-teal); box-shadow: 0 0 0 1px var(--cs-line); }
.tg-board__cards { position: relative; pointer-events: none; }

.tg-card {
  position: absolute;
  top: calc(var(--cp) + var(--hh) + 8px);
  left: var(--cp);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 1fr;
  gap: 2px 8px;
  width: calc((100% - 3 * var(--gap)) / 4 - 2 * var(--cp));
  height: var(--ch);
  padding: 12px;
  border: 1px solid var(--cs-line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 12px 24px -18px rgb(11 61 68 / 50%);
  transform: translate3d(calc(var(--c, 0) * (100% + 2 * var(--cp) + var(--gap))), calc(var(--r, 0) * (100% + var(--rg))), 0);
  transition: transform .8s var(--ease), background .45s, border-color .45s, color .45s;
}
.tg-card__id { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.tg-card__id::before { content: "Project "; }
.tg-card__city { grid-row: 2; font-size: 12px; color: var(--cs-muted); }
.tg-card__tag { grid-column: 2; grid-row: 1; align-self: center; width: 10px; height: 10px; border-radius: 50%; background: #c8d6d6; transition: background .45s, box-shadow .45s; }
.tg-card__esg { grid-column: 1 / -1; align-self: end; display: flex; gap: 4px; }
.tg-card__esg i { position: relative; flex: 1; height: 5px; border-radius: 3px; background: #e5eeee; overflow: hidden; }
.tg-card__esg i::before { content: ""; position: absolute; inset: 0; width: var(--w); border-radius: inherit; background: var(--tg-aqua); transform: scaleX(0); transform-origin: left; transition: transform .7s var(--ease) .25s; }
.tg-card:not([data-c="0"]) .tg-card__esg i::before { transform: none; }
.tg-card[data-c="1"] .tg-card__tag { background: var(--white); box-shadow: inset 0 0 0 2.5px var(--tg-aqua); }
.tg-card[data-c="2"] { border-color: var(--tg-aqua); }
.tg-card[data-c="2"] .tg-card__tag { background: var(--tg-aqua); }
.tg-card[data-c="3"] { border-color: var(--tg-teal); background: var(--tg-teal); color: var(--white); }
.tg-card[data-c="3"] .tg-card__city { color: rgb(255 255 255 / 72%); }
.tg-card[data-c="3"] .tg-card__tag { background: #8fe6dc; }
.tg-card[data-c="3"] .tg-card__esg i { background: rgb(255 255 255 / 18%); }
.tg-card[data-c="3"] .tg-card__esg i::before { background: #8fe6dc; }

.tg-board__rail { height: 4px; margin: 16px 4px 2px; border-radius: 4px; background: #e3eded; overflow: hidden; }
.tg-board__rail span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--tg-aqua), var(--tg-teal)); transform: scaleX(var(--p, 1)); transform-origin: left; transition: transform .6s var(--ease); }

@keyframes tg-pulse { 50% { opacity: .3; } }

@media (max-width: 1000px) {
  .tg-pipe__stage { grid-template-columns: 1fr; }
  .tg-pipe.is-live .tg-pipe__stage { align-content: center; gap: 28px; }
  .tg-pipe.is-live .tg-board { order: -1; }
  .tg-pipe.is-live .tg-caps { max-width: 620px; }
}
@media (max-width: 720px) {
  .tg-board { --gap: 5px; --cp: 5px; --hh: 30px; --ch: 52px; --rg: 6px; padding: 10px; border-radius: 16px; }
  .tg-board__top { padding: 2px 4px 10px; font-size: 12.5px; }
  .tg-col { border-radius: 10px; }
  .tg-col p { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; font-size: 9.5px; letter-spacing: -.01em; }
  .tg-col i { min-width: 0; height: auto; padding: 0; background: none; box-shadow: none; font-size: 9.5px; color: var(--accent); }
  .tg-card { padding: 6px 7px; border-radius: 8px; gap: 0; }
  .tg-card__id { font-size: 13px; }
  .tg-card__id::before { content: none; }
  .tg-card__city { font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tg-card__tag { width: 7px; height: 7px; }
  .tg-card__esg { gap: 2px; }
  .tg-card__esg i { height: 3px; }
  .tg-board__rail { margin-top: 10px; }
  .tg-pipe.is-live .tg-pipe__stage { gap: 20px; padding-block: 12px; }
  .tg-cap { gap: 10px; }
  .tg-cap .tg-h3 { font-size: 22px; }
  .tg-cap p:not(.tg-cap__n) { font-size: 14.5px; line-height: 1.55; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-card, .tg-card__esg i::before, .tg-board__rail span, .tg-pipe .tg-cap { transition: none; }
  .tg-board__live::before { animation: none; }
}

/* ---------- § 4 plates, sized to the images: the three square screens in a row,
   then the wide data store (1003x565) at up to its native width with its caption beside it. ---------- */
.tg-plates { background: linear-gradient(180deg, var(--cs-bg), var(--tg-ice)); }
.tg-rows { display: grid; gap: clamp(56px, 6vw, 88px); margin-top: clamp(56px, 6vw, 88px); }
.tg-rows .tg-plate, .tg-rows .tg-plate:nth-child(n) { margin-top: 0; }
.tg-row--three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 32px); align-items: start; }
.tg-plate--wide { grid-template-columns: minmax(0, 1031px) minmax(0, 380px); justify-content: start; gap: clamp(28px, 4vw, 64px); align-items: center; }
.tg-plate--wide figcaption { max-width: 380px; }
@media (max-width: 1000px) {
  .tg-plate--wide { grid-template-columns: minmax(0, 1fr); }
  .tg-plate--wide figcaption { max-width: 520px; }
}
@media (max-width: 720px) {
  .tg-row--three { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .tg-rows .tg-plate .tg-mat { max-width: 752px; }
}

/* Phones: four stages need less scrolling than on a wide screen. */
@media (max-width: 720px) {
  .tg-pipe.is-live .tg-pipe__track { height: 300vh; }
}

/* hero: sized to the 1920x700 banner so the image fills it edge to edge (no dark band below);
   lighter scrim so the background shows through behind the copy */
@media (min-width: 1001px) {
  .tg-hero { min-height: 0; aspect-ratio: 2092 / 751; padding-block: clamp(40px, 4vw, 72px); }
  .tg-hero__art img { object-fit: cover; object-position: center; }
  .tg-hero::before { background: linear-gradient(90deg, rgb(9 50 58 / 62%) 0%, rgb(9 50 58 / 34%) 28%, rgb(9 50 58 / 0%) 46%); }
  .tg-hero__title, .tg-hero__lead { text-shadow: 0 2px 18px rgb(9 50 58 / 45%); }
}

@media (min-width: 1001px) {
  .tg-hero { background: transparent; }
  .tg-hero__art { inset: -1px -2px -1px -2px; }
  .tg-hero__art img { width: 100%; height: 100%; }
  .tg-hero::before { display: none; }
  .tg-hero__title, .tg-hero__lead { text-shadow: none; }
  .tg-hero__title { color: var(--tg-deep); }
  .tg-hero__title .tg-serif { color: var(--tg-teal); }
  .tg-hero__lead { color: #2c4a4f; }
}

@media (max-width: 1000px) {
  .tg-hero { background: #c9f0f0; }
  .tg-hero__title { color: var(--tg-deep); }
  .tg-hero__title .tg-serif { color: var(--tg-teal); }
  .tg-hero__lead { color: #2c4a4f; }
}

/* devices from the original render, laid over the aqua bubbles background; left edge feathered into it */
.tg-hero__art { position: absolute; }
.tg-hero__art img.tg-hero__devices { position: absolute; top: 0; right: 0; width: auto; height: 100%; max-width: none; object-fit: initial;
  -webkit-mask-image: linear-gradient(90deg, transparent 44%, #000 56%); mask-image: linear-gradient(90deg, transparent 44%, #000 56%); }
@media (max-width: 1000px) {
  .tg-hero__art { position: relative; }
  .tg-hero__art img.tg-hero__devices { position: relative; width: 100%; height: auto; -webkit-mask-image: none; mask-image: none; }
  .tg-hero__art img:first-child { display: none; }
}

/* soften the bright bubble at the bottom centre of the background */
@media (min-width: 1001px) {
  .tg-hero__art::after { content: ""; position: absolute; left: 33.5%; top: 66%; width: 17%; height: 44%; border-radius: 50%;
    -webkit-backdrop-filter: blur(14px) saturate(.85); backdrop-filter: blur(14px) saturate(.85); background: rgb(200 240 240 / 18%);
    -webkit-mask-image: radial-gradient(closest-side, #000 60%, transparent 100%); mask-image: radial-gradient(closest-side, #000 60%, transparent 100%); pointer-events: none; }
}

/* § 3 onboarding render (1312x1199, white ground): shown whole at its own ratio, up to native width */
.tg-doors__grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 3vw, 56px); }
.tg-doors__art { margin: clamp(-56px, -3vw, 0px) 0 clamp(-56px, -3vw, 0px) clamp(-96px, -5vw, 0px); }
.tg-doors__art img { display: block; width: 100%; max-width: 980px; height: auto; mix-blend-mode: multiply; }
@media (max-width: 900px) {
  .tg-doors__grid { grid-template-columns: minmax(0, 1fr); }
  .tg-doors__art { margin: 0 auto; max-width: 560px; }
}

/* § 3 on dark: deep teal ground, light copy; the white-ground render is feathered into the dark as a soft lit pool */
.tg-doors { background: radial-gradient(55% 70% at 28% 50%, rgb(43 181 168 / 22%), transparent 70%), linear-gradient(180deg, var(--tg-deep), #082d33); color: #fff; }
.tg-doors .cs-h2, .tg-doors__list h3 { color: #fff; }
.tg-doors .tg-serif, .tg-doors__list li::before { color: #8fe6dc; }
.tg-doors .tg-sec { color: rgb(255 255 255 / 62%); }
.tg-doors .tg-sec span { color: #8fe6dc; }
.tg-doors .tg-sec::after { background: rgb(255 255 255 / 25%); }
.tg-doors .cs-lead, .tg-doors__list p { color: rgb(255 255 255 / 74%); }
.tg-doors__list li, .tg-doors__list li:last-child { border-color: rgb(255 255 255 / 14%); }
.tg-doors__art { margin: 0; }
.tg-doors__art img { mix-blend-mode: normal; -webkit-mask-image: none; mask-image: none; border-radius: 0; filter: none; aspect-ratio: 1536 / 1024; }

/* contact shadow under the platform */
.tg-doors__art { position: relative; }
.tg-doors__art::after { content: ""; position: absolute; z-index: -1; left: 16%; right: 12%; bottom: 6%; height: 12%; border-radius: 50%; background: radial-gradient(closest-side, rgb(0 12 14 / 75%), rgb(0 12 14 / 35%) 55%, transparent 100%); filter: blur(14px); pointer-events: none; }
.tg-doors__art img { position: relative; filter: drop-shadow(0 26px 22px rgb(0 10 12 / 45%)); }
.tg-doors__grid { position: relative; z-index: 0; }

/* § 3: the laptop render (1671x941, its own dark ground) fills the section; the left column shows it whole,
   section ground matches the render's own navy-teal so the edges disappear */
.tg-doors { background: #013340; }
.tg-doors__grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(16px, 2vw, 40px); }
.tg-doors__art { visibility: visible; margin: 0 0 0 calc(var(--gutter) * -1); max-width: none; }
.tg-doors__art::after { display: none; }
.tg-doors__art img { width: 100%; max-width: 1671px; height: auto; aspect-ratio: 1671 / 941; filter: none; border-radius: 0; mix-blend-mode: normal;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent), linear-gradient(0deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, #000 85%, transparent), linear-gradient(0deg, transparent, #000 8%, #000 92%, transparent); mask-composite: intersect; }
@media (max-width: 900px) {
  .tg-doors__grid { grid-template-columns: minmax(0, 1fr); }
  .tg-doors__art { margin: 0 calc(var(--gutter) * -1); }
}

/* § 3: transparent PNG cut-out of the laptop render (glow + floor shadow kept as alpha), shown larger */
.tg-doors { background: #01313d; }
.tg-doors__grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; }
.tg-doors__art { margin: 0; }
.tg-doors__art img { max-width: 1049px; aspect-ratio: 1049 / 859; -webkit-mask-image: linear-gradient(0deg, transparent, #000 10%); mask-image: linear-gradient(0deg, transparent, #000 10%); }
@media (max-width: 900px) { .tg-doors__art { margin: 0; } }

/* podium shadow now fades inside the PNG itself: no CSS mask */
.tg-doors__art img { aspect-ratio: 1049 / 999; -webkit-mask-image: none; mask-image: none; }

/* wider PNG: side glow fades to transparent inside the file, so no left/right cut */
.tg-doors__art img { max-width: 1329px; aspect-ratio: 1329 / 999; }
.tg-doors__art { overflow: visible; }

/* bigger graphic: transparent side padding in the PNG overflows the column, so the laptop itself grows */
.tg-doors { position: relative; overflow: hidden; }
@media (min-width: 901px) {
  .tg-doors__grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  .tg-doors__art img { width: 128%; max-width: none; margin: -6% 0 -8% -16%; }
}
@media (max-width: 900px) { .tg-doors__art img { width: 124%; max-width: none; margin: 0 -12%; } }
/* leaf from the render, top-right corner */
.tg-doors::after { content: ""; position: absolute; top: -10px; right: -18px; width: clamp(110px, 11vw, 200px); aspect-ratio: 162 / 270;
  background: url("../../../uploads/tig/leaf.webp") center / contain no-repeat; transform: scaleX(-1) rotate(-28deg); transform-origin: top right; opacity: .9; filter: blur(.4px); pointer-events: none; }
.tg-doors__grid { position: relative; z-index: 1; }

/* leaf: hangs from the top-right corner (stem into the corner), fully inside the section, soft depth blur */
.tg-doors::after { top: 0; right: clamp(8px, 1.5vw, 28px); width: clamp(96px, 8.5vw, 150px); transform: scaleY(-1) rotate(-12deg); transform-origin: top right; opacity: .85; filter: blur(1.2px) drop-shadow(0 12px 18px rgb(0 10 12 / 45%)); }
@media (max-width: 900px) { .tg-doors::after { width: 84px; opacity: .7; } }

/* top-right: the same plant that sits behind the laptop, upright, at native size */
.tg-doors::after { top: clamp(20px, 3vw, 48px); right: clamp(16px, 3vw, 56px); width: clamp(140px, 14vw, 230px); aspect-ratio: 270 / 290;
  background-image: url("../../../uploads/tig/leaf-plant.webp"); transform: none; opacity: 1; filter: drop-shadow(0 14px 20px rgb(0 10 12 / 40%)); }
@media (max-width: 900px) { .tg-doors::after { width: 110px; opacity: .8; } }

/* leaf grows in from the top-right corner: stem tucked past the corner, leaves reaching down-left into the section */
.tg-doors::after { top: clamp(-70px, -4vw, -30px); right: clamp(-60px, -3vw, -24px); width: clamp(170px, 17vw, 270px); transform: rotate(-90deg); transform-origin: center; filter: drop-shadow(0 16px 22px rgb(0 10 12 / 45%)); }
@media (max-width: 900px) { .tg-doors::after { width: 120px; top: -24px; right: -20px; opacity: .8; } }

/* cleaner cut-out leaf (405x435), a little larger */
.tg-doors::after { background-image: url("../../../uploads/tig/leaf-plant-v2.webp"); width: clamp(210px, 21vw, 340px); aspect-ratio: 405 / 435; top: clamp(-90px, -5vw, -40px); right: clamp(-80px, -4vw, -30px); }
@media (max-width: 900px) { .tg-doors::after { width: 150px; top: -30px; right: -26px; } }

/* visible graphic (panels to podium) sits ~9% above the PNG centre because of the faded floor glow below it; shift it so top and bottom gaps match */
@media (min-width: 901px) { .tg-doors__art img { transform: translateY(9%); } }

/* leaf a little smaller */
.tg-doors::after { width: clamp(170px, 16vw, 260px); top: clamp(-70px, -4vw, -30px); right: clamp(-60px, -3vw, -24px); }
@media (max-width: 900px) { .tg-doors::after { width: 120px; top: -24px; right: -20px; } }
