/* Case study page (/projects/mama-ds-scheduler), on top of style.css + projects.css.
   From Mockups/freelance/projects/case-study-v2.html layout C "Sideways" (chosen 2026-11-17).
   Without JS (or below 900x560, or with reduced motion) the five panels simply stack and everything shows;
   js/case-study.js adds .pin to .c-scene to pin the story and slide the panels past sideways. */

:root { --nav: 72px; --hand: 'Caveat', cursive; --box: color-mix(in srgb, var(--ink) 4%, var(--paper)); }
.nowrap { white-space: nowrap; }

/* ===== Header: title, summary, client card ===== */
.cs-head { padding-top: clamp(32px, 5vw, 64px); padding-bottom: clamp(48px, 6vw, 80px); }
/* Client card: the same rounded box as the story panels. Logo = Drew's file, trimmed (img/projects/mamads-logo.png) */
.client { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: center; margin-top: clamp(28px, 3.5vw, 44px); padding: clamp(20px, 2.6vw, 30px); border-radius: 20px; background: var(--box); border: 1px solid var(--line); }
.client-who { display: flex; align-items: center; gap: 16px; }
.client-logo { display: grid; place-items: center; width: 108px; height: 80px; flex: none; padding: 8px 10px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.client-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.client-who b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.client-who small { display: block; margin-top: 2px; font-size: 14.5px; color: var(--body); }
.client-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; padding-left: clamp(20px, 4vw, 56px); border-left: 1px solid var(--line); }
.client-facts dt { font-size: 13px; color: var(--muted); }
.client-facts dd { margin: 3px 0 0; font-size: 15.5px; font-weight: 600; }

/* ===== The story: five panels, each a head row over one equal-size box ===== */
section.c-scene { padding: 0; } /* style.css pads every section; the story sets its own spacing */
.c-stage > .prog { display: none; }
.c-track { display: grid; gap: clamp(56px, 8vw, 96px); padding: 0 var(--gutter); max-width: 1280px; margin: 0 auto; }
.c-panel { display: grid; gap: clamp(18px, 2.4vh, 28px); align-content: start; }
.c-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(16px, 2.4vw, 36px); align-items: end; }
.c-head h2 { margin: 0; font-size: clamp(40px, 5vw, 68px); font-weight: 800; letter-spacing: -0.04em; line-height: .82; text-transform: uppercase; }
.c-head p { margin: 0; max-width: 34ch; font-size: clamp(17px, 1.4vw, 20px); line-height: 1.35; color: var(--body); }
.c-box { --pad: clamp(18px, 2.4vw, 28px); display: grid; place-items: center; padding: var(--pad); border-radius: 20px; background: var(--box); border: 1px solid var(--line); }
.c-fit { width: 100%; }
.c-fit .paper { max-width: 600px; margin: 0 auto; }
.c-fit .phone { margin: 0 auto; }
.c-box--phone { align-items: start; height: calc(560px + var(--pad)); padding-bottom: 0; overflow: hidden; }
.c-box--phone .phone { --ph: 560px; --cut: 90px; } /* the phone carries on past the box edge */
.c-box--result { background: var(--accent); border-color: var(--accent); color: #fff; place-items: center stretch; }

/* Progress bar over the pinned story */
.prog { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 20px); }
.prog > div { font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.prog > div.on { color: var(--ink); }
.prog i { position: relative; display: block; height: 3px; margin-top: 10px; border-radius: 2px; background: var(--line); overflow: hidden; }
.prog i::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform-origin: left; scale: var(--f, 0) 1; }

/* ----- Listen: the paper schedule, redrawn from the real Mama D's sheet ----- */
.paper { position: relative; container-type: inline-size; width: 100%; padding: 2.4cqi 2.6cqi 1.6cqi; background: #fff; border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 4px; color: var(--ink); }
.paper table { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--sans); }
.paper col.c-name { width: 14%; }
.paper thead th { height: 10.5cqi; padding: 0 0 .8cqi; vertical-align: bottom; text-align: left; font-weight: 600; white-space: nowrap; }
.paper .slant { display: inline-block; transform-origin: 0 100%; rotate: -34deg; translate: 1.4cqi 0; font-size: max(8px, 2.2cqi); color: var(--error); }
.paper .slant--emp { color: var(--accent); translate: .4cqi 0; }
.paper .slant i { margin-left: .8cqi; font-family: var(--hand); font-size: max(9px, 2.7cqi); font-style: normal; font-weight: 500; color: var(--ink); }
.paper .sub th { height: auto; padding: .5cqi .4cqi; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); font-size: max(6px, 1.45cqi); font-weight: 600; color: var(--body); }
.paper .sub th:first-child { color: var(--error); }
.paper .sub th span { display: flex; justify-content: space-around; }
.paper tbody td { height: max(18px, 4.8cqi); padding: 0 .3cqi; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); text-align: center; font-family: var(--hand); font-size: max(11px, 3.7cqi); font-weight: 500; line-height: 1; white-space: nowrap; }
.paper tbody tr:nth-child(odd) td { background: color-mix(in srgb, var(--error) 11%, #fff); }
.paper tbody td.n { padding-left: .6cqi; text-align: left; font-family: var(--sans); font-size: max(8px, 1.95cqi); font-weight: 700; color: var(--accent); }
.paper tbody td.mon { background: color-mix(in srgb, var(--accent-light) 75%, #fff) !important; }
.paper sup { font-size: .55em; }
.paper .strike { display: block; height: 1.5px; margin: 0 1cqi; background: var(--ink); opacity: .65; rotate: -.3deg; }
.paper tfoot td { padding: 0; border: 0; }
.paper tfoot .fry { padding: 1cqi .6cqi 1.6cqi; border-left: 1px solid var(--ink); border-right: 1px solid var(--ink); font-family: var(--hand); font-size: max(10px, 2.9cqi); line-height: 1.05; }

/* ----- Plan: text only, three columns ----- */
.plan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); width: 100%; align-self: center; }
.plan h3 { margin: 0; padding: 12px 0 10px; border-top: 2px solid var(--accent); font-size: clamp(16px, 1.5vw, 19px); font-weight: 700; letter-spacing: -0.01em; }
.plan ul { margin: 0; padding: 0; list-style: none; }
.plan li { padding: 11px 0; border-top: 1px solid var(--line); font-size: clamp(15px, 1.3vw, 17px); line-height: 1.4; color: var(--body); }
.plan li b { font-weight: 600; color: var(--ink); }
.plan li small { display: block; margin-top: 2px; font-size: clamp(13.5px, 1.1vw, 15px); color: var(--muted); }

/* ----- Build: Feature list beside the MacBook. The bar fills while it plays by itself (6s a step); when it
   fills, the next step opens. A click restarts it from there; hovering (or tabbing through) pauses it. ----- */
.tour { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2.1fr); gap: clamp(16px, 2.4vw, 32px); align-items: center; width: 100%; }
.tour-tabs { --play: 6s; display: grid; gap: 4px; }
.tour-tabs button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 76px minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 10px; border-radius: 14px; cursor: pointer; transition: background .25s; }
.f-thumb { grid-row: 1 / span 2; width: 76px; aspect-ratio: 16 / 10; overflow: hidden; border: 2px solid transparent; border-radius: 7px; background: #fff; opacity: .55; transition: opacity .25s, border-color .25s; }
.f-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tour-tabs b { font-size: clamp(15px, 1.35vw, 17px); font-weight: 700; color: var(--muted); transition: color .25s; }
.f-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ease); }
.f-more > span { display: block; min-height: 0; overflow: hidden; }
.f-text { display: block; padding-top: 3px; font-size: 13.5px; line-height: 1.4; color: var(--body); }
.f-more i { position: relative; display: block; height: 3px; margin: 10px 0 2px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; opacity: 0; transition: opacity .3s; }
.f-more i::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform-origin: left; scale: 0 1; }
.playing .f-more i { opacity: 1; }
.playing .tour-tabs [aria-selected="true"] .f-more i::after { animation: cs-fill var(--play) linear forwards; }
.tour:hover .f-more i::after, .tour:has(:focus-visible) .f-more i::after { animation-play-state: paused; }
@keyframes cs-fill { from { scale: 0 1; } to { scale: 1 1; } }
.tour-tabs [aria-selected="true"] { background: #fff; }
.tour-tabs [aria-selected="true"] b { color: var(--ink); }
.tour-tabs [aria-selected="true"] .f-thumb { opacity: 1; border-color: var(--accent); }
.tour-tabs [aria-selected="true"] .f-more { grid-template-rows: 1fr; }
.tour-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .tour-tabs button:hover b { color: var(--ink); } .tour-tabs button:hover .f-thumb { opacity: 1; } }
/* MacBook = Drew's image (img/projects/macbook.png, 1062x700, see-through screen at x 109-953, y 77-623);
   the screen sits behind it. Screenshots are Drew's Mac captures, whole and uncropped. */
.mac { position: relative; width: 100%; max-width: 640px; aspect-ratio: 1062 / 700; justify-self: center; }
.mac-frame { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.mac-screen { position: absolute; left: 10.1%; top: 10.8%; width: 79.8%; height: 78.4%; overflow: hidden; background: #fff; container-type: inline-size; }
.mac-bar { height: 2.2cqi; background: #000; }
.mac-media { position: relative; overflow: hidden; }
.mac-media img { display: block; width: 100%; height: auto; transition: opacity .2s; }
.cs-wipe { position: absolute; inset: 0; background: #fff; transform-origin: bottom; scale: 1 0; }

/* ----- Launch: iPhone with the staff group text. Apple's own colours, the one exception to the tokens ----- */
.phone { --ph: 600px; --cut: 0px; position: relative; width: 100%; max-width: 340px; height: calc(var(--ph) + var(--cut)); margin: 0 auto; padding: 8px; border: 3px solid #c7c7cc; border-radius: 54px; background: #000; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif; }
.phone::before, .phone::after { content: ''; position: absolute; width: 3px; border-radius: 2px; background: #c7c7cc; }
.phone::before { left: -6px; top: 118px; height: 118px; background: linear-gradient(#c7c7cc 0 22%, transparent 22% 34%, #c7c7cc 34% 61%, transparent 61% 73%, #c7c7cc 73%); }
.phone::after { right: -6px; top: 160px; height: 74px; }
.ph-screen { position: relative; display: flex; flex-direction: column; height: 100%; border-radius: 44px; overflow: hidden; background: #fff; color: #000; }
.ph-status { position: relative; display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 4px 20px 0 30px; background: #f6f6f6; font-size: 15px; font-weight: 600; flex: none; }
.ph-island { position: absolute; left: 50%; top: 11px; translate: -50% 0; width: 30%; height: 28px; border-radius: 20px; background: #000; }
.ph-icons { display: flex; align-items: center; gap: 4px; }
.ph-icons svg { display: block; fill: #000; }
.ph-head { position: relative; display: grid; justify-items: center; gap: 4px; padding: 4px 12px 10px; background: #f6f6f6; border-bottom: 1px solid #d1d1d6; flex: none; }
.ph-back { position: absolute; left: 10px; top: 20px; width: 22px; height: 22px; fill: none; stroke: #007aff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; rotate: 180deg; }
.ph-av { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: #9a9aa2; color: #fff; font-size: 19px; font-weight: 500; }
.ph-name { display: flex; align-items: center; gap: 2px; font-size: 12px; }
.ph-name svg { width: 9px; height: 9px; fill: none; stroke: #8e8e93; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-msgs { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 1; min-height: 0; padding: 10px 12px; overflow: hidden; }
.ph-when { align-self: center; margin: 2px 0 8px; font-size: 11px; line-height: 1.35; text-align: center; color: #8e8e93; }
.ph-when b { font-weight: 600; }
.bubble { max-width: 78%; padding: 8px 13px; border-radius: 18px; background: #34c759; color: #fff; font-size: 15px; line-height: 1.3; }
.bubble--tail { position: relative; }
.bubble--tail::before, .bubble--tail::after { content: ''; position: absolute; bottom: 0; height: 20px; }
.bubble--tail::before { right: -7px; width: 20px; background: #34c759; border-bottom-left-radius: 16px 14px; }
.bubble--tail::after { right: -26px; width: 26px; background: #fff; border-bottom-left-radius: 10px; }
.bubble--img { width: 74%; padding: 0; overflow: hidden; border: 1px solid #e5e5ea; border-radius: 16px; background: #fff; }
.bubble--img img { display: block; width: 100%; height: auto; }
.ph-meta { margin-right: 4px; font-size: 11px; color: #8e8e93; }
.ph-input { display: flex; align-items: center; gap: 8px; margin: 6px 10px calc(var(--cut) + 12px); flex: none; }
.ph-cursor { width: 1.5px; height: 18px; margin-right: 1px; background: #007aff; }
.ph-field > span { display: flex; align-items: center; }
.ph-plus { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e9e9eb; flex: none; }
.ph-plus svg { width: 14px; height: 14px; stroke: #7c7c80; stroke-width: 2; stroke-linecap: round; }
.ph-field { display: flex; align-items: center; justify-content: space-between; flex: 1; height: 34px; padding: 0 12px; border: 1px solid #d1d1d6; border-radius: 18px; color: #c7c7cc; font-size: 15px; }
.ph-field svg { width: 12px; height: 16px; fill: none; stroke: #8e8e93; stroke-width: 1.6; stroke-linecap: round; }

/* ----- Result: three big numbers on green ----- */
.nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 3vw, 48px); width: 100%; padding: 0 clamp(0px, 2vw, 24px); }
.nums b { display: block; font-size: clamp(36px, 4.4vw, 64px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; white-space: nowrap; color: var(--accent-light); }
.nums span { display: block; margin-top: 8px; font-size: 16px; color: #fff; }

/* ----- One-shot reveals inside the story, switched on by .lit (JS adds it; without JS nothing is hidden) ----- */
.js .fx .paper .hw { opacity: 0; transition: opacity .3s; transition-delay: calc(.2s + var(--d) * 30ms); }
.js .fx .plan-col { opacity: 0; translate: 0 20px; transition: opacity .5s, translate .7s var(--ease); transition-delay: calc(var(--i) * 160ms); }
.js .fx .cs-wipe { scale: 1 1; transition: scale 1.3s var(--ease) .3s; }
.js .fx .bubble, .js .fx .ph-meta { opacity: 0; translate: 0 24px; transition: opacity .4s, translate .6s var(--ease); transition-delay: calc(.35s + var(--i, 0) * .45s); }
.js .fx .lit .paper .hw { opacity: 1; }
.js .fx .lit .plan-col { opacity: 1; translate: 0; }
.js .fx .lit .cs-wipe { scale: 1 0; }
.js .fx .lit .bubble, .js .fx .lit .ph-meta { opacity: 1; translate: 0; }

/* ----- Pinned (JS, >= 900x560, no reduced motion): the stage sticks under the nav, the track slides sideways ----- */
.c-scene.pin .c-stage { position: sticky; top: var(--nav); height: calc(100vh - var(--nav)); overflow: hidden; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr);
  --H: min(620px, calc(100vh - var(--nav) - 240px)); }
.c-scene.pin .c-stage > .prog { display: grid; padding: 22px var(--gutter) 0; max-width: 1280px; margin: 0 auto; width: 100%; }
.c-scene.pin .c-track { display: flex; gap: 0; max-width: none; margin: 0; padding: 0 0 0 calc((100% - min(66vw, 900px)) / 2); align-items: center; will-change: transform; } /* the panel in focus sits in the middle of the screen */
.c-scene.pin .c-track::after { content: ''; flex: 0 0 var(--gutter); }
.c-scene.pin .c-panel { flex: 0 0 min(66vw, 900px); margin-right: clamp(32px, 4vw, 64px); padding: clamp(24px, 4vh, 40px) 0; }
.c-scene.pin .c-panel:last-child { margin-right: 0; }
.c-scene.pin .c-box { height: var(--H); --in: calc(var(--H) - var(--pad) * 2); }
.c-scene.pin .c-fit .paper { width: min(620px, calc(var(--in) * 1.32)); }
.c-scene.pin .mac { max-width: min(640px, calc(var(--in) / .66)); }
.c-scene.pin .c-box--phone .phone { --ph: calc(var(--H) - var(--pad)); }
.c-scene.pin .c-panel > * { opacity: .3; transition: opacity .6s; }
.c-scene.pin .c-panel.lit > * { opacity: 1; }

/* Quote after the story */
section.cs-quote { padding: clamp(72px, 9vw, 128px) 0 clamp(72px, 9vw, 120px); }
.c-scene.pin + .cs-quote { padding-top: clamp(48px, 5vw, 72px); }
@media (max-width: 899px) { section.cs-quote { padding: 72px 0; } }

@media (max-width: 899px) {
  :root { --nav: 60px; }
  .client { grid-template-columns: 1fr; }
  .client-facts { grid-template-columns: 1fr 1fr; padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .c-head { grid-template-columns: 1fr; gap: 10px; }
  .plan { grid-template-columns: 1fr; gap: 24px; }
  .tour { grid-template-columns: 1fr; } .tour .mac { order: -1; }
  .nums { grid-template-columns: 1fr; gap: 24px; }
}
