/* ==========================================================================
   samisee.design, CASE STUDIES (a folio tab) and the LIGHTBOX.
   Logic: js/case.js, js/lightbox.js. Every colour is a look token, so night,
   sunset and day all hold. Section labels are DM Mono caps in the accent,
   like read_me's headings; display type is Syne; reading text is the body face.
   ========================================================================== */

.case { padding: 0; }
.case h4 { margin: 0 0 12px; font: 500 var(--text-caption)/1.2 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--os-accent); }
.case h4 span { margin-left: 8px; letter-spacing: var(--track-label); text-transform: none; color: var(--os-ink-dim); }

/* ---- the header stays while the view scrolls under it ---- */
.case__top {
  position: sticky; top: 0; z-index: 3; padding: 20px 28px 14px;
  background: color-mix(in srgb, var(--window-fill) 92%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--os-border);
}
.case__title { display: flex; align-items: baseline; gap: 12px; }
.case__title b { font: 500 var(--text-caption)/1 var(--font-mono); color: var(--os-accent); }
.case__title h3 { margin: 0; font: var(--weight-display) var(--text-display)/1 var(--font-display); letter-spacing: -.01em; }
.case__desc { margin: 8px 0 14px; max-width: 62ch; max-height: 4.5em; overflow: hidden; font: 400 var(--text-lead)/1.5 var(--font-body); color: color-mix(in srgb, var(--os-ink) 78%, transparent); transition: max-height .35s var(--ease-enter), margin .35s var(--ease-enter), opacity .25s; }
/* scrolled: the descriptor folds away, so the view gets the room */
.case.is-tucked .case__top { padding-top: 14px; padding-bottom: 10px; }
.case.is-tucked .case__desc { max-height: 0; margin: 4px 0 8px; opacity: 0; }
.case__top { transition: padding .35s var(--ease-enter); }
.case__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.case__pills { margin: 0; font: 400 var(--text-caption)/1.4 var(--font-mono); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--os-ink-dim); }

/* the segmented switch: story · system · gallery */
.seg { display: inline-flex; gap: 2px; padding: 3px; --lg-r: 999px; }
.seg button { padding: 7px 16px; border-radius: 999px; font: 500 var(--text-body)/1 var(--font-mono); color: var(--os-ink-dim); transition: color .2s, background .2s; }
.seg button:hover { color: var(--os-ink); }
.seg button[aria-selected="true"] { color: var(--os-ink); background: var(--os-accent-wash); box-shadow: inset 0 0 0 1px var(--os-accent-line); }

.case__view { padding: 22px 28px 36px; animation: case-in .35s var(--ease-enter); }
@keyframes case-in { from { opacity: 0; translate: 0 6px; } }

/* ---- click-to-play video: a blurred still, a glass play button, a label ---- */
.vid { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px; background: var(--os-inset); box-shadow: inset 0 0 0 1px var(--glass-edge); cursor: pointer; }
.vid__still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; scale: 1.08; filter: blur(6px) saturate(1.1) brightness(.8); transition: filter .4s, scale .6s var(--ease-enter); pointer-events: none; }
.vid:hover .vid__still, .vid:focus-visible .vid__still { filter: blur(3px) saturate(1.15) brightness(.9); scale: 1.04; }
.play { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; pointer-events: none; }
.play__btn { width: 66px; height: 66px; display: grid; place-items: center; --lg-r: 50%; color: var(--os-accent); transition: scale .3s cubic-bezier(.3, 1.5, .5, 1); }
.play__btn svg { width: 26px; height: 26px; margin-left: 3px; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--os-accent) 60%, transparent)); }
.vid:hover .play__btn { scale: 1.08; }
.play__label { padding: 6px 12px; border-radius: 999px; font: 500 var(--text-caption)/1 var(--font-mono); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--os-ink); background: var(--os-glass); box-shadow: inset 0 0 0 1px var(--glass-edge); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.vid--tile { border-radius: 10px; }
.vid--tile .play__btn { width: 46px; height: 46px; }
.vid--tile .play__btn svg { width: 18px; height: 18px; }
/* the reel fits the visible part of the window (--view-h, set in case.js), whatever its shape */
.vid--hero { width: min(100%, calc(var(--view-h, 60vh) * 16 / 9)); margin: 0 auto; }
.vid--playing { display: block; width: auto; max-width: 100%; min-width: min(100%, 480px); max-height: var(--view-h, 60vh); margin: 0 auto; border-radius: 16px; background: #000; }
.case__img { position: relative; }

/* ---- story ---- */
.case__view .case__stats { margin: 16px 0 24px; }
.case__pull { margin: 0 0 14px; padding-left: 16px; border-left: 2px solid var(--os-accent); font: var(--weight-display) var(--text-subhead)/1.4 var(--font-display); color: var(--os-ink); }
.case__p { max-width: 66ch; margin: 0 0 12px; font: 400 var(--text-lead)/1.7 var(--font-body); color: color-mix(in srgb, var(--os-ink) 84%, transparent); }
.case__standout { margin: 28px 0; }
/* the standout piece is seen whole: never taller than the visible window */
.case__standout .case__img { width: fit-content; max-width: 100%; margin: 0 auto; }
.case__standout .case__img img { width: auto; max-width: 100%; max-height: var(--view-h, 60vh); }
.case__standout figcaption { text-align: center; }
.case__standout figcaption { margin-top: 10px; font: 400 var(--text-body)/1.5 var(--font-body); color: color-mix(in srgb, var(--os-ink) 78%, transparent); }
.case__standout figcaption b { color: var(--os-ink); font-weight: 600; }
.case__standout figcaption i { font-style: normal; color: var(--os-accent); }
.case__img { display: block; width: 100%; padding: 0; cursor: zoom-in; border-radius: 12px; overflow: hidden; }
.case__img img { display: block; width: 100%; height: auto; border-radius: 12px; transition: filter .3s, scale .5s var(--ease-enter); }
.case__img:hover img { filter: brightness(1.06); scale: 1.015; }
.case__scope { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 28px 0 22px; }
.case__scope ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.case__scope li { padding: 6px 11px; border-radius: 999px; font: 400 var(--text-body)/1 var(--font-body); background: var(--os-wash); box-shadow: inset 0 0 0 1px var(--os-border); }
.case__credits { margin: 0 0 24px; }
.case__credits div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--os-border); }
.case__credits dt { font: 400 var(--text-caption)/1.5 var(--font-mono); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--os-ink-dim); }
.case__credits dd { margin: 0; text-align: right; font: 500 var(--text-body)/1.5 var(--font-body); }
.case__next { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 14px 18px; border-radius: 14px; background: var(--os-wash); box-shadow: inset 0 0 0 1px var(--glass-edge); font: var(--weight-display) var(--text-subhead)/1 var(--font-display); text-align: left; transition: background .2s; }
.case__next:hover { background: var(--os-accent-wash); }
.case__next span { font: 400 var(--text-caption)/1 var(--font-mono); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--os-ink-dim); }
.case__next b { font: 500 var(--text-caption)/1 var(--font-mono); color: var(--os-accent); }

/* ---- system ---- */
.sys { margin: 0 0 30px; }
.sys--two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.sys__note { max-width: 66ch; margin: 12px 0 0; font: 400 var(--text-body)/1.6 var(--font-body); font-style: italic; color: color-mix(in srgb, var(--os-ink) 72%, transparent); }
.sys__shape { max-width: 60ch; margin: 0; font: var(--weight-display) var(--text-subhead)/1.45 var(--font-display); }

.pal { display: flex; gap: 8px; }
.pal__group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pal__role { position: relative; padding-bottom: 5px; font: 400 var(--text-micro, 8px)/1 var(--font-mono); letter-spacing: var(--track-wide); text-transform: uppercase; color: var(--os-ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal__role::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border: 1px solid var(--os-border-strong); border-bottom: 0; border-radius: 3px 3px 0 0; }
.pal__row { display: flex; gap: 3px; }
.pal__sw { position: relative; flex: 1; height: 58px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--os-ink) 10%, transparent); cursor: copy; transition: translate .2s; }
.pal__sw:hover, .pal__sw:focus-visible { translate: 0 -3px; }
.pal__tip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); translate: -50% 4px; z-index: 2; display: flex; flex-direction: column; gap: 3px;
  padding: 7px 10px; border-radius: 10px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, translate .15s;
  font: 400 var(--text-caption)/1 var(--font-mono); color: var(--os-ink-dim); background: var(--os-glass-dense); box-shadow: inset 0 0 0 1px var(--glass-edge), 0 8px 18px -10px color-mix(in srgb, var(--shade) 50%, transparent);
}
.pal__tip b { font: 600 var(--text-body)/1 var(--font-body); color: var(--os-ink); }
.pal__sw:hover .pal__tip, .pal__sw:focus-visible .pal__tip { opacity: 1; translate: -50% 0; }

.type__row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--os-border); }
.type__aa { width: 58px; flex: none; text-align: center; font-size: 34px; line-height: 1; color: var(--os-ink); }
.type__meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.type__meta b { font-size: 17px; font-weight: 400; color: var(--os-ink); }
.type__meta small { font: 400 var(--text-caption)/1.4 var(--font-mono); color: var(--os-ink-dim); }
.logo { margin: 0 0 14px; padding: 0; list-style: none; }
.logo li { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--os-border); }
.logo b { font-size: 22px; font-weight: 400; line-height: 1.1; color: var(--os-ink); }
.logo span { font: 400 var(--text-caption)/1.4 var(--font-mono); color: var(--os-ink-dim); }
.brandid { display: grid; gap: 10px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills span {
  padding: 7px 13px; border-radius: 999px; font: 500 var(--text-body)/1 var(--font-body); color: var(--os-ink);
  background: linear-gradient(110deg, color-mix(in srgb, var(--t1) 26%, transparent), color-mix(in srgb, var(--t2) 26%, transparent), color-mix(in srgb, var(--t3) 26%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t2) 45%, transparent);
}

.evo { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: evo; }
.evo li { display: flex; flex-direction: column; gap: 4px; }
.evo li .case__img img { aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.evo b { margin-top: 4px; font: 500 var(--text-caption)/1.3 var(--font-mono); color: var(--os-ink); }
.evo span { font: 400 var(--text-caption)/1.3 var(--font-body); color: var(--os-ink-dim); }
.evo__more { margin-top: 12px; padding: 6px 12px; border-radius: 999px; font: 500 var(--text-caption)/1 var(--font-mono); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--os-accent); box-shadow: inset 0 0 0 1px var(--os-accent-line); }
.evo__more:hover { background: var(--os-accent-wash); }
.evo__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.evo__grid .case__img, .evo__grid .case__img img { border-radius: 6px; }
.evo__grid img { aspect-ratio: 1; object-fit: cover; }

/* ---- gallery ---- */
.photo { margin: 0 0 30px; }
.photo__hero { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.photo__hero img { height: 300px; object-fit: cover; }
.photo__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.photo__row figure { margin: 0; }
.photo__row img { aspect-ratio: 1; object-fit: cover; }
.photo__row figcaption { margin-top: 6px; font: 400 var(--text-caption)/1.3 var(--font-mono); color: var(--os-ink-dim); }
.gal__cols { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; align-items: start; }
.gal__cols > div { display: flex; flex-direction: column; gap: 8px; }
.gal__item .case__img, .gal__item .case__img img { border-radius: 10px; }

@media (max-width: 700px) {
  .case__scope, .sys--two { grid-template-columns: 1fr; }
  .evo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- lightbox: one piece at a time, over everything ---- */
.lb {
  position: fixed; inset: 0; z-index: var(--z-overlay); opacity: 0; transition: opacity .25s var(--ease-standard);
  background: color-mix(in srgb, var(--os-sky-stop-1) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.lb[data-open] { opacity: 1; }
.lb[hidden] { display: none; }
/* sized against the screen, not the stage's grid track, so square and tall pieces fit whole */
.lb__stage { position: absolute; inset: 56px 96px 64px; display: flex; align-items: center; justify-content: center; }
.lb__stage img, .lb__stage video { display: block; width: auto; height: auto; max-width: calc(100vw - 192px); max-height: calc(100vh - 120px); object-fit: contain; border-radius: 12px; box-shadow: 0 24px 60px -24px color-mix(in srgb, var(--shade) 70%, transparent); -webkit-user-drag: none; user-select: none; }
.lb__btn { position: absolute; width: 46px; height: 46px; display: grid; place-items: center; --lg-r: 50%; font: 500 18px/1 var(--font-mono); color: var(--os-ink); }
.lb__prev { left: 28px; top: 50%; translate: 0 -50%; }
.lb__next { right: 28px; top: 50%; translate: 0 -50%; }
.lb__close { right: 28px; top: 20px; font-size: 14px; }
.lb__btn[hidden] { display: none; }
.lb__count { position: absolute; left: 50%; bottom: 22px; translate: -50% 0; font: 500 var(--text-caption)/1 var(--font-mono); letter-spacing: var(--track-label); color: var(--os-ink-dim); }

@media (prefers-reduced-motion: reduce) {
  .case__view { animation: none; }
}
