/* /work/one-clock/: the machine film, the two-lane diagram and the close. Load after case3d.css. */

body[data-page="one-clock"] {
  --case-accent: #ffb25e;
  --oc-amber: #ffb25e;
  --oc-cyan: #7fd8ff;
  --oc-red: #ff8a7a;
  --oc-card: rgba(5, 7, 10, .82);
  --oc-card-line: rgba(255, 178, 94, .22);
  --oc-vh: var(--case3d-vh, 1svh);
  /* Keep: the sticky stage needs body to stay out of the scroll; html still clips sideways. */
  overflow-x: visible;
}

/* ---------- the film: one sticky stage, beats scrolling over it ---------- */
.oc-film { position: relative; }
.oc-stage {
  --case3d-stage-vh: 100;
  position: sticky;
  top: 0;
  z-index: 0;
  background: #05070a;
}
.oc-stage .case3d-canvas { z-index: 1; }
.oc-still {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.oc-still[hidden] { display: none; }
.oc-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 7, 10, .82) 0%, rgba(5, 7, 10, .45) 30%, rgba(5, 7, 10, 0) 52%);
}
/* The hero's title and deck sit over the machine itself: a deeper shade while they are on screen. */
.oc-shade::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 7, 10, .9) 0%, rgba(5, 7, 10, .82) 34%, rgba(5, 7, 10, 0) 58%);
  opacity: 0;
  transition: opacity 500ms var(--ease-out);
}
.oc-film:not([data-active]) .oc-shade::before,
.oc-film[data-active="hero"] .oc-shade::before { opacity: 1; }

/* Labels pinned to parts of the scene. Placed, faded and kept off the cards by script (transform
   and opacity only). */
.oc-tags {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}
.oc-tag {
  position: absolute;
  top: 0;
  left: 0;
  padding: 6px 9px;
  border: 1px solid var(--oc-card-line);
  border-radius: 6px;
  background: rgba(5, 7, 10, .9);
  color: var(--color-text);
  font: 500 12px/1.2 "JetBrains Mono", var(--font-mono);
  letter-spacing: .04em;
  white-space: nowrap;
  opacity: 0;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}
.oc-tag--warn { color: var(--oc-amber); border-color: rgba(255, 138, 122, .45); }
.oc-tag--group {
  padding: 4px 8px;
  border-color: transparent;
  background: rgba(5, 7, 10, .72);
  color: var(--oc-amber);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.oc-tag--inspect {
  max-width: min(300px, calc(100vw - 48px));
  padding: 9px 12px;
  border-color: rgba(255, 178, 94, .5);
  background: rgba(5, 7, 10, .94);
  color: var(--color-body);
  line-height: 1.55;
  white-space: pre-line;
}
.oc-tag--inspect::first-line { color: var(--oc-amber); }
.oc-lead {
  position: absolute;
  top: 0;
  left: 0;
  width: 100px;
  height: 1px;
  background: linear-gradient(90deg, var(--oc-amber), rgba(255, 178, 94, .12));
  opacity: 0;
  transform-origin: 0 50%;
}

.oc-beats {
  position: relative;
  z-index: 1;
  margin-top: calc(var(--oc-vh) * -100);
  pointer-events: none;
}
.oc-beat {
  display: flex;
  align-items: center;
  min-height: calc(var(--oc-vh) * 72);
  padding-inline: var(--rebuild-gutter);
}
.oc-beat :is(a, button, .oc-card) { pointer-events: auto; }
.oc-hero { min-height: calc(var(--oc-vh) * 100); padding-top: 72px; }
.oc-real { min-height: calc(var(--oc-vh) * 96); }
.oc-all { min-height: calc(var(--oc-vh) * 92); }
.oc-path { min-height: calc(var(--oc-vh) * 58); }
.oc-break {
  align-items: flex-start;
  min-height: calc(var(--oc-vh) * 170);
}

.oc-card {
  width: min(410px, 100%);
  padding: 22px 24px 24px;
  border: 1px solid var(--color-hair);
  border-radius: 14px;
  background: var(--oc-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.oc-card .eyebrow { margin: 0 0 12px; letter-spacing: .08em; }
.oc-card h2 {
  margin: 0 0 12px;
  color: var(--color-text);
  font: 500 clamp(1.6rem, 2.3vw, 2.05rem)/1.1 "Space Grotesk", var(--font-display);
  letter-spacing: -.02em;
  text-wrap: balance;
}
.oc-card p:not(.eyebrow) { margin: 0; color: var(--color-body); font-size: 1rem; line-height: 1.6; }

.oc-card--hero {
  width: min(600px, 100%);
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.oc-title {
  margin: 0 0 22px;
  color: var(--color-text);
  font: 500 clamp(2.6rem, 5.2vw, 4.7rem)/1.02 "Space Grotesk", var(--font-display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
/* The claim the whole page rests on: as loud as anything but the title. */
.oc-card p.oc-claim {
  max-width: 32ch;
  margin: 0 0 22px;
  padding-left: 16px;
  border-left: 2px solid var(--oc-amber);
  color: var(--color-text);
  font: 500 clamp(1.15rem, .98rem + .6vw, 1.5rem)/1.32 "Space Grotesk", var(--font-display);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.oc-claim strong {
  display: block;
  margin-bottom: 7px;
  color: var(--oc-amber);
  font: 600 .8125rem/1.2 "JetBrains Mono", var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.oc-card p.oc-deck { max-width: 52ch; margin: 0 0 26px; color: var(--color-body); font-size: clamp(1.02rem, .96rem + .25vw, 1.16rem); line-height: 1.62; }
.oc-cue {
  margin: 0;
  color: var(--color-meta);
  font: 500 .75rem/1 "JetBrains Mono", var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.oc-cue::after {
  content: "";
  display: block;
  width: 1px;
  height: 38px;
  margin: 14px 0 0 6px;
  background: linear-gradient(var(--oc-amber), transparent);
}

/* One to one: the proof, line by line. With the scene running, each line comes up as the trace
   through the real connections reaches it. */
.oc-card--real { width: min(500px, 100%); }
.oc-card--real h2 { font-size: clamp(1.85rem, 2.9vw, 2.55rem); }
.oc-proof {
  display: grid;
  gap: 10px;
  margin: 18px 0 18px;
  padding: 14px 0;
  border-block: 1px solid var(--color-hair);
  list-style: none;
  color: var(--color-text);
  font: 500 .875rem/1.45 "JetBrains Mono", var(--font-mono);
}
.oc-proof li {
  display: grid;
  grid-template-columns: 7ch minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.oc-proof b { color: var(--oc-amber); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.oc-film.oc-traced .oc-proof li:not(.is-lit) { opacity: .2; transform: translateX(-8px); }
.oc-card p.oc-hint:not(.eyebrow) { display: none; margin-top: 14px; color: var(--oc-amber); font: 500 .8125rem/1.5 "JetBrains Mono", var(--font-mono); }
.oc-stage[data-case3d="live"] ~ .oc-beats .oc-card p.oc-hint:not(.eyebrow) { display: block; }

.oc-caption {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--oc-card-line);
  border-radius: 8px;
  background: var(--oc-card);
  color: var(--color-text);
  font: 500 .875rem/1.4 "JetBrains Mono", var(--font-mono);
  pointer-events: auto;
}

/* ---------- break it on purpose ---------- */
/* Two stacked panels read as one; the first press sends the head away, the live part stays. */
.oc-card--break {
  position: sticky;
  top: calc(var(--oc-vh) * 16);
  width: min(440px, 100%);
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.oc-break__head,
.oc-break__live { position: relative; isolation: isolate; padding-inline: 24px; }
.oc-break__head {
  padding-top: 22px;
  padding-bottom: 2px;
  transition: opacity 380ms var(--ease-out), transform 560ms var(--ease-out);
}
.oc-break__live { padding-top: 18px; padding-bottom: 24px; }
.oc-break__head::before,
.oc-break__live::before,
.oc-break__live::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 1px solid var(--color-hair);
  background: var(--oc-card);
  pointer-events: none;
}
.oc-break__head::before { bottom: -1px; border-bottom: 0; border-radius: 14px 14px 0 0; }
.oc-break__live::before { border-top: 0; border-radius: 0 0 14px 14px; transition: opacity 420ms var(--ease-out); }
.oc-break__live::after {
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  opacity: 0;
  transition: opacity 420ms var(--ease-out);
}
/* Only the panels take the pointer, so once the head has gone the space it left belongs to the scene. */
.oc-beat .oc-card--break { pointer-events: none; }
.oc-beat .oc-break__head, .oc-beat .oc-break__live { pointer-events: auto; }
.oc-beat .oc-card--break.is-open .oc-break__head { opacity: 0; transform: translateY(-14px); pointer-events: none; }
.oc-card--break.is-open .oc-break__live::before { opacity: 0; }
.oc-card--break.is-open .oc-break__live::after { opacity: 1; }

.oc-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.oc-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 178, 94, .5);
  border-radius: 999px;
  background: rgba(255, 178, 94, .06);
  color: var(--color-text);
  font: 500 .875rem/1.2 "JetBrains Mono", var(--font-mono);
  letter-spacing: .02em;
  cursor: pointer;
}
/* The chosen one: an amber fill and ring that fade in; hover shows a little of it. */
.oc-btn::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 178, 94, .26);
  box-shadow: inset 0 0 0 1px var(--oc-amber);
  opacity: 0;
  transition: opacity 320ms var(--ease-out);
}
.oc-btn:hover::before { opacity: .4; }
.oc-btn[aria-pressed="true"]::before { opacity: 1; }
.oc-btn:focus-visible { outline: 2px solid var(--oc-amber); outline-offset: 3px; }
/* How far the replay has run, along the bottom of the chosen button. */
.oc-btn__run {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--oc-amber);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: opacity 420ms var(--ease-out);
}
.oc-btn.is-running .oc-btn__run { opacity: 1; }
/* What happened: every answer sits in the same cell, so the box is as tall as the longest and a
   new answer cross-fades in without moving anything. */
.oc-results {
  display: grid;
  padding-top: 14px;
  border-top: 1px solid var(--color-hair);
}
.oc-card .oc-results .oc-result {
  grid-area: 1 / 1;
  margin: 0;
  color: var(--color-text);
  font-size: .975rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 240ms ease-in, transform 240ms ease-in;
}
.oc-card .oc-results .oc-result[data-result=""] { color: var(--color-meta); }
.oc-card .oc-results .oc-result.is-on {
  opacity: 1;
  transform: none;
  transition: opacity 520ms var(--ease-out) 160ms, transform 520ms var(--ease-out) 160ms;
}
.oc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- the rule underneath ---------- */
.oc-rule { position: relative; z-index: 2; background: var(--color-bg); border-top: 1px solid var(--color-hair); }
.oc-rule__head { max-width: 760px; margin-bottom: clamp(32px, 5vw, 56px); }
.oc-rule__head .eyebrow, .oc-close__text .eyebrow { margin: 0 0 14px; letter-spacing: .08em; }
.oc-rule h2, .oc-close h2 {
  margin: 0 0 18px;
  color: var(--color-text);
  font: 500 clamp(1.9rem, 3.4vw, 2.9rem)/1.06 "Space Grotesk", var(--font-display);
  letter-spacing: -.025em;
  text-wrap: balance;
}
.oc-rule__head p:not(.eyebrow) { margin: 0; color: var(--color-body); max-width: 64ch; }
.oc-rule__head p:not(.eyebrow) + p { margin-top: 14px; }

.oc-lanes {
  margin: 0;
  padding: clamp(22px, 3.4vw, 44px);
  border: 1px solid var(--color-hair);
  border-radius: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 100% 28px,
    #070a0f;
}
.oc-lane {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 200px;
  gap: 24px;
  align-items: center;
}
.oc-lane__name, .oc-lane__end { margin: 0; font: 500 .875rem/1.35 "JetBrains Mono", var(--font-mono); letter-spacing: .04em; }
.oc-lane__name { text-transform: uppercase; }
.oc-lane--code .oc-lane__name { color: var(--oc-amber); }
.oc-lane--model .oc-lane__name { color: var(--oc-cyan); }
.oc-lane__end { color: var(--color-text-muted); }
.oc-lane__track { position: relative; height: 112px; }
.oc-lane__line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255, 255, 255, .18); }
.oc-gate {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 66px;
  margin: -33px 0 0 -9px;
  border: 1px solid rgba(255, 178, 94, .75);
  border-radius: 3px;
  background: rgba(255, 178, 94, .1);
}
.oc-gate:nth-of-type(2) { left: 26%; }
.oc-gate:nth-of-type(3) { left: 52%; }
.oc-gate:nth-of-type(4) { left: 78%; }
.oc-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--oc-amber);
  box-shadow: 0 0 12px rgba(255, 178, 94, .8);
  opacity: 0;
}
.oc-comb {
  position: absolute;
  top: 50%;
  left: 62%;
  width: 30px;
  height: 72px;
  margin: -36px 0 0 -15px;
  border-inline: 1px solid rgba(127, 216, 255, .65);
  background: repeating-linear-gradient(90deg, rgba(127, 216, 255, .55) 0 1px, transparent 1px 6px);
}
.oc-tray {
  position: absolute;
  top: calc(50% + 40px);
  left: 62%;
  width: 64px;
  height: 10px;
  margin-left: -32px;
  border: 1px solid rgba(255, 138, 122, .55);
  border-top: 0;
  border-radius: 0 0 4px 4px;
}
.oc-words {
  position: absolute;
  top: 50%;
  left: 0;
  width: 46px;
  height: 9px;
  margin: -4.5px 0 0 -23px;
  border-radius: 5px;
  background: var(--oc-cyan);
  box-shadow: 0 0 10px rgba(127, 216, 255, .55);
  opacity: 0;
}
.oc-words.is-dropped { background: var(--oc-red); box-shadow: 0 0 10px rgba(255, 138, 122, .5); }
.oc-wall {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 200px;
  gap: 24px;
  margin: 10px 0 18px;
}
.oc-wall span {
  grid-column: 2;
  display: block;
  padding-top: 10px;
  border-top: 2px dashed rgba(255, 255, 255, .2);
  color: var(--color-text-muted);
  text-align: center;
  font: 500 .8125rem/1.3 "JetBrains Mono", var(--font-mono);
  letter-spacing: .04em;
}
.oc-lanes figcaption { max-width: 64ch; margin-top: 28px; color: var(--color-text-muted); font-size: .95rem; }
/* Without motion the lanes hold one readable moment. */
.oc-lanes:not(.is-running) .oc-dot:nth-of-type(1) { left: 13%; opacity: 1; }
.oc-lanes:not(.is-running) .oc-dot:nth-of-type(2) { left: 64%; opacity: 1; }
.oc-lanes:not(.is-running) .oc-words:nth-of-type(1) { left: 20%; opacity: 1; }
.oc-lanes:not(.is-running) .oc-words:nth-of-type(2) { left: 44%; opacity: 1; }
.oc-lanes:not(.is-running) .oc-words:nth-of-type(3) { left: 88%; opacity: 1; }
.oc-lanes:not(.is-running) .oc-words:nth-of-type(4) { left: 62%; top: calc(50% + 34px); opacity: 1; background: var(--oc-red); box-shadow: none; }

/* ---------- close ---------- */
.oc-close { position: relative; z-index: 2; background: var(--color-bg); padding-top: 0; }
.oc-close .container { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.oc-computer { margin: 0; }
.oc-box {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 50%;
  border-radius: 14px;
  background: #05070a;
}
.oc-computer figcaption { margin-top: 12px; color: var(--color-meta); font: 400 .8125rem/1.45 "JetBrains Mono", var(--font-mono); }
.oc-proves { display: grid; gap: 14px; margin: 0 0 26px; padding: 0; list-style: none; }
.oc-proves li {
  padding-left: 18px;
  border-left: 2px solid rgba(255, 178, 94, .45);
  color: var(--color-body);
}
.oc-proves b { color: var(--color-text); font-weight: 600; }
.oc-close__pitch { margin: 0 0 26px; color: var(--color-text); }

/* ---------- phones and narrow screens ---------- */
@media (max-aspect-ratio: 17/20) {
  .oc-shade { background: linear-gradient(0deg, rgba(5, 7, 10, .9) 0%, rgba(5, 7, 10, .55) 34%, rgba(5, 7, 10, 0) 58%); }
  .oc-shade::before { background: linear-gradient(0deg, rgba(5, 7, 10, .94) 0%, rgba(5, 7, 10, .86) 52%, rgba(5, 7, 10, 0) 78%); }
  .oc-beat { align-items: flex-end; padding-bottom: calc(var(--oc-vh) * 7); }
  .oc-hero { padding-bottom: calc(var(--oc-vh) * 6); }
  .oc-card { width: 100%; padding: 18px 18px 20px; }
  .oc-card--hero { padding: 0; }
  .oc-card h2 { font-size: clamp(1.45rem, 6.2vw, 1.8rem); }
  .oc-card--real h2 { font-size: clamp(1.6rem, 7.4vw, 2rem); }
  .oc-card p:not(.eyebrow) { font-size: .975rem; }
  .oc-title { font-size: clamp(2.3rem, 10.5vw, 3.2rem); margin-bottom: 16px; }
  .oc-card p.oc-claim { margin-bottom: 16px; padding-left: 13px; font-size: clamp(1.1rem, 4.9vw, 1.3rem); }
  .oc-card p.oc-deck { margin-bottom: 18px; font-size: 1rem; }
  .oc-proof { margin: 14px 0; padding: 12px 0; font-size: .8125rem; gap: 8px; }
  .oc-cue::after { height: 26px; margin-top: 10px; }
  /* The card stands on the bottom of the screen (the real bottom, toolbar or not) and holds
     there while the scene plays; the machine has the space above it. */
  .oc-break { align-items: flex-end; padding-bottom: 0; }
  .oc-card--break { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 0; }
  .oc-break__head, .oc-break__live { padding-inline: 18px; }
  .oc-break__head { padding-top: 18px; }
  .oc-break__live { padding-top: 14px; padding-bottom: 18px; }
  .oc-buttons { margin: 0 0 12px; gap: 8px; }
  .oc-btn { padding: 9px 13px; font-size: .8125rem; }
  .oc-btn__run { left: 15px; right: 15px; }
  .oc-card .oc-results .oc-result { font-size: .9375rem; }
}
@media (max-width: 820px) {
  .oc-lane, .oc-wall { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .oc-wall span { grid-column: 1; }
  /* Tall enough to hold everything drawn in them: the gates, and the comb with its tray below. */
  .oc-lane--code .oc-lane__track { height: 80px; }
  .oc-lane--model .oc-lane__track { height: 120px; }
  .oc-lane--model .oc-lane__end { margin-top: 4px; }
  .oc-close .container { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .oc-box { aspect-ratio: 4 / 5; }
}

/* Reduced motion, or motion paused on the page: every state change lands finished. */
html[data-motion-preference="off"] .oc-shade::before,
html[data-motion-preference="off"] .oc-btn::before,
html[data-motion-preference="off"] .oc-btn__run,
html[data-motion-preference="off"] .oc-proof li,
html[data-motion-preference="off"] .oc-break__head,
html[data-motion-preference="off"] .oc-break__live::before,
html[data-motion-preference="off"] .oc-break__live::after,
html[data-motion-preference="off"] .oc-card .oc-results .oc-result,
html[data-motion-preference="off"] .oc-card .oc-results .oc-result.is-on { transition: none; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion-preference="on"]) .oc-shade::before,
  html:not([data-motion-preference="on"]) .oc-btn::before,
  html:not([data-motion-preference="on"]) .oc-btn__run,
  html:not([data-motion-preference="on"]) .oc-proof li,
  html:not([data-motion-preference="on"]) .oc-break__head,
  html:not([data-motion-preference="on"]) .oc-break__live::before,
  html:not([data-motion-preference="on"]) .oc-break__live::after,
  html:not([data-motion-preference="on"]) .oc-card .oc-results .oc-result,
  html:not([data-motion-preference="on"]) .oc-card .oc-results .oc-result.is-on { transition: none; }
}
