/* Inner pages (case studies, concepts, colophon): header, theme button, galleries, detail view.
   Builds on css/base.css. */
:root { --nav-h: 4.6rem; }
html, main { overflow-x: clip; }
html.g-locked { overflow: hidden; }
body { font-family: 'Archivo', system-ui, sans-serif; line-height: 1.5; }
.mono { font-family: 'Geist Mono', monospace; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.muted { color: var(--muted); }
.wrap { padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; z-index: 100; left: var(--gutter); top: .6rem; padding: .7rem 1rem; border-radius: 99px; background: var(--ink); color: var(--bg); text-decoration: none; translate: 0 -200%; transition: translate .4s var(--ease); }
.skip:focus { translate: 0 0; }

/* Header */
.top { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem var(--gutter); background: var(--bg); box-shadow: 0 1px 0 var(--line); transition: background-color .6s var(--ease); }
.logo { font-weight: 600; font-size: 1.625rem; letter-spacing: -.045em; line-height: 1; text-decoration: none; padding: .45rem .8rem; margin-left: -.8rem; border-radius: 99px; }
.logo i { display: inline-block; width: .15em; height: .15em; margin-left: .105em; background: var(--mark); transition: scale .5s cubic-bezier(.34, 1.56, .64, 1); transform-origin: 50% 100%; }
.logo:hover i { scale: 1.6; }
.back { text-decoration: none; display: inline-flex; gap: .5rem; align-items: center; min-height: 2.5rem; }
.top__end { display: flex; align-items: center; gap: .6rem; }
.theme { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: .55rem; height: 2.9rem; padding: 0 1rem 0 .8rem; border: 1px solid var(--line); border-radius: 99px; transition: background-color .4s, color .4s; }
.theme:hover { background: var(--ink); color: var(--bg); }
.theme:focus-visible, .pill:focus-visible, .seg button:focus-visible, .idx button:focus-visible, .g-stage:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.theme__icon { position: relative; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--pink); overflow: hidden; transition: rotate .7s var(--ease); }
.theme__icon i { position: absolute; inset: 0; border-radius: 50%; background: var(--bg); translate: 60% -40%; scale: 0; transition: scale .6s var(--ease), translate .6s var(--ease); }
:root[data-theme='dark'] .theme__icon { rotate: -30deg; }
:root[data-theme='dark'] .theme__icon i { scale: 1; translate: 38% -22%; }
.theme:hover .theme__icon i { background: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: .6rem; padding: .95rem 1.35rem; border-radius: 99px; background: var(--ink); color: var(--bg); text-decoration: none; font: 600 .95rem/1 'Archivo'; white-space: nowrap; }
.pill b { display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--pink); color: var(--on-pink); transition: rotate .5s var(--ease); }
.pill:hover b { rotate: -45deg; }
.ulink { background: linear-gradient(var(--mark), var(--mark)) 0 100% / 0 2px no-repeat; padding-bottom: 2px; transition: background-size .6s var(--ease); }
a:hover > .ulink, a:focus-visible > .ulink { background-size: 100% 2px; }
.arr { display: inline-block; transition: translate .5s var(--ease); }
a:hover .arr, a:focus-visible .arr { translate: .35em 0; }

/* Page head */
.head { padding: clamp(3rem, 9vh, 6rem) var(--gutter) 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: end; }
.head .mono:first-child { grid-column: 1 / -1; margin-bottom: 1.5rem; color: var(--teal); }
.head h1 { grid-column: 1 / -1; margin: 0; font-weight: 800; font-size: clamp(3.4rem, 14vw, 15rem); line-height: .82; letter-spacing: -.02em; text-transform: uppercase; display: flex; align-items: flex-end; }
.head h1 i { flex: none; width: .2em; height: .2em; margin: 0 0 .06em .05em; background: var(--mark); view-transition-name: dot; }
.head__lede { grid-column: 1 / 7; margin: 2.5rem 0 0; font-size: clamp(1.2rem, 1.8vw, 1.6rem); line-height: 1.3; }
.facts { grid-column: 8 / 13; margin: 2.5rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .6rem 2rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; } .facts a { color: inherit; }
@view-transition { navigation: auto; }

/* Section */
.sec { padding: clamp(5rem, 13vh, 9rem) var(--gutter) 0; }
.sec__head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.sec__head h2 { margin: 0; font-weight: 800; font-size: clamp(2.6rem, 7vw, 7.5rem); line-height: .82; text-transform: uppercase; font-stretch: 62%; }

/* Segmented control: switch the gallery's arrangement */
.seg { display: inline-flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; gap: .25rem; padding: .3rem; border: 1px solid var(--line); border-radius: 99px; }
.seg button { all: unset; box-sizing: border-box; cursor: pointer; padding: .6rem .95rem; border-radius: 99px; min-height: 2.4rem; display: inline-flex; align-items: center; transition: background-color .35s, color .35s; }
.seg button:hover { background: var(--bg-2); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }

/* Gallery stage */
.gal { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(1.5rem, 4vw, 4rem); margin-top: 2rem; align-items: start; }
.g-stage { position: relative; height: clamp(26rem, 62vh, 44rem); perspective: 1600px; perspective-origin: 50% 40%; overflow: hidden; border-radius: 1.2rem; background: var(--bg-2); touch-action: pan-y; user-select: none; cursor: grab; }
.g-stage:active { cursor: grabbing; }
.g-item { all: unset; position: absolute; left: 50%; top: 46%; width: 62%; aspect-ratio: 16 / 10; border-radius: .9rem; overflow: hidden; background: var(--bg); box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(0, 0, 0, .5); cursor: pointer; will-change: transform, opacity; transform-style: preserve-3d; }
.g-item img { width: 100%; height: 100%; object-fit: cover; object-position: top center; pointer-events: none; -webkit-user-drag: none; }
.g-item:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.g-item.is-front::after { content: 'Open'; position: absolute; right: .8rem; bottom: .8rem; padding: .45rem .75rem; border-radius: 99px; background: var(--pink); color: var(--on-pink); font: 600 .7rem 'Geist Mono'; letter-spacing: .06em; text-transform: uppercase; opacity: 0; translate: 0 6px; transition: opacity .3s, translate .4s var(--ease); }
.g-item.is-front:hover::after { opacity: 1; translate: 0 0; }
.g-stage[data-arrange='fan'] .g-item { top: 38%; }
.g-stage[data-arrange='grid'] .g-item { top: 50%; }
.g-stage[data-arrange='staircase'] .g-item { left: 32%; top: 34%; width: 48%; }
.g-stage[data-arrange='list'] .g-item { top: 50%; }
.g-hint { display: flex; justify-content: space-between; gap: 1rem; margin-top: .9rem; color: var(--muted); }

/* Clickable index beside the stage */
.idx { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.idx button { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: baseline; gap: .5rem; padding: .8rem 0; border-bottom: 1px solid var(--line); color: var(--muted); position: relative; transition: color .3s; }
.idx button::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--mark); scale: 0 1; transform-origin: left; transition: scale .6s var(--ease); }
.idx button:hover, .idx button.is-current { color: var(--ink); }
.idx button:hover::after, .idx button.is-current::after { scale: 1 1; }
.idx .nm { font: 700 clamp(1.05rem, 1.4vw, 1.4rem)/1.1 'Archivo'; text-transform: uppercase; font-stretch: 85%; transition: translate .5s var(--ease); }
.idx button:hover .nm, .idx button.is-current .nm { translate: .4rem 0; }
.idx button.is-current .nm { color: var(--pink-ink); }
.caption { margin-top: 1.5rem; padding: 1.2rem 1.3rem; border-radius: 1rem; background: var(--bg-2); min-height: 8rem; }
.caption h3 { margin: 0 0 .4rem; font-size: 1.25rem; font-weight: 700; }
.caption p { margin: 0; color: var(--muted); }

/* Detail view */
.g-detail { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); grid-template-rows: minmax(0, 1fr) auto; gap: 1.5rem clamp(1.5rem, 3vw, 3rem); padding: calc(var(--nav-h) + .5rem) var(--gutter) 1.2rem; background: var(--bg); overflow: auto; }
.g-detail[hidden] { display: none; }
.g-detail__close { all: unset; position: absolute; top: 1.3rem; right: var(--gutter); cursor: pointer; display: inline-flex; gap: .6rem; align-items: center; padding: .7rem 1rem; border-radius: 99px; border: 1px solid var(--line); transition: background-color .3s, color .3s; }
.g-detail__close:hover, .g-detail__close:focus-visible { background: var(--ink); color: var(--bg); }
.g-detail__close b { font-size: 1.1rem; font-weight: 400; }
.g-detail__fig { margin: 0; align-self: stretch; min-height: 0; border-radius: 1rem; overflow: hidden; background: var(--bg-2); }
.g-detail__fig img { width: 100%; height: 100%; object-fit: contain; display: block; }
.g-detail__side { align-self: end; display: grid; gap: 1rem; padding-bottom: .5rem; }
.g-detail__sub { margin: 0; color: var(--teal); }
.g-detail__side h3 { margin: 0; font-weight: 800; font-size: clamp(2rem, 3.6vw, 3.8rem); line-height: .9; text-transform: uppercase; font-stretch: 80%; }
.g-detail__text { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 36ch; }
.g-detail__side dl { margin: 0; display: grid; gap: .45rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.g-detail__side dl div { display: flex; justify-content: space-between; gap: 1rem; }
.g-detail__side dt { color: var(--muted); } .g-detail__side dd { margin: 0; text-align: right; }
.g-detail__cta { color: var(--teal); text-decoration: none; font-weight: 600; display: inline-flex; gap: .4rem; align-items: center; min-height: 2.5rem; }
.g-detail__strip { grid-column: 1 / -1; display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .3rem; }
.g-thumb { all: unset; cursor: pointer; flex: none; width: 7.5rem; aspect-ratio: 16 / 10; border-radius: .5rem; overflow: hidden; opacity: .5; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .3s, outline-color .3s; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.g-thumb:hover, .g-thumb.is-on { opacity: 1; }
.g-thumb.is-on { outline-color: var(--mark); }
.g-thumb:focus-visible { outline-color: var(--teal); opacity: 1; }

/* Text blocks */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); margin-top: 2rem; }
.cols h3 { margin: .6rem 0 .5rem; font-size: 1.5rem; line-height: 1.05; font-weight: 700; }
.cols p { margin: 0; color: var(--muted); }
.cols .mono { color: var(--teal); }
.note { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); margin-top: 2rem; }
.note p { grid-column: 1 / 8; margin: 0; font-size: clamp(1.3rem, 2.2vw, 2rem); line-height: 1.25; }
.next { margin-top: clamp(5rem, 13vh, 9rem); background: var(--ink); color: var(--bg); border-radius: 2rem 2rem 0 0; padding: clamp(3rem, 9vh, 6rem) var(--gutter) 2rem; }
.next a.big { display: inline-flex; align-items: flex-end; gap: .3em; color: inherit; text-decoration: none; font-weight: 800; font-size: clamp(3rem, 10vw, 11rem); line-height: .82; text-transform: uppercase; }
.next a.big i { width: .2em; height: .2em; background: var(--mark); margin-bottom: .06em; transition: translate .6s var(--ease); }
.next a.big:hover i { translate: .2em 0; }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 4rem; padding-top: 1.2rem; border-top: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); }
.foot a { color: inherit; }

@media (max-width: 900px) {
  .top .pill { display: none; }
  .head__lede, .facts { grid-column: 1 / -1; }
  .gal { grid-template-columns: 1fr; } .gal > :first-child { order: 2; }
  .g-stage { height: clamp(22rem, 58vh, 30rem); }
  .g-item { width: 80%; }
  .g-stage[data-arrange='staircase'] .g-item { left: 36%; width: 60%; }
  .cols { grid-template-columns: 1fr; }
  .note p { grid-column: 1 / -1; }
  .g-detail { grid-template-columns: 1fr; grid-template-rows: auto auto auto; padding-top: 4.5rem; }
  .g-detail__fig { height: 46svh; }
}
@media (max-width: 600px) {
  .theme { width: 2.9rem; padding: 0; justify-content: center; } .theme__label { display: none; }
  .back .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) { .g-item, .idx .nm, .arr { transition: none; } }
