/* marckaiohasler.ch: the chapter "Selected work".
   Only linked when scripts/build_work.py has written at least one document.
   It uses the tokens of site.css. Part 1 is the stacks that turn their pages in place,
   part 2 the reading mode behind "Open large". */

/* ------------------------------------------------------------ 1 stacks */
.work-grid { margin-top: clamp(1.75rem, 3.4vw, 2.5rem); display: grid; gap: 2.75rem 2.25rem; }
.work-item { min-width: 0; scroll-margin-top: 5.5rem; }

/* One stage for both formats: a portrait paper stands in it, a landscape deck lies in it. */
.work-stage { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--band); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent; transition: background 0.3s, border-color 0.3s; }
.work-stage:hover, .work-stage:focus-visible { background: var(--petrol-tint); border-color: var(--petrol-mid); }
.work-fit { position: absolute; inset: 8% 7% 9%; display: flex; align-items: center; justify-content: center; }
.work-sheet { position: relative; isolation: isolate; display: block; max-width: 100%; max-height: 100%; }
.work-sheet.fit-h { height: 100%; }
.work-sheet.fit-w { width: 100%; }
.work-sheet img { position: absolute; inset: 0; width: 100%; height: 100%; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px rgba(34, 48, 58, 0.1), 0 10px 22px -10px rgba(34, 48, 58, 0.4); user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
/* the sheets that wait below the top one */
.work-sheet::before, .work-sheet::after { content: ""; position: absolute; inset: 0; z-index: -1; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px var(--border-strong); transition: transform 0.5s var(--ease); }
.work-sheet::before { transform: translate(8px, 7px); }
.work-sheet::after { transform: translate(4px, 3.5px); }
.work-stage:hover .work-sheet::before, .work-stage:focus-visible .work-sheet::before { transform: translate(12px, 9px) rotate(1.6deg); }
.work-stage:hover .work-sheet::after, .work-stage:focus-visible .work-sheet::after { transform: translate(6px, 4.5px) rotate(0.8deg); }

.work-bar { display: flex; align-items: center; gap: 0.25rem; min-height: 2.75rem; margin-top: 0.625rem; font-family: var(--sans); }
.work-b { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--card); color: var(--ink); cursor: pointer; transition: background 0.15s, border-color 0.15s, opacity 0.15s; }
.work-b:hover { border-color: var(--petrol); color: var(--petrol); }
.work-b:disabled { opacity: 0.35; cursor: default; border-color: var(--border-strong); color: var(--ink); }
.work-b svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.work-count { min-width: 4.75rem; text-align: center; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.work-large { display: inline-flex; align-items: center; gap: 0.4375rem; min-height: 2.75rem; margin-left: auto; padding: 0 0.25rem; font-size: 0.9375rem; font-weight: 600; text-decoration: none; }
.work-large::before { content: ""; width: 0.6875rem; height: 0.6875rem; border: 2px solid currentColor; border-radius: 2px; }
.work-large:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.work-kind { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.625rem; font-family: var(--sans); font-size: 0.8125rem; font-weight: 600; line-height: 1.2; color: var(--petrol); }
.work-kind span { color: var(--muted); font-weight: 400; display: inline-flex; align-items: center; gap: 0.625rem; }
.work-kind span::before { content: ""; width: 0.1875rem; height: 0.1875rem; border-radius: 50%; background: var(--border-strong); }
.work-item h4 { margin-top: 0.4375rem; font-weight: 500; font-size: clamp(1.375rem, 2vw, 1.625rem); line-height: 1.18; letter-spacing: -0.012em; color: var(--ink); text-wrap: balance; }
.work-ctx { margin-top: 0.3125rem; font-family: var(--sans); font-size: 0.875rem; line-height: 1.4; color: var(--muted); }
.work-sum { margin-top: 0.625rem; font-size: 1.0625rem; line-height: 1.45; max-width: 32em; }
.work-note { margin-top: 0.5rem; font-family: var(--sans); font-size: 0.8125rem; line-height: 1.4; color: var(--muted); }
/* only ever written into preview/ */
.work-flag { display: inline-block; margin-top: 0.625rem; font-family: var(--sans); font-size: 0.75rem; font-weight: 600; line-height: 1; padding: 0.3125rem 0.5rem; border-radius: 2px; background: var(--bronze-tint); color: var(--bronze); box-shadow: inset 0 0 0 1px #E6D8B0; }
.work-preview { margin-top: 1.25rem; max-width: 44em; padding: 0.625rem 0.875rem; border-radius: 4px; background: var(--bronze-tint); box-shadow: inset 0 0 0 1px #E6D8B0; font-family: var(--sans); font-size: 0.875rem; line-height: 1.4; color: var(--bronze); }

@media (min-width: 48rem) {
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-item:only-child { grid-column: 1 / -1; max-width: 40rem; }
}

/* ------------------------------------------------------------ 2 reading mode (filled by work.js) */
.wv { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); background: #141C22; color: #fff; font-family: var(--sans); outline: 0; -webkit-tap-highlight-color: transparent; }
.wv-head { display: flex; align-items: center; gap: 0.5rem; min-height: 3.5rem; padding: 0.375rem 0.375rem 0.375rem 1rem; }
.wv-id { min-width: 0; margin-right: auto; }
.wv-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-family: var(--serif); font-size: 1.125rem; font-weight: 500; line-height: 1.25; color: #fff; }
.wv-ctx { font-size: 0.8125rem; line-height: 1.3; color: var(--muted-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-count { flex: none; padding: 0 0.375rem; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wv-tools { display: flex; align-items: center; gap: 0.125rem; flex: none; }
.wv-b { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; text-decoration: none; transition: background 0.15s; }
.wv-b:hover, .wv-b[aria-pressed="true"] { background: rgba(255, 255, 255, 0.14); }
.wv .wv-b:focus-visible, .wv-scroll:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.wv-b svg { width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wv-dl span { display: none; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.wv-prog { height: 2px; background: rgba(255, 255, 255, 0.14); }
.wv-prog i { display: block; height: 100%; background: var(--petrol-light); transform: scaleX(0); transform-origin: left; }

/* All pages below each other. Zoom widens the column, the scroller then pans in both directions. */
.wv-scroll { position: relative; overflow: auto; overscroll-behavior: contain; cursor: zoom-in; }
.wv.is-zoom .wv-scroll { cursor: zoom-out; }
.wv-pages { --max: 54rem; --zf: 2.4; display: grid; gap: 0.75rem; width: min(100% - 1.25rem, var(--max)); margin: 0 auto; padding: 0.75rem 0 3rem; }
.wv.deck .wv-pages { --max: 78rem; }
.wv.is-zoom .wv-pages { width: calc(min(100vw - 1.25rem, var(--max)) * var(--zf)); }
.wv-pages li { background: #fff; border-radius: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.6); }
.wv-pages img { width: 100%; height: auto; border-radius: 2px; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }

@media (min-width: 40rem) {
  .wv-title { -webkit-line-clamp: 1; }
  .wv-dl { width: auto; gap: 0.5rem; padding: 0 0.875rem 0 0.75rem; border-radius: 999px; display: inline-flex; align-items: center; }
  .wv-dl span { display: inline; }
  .wv-count { padding: 0 0.75rem; }
  .wv-pages { gap: 1.25rem; padding-top: 1.25rem; }
}
@media (min-width: 56rem) {
  .wv-head { padding: 0.5rem 0.75rem 0.5rem 1.5rem; }
  .wv-pages { --zf: 1.7; }
  .wv.deck .wv-pages { --zf: 1.5; }
}
@media (prefers-reduced-motion: reduce) {
  .work-stage:hover .work-sheet::before, .work-stage:focus-visible .work-sheet::before { transform: translate(8px, 7px); }
  .work-stage:hover .work-sheet::after, .work-stage:focus-visible .work-sheet::after { transform: translate(4px, 3.5px); }
}
@media print { .wv, .work-bar { display: none !important; } }
