/* ============================================================
   Space page — full-screen WebGL particle field behind the bar.
   (Bar + custom cursor styling come from landing.css.)
   ============================================================ */

/* This page loads landing.css (built for the white landing) but is its own dark,
   immersive field. Restore the theme + the top bar (logo left · nav right) here;
   miscellanea.css only loads on this page, so these overrides don't touch the landing. */
:root { --bg: #000; --fg: #ffffff; --ink: #ffffff; }

/* Bar identical to the landing (only the reveal + colour need re-asserting because this
   page shares landing.css but has no `home-in` state and a white field). */
.bar { top: calc(env(safe-area-inset-top, 0px) + clamp(16px, 3vh, 26px)); }
.logo { display: inline-block; text-decoration: none; color: #111; opacity: 1; }
.nav { opacity: 1; }
.nav__link { color: #111; }

/* Desktop: no Catalogue button — clicking an image reveals its info instead. */
@media (min-width: 761px) { .catalogue-toggle { display: none; } }

#misc-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;            /* behind the bar (z-index 1) and the cursor (z-index 9999) */
  display: block;
  /* three.js sets the inline size to innerWidth × innerHeight (the visual viewport,
     short of the screen under the iOS toolbar). Force the full large-viewport size so
     the field fills the whole screen — no black bands. */
  width: 100vw !important;
  height: 100lvh !important;
  touch-action: none;    /* let OrbitControls handle touch drag/zoom/pan */
}

/* ---- Typewriter intro (centre) ---- */
.misc-intro {
  position: fixed;
  inset: 0;
  z-index: 3;                  /* above the canvas + bar, below the catalogue */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8vw;
  text-align: center;
  pointer-events: none;        /* let drags reach the canvas */
  color: var(--ink);
  font-size: var(--fs-body);   /* same type + line-height as the rest of the site */
  font-weight: 400;
  line-height: 1.15;
  mix-blend-mode: difference;  /* readable over the white field or a dark image */
  transition: opacity 0.6s ease;
}
.misc-intro.is-done { opacity: 0; }

.misc-intro__caret {
  margin-left: 0.06em;
  animation: misc-caret 1s steps(1, start) infinite;
}
@keyframes misc-caret { 50% { opacity: 0; } }

/* ---- Hovered project name (top centre) ---- */
.misc-title {
  position: fixed;
  top: clamp(20px, 4vh, 34px);
  left: 0;
  right: 0;
  text-align: center;
  z-index: 2;
  font-size: var(--fs-body);
  color: var(--ink);
  mix-blend-mode: difference;   /* readable over the white field or a dark image */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.misc-title.is-on { opacity: 1; }

/* ---- Filter chips (design / make / illustration) ---- */
.misc-chips {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + clamp(58px, 9vh, 92px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 8px;
}
.misc-chip {
  font: inherit;
  font-size: var(--fs-body);
  color: #111;
  background: rgba(255, 255, 255, 0.68);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  backdrop-filter: blur(12px) saturate(1.5);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  padding: 0.3em 0.95em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
/* Active chip colours — reused from the landing palette (violet · orange · green). */
.misc-chip.is-on { color: #fff; }
.misc-chip[data-cat="design"].is-on { background: #ff6a2b; border-color: #ff6a2b; }
.misc-chip[data-cat="concept"].is-on { background: #9775fa; border-color: #9775fa; }
.misc-chip[data-cat="illustration"].is-on { background: #12b886; border-color: #12b886; }

/* ---- Project window: a white floating panel — info on the LEFT, all the project's
   photos scrolling on the RIGHT (only that column scrolls). Opens on clicking a
   particle; the field stays behind it. ---- */
.misc-info {
  position: fixed;
  inset: clamp(10px, 3vh, 40px) clamp(10px, 4vw, 60px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  color: #0a0a0a;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  font-size: var(--fs-body);
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.99);
  transition: opacity 0.32s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.misc-info.is-on { opacity: 1; pointer-events: auto; transform: none; }

.misc-win__bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 32px);
  padding: clamp(15px, 1.8vw, 22px) clamp(18px, 2.4vw, 32px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.misc-win__close { border: none; background: none; color: #6b6b6b; font: inherit; white-space: nowrap; transition: color 0.2s ease; }
.misc-win__close:hover { color: #000; }
.misc-win__meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.misc-win__sub { color: #6b6b6b; }

.misc-win__body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
}
.misc-win__info { padding: clamp(24px, 3vw, 48px) clamp(20px, 2.4vw, 40px); }
.misc-win__info a { color: #2962ff; text-decoration: none; }
/* Only the right column scrolls. */
.misc-win__shots {
  overflow-y: auto;
  overscroll-behavior: contain;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  padding: clamp(16px, 1.6vw, 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.4vw, 18px);
}
.misc-win__shot { display: block; width: 100%; height: auto; border-radius: 12px; background: #f1f1ef; }

@media (max-width: 760px) {
  .misc-info { inset: 0; border-radius: 0; }
  .misc-win__body { grid-template-columns: 1fr; overflow-y: auto; }
  .misc-win__shots { border-left: none; border-top: 1px solid rgba(0, 0, 0, 0.08); overflow: visible; }
}

/* ---- Bottom trigger ---- */
.catalogue-toggle {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(18px, 4vh, 32px));
  transform: translateX(-50%);
  z-index: 7;                   /* above the catalogue so it stays clickable */
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-body);
  font-weight: 400;
  white-space: nowrap;
  mix-blend-mode: difference;
}

/* ---- Slide-up catalogue page ---- */
.catalogue {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: var(--bg);
  color: var(--fg);
  overflow-y: auto;
  transform: translateY(100%);
  /* Hidden while closed so it never composites/flashes over the WebGL zoom;
     only un-hides for the slide-up, and re-hides after sliding back down. */
  visibility: hidden;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.85s;
  /* Same type as the rest of the site. */
  font-family: var(--font-sans);
  letter-spacing: -0.015em;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
.catalogue.is-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

.catalogue__title {
  position: sticky;             /* stays put while the list scrolls */
  top: 0;
  text-align: center;
  padding: clamp(20px, 4vh, 34px) 0;
  font-size: var(--fs-body);
  background: var(--bg);
  z-index: 1;
}

.catalogue__list {
  padding: 0 clamp(20px, 2.2vw, 36px) 12vh;
}

.catalogue__item {
  padding: clamp(28px, 5vh, 60px) 0;
  border-bottom: 0.5px solid var(--fg);
}
.catalogue__item:last-child { border-bottom: none; }

.catalogue__meta {
  display: flex;
  flex-direction: column;          /* [year] sits on its own line, above the name */
  gap: 0.1em;
  font-size: var(--fs-body);
  margin-bottom: 1em;
}
.catalogue__name { white-space: nowrap; }

.catalogue__desc {
  margin: 0 0 1.6em;
  font-size: var(--fs-body);
  line-height: 1.3;
  max-width: 120ch;
}

.catalogue__mediawrap { position: relative; }

.catalogue__media {
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 0.6vw, 9px);   /* same gap as the info image column */
  overflow-x: auto;
  scrollbar-width: none;        /* Firefox */
}
.catalogue__media::-webkit-scrollbar { display: none; }   /* WebKit */

/* ← → arrows over the strip's edges — styled EXACTLY like the booklet's flip arrows:
   a thin white glyph on mix-blend-difference (so it's dark over a light photo, white over
   a dark one), no disc. Shown only when the strip overflows (see miscellanea.js). */
.catalogue__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: none;                 /* .has-scroll flips this to block */
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  mix-blend-mode: difference;    /* dark on a light photo, white on a dark one — like the booklet */
  font-family: var(--font-sans);
  font-size: 1.6em;
  line-height: 1;
  transition: opacity 0.22s ease;
}
.catalogue__mediawrap.has-scroll .catalogue__arrow { display: block; }
.catalogue__arrow--prev { left: clamp(8px, 1.4vw, 18px); }
.catalogue__arrow--next { right: clamp(8px, 1.4vw, 18px); }
.catalogue__arrow.is-hidden { opacity: 0; pointer-events: none; }

.catalogue__img {
  height: clamp(280px, 58vh, 680px);
  width: auto;
  flex: 0 0 auto;
  display: block;
  object-fit: cover;
}

::selection { background: transparent; color: #000; text-decoration: underline 2px #ffd400; }
::-moz-selection { background: transparent; color: #000; text-decoration: underline 2px #ffd400; }

@media (max-width: 760px) {
  :root { --fs-body: clamp(17px, 4.8vw, 20px); }
}

@media (max-width: 760px) {
  /* GiuliaRinaldo pinned to the top-LEFT corner (overriding the landing's centred column
     stack); the intro sentence stays centred on screen. The landing's white-splash rules
     (mix-blend:normal, the off-screen slide-in transform, the big splash size, black
     colour) leak in via landing.css — undo them here so the wordmark sits top-left and
     inverts against the field like every other page. */
  .bar {
    top: calc(env(safe-area-inset-top, 0px) + clamp(20px, 4vh, 34px));
    transform: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0;
    mix-blend-mode: difference;   /* invert the white wordmark over the white/black field */
  }
  .logo {
    transform: none;              /* the splash pushes it off-screen (translateX(-115vw)) */
    color: var(--ink);            /* white source, inverted by the bar's difference blend */
    font-size: var(--fs-body);    /* normal nav size, not the big splash size */
    filter: none;
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .nav { display: none; }   /* no nav on the Space page on mobile */
}
