/* ==========================================================
   Martino Zampardi — base styles
   All top-bar measurements come from the mockup, which is
   2000 units wide. --u is one mockup unit in screen pixels.
   ========================================================== */

:root {
  --bg: #101010;            /* exact background from the mockup */
  --fg: #ffffff;
  --line: #f4f4ff;          /* zoom line: white with a faint cool tint */

  /* Adobe Fonts family names (kit ndg3xua) */
  --font-name: "rosella-engraved", "Bodoni 72", Didot, "Times New Roman", serif;
  --font-text: "sweet-sans-pro", "Helvetica Neue", Arial, sans-serif;
  /* Sweet Sans Pro Medium = weight 700 in this kit (Regular 600, Bold 800) */
  --weight-text: 700;

  --u: calc(100vw / 2000);
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-weight: var(--weight-text);
  font-synthesis: none;            /* never fake bold or italic */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: hidden;              /* the canvas handles all movement */
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }

/* ----------------------------------------------------------
   Top bar
   ---------------------------------------------------------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 0;                     /* takes no space: the canvas runs underneath */
  z-index: 100;
  pointer-events: none;          /* only its links and slider catch the pointer */
}
.topbar a,
.topbar .zoom { pointer-events: auto; }

/* Name + categories, centred */
.brand {
  position: absolute;
  left: 50%;
  top: calc(var(--u) * 68.5);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.brand__name {
  font-family: var(--font-name);
  font-weight: 400;
  font-size: max(14px, calc(var(--u) * 23.9));
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  display: inline-block;
  transform: scale(1.12, 0.85);     /* stretched: wider and flatter, thin like the reference */
  transform-origin: center top;
}
.brand__cats {
  display: flex;
  gap: calc(var(--u) * 44);
  margin-top: calc(var(--u) * 24.8 - 0.15em);   /* the flatter name leaves a little less height */
}
.brand__cats a,
.side a {
  font-size: max(11px, calc(var(--u) * 20));
  line-height: max(1.15em, calc(var(--u) * 24));   /* About → Contact are 24 units apart */
  letter-spacing: 0;
  white-space: nowrap;
}
.brand__cats a {                    /* Design / Architecture / Sound: regular, one size smaller */
  font-weight: 600;
  font-size: max(10px, calc(var(--u) * 17));
}
.side a {                           /* About / Contact: same size as the categories */
  font-size: max(10px, calc(var(--u) * 17));
  line-height: max(1.2em, calc(var(--u) * 21));
}

/* About / Contact, top right */
.side {
  position: absolute;
  right: calc(var(--u) * 76);
  top: calc(var(--u) * 68.3);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Links: quiet hover, current item stays solid */
.topbar a { transition: opacity 0.3s ease; }
.topbar a:hover { opacity: 0.55; }
.topbar a:focus-visible,
.zoom:focus-visible { outline: 1px solid var(--line); outline-offset: 4px; }

/* Zoom slider — a thin line; the bright part shows the zoom level */
.zoom {
  position: absolute;
  left: calc(var(--u) * 67);
  top: calc(var(--u) * 83);
  width: calc(var(--u) * 206);
  height: 24px;                  /* generous invisible hit area */
  margin-top: -12px;
  cursor: ew-resize;
  touch-action: none;
}
.zoom__track,
.zoom__fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: max(1px, calc(var(--u) * 2.5));
  transform: translateY(-50%);
  background: var(--line);
}
.zoom__track { width: 100%; opacity: 0.28; }
.zoom__fill  { width: 30%; }

/* ----------------------------------------------------------
   Canvas
   ---------------------------------------------------------- */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;            /* we handle pan / pinch ourselves */
  user-select: none;
  -webkit-user-select: none;
}
.stage.is-dragging { cursor: grabbing; }

.item {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  transform-origin: 50% 50%;
  contain: layout paint;
  will-change: transform;   /* each thumbnail moves on the GPU, without redrawing */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s ease;
  -webkit-user-drag: none;
  pointer-events: none;
}
.item img.is-loaded { opacity: 1; }
.item.is-contain { background: #000; }          /* photo shot on black: shown whole, not cropped */
.item.is-contain img { object-fit: contain; }
.item.is-hidden { visibility: hidden; }
/* diving into an image: the page fades to the background as the project opens */
.dive-veil {
  position: fixed;
  inset: 0;
  z-index: 48;                       /* over the canvas, under the project and the top bar */
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
.dive-veil.is-on { opacity: 1; transition: opacity 0.5s cubic-bezier(0.55, 0, 0.8, 0.4); }
.item.is-hover { z-index: 100000 !important; }   /* the pointed-at image grows over its neighbours */   /* far off-screen: skip painting */

.stage.is-dragging .item { cursor: grabbing; }

/* In the left strip the thumbnails step back, so the project being
   read stays in focus: a dark veil (the background colour) sits on
   top of each one. The images stay solid, so overlaps never show
   through. Hovering one lifts its veil.
   Change --strip-veil: higher = darker (0.6), lower = brighter (0.3). */
.stage { --strip-veil: 0.45; }
.item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.stage.is-strip .item::after { opacity: var(--strip-veil); }
.item { transition: opacity 0.45s ease; }
/* every image stays in the strip, the open project's own too */
.stage.is-strip .item:hover::after,
.stage.is-strip .item:focus-visible::after { opacity: 0; transition-duration: 0.25s; }

/* ----------------------------------------------------------
   Project page
   Measurements from the second mockup (2000 units wide):
   strip up to x≈330, text block right edge at 687,
   images from 720 to 1867, top at 301, 31 apart.
   The page scrolls down: the text block stays in place, the
   images flow below each other — upright photos two side by
   side (as in the mockup), landscape photos full width.
   ---------------------------------------------------------- */
.project {
  --img-top: calc(var(--u) * 301);
  --gap: calc(var(--u) * 31);

  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;                           /* starts under the strip, so a long title can sit over it */
  right: 0;
  z-index: 50;                       /* above the canvas, below the top bar */
  pointer-events: none;
  opacity: 0;
  transform: translateY(calc(var(--u) * 50));
  transition:
    opacity 0.35s ease,
    transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.project.is-open {
  pointer-events: none;              /* the strip underneath stays clickable… */
  opacity: 1;
  transform: none;
  transition:
    opacity 0.6s ease 0.25s,
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s;
}

.project.is-open .project__row { pointer-events: auto; }   /* …the text and images are not see-through */
.project__num { pointer-events: none; }                    /* a title over the strip lets clicks pass */
.project__scroller {
  padding-left: calc(var(--u) * 330);  /* the content still starts where it always did */
  box-sizing: border-box;
  touch-action: pan-x pan-y pinch-zoom;   /* scroll, and pinch to zoom in on the images */
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;             /* quiet: no visible scrollbar */
  overscroll-behavior: contain;
}
/* images fade out softly under the top bar instead of a hard cut:
   a band of the background colour fading to clear, laid on top.
   (Cheaper than a mask on the scrolling content — smooth in Safari.) */
.project::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(var(--u) * 330);
  right: 0;
  height: calc(var(--u) * 290);
  background: linear-gradient(to bottom, var(--bg) calc(var(--u) * 190), rgba(16, 16, 16, 0));
  z-index: 1;
  pointer-events: none;
}
.project__scroller::-webkit-scrollbar { display: none; }

.project__row {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: var(--img-top) calc(var(--u) * 133) calc(var(--u) * 200) 0;
}

/* Text block: right-aligned, ends just left of the images, stays put */
.project__info {
  flex: 0 0 auto;
  position: sticky;
  top: var(--img-top);
  width: calc(var(--u) * 357);       /* 330 → 687 */
  margin-right: calc(var(--u) * 2);
  text-align: right;
  /* a long text never runs off the screen: the paragraphs scroll on
     their own, while the title and the facts above them stay put */
  max-height: calc(100vh - var(--img-top) - var(--u) * 60);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.project__info > * { flex: 0 0 auto; }
.project__info > .project__text {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.project__text::-webkit-scrollbar { display: none; }
.project__num {
  margin: 0;
  white-space: nowrap;               /* one line; a long title runs over the strip, in front of it */
  text-transform: uppercase;         /* every project title in capitals */
  font-size: max(20px, calc(var(--u) * 40.8));
  font-weight: var(--weight-text);
  line-height: 1;
  letter-spacing: 0.02em;
  margin-top: calc(var(--u) * -2.5);
}
/* 3D model in a project: no background, just the object */
.project__img.project__model { background: none; cursor: grab; }   /* no backdrop: the object floats on the page */
.project__model:active { cursor: grabbing; }
.project__model model-viewer {
  display: block;
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  --progress-bar-color: transparent;   /* no loading line on top while the model downloads */
  --progress-bar-height: 0px;
}

/* Design objects: the drawing from the Design page, small, under the title.
   Change 0.42 to make it bigger or smaller. It links back to Design. */
.project__icon {
  display: inline-block;
  margin-top: calc(var(--u) * 40);
  animation: index-float 13s ease-in-out infinite alternate;
}
.project__icon img {
  display: block;
  height: calc(var(--u) * var(--h) * 0.42);
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.72;
  transition: opacity 0.4s ease;
  -webkit-user-drag: none;
}
.project__icon:hover img { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .project__icon { animation: none; } }

.project__meta,
.project__credits {
  margin: calc(var(--u) * 47.7) 0 0;
  font-size: max(12px, calc(var(--u) * 24));
  line-height: max(1.2em, calc(var(--u) * 29));
}
.project__meta,
.project__credits { white-space: nowrap; }   /* one fact per line, as in the mockup */
.project__credits { margin-top: calc(var(--u) * 28); }
.project__credits a { border-bottom: 1px solid rgba(255, 255, 255, 0.4); transition: opacity 0.3s ease; }
.project__credits a:hover { opacity: 0.55; }
.project__text {
  margin-top: calc(var(--u) * 40);
  font-size: max(11px, calc(var(--u) * 19));
  line-height: 1.45;
  opacity: 0.8;
}
.project__text p { margin: 0; }
.project__text p + p { margin-top: 1em; }   /* a blank line between paragraphs */
.project__text p.project__by { margin-top: 1.6em; opacity: 0.6; }
.project__text p.project__specs { margin-top: 1.6em; }   /* material, size, weight, price */   /* who wrote the text */

/* Images: 720 → 1867 units wide, one row under the other.
   Each row holds one landscape photo (full width) or two photos
   side by side at the same height (see renderProject in js/main.js). */
.project__gallery {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.project__pair {
  display: flex;
  gap: var(--gap);
}
/* images marked join: true share one row with no gap: one black panel */
.project__pair.is-joined { gap: 0; }
/* sketch: true = transparent drawing, no grey frame behind it */
.project__img.is-sketch { background: none; }
/* small caption under an image ("Interior view", "Section"…) */
.project__img { position: relative; }
.project__caption {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: calc(var(--u) * 14);
  font-size: max(10px, calc(var(--u) * 17));
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
  white-space: nowrap;
}
.project__pair.has-caption { margin-bottom: calc(var(--u) * 46); }   /* room for the caption */

.project__img.is-solo {               /* lone upright photo: same size as a pair's half */
  flex: 0 0 calc((100% - var(--gap)) / 2);
}
.project__img.is-solo.is-big {        /* lone upright marked big: true → full width, edge to edge */
  flex-basis: 100%;
}
.project__img {
  flex-basis: 0;                     /* width shared by proportions → equal heights */
  min-width: 0;
  margin: 0;
  background: #161616;               /* reserves the space while loading */
}
.project__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
  -webkit-user-drag: none;
}
.project__img img.is-loaded { opacity: 1; }
/* videos in a project: same frame as the photos, fade in once they can play */
.project__img video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.project__img video.is-loaded { opacity: 1; }
/* fit: "contain" = the whole image, on black, inside the frame (no crop) */
.project__img.is-contain { background: #000; }
.project__img.is-contain img { object-fit: contain; }

/* ----------------------------------------------------------
   Category index (DESIGN)
   Measurements from the Design mockup (2000 units wide):
   drawings centred around y≈705, ~220 apart edge to edge,
   labels ~35 below the drawings, same type as the menu.
   ---------------------------------------------------------- */

/* the active category stays white, the others step back */
body[data-view] .brand__cats a { transition: opacity 0.4s ease; }
body[data-view="design"] .brand__cats a:not(.is-active),
body[data-view="architecture"] .brand__cats a:not(.is-active),
body[data-view="sound"] .brand__cats a:not(.is-active) { opacity: 0.45; }

/* the floating canvas fades away behind an index */
.stage { transition: opacity 0.6s ease; }
.stage.is-away { opacity: 0; pointer-events: none; }

.index {
  position: fixed;
  inset: 0;
  z-index: 45;                       /* above the canvas, below the top bar */
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
  /* scrolls down once the drawings are big enough to stack */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
/* drawings fade softly as they pass under the top bar (a band laid on top) */
.index::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--u) * 260);
  background: linear-gradient(to bottom, var(--bg) calc(var(--u) * 170), rgba(16, 16, 16, 0));
  z-index: 2;
  pointer-events: none;
}
.index::-webkit-scrollbar { display: none; }
.index img, .index a { -webkit-user-drag: none; }
.index.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.5s ease 0.2s, visibility 0s;
}

/* --s = size set by the top-left line (1 = mockup size)
   --cols = drawings per row (4 → 3 → 2 → 1 as they grow) */
.index__wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--u) * 290) 0;   /* clear of the top bar fade; equal top and bottom keeps the row centred */
}
.index__row {
  display: grid;
  grid-template-columns: repeat(var(--cols), auto);
  justify-content: center;
  justify-items: center;
  align-items: center;
  column-gap: calc(var(--u) * 208 * min(var(--s), 1.5));
  row-gap: calc(var(--u) * 170);
}


.index__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  /* entrance: one after another */
  opacity: 0;
  transform: translateY(calc(var(--u) * 24));
}
.index.is-open .index__item {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.8s ease calc(0.25s + var(--i) * 0.09s),
    transform 1s cubic-bezier(0.2, 0.7, 0.2, 1) calc(0.25s + var(--i) * 0.09s);
}
.index__item.is-soon { cursor: default; }
.index__soon { display: block; margin-top: 0.35em; opacity: 0.5; }   /* "COMING SOON" under an upcoming song */
.item.is-soon { cursor: default; }
body.is-arranging .item { cursor: move; outline: 1px dashed rgba(255, 255, 255, 0.35); outline-offset: -1px; }
body.is-arranging .stage.is-dragging .item { cursor: move; }

/* drawings sit in a box of equal height, centred on one line */
.index__fig {
  height: calc(var(--u) * 320 * var(--s));
  display: flex;
  align-items: center;
  animation: index-float 11s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -2.7s);
  animation-duration: calc(9s + var(--i) * 1.7s);
}
.index__fig img {
  display: block;
  height: calc(var(--u) * var(--h) * var(--s));
  width: auto;
  /* the drawings are grey lines on transparent: show them light */
  filter: brightness(0) invert(1);
  opacity: 0.72;
  transition: opacity 0.4s ease;
  -webkit-user-drag: none;
}
.index__item:not(.is-soon):hover .index__fig img,
.index__item:focus-visible .index__fig img { opacity: 1; }

.index__label {
  position: absolute;
  top: calc(100% + var(--u) * 32);
  left: 50%;
  transform: translateX(-50%);
  font-size: max(11px, calc(var(--u) * 20));
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: opacity 0.4s ease;
}
.index__item:not(.is-soon):hover .index__label { opacity: 0.55; }

@keyframes index-float {
  from { transform: translateY(calc(var(--u) * -4)); }
  to   { transform: translateY(calc(var(--u) * 4)); }
}
@media (prefers-reduced-motion: reduce) {
  .index__fig { animation: none; }
}

/* ----------------------------------------------------------
   Sound index: square covers in one row (mockup: 210 wide,
   22 apart, centred). Same growing behaviour as Design.
   ---------------------------------------------------------- */
.index[data-kind="sound"] .index__row {
  column-gap: calc(var(--u) * 22 * var(--s));
  row-gap: calc(var(--u) * 130);
  align-items: start;
}
.index[data-kind="sound"] .index__fig {
  height: auto;
  animation-duration: calc(12s + var(--i) * 1.3s);
}
.index[data-kind="sound"] .index__fig img.index__cover {
  width: calc(var(--u) * 210 * var(--s));
  height: calc(var(--u) * 210 * var(--s));
  object-fit: cover;
  filter: none;
  opacity: 1;
  background: #1a1a1a;               /* holds the square while loading */
}
/* the song name sits under its cover, wrapped to the cover width; always shown */
.index[data-kind="sound"] .index__label {
  top: calc(100% + var(--u) * 33);
  width: max(100%, calc(var(--u) * 150));
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  opacity: 1;
}
.index[data-kind="sound"] .index__item:not(.is-soon):hover .index__label { opacity: 0.55; }

/* pointed at: the cover (and its video) grows a little, like the Architecture page */
.index[data-kind="sound"] .index__fig img.index__cover,
.index[data-kind="sound"] .index__video {
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.9s ease;
}
.index[data-kind="sound"] .index__item:hover img.index__cover,
.index[data-kind="sound"] .index__item:hover .index__video,
.index[data-kind="sound"] .index__item:focus-visible img.index__cover,
.index[data-kind="sound"] .index__item:focus-visible .index__video { transform: scale(1.05); }
@media (prefers-reduced-motion: reduce) {
  .index[data-kind="sound"] .index__fig img.index__cover,
  .index[data-kind="sound"] .index__video { transition: opacity 0.9s ease; }
}

/* ARCHITECTURE: one photo per project in a grid, all the same 3:2 shape.
   The project name always sits under its photo; pointing at a photo
   grows it slightly. */
.index[data-kind="architecture"] .index__row {
  column-gap: calc(var(--u) * 40 * var(--s));
  row-gap: calc(var(--u) * (40 * var(--s) + 50));   /* room for the names */
  align-items: start;
}
.index[data-kind="architecture"] .index__fig {
  height: auto;
  animation-duration: calc(12s + var(--i) * 1.3s);
}
.index[data-kind="architecture"] .index__fig img.index__cover {
  width: calc(var(--u) * 360 * var(--s));
  aspect-ratio: 3 / 2;
  height: auto;
  object-fit: cover;
  filter: none;
  opacity: 1;
  background: #1a1a1a;               /* holds the shape while loading */
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* pointed at: the photo grows a little (change 1.05 for more or less) */
.index[data-kind="architecture"] .index__item:not(.is-soon):hover img.index__cover,
.index[data-kind="architecture"] .index__item:focus-visible img.index__cover { transform: scale(1.05); }
@media (prefers-reduced-motion: reduce) {
  .index[data-kind="architecture"] .index__fig img.index__cover { transition: none; }
}
.index[data-kind="architecture"] .index__fig img.index__cover.is-contain {
  object-fit: contain;
  background: #000;                  /* photo shot on black: show it whole */
}
.index[data-kind="architecture"] .index__label {
  top: calc(100% + var(--u) * 22);
  opacity: 1;
}
.index[data-kind="architecture"] .index__item:not(.is-soon):hover .index__label { opacity: 0.55; }

/* a cover's video sits exactly on top of it and fades in while playing */
.index[data-kind="sound"] .index__fig { position: relative; }
.index__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.index__item.is-playing .index__video { opacity: 1; }
/* a non-square video lines up exactly with the cover at its first frame;
   the strips of the cover it doesn't reach then fade away, so nothing
   stays frozen around the moving image */
.index__video.is-boxed { inset: auto; object-fit: fill; }
.index[data-kind="sound"] .index__item:has(.is-boxed) .index__fig img.index__cover { transition: opacity 0.9s ease; }
.index[data-kind="sound"] .index__item.is-playing:has(.is-boxed) .index__fig img.index__cover { opacity: 0; transition: opacity 0.9s ease 0.35s; }

.noscript {
  position: fixed;
  inset: 45% 0 auto;
  text-align: center;
}

/* ----------------------------------------------------------
   CONTACT: e-mail and Instagram, centred, nothing else
   ---------------------------------------------------------- */
.contact {
  position: fixed;
  inset: 0;
  z-index: 45;                       /* above the canvas, below the top bar */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 14);
  font-size: max(13px, calc(var(--u) * 24));
  letter-spacing: 0.02em;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.contact.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.5s ease 0.2s, visibility 0s;
}
.contact a { transition: opacity 0.3s ease; }
.contact a:hover { opacity: 0.55; }
/* on About / Contact, the open one stays white and the other steps back */
body[data-view="contact"] .side a:not(.is-active),
body[data-view="about"] .side a:not(.is-active) { opacity: 0.45; }

/* ----------------------------------------------------------
   ABOUT: the white self-portrait drawing beside a short text,
   centred on the plain background. Stacks on narrow screens.
   ---------------------------------------------------------- */
.about {
  position: fixed;
  inset: 0;
  z-index: 45;                       /* above the canvas, below the top bar */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 110);
  padding: calc(var(--u) * 260) calc(var(--u) * 200) calc(var(--u) * 160);
  overflow-y: auto;
  scrollbar-width: none;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.about::-webkit-scrollbar { display: none; }
.about.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  transition: opacity 0.5s ease 0.2s, visibility 0s;
}
.about__portrait {
  flex: 0 0 auto;
  height: calc(var(--u) * 480);
  width: auto;
  -webkit-user-drag: none;
}
.about__text {
  flex: 0 1 calc(var(--u) * 760);
  margin: 0;
  font-size: max(13px, calc(var(--u) * 22));
  line-height: 1.55;
  letter-spacing: 0.01em;
}

/* ----------------------------------------------------------
   TIMELINE (a project's "timeline" in data/projects.js)
   The same place at different moments. The two views of a moment
   (outside above, inside below) are sized so both fit on screen;
   the years run down a vertical line on the right, aligned with the
   right edge of the images above. Drag or swipe sideways, click a
   year, or use the arrow keys to move through time.
   ---------------------------------------------------------- */
.tl {
  display: flex;
  align-items: stretch;
  gap: calc(var(--u) * 40);
  margin-top: calc(var(--u) * 60);
}
.tl.is-first { margin-top: 0; }   /* at the start of a page: same gap below as between photos */
.tl__track {
  order: 1;
  flex: 0 0 auto;
  /* as wide as the column allows, but never so tall that a whole moment
     can't be seen at once: --tl-n images of shape --tl-ratio fit the screen */
  width: min(calc(100% - var(--u) * 260),
             calc((100vh - var(--img-top) - var(--u) * 140 - (var(--tl-n, 2) - 1) * var(--gap)) / var(--tl-n, 2) * var(--tl-ratio, 1.7778)));
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  cursor: grab;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
}
.tl__track::-webkit-scrollbar { display: none; }
.tl__track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.tl__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.tl__slide img {
  display: block;
  width: 100%;
  height: auto;
  background: #161616;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* the years: a vertical line on the right, top = first year, bottom = last */
.tl__bar {
  order: 2;
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
}
/* drawn like the zoom line in the top-left corner: a faint track and a solid fill */
.tl__line {
  position: relative;
  width: max(1px, calc(var(--u) * 2.5));
  background: rgba(255, 255, 255, 0.28);
}
.tl__fill {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 0;
  background: var(--line);
}
.tl__stop {
  position: absolute;
  top: var(--x);
  left: 50%;
  width: calc(var(--u) * 30);
  height: calc(var(--u) * 30);
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tl__dot { display: none; }          /* no circles: just the line and the years */
.tl__year {
  position: absolute;
  right: calc(100% + var(--u) * 18);
  top: 50%;
  transform: translateY(-50%);
  font-size: max(12px, calc(var(--u) * 22));
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0.4;
  transition: opacity 0.35s ease;
}
.tl__stop.is-on .tl__year,
.tl__stop:hover .tl__year { opacity: 1; }

/* ----------------------------------------------------------
   LIGHT (timelineStyle: "switch" in data/projects.js)
   The same object in different light, stacked. The words run down
   the same minimal line as the STONAK timeline (.tl__bar, above);
   choosing one fades the photo softly to that light.
   ---------------------------------------------------------- */
.lx {
  display: flex;
  align-items: stretch;
  gap: calc(var(--u) * 40);
}
.lx__stage {
  flex: 0 0 auto;
  /* the whole moment (--lx-m views stacked) always fits on screen */
  width: min(calc(100% - var(--u) * 260),
             calc((100vh - var(--img-top) - var(--u) * 140 - (var(--lx-m, 1) - 1) * var(--gap)) / var(--lx-m, 1) * var(--lx-ratio, 0.6667)));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  cursor: pointer;                   /* a click shows the next moment */
  outline: none;
}
.lx__panel {
  position: relative;
  aspect-ratio: var(--lx-ratio, 0.6667);
  background: #161616;
  overflow: hidden;
}
.lx__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.45, 0, 0.2, 1);
  -webkit-user-drag: none;
  pointer-events: none;
}
.lx__img.is-on { opacity: 1; }
.lx .tl__fill { transition: height 0.9s cubic-bezier(0.45, 0, 0.2, 1); }
/* timelineWide: the photo runs the full width of the column, edge to edge;
   the line sits inside the photo near its right edge, words to its left */
.lx.is-wide { position: relative; }
.lx.is-wide .lx__stage { width: 100%; }
.lx.is-wide .tl__bar {
  position: absolute;
  top: calc(var(--u) * 40);
  bottom: calc(var(--u) * 40);
  right: calc(var(--u) * 44);
  z-index: 2;
}
.lx.is-wide .tl__line { background: rgba(255, 255, 255, 0.35); }
/* the line over the photo never gets in the way of the mouse; the words stay clickable */
.lx.is-wide .tl__bar, .lx.is-wide .tl__line { pointer-events: none; }
.lx.is-wide .tl__stop { pointer-events: auto; }
.lx.is-wide .tl__year { text-shadow: 0 0 10px rgba(0, 0, 0, 0.55); }
@media (prefers-reduced-motion: reduce) {
  .lx__img, .lx .tl__fill { transition-duration: 0.01s; }
}

/* ==========================================================
   PHONES (narrower than 760px)
   Everything above is the desktop layout; below, only what
   changes on a small screen. The strip of images runs along
   the bottom of the screen (js/canvas.js: ROW, 92px tall).
   ========================================================== */
@media (max-width: 759.98px) {

  /* --- top bar: name and categories centred, About/Contact top right --- */
  .brand { top: 18px; }
  .brand__name { font-size: min(12.5px, 3.33vw); }   /* the stretched name stays clear of the zoom line and About/Contact */
  .brand__cats { gap: 14px; margin-top: 9px; }
  .brand__cats a { font-size: 9.5px; line-height: 1.3; }
  .side { top: 16px; right: 14px; }
  .side a { font-size: 9.5px; line-height: 1.45; }
  .zoom { left: 14px; top: 24px; width: 64px; height: 36px; margin-top: -18px; }   /* easier to catch with a finger */
  .zoom__track, .zoom__fill { height: 1px; }

  /* --- project page: one column, info first, images full width --- */
  .project {
    --img-top: 104px;
    --gap: 8px;
    bottom: 92px;                    /* the strip row lives below */
  }
  /* the panel doesn't overlap the strip here, so it can take the finger:
     touch scrolling needs the scrolling area itself to receive touches */
  .project.is-open,
  .project.is-open .project__scroller { pointer-events: auto; }
  .project__scroller { -webkit-overflow-scrolling: touch; }
  .project__scroller { padding: 0 16px; }
  .project::before {
    left: 0;
    height: 98px;
    background: linear-gradient(to bottom, var(--bg) 64px, rgba(16, 16, 16, 0));
  }
  .index::before {
    height: 104px;
    background: linear-gradient(to bottom, var(--bg) 70px, rgba(16, 16, 16, 0));
  }
  .project__row {
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
    padding: var(--img-top) 0 40px;
  }
  .project__info {
    position: static;
    width: auto;
    max-height: none;
    margin: 0;
    text-align: left;
    align-items: flex-start;
  }
  .project__info > .project__text { overflow: visible; }
  /* order on phones: title and facts, then the images, then the text */
  .project__row { gap: 0; }
  .project__info { display: contents; }
  .project__num { order: 1; }
  .project__icon { order: 2; align-self: flex-start; }
  .project__meta { order: 3; }
  .project__credits { order: 4; }
  .project__gallery { order: 5; margin-top: 22px; }
  .project__text { order: 6; margin-top: 30px !important; }
  .project__num { font-size: 26px; margin-top: 0; }
  .project__meta,
  .project__credits { margin-top: 12px; font-size: 13px; line-height: 1.35; }
  .project__credits { margin-top: 8px; }
  .project__text { margin-top: 18px; font-size: 13px; line-height: 1.55; }
  .project__icon { margin-top: 14px; }
  .project__icon img { height: calc(var(--h) * 0.22px); }
  .project__caption { margin-top: 6px; font-size: 9.5px; }
  .project__pair.has-caption { margin-bottom: 22px; }

  /* timeline / light: the line keeps a narrow column on the right */
  .tl, .lx { gap: 10px; }
  .tl { margin-top: 22px; }
  .tl__track {
    width: min(calc(100% - 66px),
               calc((100vh - var(--img-top) - 92px - 40px - (var(--tl-n, 2) - 1) * var(--gap)) / var(--tl-n, 2) * var(--tl-ratio, 1.7778)));
  }
  .lx__stage {
    width: min(calc(100% - 86px),
               calc((100vh - var(--img-top) - 92px - 40px - (var(--lx-m, 1) - 1) * var(--gap)) / var(--lx-m, 1) * var(--lx-ratio, 0.6667)));
  }
  .tl__line { width: 1px; }
  /* phones: the full-width photo keeps its line inside, near the right edge */
  .lx.is-wide .tl__bar { top: 14px; bottom: 14px; right: 16px; }
  .tl__year { font-size: 10.5px; right: calc(100% + 7px); }

  /* --- Design / Architecture / Sound: everything a little larger --- */
  .index { --u: calc(100vw / 900); }
  .index__wrap { padding: 112px 16px 70px; }
  .index__label { font-size: 11px; }
  .index[data-kind="sound"] .index__label { font-size: 10px; }
  .index[data-kind="architecture"] .index__label { font-size: 10px; }
  /* grown by a pinch or the line: never wider than the screen */
  .index__fig img { max-width: calc(100vw - 32px); object-fit: contain; }
  .index[data-kind="sound"] .index__fig img.index__cover {
    width: min(calc(var(--u) * 210 * var(--s)), calc(100vw - 32px));
    height: auto;
    aspect-ratio: 1;
  }
  .index[data-kind="architecture"] .index__fig img.index__cover {
    width: min(calc(var(--u) * 360 * var(--s)), calc(100vw - 32px));
  }

  /* --- About: drawing above, text below --- */
  .about {
    flex-direction: column;
    justify-content: flex-start;
    gap: 28px;
    padding: 110px 22px 60px;
  }
  .about__portrait { height: 210px; }
  .about__text { flex: none; max-width: 520px; font-size: 13.5px; line-height: 1.6; }

  /* --- Contact --- */
  .contact { font-size: 14px; gap: 10px; }
}

/* soft edges of the image strip (placed by js/canvas.js) */
.strip-fade {
  position: fixed;
  display: none;
  z-index: 5;                       /* over the strip, under the project and the top bar */
  pointer-events: none;
}
