/*
  V6 surface system. Materials are translated into flat color, not texture.
  In use: plaster or concrete (surface, mixed by deck.js), charcoal (type),
  paper (card fallback). The rest are defined for later surfaces.
*/
:root {
  --plaster: #f1f1ec;             /* sun-warmed plaster, cool side of off-white */
  --surface: var(--plaster);      /* deck.js mixes plaster toward concrete from the tuning panel */
  --paper: #f7f5f0;               /* uncoated paper, used behind artifacts while they load */
  --canvas: #e6e0d5;              /* washed natural textile */
  --concrete: #dbdcd8;            /* light architectural concrete */
  --stone: #b9b7b1;
  --concrete-dark: #85837d;
  --wood: #6f5a45;                /* weathered wood */
  --cognac: #8b5634;              /* aged leather; restrained accent only */
  --steel: #2c2d2e;               /* blackened steel */
  --charcoal: #252321;            /* type */
  --charcoal-2: #6a6862;

  --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --card-w: 330px;
  --card-h: 412px;
  --radius: 10px;
  --meta-gap: 10px;               /* card to title */
  --proof-gap: 7px;              /* company/year to results */
  --story-gap: 8px;              /* results to story line */
  --card-shadow: 0 1px 2px rgba(34,30,26,.1), 0 12px 25px -9px rgba(34,30,26,.27);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--surface); }
body {
  color: var(--charcoal);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- shell ---------- */
.track { position: relative; }
.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.shell {
  position: absolute; z-index: 2000;
  top: 28px; left: 36px;
  pointer-events: none;
}
.shell .name {
  font-weight: 500; font-size: 10.5px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--charcoal-2);
}

/* ---------- deck ---------- */
.deck { position: absolute; inset: 0; }
.card {
  position: absolute; left: 50%; top: 50%;
  width: var(--card-w); height: var(--card-h);
  margin-left: calc(var(--card-w) / -2);
  margin-top: calc(var(--card-h) / -2);
  transform-origin: 50% 50%;
  will-change: transform;
}

/* the physical card: one shape for every moment, softened corners, low shadow */
.body {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--card-shadow);
  isolation: isolate;               /* keeps media clipped to the radius */
}

/* an artifact inside the viewport */
.layer { position: absolute; inset: 0; overflow: hidden; }
.layer > img, .layer > video {
  display: block; width: 100%; height: 100%;
}
.fit-cover > img, .fit-cover > video { object-fit: cover; }
.fit-contain > img, .fit-contain > video { object-fit: contain; }

/* sequence: contents of the card change; story: hard cuts */
.m-sequence .frame { opacity: 0; transition: opacity 800ms ease; }
.m-story .frame { opacity: 0; }
.frame.on { opacity: 1; }

/* pan: the original page travels through the window while the card is visible */
.pan { background: #fff; }
.pan > img {
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-play-state: paused;
}
.pan-y > img { width: 100%; height: auto; animation-name: pan; }
.is-playing .pan > img { animation-play-state: running; }
/* timed read (JS-driven): no CSS loop */
.pan-seq > img { animation: none !important; will-change: transform; }
/* embedded-film reveal (JS-driven): the page is a fixed-width source moved by transform;
   the film window starts on the page's own video module and opens to the full card */
.pan-reveal > img { position: absolute; left: 0; top: 0; width: 100%; height: auto;
  transform-origin: 0 0; animation: none !important; will-change: transform; }
.pan-reveal .reveal-win { position: absolute; overflow: hidden; opacity: 0; background: #000; }
.pan-reveal .reveal-win > video { display: block; width: 100%; height: 100%; object-fit: cover; }
@keyframes pan {
  from { transform: translateY(0); }
  to { transform: translateY(calc(-100% + var(--card-h))); }
}

/* label: outside the card, archival and small. MOMENT NAME / Company, Year */
.meta {
  position: absolute; left: 1px; top: calc(100% + var(--meta-gap));
  width: var(--card-w);
  pointer-events: none;
}
.meta .title {
  font-family: var(--sans); font-weight: 600;
  font-size: 11px; line-height: 1.3;
  letter-spacing: 0.09em; text-transform: uppercase;
}
.meta .by {
  margin-top: 2px;
  font-size: 12px; line-height: 1.3;
  color: var(--charcoal-2);
}
/* proof: unfolds near the crest; height is set per frame by deck.js.
   Up to two stacked points (value over label), then an optional one-line story. */
.meta .proof { height: 0; overflow: hidden; }
.meta .proof-in {
  padding-top: var(--proof-gap);
  opacity: 0;
  will-change: transform, opacity;
}
.meta .points { display: flex; gap: 28px; align-items: flex-start; }
.meta .pt { display: flex; flex-direction: column; max-width: 190px; }
.meta .pv {
  font-size: 17px; line-height: 1.15; font-weight: 500;
  letter-spacing: -0.005em; font-variant-numeric: tabular-nums;
  color: var(--charcoal);
}
.meta .pl { font-size: 11.5px; line-height: 1.3; color: var(--charcoal-2); margin-top: 1px; }
.meta .pt-fact .pl { font-size: 12.5px; color: var(--charcoal); padding-top: 2px; }
.meta .story {
  margin-top: var(--story-gap); max-width: min(46ch, var(--card-w));
  font-size: 13px; line-height: 1.45; color: var(--charcoal-2);
}
.is-mobile .meta .story { display: none; }
.is-mobile .meta .pv { font-size: 15px; }
.is-mobile .meta .points { gap: 20px; }

/* horizontal pan (e.g. a flattened 360 frame travels sideways through the card) */
.pan-x > img {
  width: auto; height: 100%; max-width: none;
  animation-name: pan-x;
}
@keyframes pan-x {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100% + var(--card-w))); }
}

/* placeholder: a visual we do not have yet. Deliberately plain and obvious. */
.placeholder {
  background: var(--concrete);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 22px;
  outline: 1px dashed rgba(37,35,33,.35); outline-offset: -10px;
}
.placeholder .ph-tag {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
  color: var(--charcoal);
}
.placeholder .ph-need { margin-top: 6px; font-size: 13px; line-height: 1.35; color: var(--charcoal-2); max-width: 26ch; }

/* ---------- after the deck ---------- */
.after { min-height: 30vh; }

/* ---------- mobile ---------- */
@media (max-width: 759px) {
  .shell { top: 18px; left: 20px; }
  .meta .title { font-size: 10.5px; }
}

/* ---------- tuning panel (T) ---------- */
.tune {
  position: fixed; right: 16px; bottom: 16px; z-index: 5000;
  width: 340px; padding: 12px 14px;
  background: rgba(247, 245, 240, 0.97); border: 1px solid rgba(37,35,33,.14);
  font: 11px/1.3 var(--sans); color: var(--charcoal);
}
.tune-h { font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.tune-h span { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--concrete-dark); margin-left: 6px; }
.tune-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 8px; margin: 3px 0; }
.tune-row b { font-weight: 500; text-align: right; }
.tune-row input { width: 100%; accent-color: var(--charcoal); }
