/* ============================================================
   components.css — buttons, media frames, corner brackets,
   cursor, loader, project experience viewer
   ============================================================ */

/* ---------- button system ---------- */
.button {
  --btn-bg: transparent;
  --btn-ink: var(--white);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 30px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--btn-ink);
  overflow: hidden;
  isolation: isolate;
  transition: color var(--duration-medium) ease, border-color var(--duration-medium) ease;
  will-change: transform;
}
.button__surface {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--white);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--duration-medium) var(--ease-out-expo);
  border-radius: inherit;
}
.button__content {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.button__label-mask {
  position: relative;
  display: block;
  overflow: hidden;
}
.button__label { display: block; transition: transform 0.42s var(--ease-out-expo); }
.button__label--next {
  position: absolute;
  inset: 0;
  transform: translateY(115%);
}
.button:hover .button__label--current,
.button:focus-visible .button__label--current { transform: translateY(-115%); }
.button:hover .button__label--next,
.button:focus-visible .button__label--next { transform: none; }

.button__arrow {
  position: relative;
  width: 15px;
  height: 15px;
  overflow: hidden;
  flex-shrink: 0;
}
.button__arrow svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.42s var(--ease-out-expo);
}
.button__arrow svg:last-child { transform: translate(-115%, 115%); }
.button:hover .button__arrow svg:first-child,
.button:focus-visible .button__arrow svg:first-child { transform: translate(115%, -115%); }
.button:hover .button__arrow svg:last-child,
.button:focus-visible .button__arrow svg:last-child { transform: translate(0, 0); }

.button--primary { border-color: var(--white); }
.button--primary:hover, .button--primary:focus-visible { color: var(--black); }
.button--primary:hover .button__surface,
.button--primary:focus-visible .button__surface { transform: scaleY(1); }

.button--secondary:hover, .button--secondary:focus-visible { border-color: var(--silver); }
.button--secondary .button__surface { display: none; }

.button--text {
  border: 0;
  min-height: 44px;
  padding: 0;
  border-radius: 0;
}
.button--text .button__surface { display: none; }
.button--text::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  height: 1px;
  background: var(--gray);
  transform-origin: left;
  transition: transform var(--duration-medium) var(--ease-out-expo), background var(--duration-fast) ease;
}
.button--text:hover::after { background: var(--white); transform: scaleX(0.6); }

/* ---------- media frame + corner brackets + action disc ---------- */
.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-soft);
  background: var(--surface);
}
.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transform: scale(1);
  transition: transform 700ms var(--ease-out-expo), filter 500ms ease;
}
.media-frame__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 450ms ease;
  pointer-events: none;
}
.media-frame__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transition: opacity 500ms ease;
  pointer-events: none;
}
.media-frame__video.is-playing { opacity: 1; }
/* hosts of preview videos outside .media-frame need a positioning context */
.rail-card__media { position: relative; }
.media-frame__disc {
  position: absolute;
  top: 50%; left: 50%;
  width: 92px; height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  background: rgba(5, 5, 5, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--white);
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 400ms ease, transform 550ms var(--ease-out-expo);
  pointer-events: none;
}
.media-corner {
  position: absolute;
  width: 14px; height: 14px;
  color: var(--white);
  opacity: 0;
  transition: opacity 350ms ease, transform 550ms var(--ease-out-expo);
  pointer-events: none;
}
.media-corner::before,
.media-corner::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.media-corner::before { width: 100%; height: 1px; }
.media-corner::after { width: 1px; height: 100%; }
.media-corner--tl { top: 14px; left: 14px; transform: translate(8px, 8px); }
.media-corner--tr { top: 14px; right: 14px; transform: translate(-8px, 8px) scaleX(-1); }
.media-corner--bl { bottom: 14px; left: 14px; transform: translate(8px, -8px) scaleY(-1); }
.media-corner--br { bottom: 14px; right: 14px; transform: translate(-8px, -8px) scale(-1); }

.media-hover:hover .media-frame img,
.media-hover:hover .media-frame video,
.media-hover:focus-visible .media-frame img,
.media-hover:focus-visible .media-frame video { transform: scale(1.045); }
.media-hover:hover .media-frame__overlay,
.media-hover:focus-visible .media-frame__overlay { opacity: 1; }
.media-hover:hover .media-frame__disc,
.media-hover:focus-visible .media-frame__disc { opacity: 1; transform: scale(1); }
.media-hover:hover .media-corner,
.media-hover:focus-visible .media-corner { opacity: 1; }
.media-hover:hover .media-corner--tl, .media-hover:focus-visible .media-corner--tl { transform: translate(0, 0); }
.media-hover:hover .media-corner--tr, .media-hover:focus-visible .media-corner--tr { transform: translate(0, 0) scaleX(-1); }
.media-hover:hover .media-corner--bl, .media-hover:focus-visible .media-corner--bl { transform: translate(0, 0) scaleY(-1); }
.media-hover:hover .media-corner--br, .media-hover:focus-visible .media-corner--br { transform: translate(0, 0) scale(-1); }

/* media entrance reveal (IO-driven) */
.media-reveal {
  clip-path: inset(10% 7% round var(--radius-md));
  transform: scale(1.04);
  transition:
    clip-path 1.2s var(--ease-out-expo),
    transform 1.2s var(--ease-out-expo);
}
.media-reveal.in {
  clip-path: inset(0 0 round var(--radius-md));
  transform: none;
}

/* generic reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease-out-quart), transform 1s var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].in { opacity: 1; transform: none; }

/* ---------- custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
body.has-cursor .cursor { opacity: 1; }
.cursor__ring {
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  transition:
    width 0.35s var(--ease-out-expo),
    height 0.35s var(--ease-out-expo),
    margin 0.35s var(--ease-out-expo),
    background 0.3s ease,
    border-color 0.3s ease;
}
.cursor__label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--black);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.cursor[data-state="view"] .cursor__ring,
.cursor[data-state="open"] .cursor__ring,
.cursor[data-state="play"] .cursor__ring,
.cursor[data-state="drag"] .cursor__ring {
  width: 76px; height: 76px;
  margin: -38px 0 0 -38px;
  background: var(--white);
  border-color: var(--white);
}
.cursor[data-state="view"] .cursor__label,
.cursor[data-state="open"] .cursor__label,
.cursor[data-state="play"] .cursor__label,
.cursor[data-state="drag"] .cursor__label { opacity: 1; }
body.has-cursor [data-cursor] { cursor: none; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  background: radial-gradient(125% 90% at 50% 38%, rgba(20,20,23,0.65), var(--black) 72%);
  display: grid;
  place-items: center;
  transition: clip-path 1s var(--ease-smooth), visibility 1s;
  clip-path: inset(0 0 0 0);
}
.loader::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0 46%, rgba(255,255,255,0.05) 50%, transparent 54%);
  mix-blend-mode: screen;
  opacity: 0.6;
  animation: loaderSweep 3.4s var(--ease-smooth) infinite;
}
.loader.is-done {
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  pointer-events: none;
}
.loader__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: min(300px, 74vw);
  text-align: center;
}
.loader__mark {
  width: 50px;
  height: 38px;
  color: var(--white);
  filter: drop-shadow(0 0 22px rgba(255,255,255,0.14));
  animation: loaderPulse 2.4s var(--ease-smooth) infinite;
}
.loader__mark svg { width: 100%; height: 100%; }
.loader__word {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--silver);
}
.loader__count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-display);
  line-height: 1;
  color: var(--white);
}
.loader__count b {
  font-weight: 600;
  font-size: clamp(42px, 9vw, 58px);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.loader__count i { font-style: normal; font-size: 14px; color: var(--gray); }
.loader__line {
  width: 100%;
  height: 1px;
  background: var(--line-soft);
  position: relative;
  overflow: hidden;
}
.loader__line i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.45), var(--white));
  transform: scaleX(0);
  transform-origin: left;
}
.loader__status {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gray-dark);
}
@keyframes loaderPulse {
  0%, 100% { opacity: 0.72; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}
@keyframes loaderSweep {
  0%, 100% { transform: translateX(-30%); opacity: 0; }
  50% { opacity: 0.6; }
  70% { transform: translateX(30%); opacity: 0; }
}

/* ---------- premium video player ---------- */
.vplayer {
  position: fixed;
  inset: 0;
  z-index: var(--z-viewer);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}
.vplayer.is-open { opacity: 1; visibility: visible; }
.vplayer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 4, 0.82);
  backdrop-filter: blur(18px) saturate(1.1);
}
.vplayer__stage {
  position: relative;
  width: min(1180px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.vplayer__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 82vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 50px 140px rgba(0, 0, 0, 0.7);
  transform-origin: center center;
  will-change: transform, opacity;
}
.vplayer__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.vplayer__big {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 10, 12, 0.5);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out-expo), background 0.2s ease;
}
.vplayer__big:hover { transform: scale(1.06); background: rgba(10, 10, 12, 0.72); }
.vplayer__big svg { width: 34px; height: 34px; }
.vplayer.is-playing .vplayer__big { opacity: 0; pointer-events: none; }
.vplayer__ico-pause { display: none; }
.vplayer.is-playing .vplayer__big .vplayer__ico-play { display: none; }
.vplayer.is-playing .vplayer__big .vplayer__ico-pause { display: block; }
.vplayer__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 30px 18px 14px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.74));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.vplayer__frame:hover .vplayer__bar,
.vplayer:not(.is-playing) .vplayer__bar,
.vplayer__frame:focus-within .vplayer__bar { opacity: 1; transform: none; }
.vplayer__ctrl {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
}
.vplayer__ctrl:hover { background: rgba(255, 255, 255, 0.12); }
.vplayer__ctrl svg { width: 20px; height: 20px; }
.vplayer__ctrl .vplayer__ico-pause,
.vplayer__ctrl .vplayer__ico-mute { display: none; }
.vplayer.is-playing .vplayer__ctrl .vplayer__ico-play { display: none; }
.vplayer.is-playing .vplayer__ctrl .vplayer__ico-pause { display: block; }
.vplayer.is-muted .vplayer__ctrl .vplayer__ico-vol { display: none; }
.vplayer.is-muted .vplayer__ctrl .vplayer__ico-mute { display: block; }
.vplayer__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--silver);
  min-width: 40px;
  text-align: center;
}
.vplayer__track {
  position: relative;
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  touch-action: none;
}
.vplayer__track i {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(0);
  background: #fff;
  border-radius: 4px;
}
.vplayer__buffer, .vplayer__knob { display: none; }
.vplayer__close {
  position: absolute;
  top: calc(-1 * clamp(40px, 7vh, 58px));
  right: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 10, 12, 0.5);
  backdrop-filter: blur(10px);
  color: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.vplayer__close:hover { border-color: rgba(255, 255, 255, 0.5); background: rgba(10, 10, 12, 0.75); }
.vplayer__close svg { width: 16px; height: 16px; }
.vplayer__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);
}
@media (hover: none) {
  .vplayer__bar { opacity: 1; transform: none; }
}
@media (max-width: 700px) {
  .vplayer { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
  .vplayer__stage { width: 100%; gap: 10px; }
  .vplayer__frame {
    max-height: calc(100svh - 92px);
    border-radius: 10px;
  }
  .vplayer__bar {
    display: grid;
    grid-template-columns: 34px 40px 1fr 40px 34px 34px;
    gap: 7px;
    padding: 42px 10px 10px;
  }
  .vplayer__track { min-width: 0; }
  .vplayer__close {
    top: 10px;
    right: 10px;
    z-index: 4;
    width: 40px;
    height: 40px;
  }
  .vplayer__label {
    max-width: calc(100vw - 24px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (max-width: 420px) {
  .vplayer__time { font-size: 10px; min-width: 34px; }
  .vplayer__ctrl { width: 30px; height: 30px; }
  .vplayer__bar { grid-template-columns: 30px 34px 1fr 34px 30px 30px; }
}

/* ---------- project experience viewer ---------- */
.viewer {
  --accent: #f3f3ef;
  --brand-bg: var(--black);
  --brand-ink: var(--white);
  --brand-accent-2: var(--silver);
  --brand-surface: var(--surface);
  --brand-type: var(--font-display);
  position: fixed;
  inset: 0;
  z-index: var(--z-viewer);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 100% at 82% -12%, color-mix(in srgb, var(--accent) 22%, var(--brand-bg)), var(--brand-bg) 64%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.viewer.is-open { opacity: 1; visibility: visible; }

.viewer__bar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding-inline: clamp(14px, 2.4vw, 32px);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 24%, rgba(255,255,255,0.16));
  background: color-mix(in srgb, var(--brand-bg) 88%, rgba(0,0,0,0.35));
  backdrop-filter: blur(16px);
}
.viewer__mark { width: 24px; height: 24px; color: var(--brand-ink); flex-shrink: 0; }
.viewer__mark svg { width: 100%; height: 100%; }
.viewer__name {
  font-family: var(--brand-type);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer__type {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--brand-ink) 68%, var(--accent));
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 100px;
  padding: 5px 12px;
  white-space: nowrap;
}
.viewer__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.viewer__action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--brand-ink) 72%, var(--accent));
  transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease;
}
.viewer__action:hover, .viewer__action:focus-visible { border-color: var(--silver); color: var(--white); }
.viewer__action svg { width: 13px; height: 13px; }

/* route toggle (main experience ↔ admin/etc) */
.viewer__route {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--brand-ink) 60%, var(--accent));
  transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.viewer__route:hover, .viewer__route:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--silver));
  color: var(--brand-ink);
}
.viewer__route.is-active {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent) 72%, transparent);
  color: var(--brand-ink);
}

.viewer__stage { position: relative; flex: 1; background: var(--black-soft); }
.viewer__story {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  color: var(--brand-ink);
  background: var(--brand-bg);
}
.viewer__story[hidden] { display: none; }
.viewer__story-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0.34;
  filter: saturate(1.08) contrast(1.05);
  transform: scale(1.015);
}
.viewer__story-bg.is-atmosphere {
  opacity: 0.82;
  object-position: center center;
}
.viewer__story::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--brand-bg) 58%, transparent), transparent 48%, color-mix(in srgb, var(--brand-bg) 42%, transparent)),
    linear-gradient(180deg, color-mix(in srgb, var(--brand-bg) 8%, transparent), color-mix(in srgb, var(--brand-bg) 74%, transparent) 100%);
}
/* accent glow — a soft base each layout can override */
.viewer__story::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.7;
  background:
    radial-gradient(70% 88% at 90% 4%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 58%),
    radial-gradient(56% 74% at 2% 104%, color-mix(in srgb, var(--brand-accent-2) 20%, transparent), transparent 62%);
}
.viewer__story-inner {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.viewer__story-inner > * { min-height: 100%; height: 100%; }

/* brand-tinted cursor glow — sits behind the content, follows the pointer */
.viewer__cursorglow {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 40vmax;
  height: 40vmax;
  margin: -20vmax 0 0 -20vmax;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s ease;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 44%, transparent), transparent 70%);
  mix-blend-mode: screen;
  will-change: transform;
}
@media (hover: hover) and (pointer: fine) {
  .viewer.is-open .viewer__story.has-cursor .viewer__cursorglow { opacity: 0.85; }
}
.viewer[data-story-layout="gallery"] .viewer__cursorglow,
.viewer[data-story-layout="craft"] .viewer__cursorglow {
  mix-blend-mode: multiply;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 28%, transparent), transparent 72%);
}

/* ---------- shared live-preview slot (each layout reframes it) ---------- */
.story-preview {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: min(100%, 1160px);
  overflow: hidden;
  background: var(--brand-surface);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, rgba(255,255,255,0.14));
  box-shadow: 0 34px 110px rgba(0,0,0,0.42), 0 0 60px -24px color-mix(in srgb, var(--accent) 58%, transparent);
}
.story-preview__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: pan-y;
  background:
    radial-gradient(80% 80% at 50% 20%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--brand-surface);
}
.story-preview__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0.85;
  filter: saturate(0.86) contrast(1.04);
  transition: opacity 0.42s ease, filter 0.42s ease;
  z-index: 1;
}
.story-preview__viewport.is-live-ready .story-preview__still {
  opacity: 0;
  filter: saturate(1) contrast(1);
}
/* the real demo, rendered at desktop width and scaled by JS to fill the frame */
.story-preview__frame {
  position: absolute;
  top: 50%;
  left: 50%;
  /* The preview is intentionally rendered at a desktop canvas size and
     scaled by project-viewer.js. reset.css must not clamp the iframe back to
     the panel width or the canvas gets scaled twice on short viewports. */
  max-width: none;
  max-height: none;
  border: 0;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
  color-scheme: normal;
  background: var(--brand-surface);
  z-index: 2;
}
.story-preview__frame.is-ready { opacity: 1; }
.story-preview__scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.48));
}
.story-preview__label {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--brand-ink) 82%, var(--accent));
}
/* the whole preview is a click/tap target (wired in project-viewer.js) */
.story-preview__viewport { cursor: pointer; }
.story-preview__viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
/* mobile-only affordance chip — desktop gets the custom "Abrir" cursor */
.story-preview__tap {
  display: none;
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-ink);
  background: color-mix(in srgb, var(--brand-bg) 62%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 999px;
  padding: 7px 11px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}
.story-preview__tap svg { width: 9px; height: 9px; }

/* ---------- shared CTA (each layout restyles it) ---------- */
.story-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border: 0;
  border-radius: 100px;
  background: var(--accent);
  color: var(--brand-bg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease, background var(--duration-fast) ease;
  box-shadow: 0 14px 40px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.story-cta:hover, .story-cta:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px -12px color-mix(in srgb, var(--accent) 82%, transparent);
}
.story-cta__arrow { display: inline-flex; transition: transform var(--duration-fast) ease; }
.story-cta:hover .story-cta__arrow { transform: translate(3px, -3px); }
.story-cta__arrow svg { width: 14px; height: 14px; }
.viewer__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.viewer__frame.is-ready { opacity: 1; }

.viewer__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(70% 60% at 50% 35%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 68%),
    color-mix(in srgb, var(--accent) 10%, var(--black-soft));
  transition: opacity 0.45s ease, visibility 0.45s;
}
.viewer__state[hidden] { display: none; }
.viewer__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.14;
  filter: blur(2px) saturate(0.8);
}
.viewer__state-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 46ch;
}
.viewer__spinner {
  width: 34px; height: 34px;
  border: 1.5px solid var(--line);
  border-top-color: color-mix(in srgb, var(--accent) 70%, var(--white));
  border-radius: 50%;
  animation: viewerSpin 0.9s linear infinite;
  box-shadow: 0 0 34px -10px var(--accent);
}
@keyframes viewerSpin { to { transform: rotate(360deg); } }
.viewer__state-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 42%, var(--silver));
}
.viewer__state-hint { font-size: 13px; line-height: 1.65; color: var(--gray); }
.viewer__state-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ============================================================
   PER-PROJECT OPENING LAYOUTS — every project opens into its own
   composition. Keyed on [data-story-layout]; no shared skeleton.
   ============================================================ */

/* bar theming — light layouts get an inverted chrome */
.viewer[data-story-layout="gallery"] .viewer__bar,
.viewer[data-story-layout="craft"] .viewer__bar {
  background: color-mix(in srgb, var(--brand-bg) 90%, #fff);
  color: var(--brand-ink);
  border-bottom-color: rgba(0,0,0,0.1);
}
.viewer[data-story-layout="gallery"] .viewer__mark,
.viewer[data-story-layout="craft"] .viewer__mark,
.viewer[data-story-layout="gallery"] .viewer__action,
.viewer[data-story-layout="craft"] .viewer__action { color: var(--brand-ink); }
.viewer[data-story-layout="poster"] .viewer__bar {
  min-height: 70px;
  background: var(--brand-bg);
  border-bottom: 2px solid rgba(255,255,255,0.3);
}
.viewer[data-story-layout="poster"] .viewer__action,
.viewer[data-story-layout="poster"] .viewer__type { border-radius: 0; font-weight: 700; }

/* ---------- 01 · console (TradeFlow) ---------- */
.st-console,
.st-poster,
.st-gallery,
.st-blueprint,
.st-editorial,
.st-system,
.st-craft {
  position: relative;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}
.st-console > *:not(.story-world):not(.st-console__network),
.st-poster > *:not(.story-world):not(.st-poster__lights),
.st-gallery > *:not(.story-world):not(.st-gallery__ambient),
.st-blueprint > *:not(.story-world):not(.st-blueprint__map),
.st-editorial > *:not(.story-world):not(.st-editorial__seal),
.st-system > *:not(.story-world):not(.st-system__aura):not(.st-system__prism),
.st-craft > *:not(.story-world):not(.st-craft__threads) {
  position: relative;
  z-index: 3;
}
.story-world {
  position: absolute;
  z-index: 1;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}
.story-world img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.78;
  filter: saturate(1.18) contrast(1.05);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0 52%, rgba(0,0,0,0.58) 72%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, #000 0 52%, rgba(0,0,0,0.58) 72%, transparent 100%);
}
.story-world span {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 70% at 50% 20%, transparent, rgba(0,0,0,0.08)),
    linear-gradient(180deg, transparent 46%, color-mix(in srgb, var(--brand-bg) 54%, transparent));
}
.story-world::before {
  content: "";
  position: absolute;
  inset: 7%;
  z-index: -1;
  border-radius: inherit;
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  filter: blur(42px);
  opacity: 0.68;
}
.story-world--console {
  right: -4vw;
  bottom: 7vh;
  width: min(48vw, 760px);
  aspect-ratio: 16 / 9;
  transform: perspective(980px) rotateY(-13deg) rotateZ(1deg);
  opacity: 0.76;
  border-radius: 18px;
}
.story-world--poster {
  right: -2vw;
  top: 10vh;
  width: min(52vw, 900px);
  aspect-ratio: 16 / 9;
  border-radius: 0;
  transform: rotate(-2deg) skewX(-2deg);
  opacity: 0.52;
  mix-blend-mode: screen;
  clip-path: polygon(4% 0, 100% 0, 94% 100%, 0 92%);
}
.story-world--gallery {
  left: 4vw;
  bottom: 5vh;
  width: min(45vw, 720px);
  aspect-ratio: 16 / 9;
  transform: rotate(-3deg);
  opacity: 0.42;
  mix-blend-mode: multiply;
  border-radius: 10px;
}
.story-world--blueprint {
  right: -3vw;
  top: 18vh;
  width: min(50vw, 820px);
  aspect-ratio: 16 / 9;
  transform: perspective(900px) rotateY(-9deg);
  opacity: 0.66;
  border-radius: 16px;
}
.story-world--editorial {
  left: 4vw;
  bottom: 8vh;
  width: min(44vw, 720px);
  aspect-ratio: 16 / 9;
  transform: rotate(-1.4deg);
  opacity: 0.5;
  border-radius: 2px;
}
.story-world--system {
  right: -7vw;
  top: 7vh;
  width: min(62vw, 1040px);
  aspect-ratio: 16 / 9;
  transform: perspective(1000px) rotateY(-6deg) rotateZ(1deg);
  opacity: 0.52;
  mix-blend-mode: screen;
  clip-path: polygon(0 18%, 74% 0, 100% 18%, 92% 100%, 14% 86%);
}
.story-world--craft {
  right: 4vw;
  top: 14vh;
  width: min(44vw, 710px);
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  transform: rotate(2.2deg);
  opacity: 0.38;
  mix-blend-mode: multiply;
}

.viewer[data-story-layout="console"] .viewer__story {
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 15%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 15%, transparent) 1px, transparent 1px),
    var(--brand-bg);
  background-size: 52px 52px, 52px 52px, auto;
}
.st-console {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3vw, 30px);
  padding: clamp(20px, 3vw, 40px) clamp(20px, 4vw, 64px);
  font-family: var(--font-mono);
}
.st-console__network {
  position: absolute;
  right: 4vw;
  top: 13vh;
  width: min(38vw, 520px);
  height: min(30vh, 280px);
  pointer-events: none;
  opacity: 0.42;
  background:
    linear-gradient(90deg, transparent 0 18%, color-mix(in srgb, var(--accent) 34%, transparent) 18% 18.4%, transparent 18.4% 100%),
    linear-gradient(25deg, transparent 0 42%, color-mix(in srgb, var(--accent) 28%, transparent) 42% 42.5%, transparent 42.5% 100%),
    linear-gradient(150deg, transparent 0 58%, color-mix(in srgb, var(--brand-accent-2) 24%, transparent) 58% 58.4%, transparent 58.4% 100%);
  filter: drop-shadow(0 0 20px color-mix(in srgb, var(--accent) 38%, transparent));
}
.st-console__network i {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}
.st-console__network i:nth-child(1) { left: 18%; top: 28%; }
.st-console__network i:nth-child(2) { left: 52%; top: 16%; }
.st-console__network i:nth-child(3) { left: 74%; top: 62%; }
.st-console__network i:nth-child(4) { left: 36%; top: 78%; }
.st-console__bar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, rgba(255,255,255,0.12));
  background: color-mix(in srgb, var(--brand-surface) 60%, transparent);
  border-radius: 6px;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
}
.st-console__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: consolePulse 1.6s ease-in-out infinite; }
@keyframes consolePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.st-console__id { color: var(--accent); font-weight: 600; }
.st-console__status { color: color-mix(in srgb, var(--brand-ink) 66%, var(--accent)); }
.st-console__idx { margin-left: auto; color: color-mix(in srgb, var(--brand-ink) 50%, transparent); }
.st-console__grid { flex: 1; display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(420px, 1.18fr); gap: clamp(24px, 4vw, 56px); align-items: stretch; }
.st-console__panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; justify-content: center; }
.st-console__name { font-family: var(--font-display); font-size: clamp(46px, 6vw, 92px); font-weight: 640; line-height: 0.92; letter-spacing: -0.04em; }
.st-console__desc { max-width: 46ch; font-family: var(--font-body); font-size: clamp(15px, 1.3vw, 18px); line-height: 1.55; color: color-mix(in srgb, var(--brand-ink) 78%, var(--brand-bg)); }
.st-console__log { list-style: none; border: 1px solid color-mix(in srgb, var(--accent) 20%, rgba(255,255,255,0.1)); border-radius: 8px; overflow: hidden; background: color-mix(in srgb, #000 32%, var(--brand-surface)); }
.st-console__log li { display: grid; grid-template-columns: 66px 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; font-size: 11px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.st-console__log li:last-child { border-bottom: 0; }
.st-console__log .t { color: color-mix(in srgb, var(--brand-ink) 46%, transparent); }
.st-console__log .m { color: color-mix(in srgb, var(--brand-ink) 86%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-console__log .s { color: var(--brand-bg); background: var(--accent); padding: 2px 8px; border-radius: 3px; font-size: 9px; letter-spacing: 0.1em; }
.st-console__metrics { display: flex; flex-wrap: wrap; gap: 10px; }
.st-console__metrics div { flex: 1 1 120px; border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 10px 12px; }
.st-console__metrics dt { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: color-mix(in srgb, var(--brand-ink) 50%, transparent); }
.st-console__metrics dd { margin-top: 4px; font-size: 15px; color: var(--brand-ink); }
.st-console__monitor { align-self: center; display: flex; align-items: center; }
.st-console__monitor .story-preview { border-radius: 8px; }
.viewer[data-story-layout="console"] .story-cta { border-radius: 6px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; align-self: flex-start; }

/* ---------- 02 · poster (Mainstage) ---------- */
.viewer[data-story-layout="poster"] .viewer__story {
  background:
    radial-gradient(52% 46% at 26% 2%, rgba(255,255,255,0.18), transparent 62%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 70px),
    radial-gradient(60% 60% at 82% 8%, rgba(0,0,0,0.34), transparent 60%),
    var(--brand-bg);
}
.viewer[data-story-layout="poster"] .viewer__story::before { opacity: 0.4; }
.st-poster { display: grid; grid-template-columns: minmax(0, 0.66fr) minmax(500px, 1.34fr); align-items: center; gap: clamp(20px, 3vw, 42px); padding: clamp(24px, 4vw, 58px) clamp(22px, 4vw, 64px); }
.st-poster__lights {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
  opacity: 0.55;
}
.st-poster__lights i {
  position: absolute;
  top: -20%;
  width: 18vw;
  height: 130%;
  background: linear-gradient(180deg, rgba(255,255,255,0.38), transparent 68%);
  transform-origin: 50% 0;
  filter: blur(10px);
}
.st-poster__lights i:nth-child(1) { left: 18%; transform: rotate(18deg); }
.st-poster__lights i:nth-child(2) { left: 46%; transform: rotate(-11deg); opacity: 0.7; }
.st-poster__lights i:nth-child(3) { right: 4%; transform: rotate(-24deg); opacity: 0.5; }
.st-poster__copy { display: flex; flex-direction: column; gap: clamp(16px, 2vw, 26px); min-width: 0; }
.st-poster__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.85); border-block: 2px solid rgba(255,255,255,0.9); padding: 8px 0; }
.st-poster__venue { font-weight: 700; }
.st-poster__name { font-family: var(--brand-type); font-weight: 900; font-size: clamp(64px, 10vw, 162px); line-height: 0.8; letter-spacing: -0.03em; text-transform: uppercase; color: #fff; text-shadow: 0 6px 0 #111, 0 26px 60px rgba(0,0,0,0.4); }
.st-poster__lineup { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.st-poster__lineup li { font-family: var(--font-display); font-weight: 800; font-size: clamp(15px, 1.7vw, 24px); letter-spacing: 0.02em; text-transform: uppercase; color: #fff; display: flex; align-items: center; gap: 12px; }
.st-poster__lineup li::before { content: "★"; color: #111; font-size: 0.7em; }
.st-poster__foot { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 6px; }
.st-poster__date { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #fff; border: 2px solid #fff; padding: 8px 12px; }
.st-poster__stage { position: relative; min-width: 0; width: 100%; }
.st-poster__stage .story-preview { border: 4px solid #111; border-radius: 0; box-shadow: 16px 16px 0 #111, 0 40px 90px rgba(0,0,0,0.4); }
.viewer[data-story-layout="poster"] .story-cta { background: #111; color: #fff; border-radius: 0; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; box-shadow: 6px 6px 0 rgba(0,0,0,0.35); }
.viewer[data-story-layout="poster"] .story-cta:hover { background: #000; transform: translate(-2px, -2px); box-shadow: 8px 8px 0 rgba(0,0,0,0.42); }

/* ---------- 03 · gallery (TecksArt) ---------- */
.viewer[data-story-layout="gallery"] .viewer__story { background: var(--brand-bg); }
.viewer[data-story-layout="gallery"] .viewer__story-bg { opacity: 0.08; filter: grayscale(1); }
.viewer[data-story-layout="gallery"] .viewer__story::after { background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--brand-bg) 88%, transparent)); }
.viewer[data-story-layout="gallery"] .viewer__story::before { opacity: 0.22; mix-blend-mode: multiply; }
.st-gallery { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.72fr); align-items: center; gap: clamp(30px, 5vw, 78px); padding: clamp(30px, 5vw, 74px) clamp(28px, 6vw, 88px); color: var(--brand-ink); }
.st-gallery__ambient {
  position: absolute;
  inset: 10% 4% auto 4%;
  height: 62%;
  pointer-events: none;
  border-top: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(0,0,0,0.055) 18% 18.2%, transparent 18.2% 100%),
    linear-gradient(180deg, rgba(255,255,255,0.36), transparent 46%);
}
.st-gallery__wall { display: grid; place-items: center; }
.st-gallery__frame { width: 100%; padding: clamp(14px, 1.6vw, 26px); background: #fff; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 40px 90px rgba(35,28,18,0.18), 0 4px 10px rgba(0,0,0,0.06); }
.st-gallery__frame .story-preview { border: 0; border-radius: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); background: #faf8f3; }
.st-gallery__frame .story-preview__still { opacity: 0.96; filter: none; }
.st-gallery__frame .story-preview__scan { display: none; }
.st-gallery__frame .story-preview__label { color: #6b5f4c; }
.st-gallery__plaque { display: flex; flex-direction: column; gap: 12px; }
.st-gallery__idx { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--accent); }
.st-gallery__name { font-family: var(--brand-type); font-weight: 520; font-size: clamp(40px, 5vw, 76px); line-height: 0.96; letter-spacing: -0.04em; }
.st-gallery__piece { font-size: clamp(16px, 1.4vw, 20px); color: color-mix(in srgb, var(--brand-ink) 72%, #fff); }
.st-gallery__meta { display: grid; gap: 0; border-top: 1px solid rgba(0,0,0,0.12); margin-top: 6px; }
.st-gallery__meta div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid rgba(0,0,0,0.1); }
.st-gallery__meta dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: color-mix(in srgb, var(--brand-ink) 55%, #fff); }
.st-gallery__meta dd { font-size: 13px; text-align: right; color: var(--brand-ink); }
.st-gallery__note { font-style: italic; font-size: 14px; color: color-mix(in srgb, var(--brand-ink) 62%, #fff); }
.viewer[data-story-layout="gallery"] .story-cta { align-self: flex-start; background: var(--brand-ink); color: var(--brand-bg); border-radius: 0; margin-top: 6px; }

/* ---------- 04 · blueprint (Vant) ---------- */
.viewer[data-story-layout="blueprint"] .viewer__story {
  background:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    radial-gradient(80% 80% at 86% 0%, rgba(47,124,255,0.28), transparent 60%),
    var(--brand-bg);
  background-size: 32px 32px, 32px 32px, auto, auto;
}
.st-blueprint { display: flex; flex-direction: column; gap: clamp(18px, 3vw, 32px); padding: clamp(22px, 3.4vw, 46px) clamp(22px, 4vw, 64px); font-family: var(--font-mono); }
.st-blueprint__map {
  position: absolute;
  right: 6vw;
  top: 10vh;
  width: min(34vw, 520px);
  height: min(24vh, 240px);
  pointer-events: none;
  opacity: 0.34;
  background:
    linear-gradient(90deg, transparent 0 25%, var(--accent) 25% 25.3%, transparent 25.3% 100%),
    linear-gradient(0deg, transparent 0 48%, var(--accent) 48% 48.3%, transparent 48.3% 100%);
}
.st-blueprint__map i {
  position: absolute;
  width: 54px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--brand-surface) 44%, transparent);
}
.st-blueprint__map i:nth-child(1) { left: 0; top: 10%; }
.st-blueprint__map i:nth-child(2) { left: 38%; top: 2%; }
.st-blueprint__map i:nth-child(3) { right: 0; top: 50%; }
.st-blueprint__map i:nth-child(4) { left: 24%; bottom: 0; }
.st-blueprint__head { display: flex; align-items: baseline; gap: 18px; border-bottom: 1px dashed color-mix(in srgb, var(--accent) 40%, rgba(255,255,255,0.2)); padding-bottom: 14px; }
.st-blueprint__code { font-family: var(--font-display); font-weight: 680; font-size: clamp(40px, 5.5vw, 86px); letter-spacing: -0.04em; line-height: 1; }
.st-blueprint__ver { margin-left: auto; font-size: 11px; letter-spacing: 0.16em; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); padding: 5px 10px; border-radius: 3px; }
.st-blueprint__grid { flex: 1; display: grid; grid-template-columns: minmax(0, 0.72fr) minmax(420px, 1.28fr); gap: clamp(24px, 4vw, 56px); align-items: stretch; }
.st-blueprint__col { display: flex; flex-direction: column; gap: 16px; min-width: 0; justify-content: center; }
.st-blueprint__desc { font-family: var(--font-body); font-size: clamp(15px, 1.3vw, 18px); line-height: 1.55; color: color-mix(in srgb, var(--brand-ink) 80%, var(--brand-bg)); max-width: 44ch; }
.st-blueprint__specs { width: 100%; border-collapse: collapse; }
.st-blueprint__specs tr { border-bottom: 1px solid rgba(255,255,255,0.12); }
.st-blueprint__specs th { text-align: left; padding: 12px 0; font-size: 10px; letter-spacing: 0.14em; color: color-mix(in srgb, var(--brand-ink) 52%, transparent); font-weight: 500; width: 34%; }
.st-blueprint__specs td { padding: 12px 0; font-family: var(--font-display); font-size: 16px; color: var(--brand-ink); }
.st-blueprint__note { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: color-mix(in srgb, var(--accent) 72%, #fff); }
.st-blueprint__render { position: relative; padding: 22px; display: flex; align-items: center; }
.st-blueprint__render .story-preview { border-radius: 2px; box-shadow: 0 0 0 1px rgba(47,124,255,0.3), 0 40px 100px rgba(0,20,70,0.5); }
.st-blueprint__render .reg { position: absolute; width: 16px; height: 16px; border: 1.5px solid var(--accent); z-index: 4; }
.st-blueprint__render .reg--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.st-blueprint__render .reg--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.st-blueprint__render .reg--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.st-blueprint__render .reg--br { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.viewer[data-story-layout="blueprint"] .story-cta { border-radius: 3px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; align-self: flex-start; }

/* ---------- 06 · editorial (Conutric) — deep-green magazine, preview LEFT ---------- */
.viewer[data-story-layout="editorial"] .viewer__story {
  background:
    radial-gradient(80% 60% at 82% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 58%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand-bg) 86%, #000) 0%, var(--brand-bg) 100%);
  color: var(--brand-ink);
}
.viewer[data-story-layout="editorial"] .viewer__story-bg { opacity: 0.08; filter: grayscale(0.4) brightness(0.5); }
.viewer[data-story-layout="editorial"] .viewer__story::before {
  mix-blend-mode: screen; opacity: 0.55;
  background: radial-gradient(58% 70% at 88% 6%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%);
}
.st-editorial { display: flex; flex-direction: column; gap: clamp(16px, 2.4vw, 32px); padding: clamp(22px, 3.2vw, 50px) clamp(28px, 5vw, 76px); }
.st-editorial__seal {
  position: absolute;
  right: clamp(26px, 5vw, 76px);
  bottom: clamp(28px, 5vh, 62px);
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: color-mix(in srgb, var(--accent) 74%, var(--brand-ink));
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  opacity: 0.35;
  transform: rotate(-8deg);
  pointer-events: none;
}
.st-editorial__masthead { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.st-editorial__title { font-family: var(--brand-type); font-weight: 700; font-size: clamp(22px, 2.6vw, 40px); letter-spacing: 0.14em; text-transform: uppercase; }
.st-editorial__rule { height: 2px; background: linear-gradient(90deg, var(--brand-ink), color-mix(in srgb, var(--accent) 75%, transparent)); }
.st-editorial__issue { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--accent); }
.st-editorial__body { flex: 1; display: grid; grid-template-columns: minmax(300px, 0.94fr) minmax(0, 1fr); gap: clamp(30px, 4vw, 64px); align-items: center; }
.st-editorial__plate { position: relative; margin: 0; }
.st-editorial__plate .story-preview { border-radius: 0; border: 1px solid color-mix(in srgb, var(--accent) 28%, rgba(255,255,255,0.14)); box-shadow: 20px 22px 0 color-mix(in srgb, var(--accent) 24%, transparent), 0 40px 90px rgba(0,0,0,0.5); }
.st-editorial__folio { position: absolute; z-index: 4; top: -0.44em; left: -0.12em; font-family: var(--brand-type); font-weight: 800; font-size: clamp(84px, 12vw, 186px); line-height: 0.8; color: transparent; -webkit-text-stroke: 2px color-mix(in srgb, var(--accent) 80%, transparent); opacity: 0.92; pointer-events: none; }
.st-editorial__lead { display: flex; flex-direction: column; gap: clamp(14px, 1.8vw, 24px); min-width: 0; }
.st-editorial__kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }
.st-editorial__headline { font-family: var(--brand-type); font-weight: 600; font-size: clamp(32px, 4.6vw, 72px); line-height: 1.0; letter-spacing: -0.035em; max-width: 15ch; }
.st-editorial__headline::first-line { color: color-mix(in srgb, var(--accent) 55%, var(--brand-ink)); }
.st-editorial__index { list-style: none; display: grid; gap: 0; border-top: 1px solid color-mix(in srgb, var(--brand-ink) 24%, transparent); }
.st-editorial__index li { display: flex; align-items: baseline; gap: 16px; padding: 11px 0; border-bottom: 1px solid color-mix(in srgb, var(--brand-ink) 14%, transparent); font-size: clamp(15px, 1.4vw, 19px); transition: padding-left var(--duration-fast) ease, color var(--duration-fast) ease; }
.st-editorial__index li:hover { padding-left: 10px; color: var(--accent); }
.st-editorial__index span { font-family: var(--font-mono); font-size: 11px; color: var(--accent); min-width: 22px; }
.st-editorial__index em { font-style: normal; }
.viewer[data-story-layout="editorial"] .story-cta { background: var(--accent); color: color-mix(in srgb, var(--brand-bg) 84%, #000); border-radius: 0; align-self: flex-start; font-weight: 700; }
.st-editorial__colophon { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid color-mix(in srgb, var(--brand-ink) 20%, transparent); padding-top: 14px; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: color-mix(in srgb, var(--brand-ink) 58%, transparent); }

/* ---------- 07 · system (Prisma) — living design console ---------- */
.viewer[data-story-layout="system"] .viewer__story {
  background:
    radial-gradient(90% 70% at 86% 4%, rgba(168,112,255,0.34), transparent 60%),
    radial-gradient(70% 60% at 4% 100%, rgba(45,242,208,0.2), transparent 60%),
    var(--brand-bg);
}
.st-system { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: clamp(12px, 1.6vw, 20px); padding: clamp(18px, 2.6vw, 36px) clamp(22px, 4vw, 64px); }
.st-system__aura { position: absolute; z-index: 0; inset: -30%; pointer-events: none; background: conic-gradient(from 0deg at 42% 32%, rgba(168,112,255,0.3), rgba(45,242,208,0.2), rgba(255,207,74,0.16), rgba(168,112,255,0.3)); filter: blur(66px); opacity: 0.7; animation: systemAura 24s linear infinite; }
.st-system__prism {
  position: absolute;
  z-index: 0;
  right: 5vw;
  top: 14vh;
  width: min(32vw, 440px);
  aspect-ratio: 1.8 / 1;
  pointer-events: none;
  opacity: 0.46;
  clip-path: polygon(0 56%, 30% 0, 100% 20%, 76% 100%, 26% 86%);
  background: linear-gradient(115deg, rgba(168,112,255,0.92), rgba(45,242,208,0.45) 48%, rgba(255,207,74,0.72));
  filter: blur(0.3px) drop-shadow(0 0 38px rgba(168,112,255,0.45));
}
@keyframes systemAura { to { transform: rotate(360deg); } }
.st-system > *:not(.st-system__aura):not(.st-system__prism):not(.story-world) { position: relative; z-index: 1; }
.st-system__head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 20px; }
.st-system__title { display: flex; flex-direction: column; gap: 8px; }
.st-system__badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-accent-2); border: 1px solid color-mix(in srgb, var(--brand-accent-2) 40%, transparent); border-radius: 999px; padding: 5px 12px; }
.st-system__badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-accent-2); box-shadow: 0 0 10px var(--brand-accent-2); animation: consolePulse 1.5s ease-in-out infinite; }
.st-system__name { font-family: var(--brand-type); font-weight: 500; font-size: clamp(44px, 6vw, 100px); letter-spacing: -0.04em; line-height: 0.9; }
.st-system__sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--brand-accent-2); }
.st-system__spectrum { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.st-system__spectrum .sw { position: relative; width: 46px; height: 58px; border-radius: 8px; background: var(--sw); box-shadow: 0 10px 30px -8px var(--sw), inset 0 0 0 1px rgba(255,255,255,0.16); transition: transform var(--duration-fast) ease, height var(--duration-fast) ease; }
.st-system__spectrum .sw:hover { transform: translateY(-4px); height: 66px; }
.st-system__spectrum .sw b { position: absolute; left: 3px; right: 3px; bottom: 5px; text-align: center; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.01em; color: #fff; mix-blend-mode: difference; }
.st-system__grid { flex: 1; display: grid; grid-template-columns: minmax(190px, 0.42fr) minmax(520px, 1.58fr); gap: clamp(18px, 2.5vw, 34px); align-items: center; min-height: 0; }
.st-system__tokens { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-content: center; }
.st-system__tokens .tok { position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 16px; background: color-mix(in srgb, var(--brand-surface) 55%, transparent); backdrop-filter: blur(8px); transition: border-color var(--duration-fast) ease, transform var(--duration-fast) ease; }
.st-system__tokens .tok:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); transform: translateY(-3px); }
.st-system__tokens .tok::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 52%); opacity: 0; transition: opacity var(--duration-fast) ease; }
.st-system__tokens .tok:hover::after { opacity: 1; }
.st-system__tokens .tok__k { position: relative; z-index: 1; display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--accent); }
.st-system__tokens .tok__v { position: relative; z-index: 1; display: block; margin-top: 6px; font-family: var(--font-display); font-size: 17px; color: var(--brand-ink); }
.st-system__canvas { align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 0; }
.st-system__canvas .story-preview { max-width: min(100%, 960px); margin-inline: auto; border-radius: 14px; background: linear-gradient(135deg, rgba(45,242,208,0.12), transparent 34%), var(--brand-surface); box-shadow: 0 34px 110px rgba(0,0,0,0.5), 0 0 80px -30px var(--accent); }
.st-system__foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 18px; }
.st-system__foot p { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: color-mix(in srgb, var(--brand-ink) 72%, transparent); }
.viewer[data-story-layout="system"] .story-cta { border-radius: 10px; box-shadow: 0 14px 40px -12px var(--accent), 0 0 30px -10px var(--brand-accent-2); }

/* ---------- 08 · craft (Hulkinho) ---------- */
.viewer[data-story-layout="craft"] .viewer__story { background: var(--brand-bg); color: var(--brand-ink); }
.viewer[data-story-layout="craft"] .viewer__story-bg { opacity: 0.12; filter: sepia(0.3); }
.viewer[data-story-layout="craft"] .viewer__story::after { background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--brand-bg) 90%, transparent)); }
.viewer[data-story-layout="craft"] .viewer__story::before { mix-blend-mode: multiply; opacity: 0.18; }
.st-craft { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.1fr); align-items: center; gap: clamp(28px, 5vw, 70px); padding: clamp(28px, 5vw, 68px) clamp(28px, 5vw, 82px); }
.st-craft__threads {
  position: absolute;
  inset: auto 4vw 10vh auto;
  width: min(34vw, 460px);
  height: 180px;
  pointer-events: none;
  opacity: 0.34;
}
.st-craft__threads i {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 12px, color-mix(in srgb, var(--accent) 35%, transparent) 12px 24px);
  border-radius: 999px;
  transform-origin: center;
}
.st-craft__threads i:nth-child(1) { top: 24%; transform: rotate(-8deg); }
.st-craft__threads i:nth-child(2) { top: 50%; transform: rotate(4deg); background: repeating-linear-gradient(90deg, var(--brand-accent-2) 0 10px, transparent 10px 20px); }
.st-craft__threads i:nth-child(3) { top: 72%; transform: rotate(-2deg); }
.st-craft__tag { position: relative; background: var(--brand-surface); border: 1px dashed color-mix(in srgb, var(--accent) 46%, rgba(0,0,0,0.2)); border-radius: 18px; padding: clamp(26px, 3vw, 42px); padding-top: 44px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 26px 70px rgba(23,37,18,0.16); }
.st-craft__hole { position: absolute; top: 16px; left: 24px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand-bg); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 50%, rgba(0,0,0,0.2)); }
.st-craft__stamp { align-self: flex-start; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--brand-bg); background: var(--accent); padding: 4px 10px; border-radius: 4px; }
.st-craft__name { font-family: var(--brand-type); font-weight: 600; font-size: clamp(40px, 5vw, 74px); line-height: 0.94; letter-spacing: -0.03em; }
.st-craft__sub { font-size: 16px; color: color-mix(in srgb, var(--brand-ink) 72%, #fff); }
.st-craft__details { display: grid; gap: 0; margin-top: 4px; }
.st-craft__details div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--accent) 24%, rgba(0,0,0,0.1)); }
.st-craft__details dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: color-mix(in srgb, var(--brand-ink) 56%, #fff); }
.st-craft__details dd { font-size: 14px; color: var(--brand-ink); }
.st-craft__photo { margin: 0; transform: rotate(-2.2deg); transition: transform 0.5s cubic-bezier(0.22,1,0.36,1); }
.st-craft__photo:hover { transform: rotate(0deg); }
.st-craft__photo .story-preview { border: 10px solid var(--brand-surface); border-radius: 20px; box-shadow: 0 30px 80px rgba(23,37,18,0.2); background: #fff; }
.st-craft__photo .story-preview__still { opacity: 0.98; filter: none; }
.st-craft__photo .story-preview__scan { display: none; }
.viewer[data-story-layout="craft"] .story-cta { border-radius: 100px; align-self: flex-start; margin-top: 6px; }

/* ---------- project chrome: the viewer shell is part of the identity too ---------- */
.viewer[data-project="tradeflow"] .viewer__bar {
  background: linear-gradient(90deg, #160710, #24101b 55%, #160710);
  border-bottom-style: dashed;
}
.viewer[data-project="tradeflow"] .viewer__name,
.viewer[data-project="tradeflow"] .viewer__type,
.viewer[data-project="tradeflow"] .viewer__action,
.viewer[data-project="tradeflow"] .viewer__route { font-family: var(--font-mono); }
.viewer[data-project="tradeflow"] .viewer__type { border-radius: 4px; }

.viewer[data-project="mainstage"] .viewer__bar {
  min-height: 72px;
  background: #c40000;
  border-bottom: 4px solid #111;
}
.viewer[data-project="mainstage"] .viewer__name { font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; }
.viewer[data-project="mainstage"] .viewer__type,
.viewer[data-project="mainstage"] .viewer__action,
.viewer[data-project="mainstage"] .viewer__route { border-radius: 0; border-width: 2px; font-weight: 700; }

.viewer[data-project="tecksart"] .viewer__bar {
  min-height: 72px;
  background: #f2efe8;
  border-bottom-color: rgba(21,18,13,0.18);
  color: #15120d;
}
.viewer[data-project="tecksart"] .viewer__mark,
.viewer[data-project="tecksart"] .viewer__name,
.viewer[data-project="tecksart"] .viewer__action { color: #15120d; }
.viewer[data-project="tecksart"] .viewer__type,
.viewer[data-project="tecksart"] .viewer__action,
.viewer[data-project="tecksart"] .viewer__route { border-radius: 0; border-color: rgba(21,18,13,0.22); }

.viewer[data-project="vant"] .viewer__bar {
  background: #061c49;
  border-bottom-color: rgba(47,124,255,0.55);
  box-shadow: 0 8px 28px rgba(0,16,70,0.35);
}
.viewer[data-project="vant"] .viewer__name { font-weight: 700; letter-spacing: 0.02em; }
.viewer[data-project="vant"] .viewer__type,
.viewer[data-project="vant"] .viewer__action,
.viewer[data-project="vant"] .viewer__route { border-radius: 4px; }

.viewer[data-project="conutric"] .viewer__bar {
  background: #0e2019;
  border-bottom-color: rgba(240,165,0,0.5);
}
.viewer[data-project="conutric"] .viewer__name { letter-spacing: 0.12em; text-transform: uppercase; }
.viewer[data-project="conutric"] .viewer__type,
.viewer[data-project="conutric"] .viewer__action,
.viewer[data-project="conutric"] .viewer__route { border-radius: 0; }

.viewer[data-project="prisma"] .viewer__bar {
  background: linear-gradient(90deg, #13082f, #21104d 50%, #13082f);
  border-bottom-color: rgba(168,112,255,0.72);
}
.viewer[data-project="prisma"] .viewer__name { font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.viewer[data-project="prisma"] .viewer__type,
.viewer[data-project="prisma"] .viewer__action,
.viewer[data-project="prisma"] .viewer__route { border-radius: 8px; }

.viewer[data-project="hulk"] .viewer__bar {
  background: rgba(248,244,233,0.94);
  border-bottom-color: rgba(65,171,82,0.36);
  color: #172512;
}
.viewer[data-project="hulk"] .viewer__mark,
.viewer[data-project="hulk"] .viewer__name,
.viewer[data-project="hulk"] .viewer__action { color: #172512; }
.viewer[data-project="hulk"] .viewer__type,
.viewer[data-project="hulk"] .viewer__action,
.viewer[data-project="hulk"] .viewer__route { border-radius: 12px; border-style: dashed; border-color: rgba(65,171,82,0.44); }

/* The live canvas inherits the same framing language as its surrounding world. */
.viewer[data-project="tradeflow"] .story-preview { border-left: 4px solid var(--accent); border-radius: 4px; }
.viewer[data-project="vant"] .story-preview { border-width: 2px; box-shadow: 0 0 0 7px rgba(47,124,255,0.08), 0 30px 80px rgba(0,20,70,0.48); }
.viewer[data-project="prisma"] .story-preview { border-radius: 18px; box-shadow: 0 0 0 1px rgba(45,242,208,0.22), 0 28px 90px rgba(0,0,0,0.48), 0 0 64px -24px var(--accent); }

.viewer[data-story-layout] .viewer__story-bg.is-atmosphere {
  opacity: 0.82;
  filter: saturate(1.16) contrast(1.06);
}
.viewer[data-story-layout="gallery"] .viewer__story-bg.is-atmosphere,
.viewer[data-story-layout="craft"] .viewer__story-bg.is-atmosphere {
  opacity: 0.64;
  filter: saturate(1.08) contrast(1.02);
}
.viewer[data-story-layout="poster"] .viewer__story-bg.is-atmosphere {
  opacity: 0.9;
}
.viewer[data-story-layout="system"] .viewer__story-bg.is-atmosphere,
.viewer[data-story-layout="blueprint"] .viewer__story-bg.is-atmosphere {
  opacity: 0.78;
}

/* ---------- opening layouts · mobile/tablet collapse ---------- */
@media (max-width: 860px) {
  .st-console__grid,
  .st-poster,
  .st-blueprint__grid,
  .st-editorial__body,
  .st-system__grid,
  .st-gallery,
  .st-craft { grid-template-columns: 1fr; align-items: stretch; }
  .viewer__story-inner > * { height: auto; }
  .st-console,
  .st-poster,
  .st-gallery,
  .st-blueprint,
  .st-editorial,
  .st-system,
  .st-craft {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }
  .st-console, .st-blueprint, .st-editorial, .st-system { gap: 20px; }
  .st-console__monitor, .st-blueprint__render, .st-system__canvas { align-self: auto; }
  /* phone-format preview: the demo renders its REAL mobile layout inside
     (see project-viewer.js scalePreviewFrame) — tall, legible, tappable */
  .story-preview {
    max-width: 100%;
    aspect-ratio: 3 / 4;
    max-height: min(54vh, 500px);
  }
  .story-preview__tap { display: inline-flex; }
  .st-poster__name { font-size: clamp(56px, 17vw, 100px); }
  .st-system__tokens { grid-template-columns: repeat(2, 1fr); }
  .st-system__head { grid-template-columns: 1fr; }
  .st-editorial__masthead { grid-template-columns: auto auto; justify-content: space-between; }
  .st-editorial__rule { display: none; }
  .st-editorial__folio { font-size: clamp(60px, 16vw, 90px); }
  .st-console__network,
  .st-poster__lights,
  .st-gallery__ambient,
  .st-blueprint__map,
  .st-editorial__seal,
  .st-system__prism,
  .st-system__aura,
  .st-craft__threads,
  .story-world { display: none; }
}

/* short viewports (notebooks, split-screen, fullscreen on laptop) — keep the
   two-column intros compact so the preview shows cleanly without scrolling */
@media (min-width: 861px) and (max-height: 920px) {
  .st-console, .st-blueprint, .st-editorial, .st-system {
    gap: clamp(12px, 2vh, 22px);
    padding-top: clamp(16px, 2.6vh, 32px);
    padding-bottom: clamp(16px, 2.6vh, 32px);
  }
  .st-poster, .st-gallery, .st-craft {
    padding-top: clamp(18px, 2.8vh, 36px);
    padding-bottom: clamp(18px, 2.8vh, 36px);
  }
  .story-preview { max-width: min(100%, 880px); }
  .st-poster__name { font-size: clamp(56px, 10vh, 112px); }
  .st-poster__lineup { gap: 3px; }
  .st-system__spectrum .sw { width: 38px; height: 48px; }
  .st-blueprint__code { font-size: clamp(38px, 7vh, 72px); }
  .st-console__log li { padding-block: 8px; }
  .st-console__name { font-size: clamp(42px, 10vh, 74px); }
  .st-gallery__name { font-size: clamp(38px, 8vh, 64px); }
  .st-editorial__headline { font-size: clamp(30px, 7vh, 56px); }
  .st-editorial__index li { padding-block: 8px; }
  .st-system__name { font-size: clamp(38px, 9vh, 74px); }
  .st-system__tokens .tok { padding: 10px 12px; }
  .st-system__tokens .tok__v { font-size: 15px; }
  .st-system > .st-system__foot {
    position: absolute !important;
    right: clamp(22px, 4vw, 64px);
    bottom: clamp(12px, 2.4vh, 22px);
    z-index: 5;
    border-top: 0;
    padding-top: 0;
  }
  .st-system__foot p { display: none; }
  .st-system__canvas .story-preview { max-width: min(100%, 880px); }
  .st-craft__name { font-size: clamp(38px, 8vh, 62px); }
}

/* cinematic accent curtain that wipes away on open (per-project colour) */
.viewer__curtain {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #000) 0%, var(--accent) 62%, color-mix(in srgb, var(--accent) 80%, #000) 100%);
  will-change: transform;
}

/* FLIP ghost used during the opening transition */
.viewer-ghost {
  position: fixed;
  z-index: calc(var(--z-viewer) + 1);
  object-fit: cover;
  border-radius: var(--radius-md);
  pointer-events: none;
  will-change: transform, width, height;
}

/* ---------- video lightbox ---------- */
.video-lightbox {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-viewer) + 20);
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 42px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms;
}
.video-lightbox.is-open { opacity: 1; visibility: visible; }
.video-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(18px);
}
.video-lightbox__panel {
  position: relative;
  width: min(1320px, 96vw);
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255,255,255,0.18);
  background: var(--black);
  box-shadow: 0 40px 140px rgba(0,0,0,0.64);
  opacity: 0;
  transform: translateY(28px) scale(0.94);
  transition: opacity 300ms ease, transform 420ms var(--ease-out-expo), border-color 300ms ease;
}
.video-lightbox.is-open .video-lightbox__panel {
  opacity: 1;
  transform: none;
}
.video-lightbox__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--black);
}
.video-lightbox__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 50%;
  background: rgba(5,5,5,0.58);
  color: var(--white);
  backdrop-filter: blur(10px);
}
.video-lightbox__close svg { width: 16px; height: 16px; }

/* ---------- cinematic scene HUD ---------- */
.scene-hud {
  position: fixed;
  left: clamp(18px, 2vw, 34px);
  top: 50%;
  z-index: 90;
  transform: translateY(-50%);
  display: grid;
  grid-template-rows: auto minmax(72px, 13vh) auto;
  justify-items: center;
  gap: 12px;
  pointer-events: none;
  color: rgba(255,255,255,0.72);
  mix-blend-mode: difference;
}
.scene-hud__index,
.scene-hud__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.scene-hud__label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: rgba(255,255,255,0.48);
}
.scene-hud__track {
  position: relative;
  width: 1px;
  height: 100%;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}
.scene-hud__track i {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleY(0.08);
  transform-origin: top;
  background: rgba(255,255,255,0.92);
}
@media (max-width: 899px) {
  .scene-hud { display: none; }
}
