/*
 * Night-street shop windows. Every dialog reads as a lit window on the rainy
 * quay: a striped awning, a brass-and-zinc frame with a sill, wet glass with a
 * soft reflection, and a small lamp beside each caption. Layout is unchanged;
 * all decoration is painted with gradients and never takes pointer input.
 */
:root {
  --lamp: #ffb673;
  --brass: #c8a56f;
  --awning-a: #8f4636;
  --awning-b: #d4c6a8;
}

dialog {
  /* A second, fainter frame line outside the first, like a window casing. */
  outline: 1px solid color-mix(in srgb, var(--brass) 28%, transparent);
  outline-offset: 5px;
  box-shadow:
    inset 0 1px 0 #d8e8ff24,
    inset 0 -6px 0 #26313c,
    inset 0 -7px 0 #5d6b78,
    0 -16px 70px -28px color-mix(in srgb, var(--lamp) 55%, transparent),
    0 28px 80px #02060cc9;
}
dialog::backdrop {
  background:
    radial-gradient(ellipse 60% 38% at 50% -8%, #ffb67330, transparent 72%),
    repeating-linear-gradient(104deg, transparent 0 21px, #9cc9f10b 21px 22px),
    #060b13d4;
  backdrop-filter: blur(3px);
}

/* The lamp beside every caption. */
dialog .sheet-head .micro::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: 1px;
  background: var(--lamp);
  box-shadow: 0 0 7px 1px color-mix(in srgb, var(--lamp) 80%, transparent);
}
#demo .preview-heading .micro::before { display: none; }

/* Project index and profile: awning, wet glass, reflection and a few drops. */
#index-sheet,
#profile-sheet {
  padding-top: calc(clamp(16px, 2.1vw, 27px) + 12px);
  background:
    radial-gradient(circle at 91% 90%, #dcefff3a 0 1.4px, transparent 2.2px),
    radial-gradient(circle at 94% 94%, #dcefff2a 0 1px, transparent 1.8px),
    radial-gradient(circle at 5% 87%, #dcefff30 0 1.2px, transparent 2px),
    linear-gradient(90deg, var(--awning-a) 0 16px, var(--awning-b) 16px 32px) 0 0 / 32px 8px repeat-x,
    radial-gradient(circle at 8px 0, var(--awning-a) 0 8px, transparent 8.6px) 0 8px / 32px 8px repeat-x,
    radial-gradient(circle at 24px 0, var(--awning-b) 0 8px, transparent 8.6px) 0 8px / 32px 8px repeat-x,
    linear-gradient(#0000005c, transparent) 0 16px / 100% 12px no-repeat,
    linear-gradient(113deg, transparent 40%, #ffffff08 40.3%, #ffffff12 47%, transparent 47.4%),
    repeating-linear-gradient(102deg, transparent 0 17px, #a8d4ff09 17px 18px),
    radial-gradient(ellipse 360px 195px at var(--mx), color-mix(in srgb, var(--accent) 16%, transparent), transparent 100%),
    radial-gradient(ellipse 70% 38% at 14% -4%, #ffb67324, transparent 72%),
    linear-gradient(137deg, #1b2632, #0e1824 70%, #172333);
}
#index-sheet { --accent: #ffb673; --awning-a: #8f4636; }
#profile-sheet { --accent: #9ed8cf; --awning-a: #2f6a68; }
#profile-sheet h2 em, #index-sheet h2 em { color: var(--accent); }

/* Index entries become hanging shop signs with a coloured lamp edge. */
#rack .project {
  border-left: 3px solid var(--accent);
  background-image: linear-gradient(100deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 55%);
}
#rack .project:hover { border-left-color: var(--lamp); }

/* Project dossiers: the awning crowns the banner in the project's own colour. */
#project-sheet .case-banner::before {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0 0 auto;
  height: 16px;
  pointer-events: none;
  --stripe-a: color-mix(in srgb, var(--accent) 62%, #20150f);
  --stripe-b: #d9ccb0;
  background:
    linear-gradient(90deg, var(--stripe-a) 0 16px, var(--stripe-b) 16px 32px) 0 0 / 32px 8px repeat-x,
    radial-gradient(circle at 8px 0, var(--stripe-a) 0 8px, transparent 8.6px) 0 8px / 32px 8px repeat-x,
    radial-gradient(circle at 24px 0, var(--stripe-b) 0 8px, transparent 8.6px) 0 8px / 32px 8px repeat-x;
  filter: drop-shadow(0 3px 3px #00000066);
}
#project-sheet .case-banner::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(113deg, transparent 42%, #ffffff09 42.3%, #ffffff14 48%, transparent 48.4%),
    repeating-linear-gradient(102deg, transparent 0 19px, #bfe0ff0b 19px 20px);
}
#project-sheet .case-banner { padding-top: 34px; }
/* Gallery blocks stack with a fixed gap, so a frame shadow or a key's drop
   shadow can never reach into the thumbnails below. */
#project-sheet .case-gallery { display: flex; flex-direction: column; gap: 18px; }
#project-sheet #filmstrip { margin-top: 0; }
#project-sheet .screen { position: relative; z-index: 0; }
#project-sheet #filmstrip button { position: relative; z-index: 1; }

/* Identical arrow keys: one drawing, mirrored for "previous", centred in a
   fixed-size key. Text arrows differ in width and weight between fonts. */
#project-sheet .transport button { display: grid; place-items: center; padding: 0; }
.transport .arrow {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#previous .arrow { transform: scaleX(-1); }
#project-sheet[data-project=pokelore] .transport .arrow { width: 16px; height: 16px; }

/* The lightweight demo is the shop's display case: same casing, no awning. */
#demo { --awning-a: transparent; }

/* Lens finish for the street itself: a gentle falloff towards the corners,
   like a long exposure of the quay at night. It sits above the canvas only. */
#viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 76% at 50% 46%, transparent 55%, rgba(3, 7, 14, .30) 100%);
}
#world.fallback #viewport::after { display: none; }

@media (max-width: 700px) {
  #project-sheet .case-banner { padding-top: 28px; }
  dialog { outline-offset: 3px; }
}
@media (forced-colors: active) {
  dialog { outline: 0; }
  #project-sheet .case-banner::before,
  #project-sheet .case-banner::after { display: none; }
}

/*
 * Scrollbars. Slim sliders that wear each dialog's own materials: a brass ruler
 * for the dossier, a perforated ticket stub, a record groove, an enamel ridge,
 * a cartridge grip, a mossy stone and a warm string of lights. The arrow
 * buttons are gone; the thumb and a ruler-marked track do the work.
 */
dialog {
  --track: #0a121b;
  --tick: color-mix(in srgb, var(--accent, #9ed8cf) 38%, transparent);
  --thumb-hi: color-mix(in srgb, var(--accent, #9ed8cf) 78%, #ffffff);
  --thumb-lo: color-mix(in srgb, var(--accent, #9ed8cf) 58%, #1c1410);
  --grip: #0000003a;
}
dialog::-webkit-scrollbar { width: 15px; height: 15px; }
dialog::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
dialog::-webkit-scrollbar-corner { background: transparent; }
dialog::-webkit-scrollbar-track {
  margin: 14px 0;
  border-radius: 8px;
  background:
    repeating-linear-gradient(180deg, var(--tick) 0 1px, transparent 1px 12px) 3px 0 / 5px 100% no-repeat,
    repeating-linear-gradient(180deg, var(--tick) 0 1px, transparent 1px 60px) 3px 0 / 9px 100% no-repeat,
    var(--track);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #9ed8cf) 22%, transparent);
}
dialog::-webkit-scrollbar-thumb {
  min-height: 52px;
  border: 3px solid transparent;
  border-radius: 9px;
  background:
    repeating-linear-gradient(0deg, var(--grip) 0 2px, transparent 2px 5px) 50% 50% / 55% 24px no-repeat,
    linear-gradient(90deg, var(--thumb-hi), var(--thumb-lo));
  background-clip: padding-box;
  box-shadow: inset 0 1px 0 #ffffff66, inset 0 -2px 0 #00000030;
}
dialog::-webkit-scrollbar-thumb:hover { filter: brightness(1.14); }
dialog::-webkit-scrollbar-thumb:active { filter: brightness(.92); }

/* Project index and profile: brass sash bar. */
#index-sheet { --thumb-hi: #f0cf94; --thumb-lo: #a8773f; }
#profile-sheet { --thumb-hi: #bfe8e1; --thumb-lo: #4b8d88; }

/* Heist Masters: a brass ruler with a bevelled slider. */
dialog[data-project=heist] {
  --track: #0f1f31; --tick: #c6a56b88; --thumb-hi: #f6dc97; --thumb-lo: #b08437; --grip: #4a37123d;
}
dialog[data-project=heist]::-webkit-scrollbar-thumb { border-radius: 3px 8px 3px 8px; }
/* ARCHANGEL: a perforated ticket stub, dashed track and a notched pink slider. */
dialog[data-project=archangel] { --track: #26102b; --tick: #ffb5db99; --thumb-hi: #ffc1de; --thumb-lo: #ff5fae; --grip: #4a174a42; }
dialog[data-project=archangel]::-webkit-scrollbar-track {
  background:
    repeating-linear-gradient(180deg, #ffb5db99 0 6px, transparent 6px 11px) 6px 0 / 2px 100% no-repeat,
    var(--track);
  border-radius: 2px;
}
dialog[data-project=archangel]::-webkit-scrollbar-thumb { border-radius: 2px; }
/* Sam Davies: a record groove track and a cream sleeve slider. */
dialog[data-project=sam] { --track: #1a1517; --tick: #6b5a50; --thumb-hi: #f4e3c9; --thumb-lo: #cfae8a; --grip: #5a3f2a40; }
dialog[data-project=sam]::-webkit-scrollbar-track {
  background: repeating-linear-gradient(90deg, #2c2528 0 1px, #1a1517 1px 3px);
  border-radius: 3px;
}
dialog[data-project=sam]::-webkit-scrollbar-thumb { border-radius: 3px; }
/* StellarEng: an enamel ridge and a cyan slider with rivets. */
dialog[data-project=stellar] { --track: #0a1b2b; --tick: #74b6c799; --thumb-hi: #c8eef7; --thumb-lo: #4f9db4; --grip: #0e3a4a40; }
dialog[data-project=stellar]::-webkit-scrollbar-thumb {
  border-radius: 6px 2px 6px 2px;
  background:
    radial-gradient(circle, #0e3a4aa0 0 1.2px, transparent 1.8px) 50% 22% / 100% 8px no-repeat,
    radial-gradient(circle, #0e3a4aa0 0 1.2px, transparent 1.8px) 50% 78% / 100% 8px no-repeat,
    repeating-linear-gradient(0deg, var(--grip) 0 2px, transparent 2px 5px) 50% 50% / 55% 20px no-repeat,
    linear-gradient(90deg, var(--thumb-hi), var(--thumb-lo));
  background-clip: padding-box;
}
/* PokéLore: a cartridge grip slider on a dark purple rail. */
dialog[data-project=pokelore] { --track: #1c1431; --tick: #a690df77; --thumb-hi: #d3c0ff; --thumb-lo: #7a60c9; --grip: #2b1b5a46; }
dialog[data-project=pokelore]::-webkit-scrollbar-thumb { border-radius: 10px; }
/* Nori-Dex: a mossy stone slider. */
dialog[data-project=nori] { --track: #0d2420; --tick: #90e7bc66; --thumb-hi: #bff5d6; --thumb-lo: #4d9a74; --grip: #0f3a2c40; }
dialog[data-project=nori]::-webkit-scrollbar-thumb { border-radius: 10px 3px 10px 3px; }
/* Sunniva Room: a wooden slider on a dark rail with warm bulbs. */
dialog[data-project=sunniva] { --track: #241a1b; --tick: #ffcf7a77; --thumb-hi: #d69a68; --thumb-lo: #8a5a3c; --grip: #3a231a46; }
dialog[data-project=sunniva]::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background:
    radial-gradient(circle, #ffe3a0 0 1.4px, #ffcf7a66 2.2px, transparent 3.6px) 50% 22% / 100% 9px no-repeat,
    radial-gradient(circle, #ffe3a0 0 1.4px, #ffcf7a66 2.2px, transparent 3.6px) 50% 78% / 100% 9px no-repeat,
    repeating-linear-gradient(0deg, var(--grip) 0 2px, transparent 2px 5px) 50% 50% / 55% 20px no-repeat,
    linear-gradient(90deg, var(--thumb-hi), var(--thumb-lo));
  background-clip: padding-box;
}

/* Firefox and others that only know the standard properties. */
@supports not selector(::-webkit-scrollbar) {
  dialog { scrollbar-width: thin; scrollbar-color: var(--thumb-lo) var(--track); }
}
@media (forced-colors: active) {
  dialog::-webkit-scrollbar-track, dialog::-webkit-scrollbar-thumb { background: ButtonFace; box-shadow: none; }
}
