@font-face { font-family: "Inter Tight"; src: url("fonts/inter-tight-latin.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }
:root {
  /* "Blue hour": the page is a dark room and its only light is the blue of selected text; the details card is the same room, a little brighter */
  --bg: #0d0d0d; --ink: #f3f3f0; --muted: #8b8d91; --line: #2a2b2e; --cue: #5b93ff; --tint: rgba(91,147,255,.34);
  --sheet: #16181d; --sheet-ink: #f3f3f0; --sheet-muted: #9a9ca3; --sheet-line: #363b46; --sheet-link: #9ab9ff; --sheet-edge: #363b46;
  --placeholder: #262a32; --grip: #626875; --button-line: #3a3e46; --focus: var(--cue);
  --pad: 56px;
  --top: max(20px, env(safe-area-inset-top));
  --bot: max(22px, env(safe-area-inset-bottom));
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* Every screen is exactly one viewport tall and each swipe, flick or wheel step lands on the next one */
html { scroll-snap-type: y mandatory; scrollbar-gutter: stable; background: var(--bg); -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 "Inter Tight", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.arch { opacity: .65; }

.skip { position: fixed; left: var(--pad); top: -60px; z-index: 20; background: var(--ink); color: var(--bg); padding: 8px 14px; text-decoration: none; }
.skip:focus { top: var(--top); }

/* Name and index, fixed above everything */
.top { position: fixed; inset: 0 0 auto 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: var(--top) var(--pad) 0; pointer-events: none; text-shadow: 0 1px 14px rgba(0,0,0,.55); }
.top > * { pointer-events: auto; }
.top .name { text-decoration: none; }
.top button { background: none; border: 0; padding: 6px 0 6px 12px; cursor: pointer; }

/* One question per screen; the type also scales with the screen's height, so a question always fits */
.slide { position: relative; height: 100vh; height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; display: grid; grid-template-rows: 1fr auto; padding: calc(var(--top) + 52px) var(--pad) var(--bot); overflow: hidden; isolation: isolate; }
.q { position: relative; z-index: 1; align-self: center; margin: 0; max-width: 17ch; font-weight: 600; font-size: clamp(30px, min(6.6vw, 12svh), 112px); line-height: 1; letter-spacing: -0.03em; text-wrap: balance; }
.q.long { font-size: clamp(28px, min(5.8vw, 10.5svh), 98px); max-width: 18ch; }
.q-wrap { position: relative; z-index: 1; align-self: center; }
.intro .q { font-weight: 500; max-width: 19ch; }
.intro .sub { color: var(--muted); font-size: clamp(17px, 1.6vw, 22px); margin: 18px 0 0; }
/* Each question's operative phrase looks just selected: a red tint with a handle at each end (knobs centred on the top-left and bottom-right corners) */
::selection { background: var(--tint); color: var(--ink); }
.sel { --k: max(7px, .13em); --b: max(2px, .028em); --band: linear-gradient(var(--tint) 0 0) 0 .2em / 100% 1em no-repeat;
  --end: radial-gradient(circle at 50% calc(100% - var(--k) / 2), var(--cue) calc(var(--k) / 2 - .5px), transparent calc(var(--k) / 2)), linear-gradient(var(--cue) 0 0) 50% 0 / var(--b) 1em no-repeat;
  position: relative; white-space: nowrap; background: var(--band); }
.sel::before, .sel::after, .sel .ch.at::after { content: ""; position: absolute; width: var(--k); height: calc(1em + var(--k) / 2); pointer-events: none; forced-color-adjust: none; }
.sel::before { left: calc(var(--k) / -2); top: calc(.2em - var(--k) / 2);
  background: radial-gradient(circle at 50% calc(var(--k) / 2), var(--cue) calc(var(--k) / 2 - .5px), transparent calc(var(--k) / 2)), linear-gradient(var(--cue) 0 0) 50% 100% / var(--b) 1em no-repeat; }
.sel::after, .sel .ch.at::after { right: calc(var(--k) / -2); top: .2em; background: var(--end); }
/* Typing it in: each letter brings its share of the tint, and the end handle rides on the last letter typed */
.sel.split { background: none; }
.sel.split .ch { position: relative; background: var(--band); }
.sel.typing .ch:not(.on), .sel.typing::after, .sel.typing:not(.started)::before { visibility: hidden; }
/* The selection lights the room: a soft glow of the accent around the phrase, rising as it types */
.slide::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: var(--glow, 0); transition: opacity .35s ease;
  background: radial-gradient(70vmax 42vmax at var(--gx, 30%) var(--gy, 45%), color-mix(in srgb, var(--cue) 15%, transparent), color-mix(in srgb, var(--cue) 5%, transparent) 45%, transparent 75%); }
.q-btn { display: inline; padding: 0; margin: 0; border: 0; background: none; font: inherit; letter-spacing: inherit; line-height: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; margin: 0; }
.foot .num { min-width: 72px; }
/* HEIG-VD, linked from the first screen, in the school's own red */
.intro .foot a[href^="https://heig-vd.ch"] { color: #e1251b; }
.foot b { color: var(--ink); font-weight: 500; }

/* Hover, keyboard focus, or settling on a question on a touch screen: the picture comes in behind the question */
.pic { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .3s ease; background: var(--bg); }
/* -webkit-touch-callout: none: on iPhones the hidden picture must not count as something you can tap, or its fade-in could swallow a tap */
.pic img, .pic video, .pic canvas { -webkit-touch-callout: none; position: absolute; top: 0; bottom: 0; right: 0; left: var(--shift, 0%); width: calc(100% - var(--shift, 0%)); height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); display: block; }
.pic::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgb(13,13,13) var(--shift, 0%), rgba(13,13,13,0) calc(var(--shift, 0%) + 26%)),
              linear-gradient(90deg, rgba(13,13,13,.9) 0%, rgba(13,13,13,.72) 36%, rgba(13,13,13,.22) 72%, rgba(13,13,13,.1) 100%); }
.revealed .pic { opacity: 1; }
/* A work with a picture of its own for phones shows it only there */
.pic .narrow { display: none; }
/* The picture lit by the selection (light.js): the canvas stands in for it, and the room's own glow steps back */
.pic.lit-on img { visibility: hidden; }
.slide:has(.lit-on)::after { opacity: calc(var(--glow, 0) * .45); }

/* About */
.end { min-height: 100vh; min-height: 100svh; scroll-snap-align: start; padding: calc(var(--top) + 72px) var(--pad) calc(var(--bot) + 20px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; align-content: center; font-size: 15px; }
.end h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; }
.end p { margin: 0 0 .6em; }
.end .what { grid-column: 1 / -1; }
.end .big { font-size: clamp(28px, 4vw, 56px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; max-width: 22ch; margin: 0 0 20px; }
.end .quiet { color: var(--muted); }
/* Short desktop windows: About stays exactly one screen tall, like every other screen, so it snaps the same way */
@media (min-width: 761px) and (max-height: 600px) {
  .end { padding-top: calc(var(--top) + 44px); padding-bottom: var(--bot); row-gap: 22px; }
  .end .big { font-size: clamp(26px, min(4vw, 7svh), 56px); margin-bottom: 14px; }
}

/* Dialogs: a work's details, the index, the image viewer */
dialog { padding: 0; border: 0; color: inherit; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0,0,0,.55); }
.close { background: none; border: 1px solid currentColor; padding: 7px 14px; cursor: pointer; }

.sheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; height: auto; max-height: 88vh; overflow: auto; overscroll-behavior: contain; background: var(--sheet); color: var(--sheet-ink); border-top: 1px solid var(--sheet-edge, transparent); --focus: var(--sheet-focus, var(--cue)); }
.sheet a { color: var(--sheet-link); }
.sheet ::selection { color: var(--sheet-ink); }
.sheet header { position: sticky; top: 0; z-index: 1; background: var(--sheet); display: flex; justify-content: space-between; gap: 20px; align-items: center; border-bottom: 1px solid var(--sheet-line); padding: 22px var(--pad) 10px; }
.sheet h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.sheet h2 span { color: var(--sheet-muted); font-weight: 400; }
.sheet form { margin: 0; }
/* On touch screens a grip says the card can be swiped down; while it is dragged it follows the finger exactly */
@media (hover: none), (pointer: coarse) { .sheet header::before { content: ""; position: absolute; left: 50%; top: max(8px, calc(var(--top) - 14px)); width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--grip); } }
/* While a dialog is dragged it follows the finger exactly; let go short of closing and it springs back */
dialog.dragging { transition: none !important; }
dialog.springing { transition: transform .25s ease, opacity .25s ease !important; }
@media (prefers-reduced-motion: reduce) { dialog.springing { transition: none !important; } }
.sheet .body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; padding: 18px var(--pad) 0; }
.sheet .lede { font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .8em; max-width: 34ch; }
.sheet p { margin: 0 0 .8em; max-width: 64ch; font-size: 17px; }
.sheet dl { margin: 0; font-size: 14px; }
.sheet dt { color: var(--sheet-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin-top: 10px; }
.sheet dd { margin: 0; }
.gallery { list-style: none; display: flex; gap: 8px; overflow-x: auto; margin: 22px 0 0; padding: 0 var(--pad) calc(var(--bot) + 18px); scroll-snap-type: x proximity; scroll-padding: 0 var(--pad); }
.gallery li { flex: none; scroll-snap-align: start; }
.gallery img, .gallery video { display: block; height: 320px; width: auto; max-width: none; background: var(--placeholder); }
.gallery .zoom { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery .zoom:hover img { opacity: .92; }

.index { position: fixed; inset: 0; margin: 0; width: 100%; height: 100%; background: rgba(13,13,13,.98); color: var(--ink); overflow: auto; overscroll-behavior: contain; padding: calc(var(--top) + 20px) var(--pad) calc(var(--bot) + 20px); }
.index .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.index h2 { margin: 0; font-size: 16px; font-weight: 400; }
.index ol { list-style: none; margin: 0; padding: 0; columns: 2 380px; column-gap: 56px; }
.index li { break-inside: avoid; border-bottom: 1px solid var(--line); }
.index a { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: baseline; padding: 12px 0; font-size: 26px; font-weight: 500; letter-spacing: -0.015em; text-decoration: none; }
.index a span:first-child, .index a span:last-child { color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.index a:hover span:nth-child(2) { color: var(--cue); }

.lightbox { position: fixed; inset: 0; margin: 0; width: 100%; height: 100%; background: #000; color: var(--ink); overflow: hidden; touch-action: pan-y; }
.lightbox figure { margin: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; padding: calc(var(--top) + 52px) var(--pad) var(--bot); gap: 14px; }
.lightbox img { width: 100%; height: 100%; object-fit: contain; min-height: 0; }
.lightbox figcaption { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.lightbox .count { color: var(--ink); min-width: 52px; }
.lightbox .bar { position: absolute; inset: var(--top) var(--pad) auto var(--pad); display: flex; gap: 10px; justify-content: flex-end; }
.lightbox .bar button { background: rgba(13,13,13,.6); border: 1px solid var(--button-line); color: var(--ink); padding: 7px 14px; cursor: pointer; }
.lightbox.single .prev, .lightbox.single .next { display: none; }

/* Motion: the details slide up, the viewer fades in; nothing moves for people who asked for less motion */
@media (prefers-reduced-motion: no-preference) {
  .sheet { transition: transform .35s ease, overlay .35s ease allow-discrete, display .35s ease allow-discrete; transform: translateY(100%); }
  .sheet[open] { transform: none; }
  @starting-style { .sheet[open] { transform: translateY(100%); } }
  .index, .lightbox { transition: opacity .25s ease, overlay .25s ease allow-discrete, display .25s ease allow-discrete; opacity: 0; }
  .index[open], .lightbox[open] { opacity: 1; }
  @starting-style { .index[open], .lightbox[open] { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .pic, .slide::after { transition: none; } }

/* When colours are forced or more contrast is asked for, nothing sits behind the questions */
@media (forced-colors: active), (prefers-contrast: more) { .pic, .slide::after { display: none; } }
@media (forced-colors: active) { .sel { background: Highlight; color: HighlightText; } .sel::before, .sel::after { display: none; } }

@media (max-width: 760px) {
  :root { --pad: 22px; }
  .slide { padding-top: calc(var(--top) + 64px); }
  .q { max-width: none; font-size: clamp(26px, min(9.6vw, 7svh), 52px); line-height: 1.02; }
  .q.long { font-size: clamp(24px, min(8.4vw, 6.2svh), 46px); }
  .intro .q { font-size: clamp(26px, min(9.4vw, 7svh), 50px); }
  .foot { font-size: 13px; }
  /* On a phone the picture fills the top of the screen, starting under the name and index, and fades out under the question */
  .pic .narrow { display: block; }
  .pic:has(.narrow) .wide { display: none; }
  .pic img, .pic video, .pic canvas { top: calc(var(--top) + 40px + var(--mtop, 0%)); left: 0; width: 100%; bottom: auto; height: 68%; object-position: var(--mpos, 50% 50%); }
  .pic::after { background: linear-gradient(180deg, rgb(13,13,13) calc(var(--top) + 40px), rgba(13,13,13,0) calc(var(--top) + 76px)),
                            linear-gradient(180deg, rgba(13,13,13,0) calc(var(--top) + 40px + var(--mtop, 0%) + 68% - 150px), rgb(13,13,13) calc(var(--top) + 40px + var(--mtop, 0%) + 68% - 4px)),
                            linear-gradient(180deg, rgba(13,13,13,0) 30%, rgb(13,13,13) 64%),
                            linear-gradient(180deg, rgba(13,13,13,0) 20%, rgba(13,13,13,.25) 30%, rgba(13,13,13,.7) 46%); }
  .sheet { max-height: none; height: 100svh; }
  .sheet header { padding-top: calc(var(--top) + 6px); }
  .sheet .body { grid-template-columns: 1fr; gap: 6px; }
  .gallery img, .gallery video { height: 58vw; }
  .index a { font-size: 24px; grid-template-columns: 34px 1fr auto; }
  .end { grid-template-columns: 1fr; gap: 22px; align-content: start; }
}

