/* SmartRead and Dayzee: the same editorial rhythm as the reviewed case studies.
   Copy stays content-led. Major visuals use a viewport budget without cropping. */
.app-case{--app-frame-height:95vh;--app-frame-padding:var(--case-section-gap);--app-media-height:max(240px,calc(var(--app-frame-height) - 2 * var(--app-frame-padding) - 1px))}
@supports(height:100dvh){.app-case{--app-frame-height:95dvh}}
.app-case .case-overview{padding-block:var(--case-section-gap)}
.app-case .case-overview .overview-column h2{margin-bottom:16px}
.app-case .case-overview .case-intro+.case-intro{margin-top:20px}
.app-case .case-overview p{max-width:var(--case-reading)}
.app-case .case-body>.app-case-section{padding-block:0;border-bottom:0}
.app-case .app-case-frame{margin:0;padding-block:var(--app-frame-padding);border-bottom:1px solid var(--line);min-width:0}
.app-case .app-case-frame>.chapter-row{margin:0}
.app-case .app-case-frame>.chapter-row+.chapter-row{margin-top:32px}
.app-case .app-case-text-frame{height:auto;min-height:0}
.app-case .app-case-stack{display:grid;grid-template-columns:minmax(0,1fr);gap:32px;max-width:var(--case-reading)}
.app-case .app-case-stack .case-cell{display:block;min-width:0;padding:0;background:transparent;border-radius:0}
.app-case .app-case-stack :is(h3,h4){margin:0 0 16px;color:var(--ink)}
.app-case .app-case-stack p{margin:0}
.app-case .app-case-principles{margin-top:32px;gap:40px}
/* Pocket principles span the eight-column content area as two equal columns. */
.case-pocket .app-case-principles{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:40px;max-width:none}
/* Keep the two featured demonstrations uninterrupted by horizontal rules. */
.case-pocket #designs>.app-case-frame{border-bottom:0}
.app-case .app-case-principles h4{font:500 1.25rem/1.35 Inter,Arial,sans-serif}
.app-case .app-case-principles p+p{margin-top:16px}
.app-case .case-body :is(p,ul,ol){max-width:var(--case-reading)}
.app-case .app-case-feature-list{padding-left:1.25em;margin:0}
.app-case .app-case-feature-list li{padding-left:.2em;margin-bottom:16px}
.app-case .app-case-feature-list li:last-child{margin-bottom:0}
.app-case .case-hero-media{height:auto;min-height:0;padding:24px;aspect-ratio:16/9;max-height:var(--app-frame-height)}
.app-case .case-hero-media>a{width:100%;height:100%}
.app-case .case-hero-media img{width:100%;height:100%;object-fit:contain;max-height:none}
.app-case .app-case-visual-frame,.app-case .app-case-animation-frame{display:flex;flex-direction:column;justify-content:center;min-height:var(--app-frame-height)}
.app-case .case-body .app-case-visual-frame>figure{width:100%;height:var(--app-media-height);margin:0;padding:24px}
.app-case .case-body .app-case-visual-frame>figure>a{height:100%}
.app-case .case-body .app-case-visual-frame>figure img{width:100%;height:100%;max-height:none;object-fit:contain}
.app-case .app-case-comparison-frame{display:flex;flex-direction:column;gap:32px}
.app-case .case-body .app-case-comparison-frame>figure{height:auto;max-height:var(--app-media-height);margin:0;padding:24px}
.app-case .case-body .app-case-comparison-frame>figure>a{height:auto;max-height:var(--app-media-height)}
.app-case .case-body .app-case-comparison-frame>figure img{width:100%;height:auto;max-height:calc(var(--app-media-height) - 48px);object-fit:contain}
.app-case .case-body .app-case-animation-frame{margin:0}
.app-case .app-case-animation-frame>.feature-layout{width:100%;align-items:start}
.app-case .app-case-animation-frame .app-case-feature-media{display:flex;align-items:flex-start;justify-content:center;gap:24px;min-width:0}
.app-case .case-body .app-case-feature-media>figure{display:flex;align-items:flex-start;justify-content:center;flex:1 1 0;width:auto;height:auto;min-height:0;max-height:none;margin:0;padding:0;background:transparent;border-radius:0}
.app-case .case-body .app-case-feature-media>figure>a{width:100%;height:auto;display:flex;align-items:flex-start;justify-content:center}
.app-case .case-body .app-case-feature-media>figure img{width:auto;height:auto;max-width:100%;max-height:var(--app-media-height);margin:0;border-radius:0;object-fit:contain}
.app-case .app-case-phone{position:relative;display:block;flex:none;overflow:hidden;max-width:100%}
/* Pocket media keeps the existing precise exterior contour masks and original GIF bytes.
   Cropping only the exterior canvas lets text align with the visible phone top. */
.case-pocket .pocket-inline-animation,.case-pocket .pocket-score-animation{transform:none}
.case-pocket .app-case-phone:has(.pocket-inline-animation){width:min(100%,calc(var(--app-media-height) * 729 / 1483));aspect-ratio:729/1483}
.case-pocket .app-case-phone:has(.pocket-score-animation){width:min(100%,calc(var(--app-media-height) * 727 / 1480));aspect-ratio:727/1480}
#main.case-pocket .case-body .app-case-phone .pocket-inline-animation{position:absolute;width:calc(100% * 774 / 729);height:calc(100% * 1522 / 1483);left:calc(-100% * 22 / 729);top:calc(-100% * 21 / 1483);max-width:none;max-height:none}
#main.case-pocket .case-body .app-case-phone .pocket-score-animation{position:absolute;width:calc(100% * 778 / 727);height:calc(100% * 1534 / 1480);left:calc(-100% * 25 / 727);top:calc(-100% * 26 / 1480);max-width:none;max-height:none}
.app-case .case-body>.app-case-section:last-child>.app-case-frame:last-child{border-bottom:0}
@media(max-width:1000px){.app-case .app-case-feature-media{gap:24px}}
@media(max-width:900px){
 .app-case .app-case-animation-frame>.feature-layout{grid-template-columns:minmax(0,1fr);gap:32px}
 .app-case .app-case-animation-frame>.feature-layout>.case-cell{grid-column:1/-1}
 .app-case .app-case-animation-frame{min-height:0}
 .app-case .app-case-animation-frame .app-case-feature-media{justify-content:flex-start}
 .app-case .case-body .app-case-feature-media>figure{justify-content:center}
}
@media(max-width:650px){
 .case-pocket .app-case-principles{grid-template-columns:minmax(0,1fr)}
 .app-case{--app-media-height:max(240px,min(65dvh,620px))}
 .app-case .case-hero-media{aspect-ratio:auto;padding:12px}
 .app-case .case-hero-media>a,.app-case .case-hero-media img{height:auto}
 .app-case .app-case-visual-frame{min-height:0}
 .app-case .case-body .app-case-visual-frame>figure{height:auto;padding:12px}
 .app-case .case-body .app-case-visual-frame>figure>a{height:auto}
 .app-case .case-body .app-case-visual-frame>figure img{height:auto;max-height:var(--app-media-height)}
 .app-case .case-body .app-case-comparison-frame>figure{padding:12px;max-height:none}
 .app-case .case-body .app-case-comparison-frame>figure img{max-height:var(--app-media-height)}
 .app-case .app-case-animation-frame .app-case-media-pair{flex-direction:column;align-items:center;gap:32px}
 .app-case .case-body .app-case-feature-media>figure{width:100%;flex:none}
}
/* Original Dayzee phone canvas: device bounds x100–704, y84–1314. */
.case-dayzee .app-case-phone{width:min(100%,calc(var(--app-media-height) * 604 / 1230));aspect-ratio:604/1230}
.case-dayzee .case-body .app-case-phone .dayzee-phone-animation{position:absolute;width:calc(100% * 800 / 604);height:calc(100% * 1399 / 1230);left:calc(-100% * 100 / 604);top:calc(-100% * 84 / 1230);max-width:none;max-height:none;mask-image:url('/assets/projects/dayzee-phone-mask.svg');mask-position:0 0;mask-size:100% 100%;mask-repeat:no-repeat;-webkit-mask-image:url('/assets/projects/dayzee-phone-mask.svg');-webkit-mask-position:0 0;-webkit-mask-size:100% 100%;-webkit-mask-repeat:no-repeat}
/* The travel-time card expands and contracts. Its animation keeps the full canvas
   and every transition; exterior transparency follows each original frame. */
.case-dayzee .app-case-transit{display:block;width:min(100%,calc(var(--app-media-height) * 404 / 648));max-width:100%;aspect-ratio:404/648}
.case-dayzee .case-body .app-case-transit .dayzee-transit-animation{display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain}

/* Keep the entry-point diagram on the page without an enclosing grey card. */
.case-pocket #exploration .app-case-comparison-frame>figure{background:transparent;border-radius:0}

/* Keep horizontal breathing room around Dayzee's edge-to-edge phone artwork. */
#main.case-dayzee .case-hero-media{padding:0 24px;height:auto;aspect-ratio:auto;width:min(calc(100% - 2 * var(--content-inset)),calc(var(--app-frame-height) * 3018 / 1554))}
#main.case-dayzee .case-hero-media>a,#main.case-dayzee .case-hero-media img{height:auto}

/* Keep the six requested Dayzee transitions open; retain the other chapter boundaries. */
.case-dayzee #development>.app-case-frame:nth-child(-n+3),
.case-dayzee #designs>.app-case-frame:nth-child(-n+3){border-bottom:0}

/* Match Design principles → principle titles to the shared title rhythm. */
.app-case .case-body h3:has(+.app-case-principles){margin-bottom:var(--case-title-gap)}
.app-case .case-body h3+.app-case-principles{margin-top:0}

/* Pocket entry points: the heading and uncropped diagram share one 95vh frame.
   A short-screen minimum and mobile content flow avoid clipping at high zoom. */
.case-pocket #exploration>.app-case-comparison-frame{display:grid;grid-template-rows:auto minmax(0,1fr);height:var(--app-frame-height);min-height:440px;gap:32px}
.case-pocket #exploration>.app-case-comparison-frame>figure{height:100%;max-height:none;min-height:0;margin:0}
.case-pocket #exploration>.app-case-comparison-frame>figure>a{height:100%;max-height:none}
.case-pocket #exploration>.app-case-comparison-frame>figure img{height:100%;max-height:none;object-fit:contain}
@media(max-width:650px){
 .case-pocket #exploration>.app-case-comparison-frame{display:flex;height:auto;min-height:var(--app-frame-height)}
 .case-pocket #exploration>.app-case-comparison-frame>figure,
 .case-pocket #exploration>.app-case-comparison-frame>figure>a,
 .case-pocket #exploration>.app-case-comparison-frame>figure img{height:auto}
}

/* Keep long SmartRead section headings within a comfortable reading measure. */
.case-pocket .case-body h3{max-width:36ch}

/* Give the vector diagram more of its existing 95vh frame. */
.case-pocket #exploration>.app-case-comparison-frame{display:grid;grid-template-rows:auto minmax(0,1fr);height:var(--app-frame-height);min-height:0;padding-block:32px;gap:24px}
.case-pocket #exploration>.app-case-comparison-frame>figure{padding:0;height:100%;max-height:none;min-height:0}
.case-pocket #exploration>.app-case-comparison-frame>figure>a,
.case-pocket #exploration>.app-case-comparison-frame>figure img{height:100%;max-height:none;min-height:0}

/* Dayzee: contiguous ideation images and one shared low-fidelity canvas. */
.case-dayzee #development>.app-case-visual-frame:has(+.dayzee-sketch-group){padding-bottom:12px;min-height:0}
.case-dayzee .dayzee-sketch-group{padding-top:12px;min-height:0}
.case-dayzee .case-body .dayzee-sketch-canvas{display:flex;flex-direction:column;gap:24px;align-items:center;height:auto;max-height:none;margin:0;padding:24px;background:var(--surface-subtle);border-radius:var(--block-radius)}
.case-dayzee .case-body .dayzee-sketch-canvas>a{display:block;width:100%;height:auto}
.case-dayzee .case-body .dayzee-sketch-canvas>a:last-child{width:56.45%}
.case-dayzee .case-body .dayzee-sketch-canvas img{display:block;width:100%;height:auto;max-height:none;object-fit:contain}
@media(min-width:901px){
 .case-dayzee #development>.app-case-comparison-frame{display:grid;grid-template-columns:minmax(0,5fr) minmax(0,6fr);gap:24px;align-items:start}
 .case-dayzee #development>.app-case-comparison-frame>.chapter-row{display:block;margin:0}
 .case-dayzee #development>.app-case-comparison-frame>figure{margin:0;align-self:start;height:auto;max-height:none;background:var(--surface-subtle)}
 .case-dayzee #development>.app-case-comparison-frame>figure>a,.case-dayzee #development>.app-case-comparison-frame>figure img{height:auto;max-height:none}
}

@media(min-width:651px){.case-dayzee #designs>.app-case-text-frame>.chapter-row{align-items:first baseline}}

/* Related Pocket design frames use one 80px gap without viewport-centering slack. */
.case-pocket #designs>.app-case-frame:has(+.app-case-frame){padding-bottom:40px}
.case-pocket #designs>.app-case-frame+.app-case-frame{padding-top:40px}
.case-pocket #designs>.app-case-animation-frame{min-height:0}

/* Shared case rhythm: 80px within chapters; chapter edges retain their responsive padding. */
.app-case .case-body>.app-case-section>.app-case-frame:has(+.app-case-frame){padding-bottom:40px}
.app-case .case-body>.app-case-section>.app-case-frame+.app-case-frame{padding-top:40px}
.app-case .case-body>.app-case-section:has(>.app-case-frame+.app-case-frame)>:is(.app-case-visual-frame,.app-case-animation-frame){min-height:0}
.case-dayzee .case-body>#development>.app-case-visual-frame:has(+.dayzee-sketch-group){padding-bottom:12px}
.case-dayzee .case-body>#development>.dayzee-sketch-group{padding-top:12px}
.case-pocket #exploration>.app-case-comparison-frame{padding-bottom:var(--case-section-gap)}

/* Exploration is a chapter boundary on both sides, even in its fixed-height layout. */
.case-pocket #exploration>.app-case-comparison-frame{padding-block:var(--case-section-gap)}

/* Full Pocket feature demos need more separation than supporting text/image blocks. */
.case-pocket .case-body>#designs>.app-case-animation-frame:has(+.app-case-animation-frame){padding-bottom:64px}
.case-pocket .case-body>#designs>.app-case-animation-frame+.app-case-animation-frame{padding-top:64px}
