/* ==========================================================================
   Case study pages
   ========================================================================== */

/* --- Hero --------------------------------------------------------------- */
.cs-hero { padding-top: clamp(28px, 4vw, 48px) !important; padding-bottom: clamp(40px, 6vw, 72px) !important; }
.cs-back { display: inline-block; margin-bottom: clamp(28px, 4vw, 48px); font-size: 14px; font-weight: 600; text-decoration: none; }
.cs-back span { display: inline-block; transition: transform .3s var(--ease); }
.cs-back:hover span { transform: translateX(-4px); }
.cs-hero h1 { margin: 0; font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(72px, 13vw, 190px); line-height: .9; }
.cs-hero h1 .script { font-size: 1.04em; }
.cs-hero__lede { margin: 18px 0 0; max-width: 24ch; font-family: var(--serif); font-size: clamp(26px, 3vw, 38px); line-height: 1.15; }
.cs-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: clamp(32px, 5vw, 56px) 0; }
.cs-facts div { border-top: 1.5px solid var(--ink); padding-top: 10px; }
.cs-facts dt { font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.cs-facts dd { margin: 6px 0 0; font-size: 16px; line-height: 1.35; }

.ff-cover {
  position: relative; display: flex; align-items: center; justify-content: center; gap: clamp(20px, 5vw, 64px);
  padding: clamp(28px, 5vw, 64px); border-radius: 8px; overflow: hidden;
  background: linear-gradient(180deg, #fbf2fa, #fbd4e3 35%, #fbb5cb 70%, #f593af);
}
.ff-cover__room { width: min(38%, 340px); height: auto; border-radius: 6px; box-shadow: 0 16px 40px -18px rgba(140, 31, 71, .55); }
.ff-cover__logo { box-sizing: border-box; width: min(48%, 440px); height: auto; padding: clamp(14px, 2.4vw, 30px) clamp(18px, 3vw, 40px); border-radius: 999px; background: #fff; box-shadow: 0 16px 40px -22px rgba(140, 31, 71, .5); }

/* --- Layout: rail + content --------------------------------------------- */
.cs-body { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); padding-top: 0 !important; }

.cs-rail { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); }
.cs-rail__line { position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.cs-rail__fill { display: block; width: 100%; height: 100%; background: var(--orchid); transform-origin: top; transform: scaleY(0); }
.cs-rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cs-rail a {
  position: relative; display: block; padding: 5px 0 5px 24px;
  font-size: 14px; font-weight: 500; line-height: 1.25; text-decoration: none; color: var(--ink-soft);
  transition: color .25s, transform .35s var(--ease);
}
.cs-rail a::before {
  content: ""; position: absolute; left: 1px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; border: 2px solid var(--line); background: var(--paper);
  transition: border-color .25s, background .25s, transform .35s var(--ease);
}
.cs-rail a:hover { color: var(--ink); }
.cs-rail a.is-past::before { border-color: var(--orchid); background: var(--orchid); }
.cs-rail a.is-current { color: var(--ink); font-weight: 700; transform: translateX(3px); }
.cs-rail a.is-current::before { border-color: var(--orchid); background: var(--orchid); transform: translateX(-3px) scale(1.25); }

/* --- Steps -------------------------------------------------------------- */
.cs-content { min-width: 0; }
.cs-step { padding: clamp(40px, 6vw, 72px) 0; border-top: 1.5px solid var(--line); scroll-margin-top: 64px; }
.cs-step:first-child { border-top: 0; padding-top: 0; }
.cs-step__n { margin: 0 0 4px; font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--orchid); }
.cs-step h2 { margin: 0 0 18px; font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(42px, 6vw, 76px); line-height: .95; }
.cs-step > p:not(.cs-step__n) { max-width: 62ch; margin: 0 0 16px; font-size: 18px; line-height: 1.55; }
.cs-step > p.cs-lede { max-width: 30ch; font-family: var(--serif); font-size: clamp(26px, 2.8vw, 34px); line-height: 1.22; }

.cs-hmw {
  margin: 28px 0 0; padding: clamp(22px, 3vw, 34px); border-radius: 8px; background: var(--paper-2);
  font-family: var(--serif); font-size: clamp(23px, 2.5vw, 30px); line-height: 1.3;
}
.cs-hmw span { color: var(--orchid-deep); font-style: italic; }

.cs-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.cs-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }

.cs-card { padding: 20px; border: 1.5px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--paper-2) 35%, var(--paper)); }
.cs-card h3 { margin: 0 0 4px; font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: 28px; line-height: 1.05; }
.cs-card h4 { margin: 14px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.cs-card__sub { margin: 0; font-size: 15px; line-height: 1.4; color: var(--ink-soft); }
.cs-card blockquote { margin: 14px 0; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.3; color: var(--orchid-deep); }
.cs-card ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.45; }
.cs-card li + li { margin-top: 4px; }
.cs-logo { display: block; width: 64px; height: 64px; margin-bottom: 14px; border-radius: 23%; object-fit: contain; box-shadow: 0 0 0 1px var(--line); }

.cs-findings { display: grid; gap: 0; margin-top: 12px; }
.cs-findings article { display: flex; gap: 24px; align-items: center; padding: 18px 0; border-top: 1.5px solid var(--line); }
.cs-findings h3 { margin: 0 0 6px; font-size: 19px; font-weight: 700; line-height: 1.25; }
.cs-findings p { margin: 0 0 6px; max-width: 62ch; font-size: 16px; line-height: 1.5; }
.cs-findings cite { font-family: var(--serif); font-size: 16px; color: var(--ink-soft); }
.cs-stat { flex: none; margin: 0 !important; font-stretch: 62%; font-weight: 900; font-size: clamp(64px, 8vw, 104px); line-height: 1; color: var(--orchid); }

.cs-issues { list-style: none; counter-reset: i; margin: 10px 0 0; padding: 0; }
.cs-issues li {
  counter-increment: i; display: flex; align-items: baseline; gap: 16px; padding: 10px 0;
  border-top: 1.5px solid var(--line);
  font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(26px, 3.4vw, 42px); line-height: 1.05;
}
.cs-issues li::before { content: counter(i); font-family: var(--serif); font-style: italic; font-weight: 400; font-stretch: normal; font-size: .7em; text-transform: none; color: var(--orchid); min-width: 1em; }

/* --- Figures ------------------------------------------------------------ */
.cs-fig { margin: 20px 0; }
.cs-grid-2 .cs-fig, .cs-grid-3 .cs-fig, .cs-sketch-pair .cs-fig { margin: 0; }
.cs-zoom { display: block; width: 100%; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #fff; cursor: zoom-in; box-shadow: 0 0 0 1.5px var(--line); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.cs-zoom:hover { transform: translateY(-3px); box-shadow: 0 0 0 1.5px var(--orchid), 0 14px 30px -20px rgba(90, 30, 50, .5); }
.cs-zoom img { display: block; width: 100%; height: auto; }
.cs-zoom { position: relative; }
.cs-zoom__cue {
  position: absolute; right: 8px; bottom: 8px; display: inline-flex; gap: 5px; padding: 6px 11px; border-radius: 99px;
  background: var(--paper); color: var(--orchid-deep); box-shadow: 0 0 0 1px var(--line);
  font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; line-height: 1;
  transition: background .25s, color .25s;
}
.cs-zoom__cue span { transition: transform .3s var(--ease); }
.cs-zoom:hover .cs-zoom__cue { background: var(--orchid-deep); color: #fff; }
:root[data-theme="wild"] .cs-zoom:hover .cs-zoom__cue { color: #161010; }
.cs-zoom:hover .cs-zoom__cue span { transform: translateX(3px); }
.cs-fig figcaption { margin-top: 10px; font-family: var(--serif); font-size: 19px; line-height: 1.35; color: var(--ink-soft); }
.cs-fig figcaption strong { font-family: var(--display); font-size: 15px; color: var(--ink); }
/* Column widths follow each image's proportions, so every sketch in a row is the same height and nothing is cropped. */
.cs-grid-3--sketch { grid-template-columns: minmax(0, .597fr) minmax(0, .705fr) minmax(0, .716fr); }
.cs-sketch-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 4.513fr); gap: 18px; margin-top: 18px; align-items: start; }

/* --- Prototype ---------------------------------------------------------- */
.ff-demo { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center; margin-top: 24px; }
.ff-phone { padding: 10px; border-radius: 42px; background: #1f1518; box-shadow: 0 24px 50px -24px rgba(60, 20, 35, .6); }
.ff-screen { position: relative; aspect-ratio: 486 / 864; overflow: hidden; border-radius: 32px; container-type: inline-size; background: #fce0eb; }
.ff-view { position: absolute; inset: 0; animation: ff-in .4s var(--ease); }
@keyframes ff-in { from { opacity: 0; transform: translateX(14px); } }
.ff-view--back { animation-name: ff-in-back; }
@keyframes ff-in-back { from { opacity: 0; transform: translateX(-14px); } }
.ff-layer { position: absolute; display: block; max-width: none; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.ff-shape { position: absolute; pointer-events: none; }
.ff-hot { position: absolute; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12cqw; }
.ff-hot:hover { background: rgba(255, 255, 255, .16); }
.ff-hot:focus-visible { outline: 2px solid #8c1f47; outline-offset: 1px; }
.ff-bounce { animation: ff-bounce .5s var(--ease); }
@keyframes ff-bounce { 40% { transform: translateY(-3%) scale(1.02); } }

/* Tap hint */
.ff-hint { display: flex; align-items: center; gap: 10px; margin: 22px 0 0; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(25px, 2.6vw, 32px); line-height: 1.15; color: var(--orchid); }
.ff-hint::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--orchid); animation: ff-ping 1.8s var(--ease) infinite; }
@keyframes ff-ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--orchid) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.ff-fresh .ff-hot:not([aria-label="Back"])::after, .ff-hot--pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  animation: ff-ring 1.8s var(--ease) infinite;
}
@keyframes ff-ring { 0% { box-shadow: 0 0 0 0 rgba(255, 61, 122, .55); } 100% { box-shadow: 0 0 0 3cqw rgba(255, 61, 122, 0); } }

/* Menu and the screens inside it, in the prototype's own style */
.ff-burger { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.1cqw; border-radius: 3cqw; }
.ff-burger i { display: block; width: 7.4cqw; height: 1.1cqw; border-radius: 1cqw; background: #ff7fa7; }
.ff-scrim { position: absolute; inset: 0; padding: 0; border: 0; background: rgba(70, 20, 40, .38); cursor: pointer; animation: fade .3s var(--ease); }
.ff-drawer {
  position: absolute; left: 0; top: 0; bottom: 0; width: 70%; display: flex; flex-direction: column; padding: 6cqw 0 0;
  background: #fcdfea; box-shadow: 2cqw 0 8cqw rgba(70, 20, 40, .25); animation: ff-drawer .38s var(--ease);
}
@keyframes ff-drawer { from { transform: translateX(-100%); } }
.ff-drawer__logo { display: grid; place-items: center; width: 22cqw; height: 22cqw; margin: 0 0 6cqw 5cqw; border-radius: 50%; background: #fff; }
.ff-drawer__logo img { width: 80%; height: auto; }
.ff-drawer button {
  padding: 3.6cqw 5cqw; border: 0; border-top: .4cqw solid rgba(255, 127, 167, .45); background: none; text-align: left; cursor: pointer;
  font-family: "Almendra", var(--serif); font-weight: 700; font-size: 4.9cqw; letter-spacing: .07em; color: #e8437a; transition: background .2s;
}
.ff-drawer button:last-child { border-bottom: .4cqw solid rgba(255, 127, 167, .45); }
.ff-drawer button:hover { background: rgba(250, 150, 181, .35); }

.ff-sub {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 3.2cqw; padding: 19cqw 5.5cqw 6cqw;
  background: linear-gradient(180deg, #fcdfea, #fcdfea 70%, #fbc6d7);
  font-family: "Almendra", var(--serif); font-weight: 700; font-size: 3.9cqw; letter-spacing: .07em; line-height: 1.25; color: #e8437a;
}
.ff-sub p { margin: 0; }
.ff-title { align-self: center; padding: 1.8cqw 5cqw; border-radius: 99px; background: #ffeef2; color: #ff7fa7; font-size: 5.6cqw; letter-spacing: .1em; text-align: center; white-space: nowrap; }
.ff-row {
  display: flex; align-items: center; justify-content: space-between; gap: 3cqw; width: 100%; padding: 4.4cqw 4.4cqw; border: 0; border-radius: 4.5cqw;
  background: rgba(250, 150, 181, .35); color: inherit; font: inherit; letter-spacing: inherit; text-align: left;
}
button.ff-row { cursor: pointer; }
.ff-row b { font-weight: 400; color: #c23a68; font-size: .92em; letter-spacing: .03em; text-align: right; overflow-wrap: anywhere; }
.ff-switch { flex: none; position: relative; width: 11cqw; height: 6cqw; border-radius: 99px; background: #fff; transition: background .25s; }
.ff-switch::after { content: ""; position: absolute; top: .8cqw; left: .8cqw; width: 4.4cqw; height: 4.4cqw; border-radius: 50%; background: #ff9ebd; transition: transform .25s var(--ease), background .25s; }
[aria-checked="true"] > .ff-switch { background: #ff7fa7; }
[aria-checked="true"] > .ff-switch::after { transform: translateX(5cqw); background: #fff; }
.ff-pill { align-self: center; margin-top: 3cqw; padding: 2.8cqw 11cqw; border: .7cqw solid #ff3d7a; border-radius: 99px; background: #ff7fa7; color: #fff; font: inherit; letter-spacing: .12em; cursor: pointer; }
.ff-avatar { align-self: center; width: 19cqw; height: auto; }
.ff-lead { text-align: center; font-size: 5cqw; color: #ff7fa7; }
.ff-lead b { display: inline-grid; place-items: center; width: 10cqw; height: 10cqw; border-radius: 50%; background: #fff; color: #e8437a; }
.ff-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1cqw; padding: 2.5cqw; border-radius: 4.5cqw; background: rgba(255, 255, 255, .6); text-align: center; font-size: 3.3cqw; letter-spacing: 0; }
.ff-cal span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; }
.ff-cal .is-today, .ff-key .is-today { background: #ff3d7a; color: #fff; }
.ff-cal .is-period, .ff-key .is-period { background: #ffb3cb; }
.ff-key { display: flex; align-items: center; justify-content: center; gap: 1.5cqw; font-size: 3cqw; }
.ff-key i { width: 3cqw; height: 3cqw; border-radius: 50%; }
.ff-key i + i { margin-left: 2cqw; }
.ff-modes { display: grid; gap: 2.6cqw; margin-top: 2cqw; }
.ff-row--mode { justify-content: flex-start; padding: 4cqw; }
.ff-row--mode strong { display: block; font-size: 4.3cqw; }
.ff-row--mode small { display: block; margin-top: .6cqw; font-size: 3.1cqw; letter-spacing: .04em; }
.ff-radio { flex: none; width: 7cqw; height: 7cqw; border: .7cqw solid #fff; border-radius: 50%; }
[aria-checked="true"] > .ff-radio { background: #ff3d7a; box-shadow: inset 0 0 0 1cqw #fff; }
.ff-small { text-align: center; font-size: 3.2cqw; color: #f26b97; }
.ff-body { font-size: 4.1cqw; line-height: 1.4; text-align: center; }
.ff-info-logo { align-self: center; width: 78%; height: auto; margin: 3cqw 0; }

.ff-tabs__row { display: flex; flex-wrap: wrap; gap: 8px; }
.ff-tabs__label { margin: 14px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.ff-tabs button {
  padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 99px; background: none; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.ff-tabs button:hover { border-color: var(--ink); }
.ff-tabs button[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.ff-note { margin-top: 18px; min-height: 8em; }
.ff-note h3 { margin: 0 0 6px; font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(28px, 3vw, 38px); line-height: 1; }
.ff-note p { margin: 0; max-width: 42ch; font-size: 17px; line-height: 1.5; }

/* --- End of page -------------------------------------------------------- */
.cs-end { padding: clamp(40px, 6vw, 72px) 0 0; border-top: 1.5px solid var(--line); }
.cs-end__line { margin: 0 0 22px; font-family: var(--serif); font-size: clamp(28px, 3vw, 38px); line-height: 1.15; }
.cs-end .btn { margin: 0 8px 8px 0; }

/* --- Scroll reveals (only when JS is running) --------------------------- */
.js-reveal .rv { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js-reveal .rv.in { opacity: 1; transform: none; }
.js-reveal .rv-img .cs-zoom { clip-path: inset(0 0 100% 0); transition: clip-path .9s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease); }
.js-reveal .rv-img.in .cs-zoom { clip-path: inset(-40px); }
.js-reveal .cs-grid-3 > .rv:nth-child(2), .js-reveal .cs-grid-2 > :nth-child(2) { transition-delay: .1s; }
.js-reveal .cs-grid-3 > .rv:nth-child(3), .js-reveal .cs-grid-3 > :nth-child(3) { transition-delay: .2s; }

/* --- Home page feature --------------------------------------------------- */
.cs-feature {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px);
  color: inherit; text-decoration: none;
}
.cs-feature .ff-cover { transition: transform .5s var(--ease); }
.cs-feature:hover .ff-cover { transform: translateY(-4px); }
.cs-feature:hover .cs-feature__title { color: var(--orchid); }
.cs-feature__title { display: block; margin: 0 0 8px; font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(44px, 6vw, 84px); line-height: .95; transition: color .3s; }
.cs-feature__text { margin: 0 0 18px; max-width: 34ch; font-family: var(--serif); font-size: clamp(21px, 2vw, 25px); line-height: 1.35; }
.cs-feature__cta { display: inline-flex; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--orchid-deep); }
.cs-feature__cta span { transition: transform .3s var(--ease); }
.cs-feature:hover .cs-feature__cta span { transform: translateX(4px); }
.cs-more { margin: clamp(24px, 3vw, 36px) 0 0; font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--ink-soft); }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 1180px) {
  .cs-body { display: block; }
  .cs-rail {
    position: sticky; top: 62px; z-index: 20; max-height: none; margin: 0 calc(var(--gutter) * -1) 24px; padding: 8px var(--gutter);
    overflow-x: auto; scrollbar-width: none; background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .cs-rail::-webkit-scrollbar { display: none; }
  .cs-rail__line { display: none; }
  .cs-rail ol { display: flex; gap: 6px; width: max-content; }
  .cs-rail a { padding: 6px 12px; border-radius: 99px; white-space: nowrap; }
  .cs-rail a::before { display: none; }
  .cs-rail a.is-current { background: var(--ink); color: var(--paper); transform: none; }
  .cs-step { scroll-margin-top: 120px; }
}
@media (max-width: 900px) {
  .cs-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-grid-3, .cs-grid-2 { grid-template-columns: 1fr; }
  .cs-grid-3--sketch { grid-template-columns: minmax(0, .597fr) minmax(0, .705fr) minmax(0, .716fr); gap: 10px; }
  .cs-feature { grid-template-columns: 1fr; }
  .ff-demo { grid-template-columns: 1fr; justify-items: center; }
  .ff-phone { width: min(100%, 320px); }
  .ff-notes { width: 100%; }
}
@media (max-width: 560px) {
  .cs-sketch-pair { grid-template-columns: 1fr; }
  .cs-sketch-pair .cs-fig:first-child { max-width: 200px; }
  .cs-findings article { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .rv, .js-reveal .rv-img .cs-zoom { opacity: 1; transform: none; clip-path: none; }
}
