/* Extra case study components: chapters, compare slider, live embed, feedback loop.
   Loaded after style.css on case studies that use them. */

/* Chapter divider inside a case study */
.chapter { display: flex; align-items: center; gap: 16px; margin-bottom: clamp(28px, 4vw, 44px); }
.chapter__num { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; background: var(--c); color: var(--on-c); white-space: nowrap; }
.chapter__title { font-size: clamp(1.2rem, 2vw, 1.55rem); letter-spacing: -0.025em; font-weight: 600; }
.chapter::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cs-body > .chapter-start { border-top: 0; padding-top: clamp(40px, 6vw, 72px); padding-bottom: 0; }
.toc .toc__group { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); padding: 14px 0 4px 16px; }

/* Status chip in case hero */
.status-chip { display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.88rem; }
.status-chip img { width: 30px; height: 30px; border-radius: 8px; }

/* Tall gallery (App Store screenshots) */
.hscroll--tall { grid-auto-columns: min(46%, 230px); }
.hscroll--tall img { aspect-ratio: auto; object-fit: contain; border-radius: 18px; box-shadow: 0 0 0 1px var(--line); }

/* Concept vs shipped */
.evolve { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(16px, 3vw, 40px); align-items: center; padding: clamp(24px, 4vw, 48px); border-radius: var(--radius-lg); background: var(--tint); margin-block: 32px; }
.evolve figure { display: grid; justify-items: center; gap: 16px; }
.evolve .phone { width: min(210px, 100%); }
.evolve figcaption { text-align: center; font-size: 0.9rem; color: var(--ink-2); max-width: 28ch; }
.evolve figcaption b { display: block; color: var(--ink); font-weight: 600; }
.evolve__arrow { font-size: 1.6rem; color: var(--c); }
@media (max-width: 640px) { .evolve { grid-template-columns: 1fr 1fr; padding: 20px 14px; } .evolve__arrow { display: none; } }

/* Guess vs fact */
.guess { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 1.6vw, 20px); margin-block: 32px; }
.guess__card { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 14px; align-content: start; }
.guess__label { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.guess__demo { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--bg); min-height: 68px; }
.guess__row { font-size: 0.93rem; line-height: 1.45; display: flex; gap: 10px; }
.guess__row--no { color: var(--ink-3); }
.guess__row--no s { text-decoration-color: var(--accent); }
.guess__row--no::before { content: "✕"; color: var(--accent); flex: none; }
.guess__row--yes::before { content: "✓"; color: var(--c); flex: none; font-weight: 700; }
.face { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; flex: none; background: var(--c); color: var(--on-c); }
.face--guess { background: transparent; color: var(--c); border: 2px dashed var(--c); font-size: 0.68rem; animation: spinDash 12s linear infinite; }
.face small { display: block; }
@keyframes spinDash { to { transform: rotate(360deg); } }
.face--guess span { display: inline-block; animation: spinDash 12s linear infinite reverse; }
.time-pill { padding: 6px 12px; border-radius: 999px; background: var(--c); color: var(--on-c); font-size: 0.85rem; }
.time-pill--fake { background: none; color: var(--ink-3); border: 1px dashed var(--line-strong); text-decoration: line-through; text-decoration-color: var(--accent); }
@media (max-width: 860px) { .guess { grid-template-columns: 1fr; } }

/* Light / dark compare slider */
.compare-wrap { display: grid; grid-template-columns: minmax(220px, 290px) 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; margin-top: 12px; }
.compare-wrap .phone { width: 100%; }
.compare { position: absolute; inset: 0; touch-action: pan-y; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.compare__top { clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.compare__line { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); pointer-events: none; z-index: 2; }
.compare__line::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #0e1718; display: grid; place-items: center; font-size: 0.95rem; box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; z-index: 3; }
.compare__tags { position: absolute; bottom: 14%; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 8px; pointer-events: none; z-index: 2; }
.compare__tags span { font-size: 0.62rem; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,0.6); color: #fff; }
.compare-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.compare-picker button { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.85rem; transition: background 0.2s, color 0.2s; }
.compare-picker button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.swatches { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.swatch { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--ink-2); }
.swatch i { width: 26px; height: 26px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
@media (max-width: 760px) { .compare-wrap { grid-template-columns: 1fr; } .compare-wrap .phone { width: 240px; margin-inline: auto; } }

/* Live embed inside a phone */
.phone__screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #021416; }
.live-wrap { display: grid; grid-template-columns: minmax(200px, 250px) 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; margin-block: 32px; }
.live-wrap .phone { width: 100%; }
.live-caption { position: absolute; left: 0; right: 0; top: 7%; text-align: center; color: #e8fffb; font-size: 0.72rem; font-weight: 500; z-index: 2; pointer-events: none; }
.credit { font-size: 0.75rem; color: #7f9a98; margin-top: 12px; }
.credit a { text-decoration: underline; }
@media (max-width: 760px) { .live-wrap { grid-template-columns: 1fr; } .live-wrap .phone { width: 210px; margin-inline: auto; } }

/* Feedback loop list */
.loop { display: grid; gap: 10px; margin-top: 20px; }
.loop__row { display: grid; grid-template-columns: 1fr 28px 1fr; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.loop__row p { font-size: 0.94rem; line-height: 1.5; color: var(--ink-2); }
.loop__row p:last-child { color: var(--ink); }
.loop__arrow { color: var(--c); text-align: center; font-size: 1.1rem; }
.loop__head { display: grid; grid-template-columns: 1fr 28px 1fr; gap: 16px; padding: 0 20px; margin-top: 28px; }
.loop__head span { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
@media (max-width: 700px) {
  .loop__row, .loop__head { grid-template-columns: 1fr; gap: 6px; }
  .loop__arrow { text-align: left; }
  .loop__head { display: none; }
}

/* Beta status strip */
.beta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-block: 28px; }
.beta div { background: var(--surface); padding: 20px; }
.beta b { display: block; font-size: 1.35rem; letter-spacing: -0.03em; margin-bottom: 4px; }
.beta span { font-size: 0.85rem; color: var(--ink-2); line-height: 1.4; display: block; }
@media (max-width: 760px) { .beta { grid-template-columns: 1fr 1fr; } }

/* Before → after inside metrics */
.metrics small { display: block; font-size: 0.78rem; color: #ffb08f; margin-top: 6px; }

/* Hard problems grid inside the dark band */
.problems { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-block: 28px; }
.problem { padding: 22px; border-radius: 16px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); }
.problem .mono { color: #7fb6bc; font-size: 0.68rem; display: block; margin-bottom: 8px; }
.problem h3, .problem h4 { color: #fff; font-size: 1.02rem; letter-spacing: -0.015em; margin-bottom: 8px; line-height: 1.3; }
.problem p { color: #b8c7c6; font-size: 0.92rem; line-height: 1.55; }
@media (max-width: 760px) { .problems { grid-template-columns: 1fr; } }

/* Audience cards (now) */
.audience { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 1.6vw, 20px); margin-top: 28px; }
.audience div { padding: 22px; border-radius: var(--radius); background: var(--tint); }
.audience b { display: block; margin-bottom: 6px; letter-spacing: -0.01em; }
.audience p { font-size: 0.93rem; color: var(--ink-2); }
@media (max-width: 760px) { .audience { grid-template-columns: 1fr; } }

/* ---------- Wide (dashboard) variants ---------- */
.browser__view--video { aspect-ratio: 1998 / 1080; }
.browser__view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

.tour--wide { grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr); }
.tour--wide .tour__stage { width: 100%; }
.tour--wide .tour__stage::before { inset: -10% -6%; }
.browser__view.tour__screens img { animation: none; height: 100%; object-fit: cover; object-position: top left; }
.tour--wide .tour__step { min-height: 62vh; }
.tour--wide .tour__mobile-img { width: 100%; max-width: none; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 20px 40px -25px rgba(0,0,0,0.4); }

/* Live prototype, rendered at desktop size and scaled to fit */
.demo-view { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #f5f6fa; }
.demo-view iframe { position: absolute; top: 0; left: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; transform: scale(var(--s, 0.5)); }
.demo-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }

/* Team credits */
.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 24px; }
.team a, .team div { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: border-color 0.2s, transform 0.3s var(--ease); }
.team a:hover { border-color: var(--ink); transform: translateY(-2px); }
.team .ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--c); font-weight: 600; flex: none; }
.team b { display: block; font-size: 0.95rem; font-weight: 600; }
.team span { font-size: 0.82rem; color: var(--ink-3); }

/* Role cards */
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 1.6vw, 20px); }
.role { padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; align-content: start; }
.role__tag { justify-self: start; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 5px 10px; border-radius: 999px; background: var(--tint); color: var(--c); }
.role h3 { font-size: 1.25rem; letter-spacing: -0.02em; }
.role p { font-size: 0.95rem; color: var(--ink-2); }
.role p b { color: var(--ink); }
@media (max-width: 760px) { .roles { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .tour--wide { grid-template-columns: 1fr; }
}

/* Achiever palette */
:root { --achiever: #26679a; --achiever-orange: #ff8e2b; --achiever-soft: #e2ecf5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --achiever-soft: #142231; --achiever: #5fa8e0; } }
:root[data-theme="dark"] { --achiever-soft: #142231; --achiever: #5fa8e0; }
.vt-achiever { view-transition-name: achiever-visual; }
.team img.ava { object-fit: cover; }

/* ===== Smart Study research components ===== */
:root { --study: #02688f; --study-soft: #e1f1f8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --study-soft: #10232c; --study: #3fb0e0; } }
:root[data-theme="dark"] { --study-soft: #10232c; --study: #3fb0e0; }

/* Hero: floating sticky notes */
.notes-hero { position: relative; border-radius: var(--radius-lg); background: var(--tint); aspect-ratio: 16 / 8.2; overflow: hidden; }
.notes-hero .sticky { position: absolute; width: clamp(110px, 15%, 190px); padding: 14px; font-size: clamp(0.72rem, 1.1vw, 0.95rem); line-height: 1.3; color: #2c2a12; background: #e6f28a; box-shadow: 0 12px 24px -14px rgba(0,0,0,0.45); border-radius: 3px; animation: stickyFloat 7s ease-in-out infinite; }
.notes-hero .sticky:nth-child(3n) { background: #9fe0dc; }
.notes-hero .sticky:nth-child(4n) { background: #ffd36e; }
.notes-hero .sticky:nth-child(5n) { background: #f7a8a8; }
.notes-hero .sticky:nth-child(odd) { animation-delay: -3s; }
@keyframes stickyFloat { 0%, 100% { transform: rotate(var(--r, -3deg)) translateY(0); } 50% { transform: rotate(calc(var(--r, -3deg) * -0.6)) translateY(-10px); } }
.notes-hero__title { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.notes-hero__title b { font-size: clamp(1.4rem, 3.4vw, 2.8rem); letter-spacing: -0.03em; color: var(--ink); background: color-mix(in srgb, var(--bg) 82%, transparent); padding: 10px 22px; border-radius: 16px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@media (max-width: 700px) { .notes-hero { aspect-ratio: 4 / 5; } .notes-hero .sticky { width: 38%; } }

/* Empathy map */
.empathy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.empathy__q { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.empathy__q h3, .empathy__q h4 { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c); margin-bottom: 4px; font-weight: 500; }
.empathy__q p.q { font-size: 0.82rem; color: var(--ink-3); margin-bottom: 12px; }
.empathy__notes { display: flex; flex-wrap: wrap; gap: 6px; }
.empathy__notes span { padding: 6px 10px; border-radius: 4px; background: #e9f59a; color: #2c2a12; font-size: 0.82rem; line-height: 1.25; box-shadow: 0 4px 8px -6px rgba(0,0,0,0.4); }
.empathy__q--wide { grid-column: span 2; }
.empathy__q--pains span { background: #ffd0d0; }
.empathy__q--gains span { background: #cdf1d1; }
@media (max-width: 860px) { .empathy { grid-template-columns: 1fr; } .empathy__q--wide { grid-column: auto; } }

/* Journey map with emotion curve */
.journey { border-radius: 22px; background: var(--surface); border: 1px solid var(--line); padding: 20px; overflow-x: auto; }
.journey__grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; min-width: 760px; position: relative; }
.journey__step h3, .journey__step h4 { font-size: 0.95rem; letter-spacing: -0.01em; padding: 10px 12px; border-radius: 12px; background: var(--tint); margin-bottom: 8px; min-height: 64px; }
.journey__step p { font-size: 0.85rem; color: var(--ink-2); padding: 0 4px; min-height: 92px; }
.journey__curve { grid-column: 1 / -1; height: 150px; position: relative; }
.journey__curve svg { width: 100%; height: 100%; overflow: visible; }
.journey__curve path { fill: none; stroke: var(--c); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1400; stroke-dashoffset: 1400; transition: stroke-dashoffset 2.2s var(--ease-out); }
.journey.is-visible .journey__curve path { stroke-dashoffset: 0; }
.journey__curve line { stroke: var(--line-strong); stroke-dasharray: 4 6; }
.journey__face { position: absolute; transform: translate(-50%, -50%) scale(0); font-size: 1.6rem; transition: transform 0.5s var(--ease-out); }
.journey.is-visible .journey__face { transform: translate(-50%, -50%) scale(1); }
.journey__feel { text-align: center; padding: 10px; border-radius: 10px; font-weight: 600; font-size: 0.88rem; }
.feel--bad { background: #fbd5cc; color: #6b2414; }
.feel--ok { background: #eef4c2; color: #4a4a10; }
.feel--good { background: #d4efce; color: #1d5a20; }

/* Value / effort matrix */
.matrix { display: grid; grid-template-columns: 34px 1fr 1fr; grid-template-rows: auto auto 30px; gap: 10px; }
.matrix__axis { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); display: grid; place-items: center; }
.matrix__axis--y { writing-mode: vertical-rl; transform: rotate(180deg); grid-row: 1 / 3; }
.matrix__axis--x { grid-column: 2 / 4; }
.matrix__cell { padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); min-height: 160px; }
.matrix__cell h3, .matrix__cell h4 { font-size: 0.95rem; margin-bottom: 4px; }
.matrix__cell small { display: block; font-size: 0.78rem; color: var(--ink-3); margin-bottom: 10px; }
.matrix__cell .empathy__notes span { background: #fff3a6; }
.matrix__cell--best { background: color-mix(in srgb, #8bd17c 16%, var(--surface)); }
.matrix__cell--best small { color: var(--ink-2); }
.matrix__cell--empty { display: grid; place-content: center; text-align: center; color: var(--ink-3); }
@media (max-width: 700px) { .matrix { grid-template-columns: 1fr; grid-template-rows: none; } .matrix__axis { display: none; } }

/* Card sort clusters */
.clusters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cluster { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.cluster h3, .cluster h4 { font-size: 1rem; letter-spacing: -0.01em; }
.cluster small { display: block; font-size: 0.8rem; color: var(--ink-3); margin: 2px 0 12px; }
.cluster .empathy__notes span { background: #c6ecf6; }
@media (max-width: 860px) { .clusters { grid-template-columns: 1fr; } }

/* Brand foundation */
.foundation { display: grid; gap: 10px; }
.foundation__row { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: stretch; }
.foundation__row > span { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); padding-top: 18px; }
.foundation__cells { display: grid; grid-template-columns: repeat(var(--n, 1), 1fr); gap: 10px; }
.foundation__cells p { padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 0.95rem; }
.foundation__cells--words p { text-align: center; font-family: var(--font-serif); font-style: italic; font-size: 1.4rem; background: var(--tint); border: 0; }
@media (max-width: 700px) { .foundation__row { grid-template-columns: 1fr; } .foundation__row > span { padding-top: 0; } .foundation__cells { grid-template-columns: 1fr; } }

/* Story (scenario) */
.story { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: st; }
.story article { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); counter-increment: st; position: relative; }
.story article::before { content: counter(st); position: absolute; top: 14px; right: 16px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); }
.story b { display: block; font-size: 1.6rem; margin-bottom: 6px; }
.story p { font-size: 0.9rem; color: var(--ink-2); }
@media (max-width: 860px) { .story { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .story { grid-template-columns: 1fr; } }

/* Optional early UI */
.early-ui { border-radius: 22px; border: 1px dashed var(--line-strong); padding: 6px 20px; }
.early-ui summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.early-ui summary::-webkit-details-marker { display: none; }
.early-ui summary::after { content: "+"; font-size: 1.4rem; transition: transform 0.3s var(--ease); }
.early-ui[open] summary::after { transform: rotate(45deg); }
.early-ui summary small { display: block; font-weight: 400; color: var(--ink-3); font-size: 0.85rem; margin-top: 2px; }
