/* =====================================================================
   50 · SELECTED WORK  —  table of contents, laid out like page 4 of the portfolio
   Two modes:
     STAGE  any landscape screen (desktop, wide, iPad and iPhone landscape)
            a 16:9 page scaled to fit, photo positions in % (set in index.html as --l --t --w --h)
     STACK  portrait (iPhone and iPad portrait)
            a list: photo on the left, number and name on the right, the page scrolls
   Sizes for stack mode: --toc-title, --toc-base, --toc-gap in 00-settings.css
   ===================================================================== */

/* ---- shared ---- */
.toc__ph { display: block; transition: filter var(--t-ui) ease; }
.toc__ph .im { display: block; width: 100%; height: 100%; overflow: hidden; }
.toc__ph img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 900ms var(--ease-out); }
.toc__ph .lab { color: #fff; letter-spacing: .14em; white-space: nowrap; }
.toc__ph .lab em { display: none; font-style: normal; }
.toc__row { display: block; text-align: left; letter-spacing: .14em; text-transform: uppercase; color: #fff; transition: filter var(--t-ui) ease; }
.toc__row .k, .toc__row .n { display: block; white-space: nowrap; }
.toc__row .n { text-transform: none; }
.toc.has-hover .toc__ph:not(.is-on), .toc.has-hover .toc__row:not(.is-on) { filter: opacity(.3); }
.toc__ph.is-on img { transform: scale(1.04); }
.toc__row.is-on .n { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .5em; }
.toc__ph:focus-visible, .toc__row:focus-visible { outline: 1px solid #fff; outline-offset: 4px; }
.toc__title { margin: 0; white-space: nowrap; }

/* ---- STAGE mode ---- */
@media (orientation: landscape) {
  #screen-work .screen__scroll { display: grid; place-items: center; overflow: hidden; }
  .toc { position: relative; width: min(100vw, calc(100svh * 16 / 9)); aspect-ratio: 16 / 9; container-type: inline-size; }
  .toc__title { position: absolute; left: 5.625%; top: 11.95%; font-size: 5.64cqw; line-height: .89; }
  .toc__title .ind { margin-left: 9.4cqw; }
  .toc__list { position: absolute; left: 66.53%; top: 15.7%; }
  .toc__row { height: 6.736cqw; font-size: calc(1cqw * var(--toc-text)); line-height: 1.7; }
  .toc__ph { position: absolute; left: var(--l); top: var(--t); width: var(--w); height: var(--h); }
  .toc__ph .lab { position: absolute; left: .2cqw; top: calc(100% + .75cqw); font-size: calc(.93cqw * var(--toc-text)); }
  .toc .legal { position: absolute; left: 5.625%; bottom: 2.4%; }
}

/* ---- STACK mode: a list, one row per project (photo left, number and name right) ---- */
@media (orientation: portrait) {
  .toc { padding: calc(var(--top) + 16px) var(--gutter) max(40px, env(safe-area-inset-bottom, 0px)); }
  .toc__title { font-size: var(--toc-title); line-height: .89; margin-bottom: .55em; }
  .toc__title .ind { margin-left: 2.1em; }
  .toc__list { display: none; }
  .toc__ph { display: grid; grid-template-columns: minmax(0, var(--toc-col)) minmax(0, 1fr); align-items: center; column-gap: 18px; width: 100%; padding: var(--toc-gap) 0; border-top: 1px solid rgba(255,255,255,.22); text-align: left; }
  .toc__ph:last-of-type { border-bottom: 1px solid rgba(255,255,255,.22); }
  .toc__ph .im { width: calc(var(--toc-base) * var(--sw)); max-width: 100%; aspect-ratio: var(--ar); height: auto; }
  .toc__ph .lab { position: static; display: block; min-width: 0; white-space: normal; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; letter-spacing: .14em; }
  .toc__ph .lab em { display: block; margin-top: 2px; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; }
  .toc__ph .lab::after { content: "\2192"; display: block; margin-top: 10px; font-size: 16px; letter-spacing: 0; opacity: .7; }
  .toc.has-hover .toc__ph:not(.is-on) { filter: none; }
  .toc .legal { margin-top: 28px; }
}
