/* neo case-study pages. Load after neo-home.css, which holds the shared type, colors,
   lists, cards, footer, "Read more..." pill and the page-load reveal. */
html { scroll-padding-top: 24px; }
/* A little more air than the home page: 18px lines for UI text, 20px for reading text */
body { line-height: 18px; }
/* Section links scroll with the page script (a little quicker than the browser's own smooth scroll) */
.sec__title[tabindex="-1"]:focus { outline: none; }

/* Top row: case study title + Back */
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); transition: color .2s ease; }
.back:hover, .back:focus-visible { color: var(--ink); }

/* Cover, then the one-line description and year */
.cs-hero { margin-top: 32px; aspect-ratio: 16 / 9; background: var(--tile); border-radius: 16px; overflow: hidden; }
.cs-hero img, .cs-hero video { display: block; width: 100%; height: 100%; object-fit: cover; }  /* the Amazon cover is a looping video */
.cs-sub { margin-top: 10px; }
.cs-desc { min-width: 0; color: var(--muted); }

/* Details | Contents */
.details li { align-items: baseline; }
.details .key { flex: none; color: var(--muted); }
.details .val { text-align: right; text-wrap: balance; }
.contents .arrow { transform: rotate(90deg); }
.contents .sup { margin-right: 5px; }

/* Sections */
.sec { margin-top: 72px; }
.fig, .gal__item { margin: 0; }  /* before the spacing rules below, so they win */
.sec__head { display: flex; justify-content: space-between; align-items: baseline; padding-top: 16px; border-top: 1px solid var(--rule); }
.sec__title { margin: 0; font-size: 13px; line-height: 18px; font-weight: 400; }
.sec > * + * { margin-top: 32px; }
.sec > .sec__head + * { margin-top: 28px; }
.sec > .prose + :not(.prose), .sec > :not(.prose, .sec__head) + .prose { margin-top: 44px; }
/* A heading that labels the figure right below it sits close to it */
.sec > .prose:has(> h4:last-child) + * { margin-top: 12px; }
.sec > .prose:has(> h3:last-child) + * { margin-top: 16px; }

.prose p, .prose li, .prose h4 { line-height: 20px; }
.prose h3 { margin: 0 0 12px; font-size: 20px; line-height: 26px; font-weight: 400; letter-spacing: -0.02em; }
.prose * + h3 { margin-top: 56px; }
.prose h4 { margin: 36px 0 8px; font-size: 13px; font-weight: 400; }
.prose > :first-child { margin-top: 0; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 16px; }
.prose ul { counter-reset: b; }
.prose li { position: relative; padding-left: 14px; counter-increment: b; }
.prose li + li { margin-top: 12px; }
.prose li::before { content: counter(b); position: absolute; left: 0; top: 0; font-family: var(--mono); font-size: 9px; line-height: 16px; letter-spacing: 0; color: var(--muted); }
.prose strong { font-weight: 500; }
/* Problem statements: the h3 size, on a rule in the project color */
.prose blockquote { margin: 24px 0 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--c, var(--ink)); }
.prose blockquote p { font-size: 20px; line-height: 26px; letter-spacing: -0.02em; text-wrap: pretty; }
.prose blockquote + * { margin-top: 24px; }

/* Figures sit on the same gray tile as the home thumbnails; click to enlarge */
.fig__zoom, .fig__tile { display: block; width: 100%; padding: 16px; background: var(--tile); border-radius: 16px; overflow: hidden; }
.fig__zoom { cursor: zoom-in; }
.fig__zoom img, .fig__tile img { width: 100%; height: auto; }
.fig__zoom img { transition: transform .8s var(--ease); }
.fig__zoom:hover img { transform: scale(1.015); }
.fig__cap { margin-top: 8px; color: var(--muted); }
/* Prototypes: tall (phone) 4:5, wide (desktop) 16:10; videos 16:9 */
.embed { position: relative; aspect-ratio: 4 / 5; background: var(--tile); border-radius: 16px; overflow: hidden; }
.embed--wide { aspect-ratio: 16 / 10; }
.embed--video { aspect-ratio: 16 / 9; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Galleries: smaller tiles, all the shape of the gallery's tallest image so rows line up */
.gal { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 24px 16px; }
.gal--pairs { gap: 16px; }
.gal--screens { --cols: 4; }
.gal--trio { --cols: 3; gap: 16px; }
.gal .fig__zoom, .gal .fig__tile { padding: 10px; border-radius: 12px; }
.gal__frame { display: flex; align-items: center; justify-content: center; aspect-ratio: var(--ar); }
.gal__frame img { width: auto; max-width: 100%; max-height: 100%; }
.gal figcaption { margin-top: 8px; }
.gal__title, .gal__cap { display: block; }
.gal__cap { margin-top: 2px; color: var(--muted); }

/* Screen + text side by side, the screen switching sides each time */
.split { display: grid; grid-template-columns: 208px minmax(0, 1fr); column-gap: 32px; align-items: center; }
.split--flip { grid-template-columns: minmax(0, 1fr) 208px; }
.split--flip .split__media { order: 2; }
.sec > .split + .split { margin-top: 40px; }

/* Logo, name, what it's for (the apps Juni instructors juggle) */
.tools { display: grid; row-gap: 12px; }
.tools li { display: grid; grid-template-columns: 24px auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.tools img { border-radius: 6px; }
.tools__use { color: var(--muted); text-align: right; }

/* More case studies */
.next { margin-top: 72px; }
.next__head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 6px; margin-bottom: 16px; }
.next__all { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); transition: color .2s ease; }
.next__all:hover, .next__all:focus-visible { color: var(--ink); }

/* Section navigator (markup and behavior in the page script). Wide screens: a sidebar on the left,
   after emmiwu.com, shown while you read the sections. Narrow screens: a floating bar at the top, in the
   same white + gray-border style as the "Read more..." pill, that scrolls sideways. */
.toc { position: fixed; z-index: 40; visibility: hidden; }
.toc ul { position: relative; }
.toc a { display: block; color: var(--muted); white-space: nowrap; transition: color .2s ease; }
.toc a:hover, .toc a:focus-visible, .toc a[aria-current] { color: var(--ink); }
.toc .sup { margin-right: 5px; }
.toc__mark { position: absolute; left: 0; top: 0; width: 6px; height: 6px; background: var(--c, var(--ink)); pointer-events: none; transition: opacity .25s ease; }
.toc__mark.is-ready { transition: opacity .25s ease, transform .6s var(--spring); }
.toc .toc__top { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; padding-left: 14px; line-height: 16px; }

@media (min-width: 1100px) {
  .toc { left: 24px; top: 84px; transition: visibility 0s .3s; }
  .toc.is-on { visibility: visible; transition: none; }
  .toc a { padding-left: 14px; line-height: 22px; }
  .toc li:not(.toc__mark), .toc .toc__top { opacity: 0; filter: blur(8px); transform: translateY(12px);
    transition: opacity .25s ease, filter .25s ease, transform 0s .3s; }
  .toc.is-on li:not(.toc__mark), .toc.is-on .toc__top { opacity: 1; filter: none; transform: none;
    transition: opacity .5s ease, filter .5s ease, transform 1.1s var(--spring); transition-delay: calc(var(--i, 6) * 40ms); }
  .toc__mark { opacity: 0; }
  .toc.is-on .toc__mark { opacity: 1; }
}
@media (max-width: 1099px) {
  html { scroll-padding-top: 64px; }
  .toc { top: 12px; left: 16px; right: 16px; background: #fff; border: 1px solid #f2f2f2; border-radius: 8px; overflow: hidden; box-shadow: var(--lift);
    /* hiding: a fast exit that leaves at full speed, 220ms (it goes 40px past the edge so the shadow clears too) */
    transform: translateY(calc(-100% - 40px)); transition: transform .22s cubic-bezier(.2, .8, .3, 1), visibility 0s .22s; }
  .toc.is-on { visibility: visible; transform: none; transition: transform .8s var(--spring), visibility 0s; }
  .toc ul { display: flex; gap: 18px; padding: 0 14px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent); }
  .toc ul::-webkit-scrollbar { display: none; }
  .toc li:not(.toc__mark) { flex: none; }
  .toc a { padding-left: 12px; line-height: 34px; }
  .toc .toc__top { display: none; }
}

/* Lightbox: the figure grows out of its place on the page with the same spring */
.lb { position: fixed; inset: 0; z-index: 60; cursor: zoom-out; }
.lb__bg { position: fixed; inset: 0; background: #fff; opacity: 0; }
.lb[hidden] { display: none; }
.lb__img { position: fixed; left: 0; top: 0; transform-origin: 0 0; max-width: none; }
.lb__close { position: fixed; top: 16px; right: 20px; z-index: 61; color: var(--muted); opacity: 0; transition: color .2s ease; }
.lb__close:hover, .lb__close:focus-visible { color: var(--ink); }
html.lb-open { overflow: hidden; }

/* Scroll reveal: the page-load reveal again, once per block as it comes into view (JS only) */
.js .reveal:not(.in) { opacity: 0; }
.reveal.in { animation: appear 1.1s var(--spring) backwards; animation-delay: var(--d, 0ms); }
@media (prefers-reduced-motion: reduce) {
  .toc, .toc.is-on, .toc li, .toc.is-on li, .toc__top, .toc.is-on .toc__top, .toc__mark.is-ready { transition: none !important; filter: none !important; }
  .js .reveal:not(.in) { opacity: 1; }
  .reveal.in { animation: none; }
  .fig__zoom img { transition: none; }
}

@media (max-width: 600px) {
  .cs-hero { margin-top: 24px; }
  .sec { margin-top: 64px; }
  .sec > .prose + :not(.prose), .sec > :not(.prose, .sec__head) + .prose { margin-top: 36px; }
  .fig__zoom, .fig__tile { padding: 10px; }
  .gal--pairs, .gal--trio { --cols: 1; }
  .gal--screens { --cols: 2; }
  .split, .split--flip { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
  .split--flip .split__media { order: 0; }
  .split .fig__zoom img, .split .fig__tile img { width: 56%; margin: 0 auto; }
  .sec > .split + .split { margin-top: 48px; }
  .next { margin-top: 56px; }
}

/* About page: the photo fills its tile, and the contact links take one column's width */
.fig__zoom--photo { padding: 0; }
.say { max-width: 96px; }  /* same as the contact column on the home page */
/* Paragraph | the home page's middle divider | photo or links */
.duo { display: grid; grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr); column-gap: 40px; align-items: center; }
@media (max-width: 600px) {
  .duo { grid-template-columns: minmax(0, 1fr); row-gap: 24px; }
  .duo .lists__divider { display: none; }
  .duo--say { row-gap: 16px; }
}

/* Links inside the words and captions */
.prose a, .fig__cap a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; transition: color .2s ease; }
.prose a:hover, .fig__cap a:hover { color: var(--ink); }

/* Treet page: the Rive hero as a looping video, and the list of live sites (name | brand, arrow) */
.fig__tile video { display: block; width: 100%; height: auto; }
.sites .sites__meta { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
