/* Shared layout for case study pages (story format: hero, serif title,
   numbered rail, label + copy sections, rounded media tiles).
   Pages can override --accent and --hero-bg on :root. */
:root {
	--bg: #16130f;
	--panel: #1f1b16;
	--ink: #f3efe8;
	--muted: #a59d91;
	--faint: #6f685e;
	--line: rgba(243, 239, 232, 0.12);
	--accent: #ffb703;
	--hero-bg: #efefef;
	--tile-bg: #eef2f7;
	--serif: 'Instrument Serif', Georgia, serif;
	--sans: 'Inter', system-ui, sans-serif;
	--gutter: clamp(20px, 4vw, 56px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page, var(--bg)); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }

/* Close button, like a case opened over the home page */
.close { position: fixed; top: 20px; right: 20px; z-index: 30; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(22,19,15,0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: background .2s, transform .2s; }
.close:hover { background: rgba(22,19,15,0.85); transform: rotate(90deg); }

/* Hero */
.hero { position: relative; margin: 12px; height: min(62vh, 610px); min-height: 340px; border-radius: 22px; overflow: hidden; background: var(--hero-bg); display: grid; place-items: center; }
.hero img { width: 100%; height: 100%; object-fit: contain; padding: clamp(16px, 4vw, 64px) clamp(8px, 4vw, 72px) 0; transform: translateY(24px) scale(.98); opacity: 0; animation: heroIn 1.4s cubic-bezier(.2,.7,.2,1) .1s forwards; }
.intro h1 { margin: 0 0 22px; font-family: var(--serif); font-weight: 400; font-size: clamp(64px, 11vw, 168px); line-height: .9; letter-spacing: -0.025em; }
.hero img.cover { object-fit: cover; padding: 0; transform: scale(1.04); }
.hero.photo { place-items: stretch; }
/* Wide screens: the hero card stays full width, its content stops growing */
.hero > img:not(.cover) { max-width: 1280px; justify-self: center; object-position: center bottom; }
.hero > .yh-stage { max-width: 1240px; margin: 0 auto; }
.logo { flex: none; }
@keyframes heroIn { to { transform: none; opacity: 1; } }

/* Intro */
.intro { padding: clamp(28px, 5vw, 56px) var(--gutter) 0; max-width: 1440px; margin: 0 auto; }
.meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.meta .logo { width: 22px; height: 22px; border-radius: 5px; background: var(--accent); color: #111; font: 700 9px/22px var(--sans); text-align: center; letter-spacing: -0.02em; }
.lede { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4.4vw, 58px); line-height: 1.06; letter-spacing: -0.01em; margin: 18px 0 22px; max-width: 1100px; }
.lede em { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
/* Link to the live product site, under the tags: live dot, a shine every few seconds, arrow nudge */
.visit-wrap { margin-top: 40px; }
.visit { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 999px; background: var(--accent); color: #111; font: 600 14px/1 var(--sans); text-decoration: none; box-shadow: 0 8px 22px rgba(0,0,0,.3); animation: visitIn .7s cubic-bezier(.2,.8,.2,1) .5s backwards; transition: transform .25s cubic-bezier(.3,1.5,.5,1), box-shadow .25s ease; }
.visit::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%); transform: translateX(-120%); animation: visitShine 4s ease-in-out 1.4s infinite; pointer-events: none; }
.visit .dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #111; flex: none; }
.visit .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #111; animation: visitPing 2s cubic-bezier(0,0,.2,1) infinite; }
.visit .arr { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #111; color: var(--accent); font-size: 13px; transition: transform .25s cubic-bezier(.3,1.5,.5,1); }
.visit:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent), 0 14px 30px rgba(0,0,0,.4); }
.visit:hover .arr { transform: translate(2px,-2px) rotate(8deg); }
.visit:active { transform: translateY(0) scale(.98); }
.visit:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
@keyframes visitIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes visitShine { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
@keyframes visitPing { 75%, 100% { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .visit, .visit::after, .visit .dot::after { animation: none; } .visit::after { display: none; } .visit, .visit .arr { transition: none; } }
.tags span { font-size: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(243,239,232,0.08); color: var(--ink); }

/* Body: rail + sections */
.body { max-width: 1440px; margin: 0 auto; padding: 72px var(--gutter) 40px; display: grid; grid-template-columns: 56px 1fr; gap: 0 32px; }
.rail { position: sticky; top: 96px; align-self: start; height: calc(100vh - 192px); display: flex; flex-direction: column; justify-content: space-between; border-left: 1px solid var(--line); padding-left: 14px; }
.rail a { font: 500 11px/1 var(--sans); color: var(--faint); text-decoration: none; letter-spacing: .04em; position: relative; transition: color .3s; }
.rail a::before { content: ''; position: absolute; left: -15px; top: -6px; bottom: -6px; width: 1px; background: transparent; transition: background .3s; }
.rail a.on { color: var(--ink); }
.rail a.on::before { background: var(--accent); }

.sec { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2.4fr); gap: 0 48px; padding: 28px 0; scroll-margin-top: 80px; }
.sec h2 { margin: 0; font: 400 22px/1.3 var(--sans); color: var(--ink); }
.sec h2 small { display: block; font-size: 12px; color: var(--faint); margin-bottom: 6px; letter-spacing: .04em; }
.copy p { margin: 0 0 14px; font-size: 17px; line-height: 1.6; color: var(--muted); max-width: 760px; }
.copy p strong { color: var(--ink); font-weight: 500; }

.stats { display: flex; flex-wrap: wrap; gap: 20px 56px; margin-top: 26px; }
.stats div b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 5vw, 64px); line-height: 1; color: var(--ink); }
.stats div span { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }

/* Figures */
.fig { grid-column: 2; margin: 12px 0 44px; display: grid; gap: 16px; }
.fig.two { grid-template-columns: 1fr 1fr; }
.fig.wide-narrow { grid-template-columns: 1.55fr 1fr; }
.fig.narrow-wide { grid-template-columns: 1fr 1.55fr; }
.fig.three { grid-template-columns: repeat(3, 1fr); }
.fig.four { grid-template-columns: repeat(4, 1fr); }
.fig.five { grid-template-columns: repeat(5, 1fr); gap: 12px; }
.fig.five .tile { border-radius: 14px; }
.tile { border-radius: 18px; overflow: hidden; background: var(--panel); position: relative; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile.pad { padding: clamp(16px, 3vw, 40px); display: grid; place-items: center; }
.tile.pad img, .tile.pad video { height: auto; object-fit: contain; border-radius: 6px; }
.tile.soft { background: var(--tile-bg); }
.fig.two > .tile, .fig.wide-narrow > .tile, .fig.narrow-wide > .tile, .fig.three > .tile { aspect-ratio: var(--ar, 4 / 3); }
.fig.wide-narrow > .tile, .fig.narrow-wide > .tile { aspect-ratio: auto; min-height: 0; }
.fig.wide-narrow, .fig.narrow-wide { grid-template-rows: clamp(280px, 36vw, 560px); grid-auto-rows: auto; }
.tile.pad img, .tile.pad video { max-height: 100%; }
.tile.contain img, .tile.contain video { object-fit: contain; }
.tile.flush img { height: auto; }
.tile[data-zoom] { cursor: zoom-in; }
.fig > .cap { grid-column: 1 / -1; margin-top: -4px; }
.tile.paper { background: #e9e4da; }
.tile.sun { background: #f3c64a; }
.cap { margin-top: 10px; font-size: 12px; color: var(--faint); }

/* Reveal: media sits dim until it scrolls in */
.rv { opacity: 0; transform: translateY(28px); transition: opacity 1s ease, transform 1s cubic-bezier(.2,.7,.2,1); }
.rv.in { opacity: 1; transform: none; }

/* Golden path */
.steps { list-style: none; margin: 18px 0 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 44px 1fr; padding: 18px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(s, decimal-leading-zero); font-size: 12px; color: var(--faint); padding-top: 6px; }
.steps h3 { margin: 0 0 6px; font: 400 20px/1.4 var(--sans); color: var(--ink); }
.steps p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }

/* The 12-column grid, drawn */
.grid12 { background: var(--panel); border-radius: 18px; padding: clamp(18px, 3vw, 36px); }
.grid12 .cols { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.grid12 .cols i { height: 6px; border-radius: 3px; background: rgba(243,239,232,0.1); }
.grid12 .mods { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin-top: 10px; }
.mod { border-radius: 10px; padding: 12px; font-size: 12px; color: var(--ink); background: rgba(243,239,232,0.07); min-height: 64px; display: flex; align-items: flex-end; opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .6s ease; }
.in .mod { opacity: 1; transform: none; }
.mod.w { background: var(--accent); color: #1a1406; font-weight: 600; min-height: 110px; }
.mod.ad { background: transparent; border: 1px dashed rgba(243,239,232,0.25); color: var(--faint); }
.s12 { grid-column: span 12; } .s8 { grid-column: span 8; } .s4 { grid-column: span 4; } .s6 { grid-column: span 6; } .s3 { grid-column: span 3; }

/* Next */
.next { max-width: 1440px; margin: 40px auto 0; padding: 48px var(--gutter) 72px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.next a { text-decoration: none; }
.next small { display: block; font-size: 12px; color: var(--faint); margin-bottom: 8px; }
.next span { font-family: var(--serif); font-size: clamp(40px, 6vw, 80px); line-height: 1; transition: color .3s; }
.next a:hover span { color: var(--accent); }
.next .home { font-size: 13px; color: var(--muted); }


/* Phone screenshots in a device frame, with a caption under them */
.tile.ph { aspect-ratio: auto !important; padding: clamp(18px, 2.4vw, 28px) clamp(14px, 2vw, 24px) 20px; display: flex; flex-direction: column; gap: 16px; }
.tile.ph.dark { background: var(--panel); }
.phone { aspect-ratio: 644 / 1400; width: min(100%, 250px); margin: 0 auto; padding: 6px; border-radius: 32px; background: #0d0d0f; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 24px 44px rgba(0,0,0,.35); }
.phone img, .phone video { width: 100%; height: 100%; object-fit: cover; border-radius: 26px; }
.tcap b { display: block; font-size: 14px; font-weight: 500; color: var(--ink); }
.tcap span { display: block; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.tile.light .tcap b { color: #16130f; } .tile.light .tcap span { color: #5f5a52; }
/* A row of small items, like clock faces */
.chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; padding: clamp(18px, 3vw, 32px); }
.chips figure { margin: 0; display: grid; justify-items: center; gap: 10px; padding: 16px 8px 12px; border-radius: 16px; background: rgba(243,239,232,.06); }
.chips img { width: 100%; max-width: 110px; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0,0,0,.35)); }
.chips figcaption { font-size: 12px; color: var(--muted); text-align: center; }

/* Pull quote and simple lists inside copy */
.copy blockquote { margin: 6px 0 18px; padding-left: 18px; border-left: 2px solid var(--accent); font-family: var(--serif); font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; color: var(--ink); }
.copy ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 760px; }
.copy ul li { margin-bottom: 6px; }
.copy ul li strong { color: var(--ink); font-weight: 500; }

/* Lightbox */
/* Image viewer: previous / next, a counter, and click-to-zoom with panning */
.lb { position: fixed; inset: 0; z-index: 50; background: rgba(10,9,7,.92); display: none; place-items: center; padding: 56px 84px; cursor: zoom-out; }
.lb.on { display: grid; animation: lbFade .2s ease; }
.lb-stage { display: grid; place-items: center; max-width: 100%; animation: lbIn .3s cubic-bezier(.2,.8,.2,1); }
.lb-stage.from-right { animation-name: lbFromRight; }
.lb-stage.from-left { animation-name: lbFromLeft; }
/* The viewer pads 56px top and bottom; size against the window, since % heights don't resolve inside the grid */
.lb-scroll { max-height: calc(100vh - 112px); max-height: calc(100dvh - 112px); overflow-y: auto; border-radius: 12px; cursor: default; }
.lb-scroll img { width: min(1100px, 92vw); max-height: none !important; border-radius: 0 !important; }
.lb img, .lb video { max-width: min(1400px, 100%); max-height: calc(100vh - 112px); max-height: calc(100dvh - 112px); object-fit: contain; border-radius: 10px; }
.lb .lb-img { cursor: zoom-in; }
.lb-pan { position: fixed; inset: 0; z-index: 1; display: flex; overflow: auto; cursor: zoom-out; overscroll-behavior: contain; }
.lb-pan img { display: block; flex: none; margin: auto; max-width: none !important; max-height: none !important; border-radius: 0 !important; }
.lb-nav, .lb-x { position: fixed; z-index: 2; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; font: 400 30px/1 var(--sans); cursor: pointer; transition: background .2s, transform .2s cubic-bezier(.3,1.5,.5,1), opacity .2s; }
.lb-nav { top: 50%; width: 52px; height: 52px; margin-top: -26px; padding-bottom: 3px; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-x { top: 20px; right: 20px; width: 44px; height: 44px; font-size: 16px; }
.lb-nav:hover, .lb-x:hover { background: rgba(255,255,255,.22); }
.lb-prev:hover { transform: translateX(-3px); }
.lb-next:hover { transform: translateX(3px); }
.lb-nav:focus-visible, .lb-x:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.lb-count { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.4); color: rgba(255,255,255,.8); font: 500 12px/1 var(--sans); letter-spacing: .08em; pointer-events: none; }
.lb.zoomed .lb-nav, .lb.zoomed .lb-count { opacity: 0; pointer-events: none; }
@keyframes lbFade { from { opacity: 0; } }
@keyframes lbIn { from { opacity: 0; transform: scale(.97); } }
@keyframes lbFromRight { from { opacity: 0; transform: translateX(40px); } }
@keyframes lbFromLeft { from { opacity: 0; transform: translateX(-40px); } }
@media (max-width: 700px) { .lb { padding: 64px 12px 72px; } .lb img, .lb-scroll { max-height: calc(100vh - 136px); max-height: calc(100dvh - 136px); } .lb-nav { top: auto; bottom: 12px; margin-top: 0; width: 44px; height: 44px; font-size: 26px; } .lb-prev { left: 12px; } .lb-next { right: 12px; } .lb-count { bottom: 26px; } }
@media (prefers-reduced-motion: reduce) { .lb.on, .lb-stage { animation: none; } .lb-nav, .lb-x { transition: none; } }


/* Hero melts into the page color as it scrolls away */
.hero::after { content: ''; position: absolute; inset: 0; background: var(--tint, var(--bg)); opacity: var(--dim, 0); pointer-events: none; border-radius: inherit; }

/* Mini-map: a tiny copy of the page on the right edge */
.mm { position: fixed; right: 18px; top: 50%; transform: translate(12px, -50%); z-index: 20; width: 46px; border-radius: 7px; background: var(--page, var(--bg)); outline: 1px solid rgba(243,239,232,.22); cursor: pointer; touch-action: none; user-select: none; opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s cubic-bezier(.2,.7,.2,1); }
.mm.show { opacity: 1; pointer-events: auto; transform: translate(0, -50%); }
.mm-map { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.mm-map span { position: absolute; display: block; }
.mm-map .tx { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.mm-map .tx b { width: 30%; height: 1.5px; flex: none; background: var(--ink); }
.mm-map .tx em { margin-left: 38%; height: 1px; flex: none; background: rgba(243,239,232,.45); }
.mm-map .tx b + em { margin-top: -3.5px; }
.mm-win { position: absolute; left: 0; right: 0; top: 0; border-radius: 4px; outline: 1px solid rgba(243,239,232,.9); outline-offset: -1px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); pointer-events: none; }
.mm-tip { position: absolute; right: calc(100% + 12px); transform: translateY(-50%); white-space: nowrap; font: 500 11px/1 var(--sans); letter-spacing: .02em; color: var(--ink); background: rgba(22,19,15,.85); border: 1px solid var(--line); padding: 6px 9px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.mm:hover .mm-tip { opacity: 1; }
@media (min-width: 901px) {
	.has-mm .body { padding-right: max(var(--gutter), calc(92px - (100vw - 1440px) / 2)); }
}
@media (max-width: 900px), (hover: none) { .mm { display: none; } }

@media (max-width: 900px) {
	.body { grid-template-columns: 1fr; padding-top: 48px; }
	.rail { display: none; }
	.sec { grid-template-columns: 1fr; gap: 14px; padding: 22px 0; }
	.fig { grid-column: 1; margin-bottom: 32px; }
	.fig.two, .fig.wide-narrow, .fig.narrow-wide { grid-template-columns: 1fr; }
	.fig.wide-narrow, .fig.narrow-wide { grid-template-rows: none; }
	.fig.wide-narrow > .tile, .fig.narrow-wide > .tile { aspect-ratio: 4 / 3; }
	.fig.three, .fig.four { grid-template-columns: 1fr 1fr; }
	.fig.three > .tile.ph:last-child:nth-child(odd) { grid-column: 1 / -1; }
	.chips { grid-template-columns: repeat(3, 1fr); }
	.phone { width: min(100%, 200px); }
	.fig.five { grid-template-columns: repeat(5, 72%); overflow-x: auto; scroll-snap-type: x mandatory; margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
	.fig.five .tile { scroll-snap-align: start; }
	.hero { height: auto; min-height: 0; aspect-ratio: 4 / 3; margin: 8px; border-radius: 16px; }
	.hero img { padding: 12px 4px 0; }
	.mod { font-size: 11px; padding: 8px; min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
	.rv, .mod { transition: none; opacity: 1; transform: none; }
	.hero img { animation: none; transform: none; opacity: 1; }
}
	
