/* Design case studies (christophernagel.com/work/...).
   Loads after /assets/case-study.css and only applies inside <body class="work">.

   Text roles
     body     EB Garamond 19px, #1a1a1a
     meta     Jost 13px uppercase, #666   (labels: facts, stats, shot labels, quote source)
     caption  EB Garamond 15px, #666      (hero and figure captions)
   Figure sizes: column (screenshots) and wide (diagrams); captions always sit in the text column. */

.work { --ink: #1a1a1a; --muted: #666; --rule: #d6d6d2; --panel: #f6f6f3; --accent: #2f6f6f; }

/* Measure: ~600px of text at 19px (about 70-75 characters per line) */
.work .wrapper { max-width: 620px; }
.work p, .work li { font-size: 19px; line-height: 1.55; }
.work h1 { font-size: 36px; line-height: 1.2; margin-bottom: .25em; }
.work h2 { font-size: 27px; margin: 2.4em 0 .55em; }
.work figure + h2, .work .stats + h2, .work .end-nav { margin-top: 2em; }

/* Text roles */
.work .meta-label, .work .facts dt, .work .stat-label, .work .shot-label, .work .quotes figcaption {
  font-family: "Jost", sans-serif; font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.work .caption, .work figcaption, .work .hero-caption {
  font-family: "EB Garamond", Georgia, serif; font-size: 15px; line-height: 1.45; color: var(--muted); font-style: normal; letter-spacing: .01em;
}
.work .lede { font-size: 20px; margin: 0 0 1.4em; }

/* Hero */
/* The hero spans 100vw, which on desktop includes the scrollbar; clip those few pixels so the page never scrolls sideways. */
body.work { overflow-x: clip; }
.work .header-image { border-top: 0; border-bottom: 0; }
.work .header-image picture { display: block; width: 100%; height: 100%; }
.work .header-image img { object-position: center center; }
.work .hero-caption { margin: -1.4rem 0 2.4rem; }
.work .hero-caption a { color: inherit; }
.work .hero-caption .credit { white-space: nowrap; }

/* Facts */
.work .facts { display: grid; grid-template-columns: 6.25rem 1fr; gap: .5em 1.25em; margin: 0 0 .5em; }
.work .facts dt { padding-top: .35em; }
.work .facts dd { margin: 0; font-family: "EB Garamond", Georgia, serif; font-size: 18px; line-height: 1.45; }

/* Links in running text and facts: ink, with a quiet underline */
.work p a, .work li a, .work .facts a { color: var(--ink); text-decoration: underline; text-decoration-color: #9a9a96; text-underline-offset: 2px; }
.work p a:hover, .work li a:hover, .work .facts a:hover { color: #527979; }

/* Lists: bold lead-ins everywhere */
.work ul { padding-left: 1.2em; }
.work li { margin: .45em 0; }
.work li strong { font-weight: 600; }

/* Stats */
.work .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin: 1.6em 0 1.8em; padding: 1.1em 0; border-top: .5px solid var(--rule); border-bottom: .5px solid var(--rule); }
.work .stat-num { display: block; font-family: "EB Garamond", Georgia, serif; font-size: 34px; line-height: 1.1; color: var(--ink); }
.work .stat-label { display: block; margin-top: .45em; text-transform: none; letter-spacing: .01em; font-size: 14px; line-height: 1.35; }

/* Quotes */
.work .quotes { margin: 1.8em 0; padding-left: 1.1em; border-left: 1px solid #9a9a96; }
.work .quotes blockquote { margin: 0 0 .6em; padding: 0; border: 0; font-family: "EB Garamond", Georgia, serif; font-size: 20px; line-height: 1.45; font-style: italic; }
.work .quotes figcaption { margin-top: .4em; }

/* Figures */
.work figure { margin: 2.2em 0; }
.work figure img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.work figure video { display: block; width: 100%; height: auto; border: 1px solid var(--rule); background: #05090a; }
.work figcaption { margin-top: .7em; }
.work .figure-media.wide { width: min(1060px, 94vw); margin-left: calc(50% - min(530px, 47vw)); }
.work .figure-media.panel { background: var(--panel); padding: clamp(16px, 3.2vw, 40px); }
.work .figure-media svg { display: block; width: 100%; height: auto; }
.work .diagram-mobile { display: none; }
.work .shot + .shot { margin-top: 1.1em; }
.work .shot-label { display: block; margin-bottom: .45em; }

/* Side figure: sits in the right margin beside the text on wide screens; inline (and capped) elsewhere */
.work .side-figure { max-width: 360px; margin: 1.2em 0 1.6em; }
.work .side-figure img { border: 0; }
@media (min-width: 1260px) {
  .work .side-figure { float: right; clear: right; width: 260px; max-width: none; margin: .35em -300px 1em 0; }
}

/* Carousel: stacked slides that crossfade, with a timed tab for each slide and a pause/play toggle.
   Markup: figure.carousel[data-interval] > .figure-media > .carousel-viewport > .carousel-slide (one .is-active)
           + .carousel-controls > button.carousel-toggle + .carousel-tabs > button.carousel-tab (label + .carousel-bar > .carousel-fill) */
.work .carousel-viewport { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--rule); background: #1a1a1a; }
.work .carousel-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease; }
.work .carousel-slide.is-active { opacity: 1; }
.work .carousel-slide img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.work .carousel-controls { display: flex; align-items: center; gap: 1rem; margin-top: .8em; }
.work .carousel-toggle { flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer; }
.work .carousel-toggle:hover { border-color: #9a9a96; }
.work .carousel-toggle svg { width: 12px; height: 12px; fill: currentColor; }
.work .carousel-toggle .icon-play { display: none; }
.work .carousel.is-paused .carousel-toggle .icon-play { display: block; }
.work .carousel.is-paused .carousel-toggle .icon-pause { display: none; }
.work .carousel-tabs { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .9rem; }
.work .carousel-tab { display: flex; flex-direction: column; gap: .45em; padding: .35em 0; border: 0; background: none; cursor: pointer; text-align: left;
  font-family: "Jost", sans-serif; font-size: 13px; font-weight: 500; letter-spacing: .06em; color: var(--muted); }
.work .carousel-tab:hover { color: var(--ink); }
.work .carousel-tab.is-active { color: var(--ink); }
.work .carousel-bar { position: relative; display: block; height: 2px; background: var(--rule); overflow: hidden; }
.work .carousel-fill { position: absolute; inset: 0; background: var(--ink); transform: scaleX(0); transform-origin: left center; }
.work .carousel-tab.is-done .carousel-fill { transform: scaleX(1); background: #9a9a96; }
.work .carousel-toggle:focus-visible, .work .carousel-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .work .carousel-slide { transition: none; } }
.work .carousel:not(.is-ready) .carousel-controls { display: none; }
/* Video player controls (video.loop-video[data-player]): the carousel toggle and bar, reused.
   Built by work.js below the video: .video-controls > button.carousel-toggle + .video-track (.carousel-bar > .carousel-fill) + .video-time */
.work .video-controls { display: flex; align-items: center; gap: 1rem; margin-top: .8em; }
.work .video-player.is-paused .carousel-toggle .icon-play { display: block; }
.work .video-player.is-paused .carousel-toggle .icon-pause { display: none; }
.work .video-track { flex: 1; padding: 11px 0; cursor: pointer; touch-action: none; }
.work .video-track .carousel-bar { transition: height .15s ease; }
.work .video-track:hover .carousel-bar, .work .video-track:focus-visible .carousel-bar, .work .video-track.is-dragging .carousel-bar { height: 4px; }
.work .video-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.work .video-time { flex: none; min-width: 5.6em; text-align: right; font-family: "Jost", sans-serif; font-size: 13px; letter-spacing: .04em; color: var(--muted); font-variant-numeric: tabular-nums; }
.work .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* End of page */
.work .end-nav { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.1em; border-top: .5px solid var(--ink); }
.work .end-nav a { font-family: "EB Garamond", Georgia, serif; font-size: 18px; color: var(--ink); text-decoration: none; }
.work .end-nav a:hover { color: #527979; }

@media (max-width: 600px) {
  .work p, .work li { font-size: 18px; }
  .work h1 { font-size: 30px; }
  .work .lede { font-size: 19px; }
  .work .facts { grid-template-columns: 1fr; gap: 0; }
  .work .facts dd { margin-bottom: .7em; }
  .work .stats { grid-template-columns: 1fr; gap: .9rem; }
  .work .figure-media.wide { width: auto; margin-left: 0; }
  .work .diagram-desktop { display: none; }
  .work .diagram-mobile { display: block; }
  .work .end-nav { flex-direction: column; }
}

/* Photo grid: figure > .figure-media.wide > .photo-grid > .photo (picture + .photo-label). Three across, two on phones.
   Images keep their own aspect ratio; set grid-template-columns inline to pair different ratios at equal height. */
.work .photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.work .photo-grid.two { grid-template-columns: repeat(2, 1fr); }
.work .photo-grid .photo { margin: 0; min-width: 0; }
.work .photo-grid img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.work .photo-label { display: block; margin-top: .5em; font-family: "Jost", sans-serif; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); line-height: 1.35; }
@media (max-width: 600px) { .work .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .work .photo-grid.two { grid-template-columns: 1fr !important; } }
