/* The project pages' layout ("story" layout). Built by
   assets/js/project-layout.js, which explains each part; notes in
   docs/PROJECT-LAYOUT.md. Everything is scoped to body.ss (or html.ss-pending),
   so a page shown in the classic layout (?classic) is untouched. */

/* Until project-layout.js has arranged the page (layout-flag.js sets this
   before the first paint and removes it after 3 s whatever happens). */
html.ss-pending main.project-page { visibility: hidden; }

body.ss { --ss-radius: 40px; }
.ss-on-dark  { --ss-ink: #ffffff; --ss-ink-2: rgba(255, 255, 255, 0.72); --ss-line: rgba(255, 255, 255, 0.3); }
.ss-on-light { --ss-ink: #1d1d1f; --ss-ink-2: rgba(29, 29, 31, 0.66); --ss-line: rgba(29, 29, 31, 0.25); }

.ss .ss-panel { position: relative; background: var(--bg); }
.ss .project-section { padding-bottom: 80px; }
.ss .ss-pager { padding-bottom: 40px; }

.ss-kicker {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ---- 1. Opening: name on the left, the page's own viewer on the right ----- */
.ss-open { background: var(--tint); color: var(--ss-ink); }
.ss-open-grid {
  display: grid;
  grid-template-columns: minmax(260px, 4fr) minmax(0, 9fr);
  gap: clamp(24px, 3vw, 56px);
  /* The card starts at the same height on every page, whatever its own
     height, so the previous / next links never move from page to page. */
  align-items: start;
  max-width: 1640px;
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100svh - var(--nav-height));
  margin: 0 auto;
  padding: clamp(18px, 3vh, 36px) clamp(16px, 2.4vw, 40px) clamp(22px, 4vh, 44px) clamp(20px, 3.4vw, 64px);
}
.ss-intro { min-width: 0; align-self: center; }
.ss-open .eyebrow {
  color: var(--ss-ink-2);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.ss-open h1 {
  margin: 0;
  color: var(--ss-ink);
  font-size: clamp(36px, 4.3vw, 76px);
  line-height: 0.96;
  letter-spacing: -0.045em;
  overflow-wrap: break-word;
}
.ss-open h1 span { color: inherit; }
.ss-open h1 > span:not(.ss-w) { color: var(--ss-ink-2); }
.ss-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; }
.ss-wi {
  display: inline-block;
  transform: translate3d(0, 105%, 0);
  transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ss-ready .ss-wi, .ss-still .ss-wi { transform: none; }
.ss-blurb {
  margin: clamp(16px, 2.6vh, 28px) 0 0;
  max-width: 30ch;
  font-size: clamp(17px, 1.45vw, 22px);
  line-height: 1.4;
  color: var(--ss-ink);
}
.ss-cue {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: clamp(24px, 5vh, 56px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ss-ink-2);
}
.ss-cue i { display: block; width: 1.5px; height: 40px; background: var(--ss-line); position: relative; overflow: hidden; }
.ss-cue i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ss-ink);
  animation: ss-cue 1.8s cubic-bezier(0.6, 0, 0.3, 1) infinite;
}
@keyframes ss-cue {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* The page's own viewer, in one large card. */
.ss .project-top {
  position: relative;
  min-width: 0;
  background: var(--bg);
  border-radius: var(--ss-radius);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  padding-bottom: 22px;
  opacity: 0;
  transform: translate3d(0, 46px, 0);
  transition: opacity 0.8s ease 0.15s, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s;
}
.ss-ready .project-top { opacity: 1; transform: none; }
.ss-still .project-top { opacity: 1; transform: none; transition: none; }
/* Its title, description and notes have moved out. */
.ss .project-head { display: none; }
/* The card's contents run to its edges (not the site's usual centred column),
   so the previous / next links sit the same distance from the card's corners
   on every page, however wide the card is. */
.ss .project-top > .wrap { max-width: none; }
@media (min-width: 861px) {
  /* The card fills the first screen's height: nav, the grid's padding and
     the card's own padding and row of controls come off the screen height. */
  .ss .project-viewer {
    --viewer-h: clamp(340px, calc(100vh - 300px), 880px);
    --viewer-h: clamp(340px, calc(100svh - 300px), 880px);
  }
}

/* Zoom: + / - buttons and a hint on the viewer (see project-layout.js). */
.ss-zoom {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
/* In the card's own bottom-right corner (every page but Miu Miu). */
.project-top > .ss-zoom { right: 22px; bottom: 22px; }
/* On a touch screen a pinch zooms, so the buttons would only be clutter. */
@media (pointer: coarse) { .ss-zoom { display: none; } }
.ss-zoom button {
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: #1d1d1f;
  font: 500 22px/1 var(--font);
  cursor: pointer;
}
.ss-zoom button + button { border-top: 1px solid rgba(0, 0, 0, 0.1); }
.ss-zoom button:hover { background: rgba(0, 0, 0, 0.06); }
.ss-zoom button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ss-zoom-hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 14px;
  translate: -50% 0;
  max-width: calc(100% - 140px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.82);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.model-stage.ss-zooming > .ss-zoom-hint { opacity: 1; }
/* The magnifier pointer while the wheel would zoom. */
.model-stage.ss-zooming, .model-stage.ss-zooming model-viewer { cursor: zoom-in; }

/* A two-viewer page showing only its main viewer in the card (the other one
   is in the info section: .ss-extra-viewer below). */
.ss .model-compare.ss-single { display: block; }

/* Miu Miu: the sign and its remote stay together in the card (KEEP_BOTH in
   project-layout.js). Same opening as every other page, with the card's top
   and right edges in the same place, so the Next link doesn't move. The name
   is smaller and its column narrower, to give the two viewers room: the sign
   gets the wider share, the tall thin remote the narrower one. */
@media (min-width: 861px) {
  .ss-wide .ss-open-grid { grid-template-columns: minmax(170px, 2.6fr) minmax(0, 10.4fr); gap: clamp(18px, 2vw, 36px); }
  .ss-wide .ss-open h1 { font-size: clamp(30px, 3.1vw, 54px); }
  .ss-wide .ss-blurb { font-size: clamp(15px, 1.15vw, 18px); }
  .ss .ss-wide .model-compare { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; }
  .ss .ss-wide .model-compare .model-stage { max-width: none; }
}

/* ---- 2. More info: the model stays and turns, the page's words scroll by ---- */
.ss-story { padding: clamp(40px, 9vh, 96px) 0 clamp(40px, 8vh, 90px); }
.ss-story-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 4.5vw, 72px); align-items: start; }
.ss-stage {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  height: calc(100vh - var(--nav-height) - 48px);
  height: calc(100svh - var(--nav-height) - 48px);
  max-height: 760px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  border-radius: var(--ss-radius);
  background: var(--tint);
  overflow: hidden;
}
/* A soft light behind the model. */
.ss-stage::before {
  content: '';
  position: absolute;
  width: 110%;
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}
.ss-stage-in { position: relative; width: 100%; aspect-ratio: 4 / 3; }
.ss-still-img, .ss-model { position: absolute; inset: 0; width: 100%; height: 100%; }
.ss-still-img { object-fit: contain; transition: opacity 0.5s ease; }
.ss-model { opacity: 0; transition: opacity 0.5s ease; --poster-color: transparent; background: transparent; pointer-events: none; }
.ss-stage-in.is-live .ss-model { opacity: 1; }
.ss-stage-in.is-live .ss-still-img { opacity: 0; }

.ss-col { min-width: 0; display: flex; flex-direction: column; gap: clamp(56px, 16vh, 150px); padding: 6vh 0 10vh; }
.ss-block .project-summary { max-width: 46ch; text-align: left; }
.ss-block .project-summary p.desc { margin: 0; font-size: clamp(19px, 1.7vw, 24px); line-height: 1.42; color: var(--text); }
.ss-block .project-summary .meta { display: none; }
.ss-block .model-notes { margin: 0; padding: 0; text-align: left; max-width: 46ch; }
.ss-block .model-notes h2 { font-size: clamp(28px, 3vw, 44px); margin-bottom: 14px; }
.ss-block .model-notes p.desc { margin: 0; font-size: 18px; line-height: 1.5; }

/* The second viewer of a two-viewer page, in the info section. */
.ss-extra-viewer {
  --viewer-h: clamp(280px, 46vh, 460px);
  --viewer-h: clamp(280px, 46svh, 460px);
  border-radius: 26px;
  background: var(--bg-alt);
  padding: 6px 12px 14px;
}
.ss-extra-viewer .model-caption { display: none; }   /* its name is the block's heading */

.ss-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.ss-card {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: 26px;
  background: var(--bg-alt);
  background: color-mix(in srgb, var(--tint) 16%, var(--bg));
}
.ss-card-label { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); }
.ss-card-value {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 36px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.ss-card-value img { width: 0.8em; height: 0.8em; vertical-align: -0.06em; margin-right: 0.18em; }
.ss-card-value a { color: inherit; white-space: normal; }
/* ---- 4. Next project ---------------------------------------------------------- */
.ss-next {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--tint);
  color: var(--ss-ink);
  border-radius: var(--ss-radius) var(--ss-radius) 0 0;
  padding-top: 12vh;
  text-align: center;
}
.ss-next .ss-kicker { color: var(--ss-ink-2); }
.ss-next-title {
  margin: 0 auto;
  max-width: 14ch;
  color: var(--ss-ink);
  font-size: clamp(40px, 8vw, 116px);
  line-height: 0.96;
  letter-spacing: -0.045em;
}
.ss-next-pic { width: min(78vw, 760px); margin: 4vh auto -6vh; aspect-ratio: 4 / 3; }
.ss-next-pic img { width: 100%; height: 100%; object-fit: contain; will-change: transform; transition: scale 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ss-next:hover .ss-next-pic img { scale: 1.04; }

/* ---- Fade-ups, progress, exit ---------------------------------------------- */
.ss-reveal {
  opacity: 0;
  transform: translate3d(0, 34px, 0);
  transition: opacity 0.8s ease, transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ss-reveal.ss-in { opacity: 1; transform: none; }

.ss-progress {
  position: fixed;
  z-index: 101;
  left: 0;
  right: 0;
  top: var(--nav-height);
  height: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}
/* ---- Tablets and phones: name, then the viewer card, stacked ------------------ */
@media (max-width: 860px) {
  body.ss { --ss-radius: 28px; }
  .ss-open-grid {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 18px;
    min-height: 0;
    padding: 22px 8px 28px;
  }
  .ss-intro { padding: 0 12px; }
  .ss-blurb { margin-top: 14px; max-width: none; }
  .ss-cue { display: none; }
  .ss .project-top { padding-bottom: 18px; }

  /* The info section on a phone: the turning model is an ordinary panel at
     the top of the section (not pinned: a pinned panel covered the text
     sliding under it), and the facts are small cards, two to a row. */
  .ss-story { padding: 26px 0 5vh; }
  .ss-story-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .ss-stage {
    position: relative;
    top: auto;
    height: auto;
    max-height: none;
    aspect-ratio: 4 / 3;
  }
  .ss-stage-in { width: 100%; }
  .ss-col { gap: 38px; padding: 0 2px 1vh; }
  .ss-kicker { margin-bottom: 12px; }
  .ss-block .project-summary p.desc { font-size: 17px; line-height: 1.5; }
  .ss-block .model-notes h2 { font-size: 26px; margin-bottom: 10px; }
  .ss-block .model-notes p.desc { font-size: 16px; }
  .ss-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ss-card { min-height: 0; gap: 10px; padding: 14px 16px 15px; border-radius: 18px; }
  .ss-card-label { font-size: 11px; }
  .ss-card-value { font-size: 18px; line-height: 1.15; letter-spacing: -0.02em; }
  .ss-extra-viewer { padding: 4px 8px 12px; border-radius: 22px; }

  .ss-next { padding-top: 9vh; }
  .ss-next-pic { width: 92vw; }
}

/* Phones and tablets (body.ss-lite, set by project-layout.js): nothing starts
   hidden waiting for a script, because the phone can be too busy unpacking
   the 3D model to run one. See "PHONES AND TABLETS" in project-layout.js. */
.ss-lite .ss-reveal { opacity: 1; transform: none; transition: none; }
.ss-lite .project-top { opacity: 1; transform: none; transition: none; }
.ss-lite .ss-wi { transform: none; transition: none; }
.ss-lite .ss-next-pic img { will-change: auto; }

/* Reduce motion: same layout, nothing moves. */
.ss-still .ss-reveal { opacity: 1; transform: none; transition: none; }
.ss-still .ss-cue i::after { animation: none; }
