.xs-case {
  --xs-width: 900px;
  --xs-gutter: clamp(24px, 6vw, 90px);
  --xs-gap: clamp(100px, 15vw, 200px);
  --xs-body-en: system-ui, sans-serif;
  --xs-body-zh: var(--font-body-zh);
  --xs-heading-en: Georgia, serif;
  --xs-heading-zh: var(--font-heading-zh);
  --xs-heading: var(--xs-heading-en);
  background: #f7f8fa;
  color: #222;
  font: 14px/1.85 var(--xs-body-en);
}
.xs-case:lang(zh) { font-family: var(--xs-body-zh); --xs-heading: var(--xs-heading-zh); }
.xs-nav { position: sticky; top: 0; z-index: 5; background: #f7f8fa; color: #294d75; }
.xs-nav button { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.xs-nav [aria-pressed="true"] { text-decoration: underline; }
.xs-story { max-width: var(--xs-width); width: calc(100% - 2 * var(--xs-gutter)); margin: auto; position: relative; padding: 70px 0 120px; }
.xs-thread { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.xs-thread path { stroke: #a8bfd9; stroke-width: 1; fill: none; }
.xs-hero, .xs-chapter { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 18%; align-items: center; }
.xs-hero { padding-bottom: 80px; }
.xs-case h1 { position: static; width: auto; margin: 8px 0; color: #284f7a; font: 36px/1.2 var(--xs-heading); }
.xs-case h1 i { font: italic 21px Georgia, serif; }
.xs-case h2 { margin: 8px 0; font: 500 18px/1.45 var(--xs-heading); }
.xs-case p { max-width: 36em; margin: 12px 0 0; }
.xs-case small { color: #365a81; }
.xs-copy { background: #f7f8fa; }
.xs-chapter { margin-top: var(--xs-gap); }
.xs-chapter:nth-of-type(odd) .xs-copy { grid-column: 2; grid-row: 1; }
.xs-chapter:nth-of-type(odd) figure { grid-column: 1; grid-row: 1; }
.xs-copy small { font: italic 17px Georgia, serif; }
.xs-composition { position: relative; min-height: 350px; display: grid; align-items: center; }
.xs-media { margin: 0; display: grid; place-items: center; text-align: center; color: #53677b; }
.xs-media small { display: block; }
.xs-print { min-height: 170px; aspect-ratio: 1.6; padding: 6px; background: #fffdfa; border: 1px solid #e0e3e7; box-shadow: 4px 11px 23px #26344b24; transform: rotate(-3deg); }
.xs-chapter:nth-of-type(even) .xs-print { transform: rotate(3deg); }
.xs-composition .xs-print { width: 78%; background: #f4efe8; transform: rotate(-9deg); }
.xs-phone { width: min(100%, 218px); aspect-ratio: 1 / 1.98; margin-inline: auto; border: 5px solid #262728; border-radius: 28px; background: #f1efeb; box-shadow: 8px 15px 24px #26344b3c; overflow: hidden; }
.xs-composition .xs-phone { position: absolute; right: 0; width: 42%; transform: rotate(8deg); }
.xs-chapter > .xs-print { width: calc(100% - 56px); justify-self: center; }
.xs-composition { width: 88%; justify-self: center; }
.xs-composition .xs-print { margin-left: 20px; }
.xs-composition .xs-phone { right: 24px; width: 40%; }
.xs-media :is(img, video) { display: block; width: 100%; height: 100%; object-fit: contain; min-height: 0; }
.xs-cutout {
  position: relative;
  width: var(--cutout-width);
  max-width: calc(100% - 32px);
  justify-self: center;
  z-index: var(--cutout-layer);
  transform: translate(var(--cutout-x), var(--cutout-y)) rotate(var(--cutout-angle));
}
.xs-cutout img { height: auto; }
.xs-composition > .xs-cutout--sketch { justify-self: start; }
.xs-composition > .xs-cutout--editor { position: absolute; right: 12px; }
.xs-media-stack { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .66fr); align-items: end; justify-items: center; gap: 12px; grid-column: 1; grid-row: 1; }
.xs-media-stack > figure { grid-area: auto !important; }
.xs-chapter:has(> .xs-cutout--overview), .xs-chapter:has(> .xs-cutout--iteration), .xs-chapter:has(> .xs-cutout--outcome) { min-height: 200px; }
@media (max-width: 700px) {
  .xs-story { --xs-gap: 90px; padding-top: 42px; }
  .xs-hero, .xs-chapter { display: flex; flex-direction: column; align-items: stretch; gap: 28px; }
  .xs-composition { min-height: 260px; }
  .xs-thread { width: 30px; left: -22px; }
  .xs-hero { padding-bottom: 15px; }
  .xs-cutout { align-self: center; }
}

.xs-case { --xs-gap: clamp(100px, 10vw, 145px); }
.xs-story { padding-top: 42px; padding-bottom: 70px; }
.xs-hero { padding-bottom: 0; }
@media (min-width: 701px) {
  .xs-hero > .xs-composition {
    --xs-hero-media-scale: 1.3;
    transform: scale(var(--xs-hero-media-scale));
    transform-origin: right center;
  }
}
.xs-chapter--overview { margin-top: 60px; }
.xs-chapter { gap: 12%; }
.xs-chapter--overview .xs-copy,
.xs-chapter--structure .xs-copy { align-self: start; padding-top: 14px; }
.xs-chapter--shop > figure { align-self: start; margin-top: -24px; }
.xs-chapter--structure > figure { width: min(calc(100% - 40px), 350px); }
.xs-chapter--recording { grid-template-columns: .85fr 1.15fr; gap: 6%; }
.xs-chapter--recording .xs-phone { width: min(190px, 90%); }
.xs-chapter--iteration { grid-template-columns: 1fr 1fr; gap: 9%; }
.xs-research { display: grid; grid-template-columns: 1fr 1.7fr; align-items: end; gap: 8px; }
.xs-research > figure { grid-area: auto !important; max-width: 100%; }
.xs-research .xs-cutout--interaction { grid-column: 2 !important; grid-row: 1 !important; width: 96%; }
.xs-research .xs-cutout--iteration { grid-column: 1 !important; grid-row: 1 !important; margin-bottom: 28px; }
.xs-chapter--contribution { margin-top: 90px; }
.xs-chapter--outcome { margin-top: 105px; }
.xs-footer { position: relative; margin-top: 65px; }
.xs-footer button { border: 0; padding: 6px 0; background: transparent; color: #294d75; font: inherit; cursor: pointer; }
/* Spread coordinates follow the exhibition board, within the same story width. */
@media (min-width: 701px) {
  .xs-hero, .xs-chapter {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0;
    align-items: start;
  }
  .xs-hero > div:first-child { grid-column: 2 / 6; margin-top: 62px; }
  .xs-hero > .xs-composition { grid-column: 6 / 13; width: 92%; transform: none; min-height: 330px; }
  .xs-composition > .xs-cutout--sketch { width: 73%; }
  .xs-composition > .xs-cutout--editor { width: 48%; top: 0; right: 5%; }
  .xs-story > .xs-chapter > .xs-copy { grid-column: var(--text-columns); grid-row: 1; margin-top: var(--text-offset, 0px); padding-top: 0; }
  .xs-story > .xs-chapter > figure { grid-column: var(--image-columns); grid-row: 1; margin-top: var(--image-offset, 0px); }
  .xs-chapter--overview { --text-columns: 2 / 6; --image-columns: 8 / 13; --image-offset: 34px; margin-top: 58px; }
  .xs-chapter--shop { --text-columns: 7 / 12; --image-columns: 3 / 6; --text-offset: 54px; margin-top: 38px; }
  .xs-chapter--shop > figure { width: 76%; aspect-ratio: .68; transform: rotate(-7deg); }
  .xs-chapter--structure { --text-columns: 2 / 7; --image-columns: 7 / 13; --image-offset: 42px; margin-top: 78px; }
  .xs-chapter--recording { --text-columns: 6 / 11; --image-columns: 2 / 5; --text-offset: 26px; --image-offset: 53px; margin-top: 54px; }
  .xs-chapter--recording > .xs-phone { transform: rotate(-8deg); width: min(180px, 82%); }
  .xs-story > .xs-chapter--recording > .xs-cutout--iteration { grid-column: 11 / 13; width: 95%; max-width: 100%; margin-top: 91px; }
  .xs-chapter--iteration { --text-columns: 3 / 7; --image-columns: 8 / 13; --image-offset: 24px; margin-top: 63px; }
  .xs-chapter--iteration > figure { width: 90%; }
  .xs-chapter--contribution { --text-columns: 5 / 10; --image-columns: 2 / 4; --image-offset: 53px; margin-top: 45px; }
  .xs-chapter--contribution > figure { width: 78%; }
  .xs-chapter--outcome { --text-columns: 2 / 8; --image-columns: 9 / 13; --text-offset: 42px; margin-top: 61px; }
}
@media (max-width: 700px) {
  .xs-thread { width: 100%; left: 0; }
  .xs-story > section { padding-inline-start: 22px; }
  .xs-chapter { gap: 24px; margin-top: 76px; }
  .xs-chapter--shop > figure { align-self: center; margin-top: 0; }
  .xs-chapter--structure > figure { align-self: center; }
}

/* Reading panels grow in normal flow; chapter observers update the thread. */
.xs-meta { font-size: 12px; color: #53677b; }
.xs-reading-toggle { border: 0; background: transparent; padding: 12px 0 4px; color: #6689b0; font: inherit; font-size: 12px; cursor: pointer; }
.xs-reading-toggle:focus-visible { outline: 1px solid #6689b0; outline-offset: 4px; }
.xs-details { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 350ms ease, visibility 350ms; }
.xs-details > div { overflow: hidden; min-height: 0; }
.xs-details.is-open { grid-template-rows: 1fr; visibility: visible; }
.xs-details p { margin-top: 16px; }
.xs-details strong { font-weight: 500; }
@media (min-width: 701px) {
  .xs-chapter--business { --text-columns: 6 / 12; margin-top: 65px; }
}
@media (prefers-reduced-motion: reduce) { .xs-details { transition: none; } }

/* Real screenshots: adaptation stays inside the existing visual slots. */
.xs-real-phone { display: block; position: relative; width: 100%; aspect-ratio: 359 / 539; }
.xs-real-phone > svg { position: absolute; inset: 0; width: 100%; height: 100%; mask-size: 100% 100%; mask-repeat: no-repeat; }
.xs-screen-plane { width: 220px; height: 480px; box-sizing: border-box; padding: 8px; transform-origin: 0 0; background: white; display: grid; align-items: center; }
.xs-real-phone .xs-screen-plane > img { width: 100%; height: 100%; object-fit: contain; }
.xs-real-phone > img { position: relative; pointer-events: none; }
.xs-chapter--shop .xs-media > img { object-fit: contain; }
.xs-tutorial-comparison { display: flex; align-items: center; width: 100%; aspect-ratio: 529 / 415; gap: 4%; }
.xs-tutorial-comparison > img { width: 60%; height: auto; }
.xs-tutorial-comparison > button { display: block; width: 36%; cursor: zoom-in; }
.xs-tutorial-comparison > button > img { width: 100%; height: auto; }
.xs-tutorial-comparison > button:focus-visible { outline: 1px solid #6689b0; outline-offset: 4px; }

.xs-tutorial-comparison > button { border: 0; padding: 0; background: transparent; }
.xs-image-viewer { border: 0; padding: 36px 14px 14px; max-width: min(92vw, 650px); max-height: 92vh; background: #f7f8fa; }
.xs-image-viewer::backdrop { background: #24354c99; }
.xs-image-viewer > img { display: block; max-width: 100%; max-height: 82vh; width: auto; height: auto; margin: auto; }
.xs-image-viewer > button { position: absolute; top: 4px; right: 10px; padding: 0 6px; border: 0; background: transparent; color: #294d75; font: 22px system-ui; cursor: pointer; }

/* Small decorative layers occupy existing whitespace without affecting flow. */
.xs-decoration { position: absolute; display: block; height: auto; pointer-events: none; user-select: none; }
.xs-decoration--structure { width: 160px; right: 2%; top: -74px; }
.xs-decoration--business { width: 170px; left: 9%; top: 40px; }
.xs-decoration--recording { width: 140px; right: 0; top: 265px; }
@media (max-width: 900px) { .xs-decoration { display: none; } }

/* P0 product media: native UI ratios, within the existing chapter slots. */
.xs-structure-composite { position: relative; }
.xs-structure-composite .xs-structure-screen { position: absolute; height: auto; object-fit: contain; filter: drop-shadow(2px 5px 5px #26344b24); }
.xs-structure-screen--0 { width: 26% !important; left: 5%; top: 4%; transform: rotate(-4deg); }
.xs-structure-screen--1 { width: 24% !important; left: 37%; top: 12%; transform: rotate(1deg); }
.xs-structure-screen--2 { width: 26% !important; left: 68%; top: 5%; transform: rotate(4deg); }
.xs-video-phone { aspect-ratio: 496 / 1074; padding: 0; }
.xs-video-phone > video { width: 100%; height: auto; aspect-ratio: 496 / 1074; object-fit: contain; }

/* Chapter 02: preserve the layout slot, remove the oversized paper surround. */
.xs-chapter--shop > .xs-print { padding: 0; border: 0; background: transparent; box-shadow: none; position: relative; }
.xs-chapter--shop > .xs-print > img { position: absolute; width: 100%; height: auto; top: -8%; left: 0; border: 1px solid #e0e3e7; border-radius: 12px; box-shadow: 4px 12px 22px #26344b24; }

/* Chapter 03: three independent cards, within the unchanged visual slot. */
.xs-structure-composite { aspect-ratio: 1.6; min-height: 170px; padding: 0; border: 0; background: transparent; box-shadow: none; transform: none; isolation: isolate; }
.xs-structure-card { position: absolute; width: 30%; padding: 0; border: 1px solid #e0e3e7; border-radius: 9px; background: transparent; cursor: zoom-in; box-shadow: 3px 9px 14px #26344b24; transform: translateY(0) rotate(var(--card-angle)) scale(1); transition: transform 250ms cubic-bezier(.22,.61,.36,1), box-shadow 250ms ease; }
.xs-structure-card--0 { --card-angle: -7deg; left: 10%; top: 5%; z-index: 1; }
.xs-structure-card--1 { --card-angle: 0deg; width: 31%; left: 35%; top: 0; z-index: 3; }
.xs-structure-card--2 { --card-angle: 7deg; left: 60%; top: 8%; z-index: 2; }
.xs-structure-card > img { display: block; width: 100%; height: auto; border-radius: inherit; }
.xs-structure-card:focus-visible { outline: 1px solid #6689b0; outline-offset: 4px; }
.xs-structure-card:is(:hover, :focus-visible) { z-index: 5; transform: translateY(-8px) rotate(var(--card-angle)) scale(1.04); box-shadow: 5px 16px 22px #26344b38; }
@media (max-width: 700px) {
  .xs-chapter--shop > .xs-print { width: min(150px, 62%); aspect-ratio: 496 / 1074; min-height: 0; }
  .xs-chapter--shop > .xs-print > img { position: static; }
  .xs-story > .xs-chapter--structure > .xs-structure-composite { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .xs-structure-card { transition: none; }
  .xs-structure-card:is(:hover, :focus-visible) { transform: rotate(var(--card-angle)); }
}

/* Phone fit: shared media plane and intrinsic inner dimensions. */
.xs-video-phone { display: block; aspect-ratio: auto; padding: 0; border-width: 3px; border-radius: 22px; line-height: 0; background: #fff; }
.xs-video-phone > video { display: block; width: 100%; height: auto; aspect-ratio: 496 / 1074; object-fit: contain; border-radius: 19px; transform: none; }
@media (max-width: 700px) {
  .xs-chapter--recording > .xs-video-phone { width: min(190px, 75%); align-self: center; }
}

/* Final supplied compositions already include their own perspective and shadows. */
.xs-final-hero { display: block; width: 100%; height: auto; }
.xs-final-outcome { --cutout-width: 86%; --cutout-x: 0px; --cutout-y: 0px; --cutout-angle: 0deg; --cutout-layer: 1; }
.xs-final-outcome > img { width: 100%; height: auto; }
@media (min-width: 701px) {
  .xs-hero > .xs-composition--final { min-height: 370px; }
}
