/* Exhibit: the stage floats on the white field as a framed window; the guide sits beside it on desktop
   and becomes a bottom sheet on phones. The light runs out from behind the stage. */

@property --iris {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.exhibit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  height: 100%;
}

.stage {
  position: relative;
  margin: 6px 0 28px 28px;
  min-height: 0;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
  background: #e9eaec;
  box-shadow: 0 0 0 1px rgba(11, 11, 12, .06), 0 2px 6px rgba(11, 11, 12, .05), 0 30px 70px -24px rgba(11, 11, 12, .28);
}
#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Chrome on the stage: small white pills that read on any scene colour. */
.stage-meta, .stage-foot {
  position: absolute;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 2;
}
.stage-meta { top: 16px; }
.stage-foot { bottom: 16px; }
.stage-foot > * { pointer-events: auto; }
.meta-name, .meta-mode, .meta-backend {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: pre;
  color: var(--ink);
}
.meta-mode::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
}
.meta-mode.is-reveal { background: var(--ink); color: var(--paper); }
.meta-mode.is-reveal::before { border: 0; background: conic-gradient(#35d7ff, #7a7bff, #ff5fd2, #ffcf3f, #4fe6b4, #35d7ff); }
.meta-backend { margin-left: auto; pointer-events: none; color: var(--ink-3); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.meta-backend:empty { display: none; }
.play-btn { min-width: 112px; min-height: 44px; justify-content: flex-start; padding: 0 18px 0 14px; }
.play-icon { display: inline-grid; }
.play-icon .icon { width: 18px; height: 18px; }
.play-btn:hover .icon { transform: none; }

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 76px;
  transform: translate(-50%, 8px);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--shadow-lift);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
  z-index: 2;
}
.drag-hint.is-on { opacity: 1; transform: translate(-50%, 0); }
.drag-hint .icon { animation: nudge 1.6s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateX(5px); } }

/* Iris veil: a white shutter with a dispersion fringe at its edge, like light round an aperture. */
.veil {
  --iris: 90vmax;
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%,
    transparent var(--iris),
    rgba(53, 215, 255, .9) calc(var(--iris) + 1px),
    rgba(122, 123, 255, .85) calc(var(--iris) + 4px),
    rgba(255, 95, 210, .8) calc(var(--iris) + 7px),
    rgba(255, 207, 63, .75) calc(var(--iris) + 10px),
    #f6f6f7 calc(var(--iris) + 16px));
  transition: --iris .5s cubic-bezier(.6, 0, .2, 1);
}
.veil.is-closed { --iris: -20px; pointer-events: auto; transition-duration: .3s; }
.veil.is-instant { transition: none; }
.veil-body {
  grid-area: 1 / 1;
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
  opacity: 0;
  transition: opacity .15s;
}
.veil.is-closed .veil-body { opacity: 1; transition: opacity .25s .3s; }
.veil.is-closed.is-instant .veil-body { transition-delay: .55s; }
.veil.has-error .veil-body { display: none; }
.veil-art { display: grid; place-items: center; width: 100%; }
.veil-plate, .zoom-plate { width: 26%; max-width: 132px; height: auto; }
.veil-plate { animation: breathe 1.8s var(--ease) infinite alternate; }
@keyframes breathe { to { transform: scale(.94); opacity: .75; } }
.veil-label { font-size: 15px; font-weight: 550; color: var(--ink-2); text-align: center; padding: 0 16px; }
.veil-progress { display: flex; align-items: center; gap: 12px; }
.veil-bar { width: 180px; height: 2px; border-radius: 2px; background: var(--hair-2); overflow: hidden; }
.veil-fill { --p: 0; display: block; height: 100%; background: var(--ink); transform: scaleX(var(--p)); transform-origin: left; transition: transform .2s; }
.veil-pct { font-family: var(--mono); font-size: 10.5px; min-width: 36px; color: var(--ink-3); }

.veil-error {
  grid-area: 1 / 1;
  display: none;
  max-width: 420px;
  margin: 16px;
  padding: 26px;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow-lift);
  gap: 12px;
  justify-items: start;
}
.veil.has-error .veil-error { display: grid; }
.veil-err-title { font-weight: 650; font-size: 22px; letter-spacing: -.03em; }
.veil-err-msg { color: var(--ink-2); font-size: 15px; }

.zoom {
  position: fixed;
  z-index: 50;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: #f6f6f7;
  box-shadow: var(--shadow-lift);
  pointer-events: none;
}

/* Guide */
.guide {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 32px 24px;
  outline: none;
}
.guide-inner { display: flex; flex-direction: column; gap: 26px; min-height: 100%; }

.g-head { display: flex; align-items: flex-start; gap: 16px; }
.g-mark { flex: none; width: 50px; height: 50px; margin-top: 4px; }
.g-mark .mark { display: block; width: 100%; height: 100%; }
.g-headings { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.g-count { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.g-title {
  font-weight: 620;
  font-size: 38px;
  line-height: .95;
  letter-spacing: -.045em;
  outline: none;
}
.g-hook { color: var(--ink-2); font-size: 15px; line-height: 1.4; margin-top: 4px; }

.sheet-toggle { display: none; }

/* Steps: four segments; the active one carries a band of film colour. */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.step-tab {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 0 4px;
  background: none;
  border: 0;
  color: var(--ink-4);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: color .2s;
}
.step-tab::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--hair-2);
  transition: background-color .3s;
}
.step-tab:hover { color: var(--ink); }
.step-n { font-family: var(--mono); font-size: 10.5px; }
.step-tab.is-done { color: var(--ink-2); }
.step-tab.is-done::before { background: var(--ink); }
.step-tab[aria-current="step"] { color: var(--ink); }
.step-tab[aria-current="step"]::before { background: var(--film); background-size: 200% 100%; animation: film-run 6s linear infinite; }
@keyframes film-run { to { background-position: -200% 0; } }

.step-card { display: flex; flex-direction: column; gap: 14px; }
.step-kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.step-body { display: flex; flex-direction: column; gap: 12px; }
.step-text { font-size: 23px; line-height: 1.28; letter-spacing: -.02em; font-weight: 450; }
.step-small { font-size: 16.5px; line-height: 1.45; letter-spacing: -.008em; color: var(--ink-2); }
.step-credit { font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--ink-3); }
.step-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; }

.guide-more { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

.adjust { border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); padding: 0 18px; }
.adjust-toggle {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.adjust-chev { width: 18px; height: 18px; transform: rotate(180deg); transition: transform .2s var(--ease); }
.adjust-toggle[aria-expanded="true"] .adjust-chev { transform: none; }
.adjust-body { padding: 2px 0 16px; }

.ctl-list { display: flex; flex-direction: column; gap: 14px; }
.ctl-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 600; }
.ctl-value { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.ctl-range input {
  width: 100%;
  height: 40px;
  margin: 0;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.ctl-range input::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: var(--hair-2); }
.ctl-range input::-moz-range-track { height: 3px; border-radius: 3px; background: var(--hair-2); }
.ctl-range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9.5px;
  border-radius: 50%;
  background: var(--ink);
  border: 4px solid var(--paper);
  box-shadow: 0 0 0 1px rgba(11, 11, 12, .12), 0 2px 6px rgba(11, 11, 12, .2);
}
.ctl-range input::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); }
.ctl-range input:focus-visible { outline: none; }
.ctl-range input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.ctl-range input:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus); }

.ctl-choice legend { padding: 0; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.segs { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 999px; background: #eeeff1; }
.seg { flex: 1 1 auto; position: relative; display: grid; place-items: center; min-height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 550; color: var(--ink-3); transition: background-color .2s, color .2s; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg:hover { color: var(--ink); }
.seg:has(input:checked) { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.seg:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; z-index: 1; }

.switch {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.switch-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: #dfe0e3; flex: none; transition: background-color .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgba(11, 11, 12, .25); transition: transform .25s var(--ease); }
.switch[aria-checked="true"] .switch-track { background: var(--ink); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(18px); }

.keys-hint { font-family: var(--mono); font-size: 10px; line-height: 1.6; color: var(--ink-4); }

.g-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.foot-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  max-width: 100%;
  transition: box-shadow .2s;
}
.foot-link.is-empty { visibility: hidden; }
.foot-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-link:hover { box-shadow: var(--shadow-lift); }
.foot-link .icon { width: 16px; height: 16px; }
.foot-prev { justify-self: start; }
.foot-next { justify-self: end; }
.foot-progress { display: grid; justify-items: center; gap: 6px; }
.foot-segs { display: flex; gap: 4px; }
.seg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hair-2); }
.seg-dot.is-done { background: var(--ink-3); }
.seg-dot.is-on { width: 18px; border-radius: 6px; background: var(--ink); }
.foot-count { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

/* Phone: the stage stays big, the guide becomes a bottom sheet. */
@media (max-width: 760px) {
  :root { --peek: 272px; }
  .exhibit { grid-template-columns: 1fr; }
  .stage { margin: 2px 10px calc(var(--peek) - 14px); border-radius: 22px; }
  .stage-meta { top: 10px; left: 10px; right: 10px; }
  .stage-foot { bottom: 24px; left: 10px; right: 10px; }
  .meta-name { display: none; }
  .meta-mode { margin-left: auto; }
  .drag-hint { bottom: 80px; }

  .guide {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: var(--peek);
    padding: 22px 18px calc(14px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    background: var(--paper);
    box-shadow: 0 -1px 0 rgba(11, 11, 12, .06), 0 -18px 40px -12px rgba(11, 11, 12, .18);
    transition: height .36s var(--ease), box-shadow .36s;
  }
  .guide::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 4px;
    background: var(--hair-2);
  }
  .guide.is-open { height: min(84dvh, 720px); box-shadow: 0 -1px 0 rgba(11, 11, 12, .06), 0 -30px 70px -10px rgba(11, 11, 12, .3); }
  .guide-inner { gap: 14px; }
  .g-head { align-items: center; gap: 12px; }
  .g-mark { width: 34px; height: 34px; margin-top: 0; }
  .g-headings { gap: 2px; }
  .g-title { font-size: 26px; }
  .g-hook, .g-count { display: none; }
  .guide.is-open .g-count { display: block; }
  .guide.is-open .g-hook { display: block; font-size: 14px; }
  .sheet-toggle {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border: 0;
    border-radius: 999px;
    background: #f1f2f4;
  }
  .sheet-chev { transition: transform .25s var(--ease); }
  .sheet-toggle[aria-expanded="true"] .sheet-chev { transform: rotate(180deg); }
  .steps { gap: 4px; }
  .step-tab { font-size: 13px; gap: 5px; padding-top: 10px; }
  .step-card { gap: 8px; }
  .step-kicker { font-size: 10px; }
  .step-text { font-size: 17px; line-height: 1.32; }
  .step-small { font-size: 15px; }
  .step-actions { gap: 8px; padding-top: 4px; }
  .step-actions .btn { flex: 1 1 auto; min-height: 48px; padding: 0 16px; font-size: 14.5px; justify-content: space-between; }
  .guide:not(.is-open) .guide-more { display: none; }
  .keys-hint { display: none; }
}
