/* ==========================================================================
   Patent page — the case-study system with a signal-amber accent, plus the
   pinned 3D stage. The stage keeps the night palette in both themes, the same
   way the enter screen and the isometric diagrams do.
   ========================================================================== */

.patent-page {
  --accent: #ffb21a;
  --accent-ink: #7a4900;
}

[data-theme="dark"] .patent-page {
  --accent: #ffc24d;
  --accent-ink: #ffc24d;
}

/* Patent 01 (the drone) swaps the amber for a flight cyan. */
.uav-page {
  --accent: #2ee6d0;
  --accent-ink: #09625a;
}

[data-theme="dark"] .uav-page {
  --accent: #3ee6d6;
  --accent-ink: #3ee6d6;
}

.uav-page .pt-stage {
  --stage-hl: #3ee6d6;
}

/* The stage is always night, so the nav flips to night colours over it. */
.nav-night {
  --nav-fg: var(--night-fg);
  --nav-bg: var(--night);
}

/* Wordmark: two words in the pixel face, ink then accent. */
.pt-wordmark .th-base .th-a {
  stroke: color-mix(in srgb, var(--ink) 34%, transparent);
}

.pt-wordmark .th-base .th-b {
  stroke: color-mix(in srgb, var(--accent-ink) 62%, transparent);
}

.pt-wordmark .th-fill .th-a {
  fill: var(--ink);
  stroke: var(--ink);
}

.pt-wordmark .th-fill .th-b {
  fill: var(--accent-ink);
  stroke: var(--accent-ink);
}

[data-theme="dark"] .pt-wordmark .th-fill .th-b {
  fill: var(--accent);
  stroke: var(--accent);
}

.pt-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.pt-status::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent) 30%, transparent);
  animation: pt-blink 2.4s ease-in-out infinite;
}

@keyframes pt-blink {
  50% {
    opacity: 0.35;
  }
}

/* --------------------------------------------------------------------------
   Stage — a tall scroll track with a sticky viewport inside it
   -------------------------------------------------------------------------- */

.pt-stage {
  --stage-hl: var(--amber);
  position: relative;
  background: var(--night);
  color: var(--night-fg);
}

.js .pt-stage {
  height: 640vh;
}

.pt-sticky {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
}

.js .pt-sticky {
  position: sticky;
  top: 0;
}

.pt-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.pt-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* Soft vignette and a scanline grid over the canvas. */
.pt-sticky::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(13, 12, 10, 0.75) 100%),
    linear-gradient(to bottom, rgba(13, 12, 10, 0.55), transparent 18%, transparent 80%, rgba(13, 12, 10, 0.7));
}

.pt-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  padding: calc(var(--nav-h) + 0.75rem) var(--gutter) clamp(1rem, 3vh, 1.75rem);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  font-family: var(--f-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pt-hud-top,
.pt-hud-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: rgba(242, 236, 226, 0.72);
}

.pt-hud-top {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(242, 236, 226, 0.16);
}

.pt-hud-top b {
  font-weight: 500;
  color: var(--stage-hl);
}

/* Registration marks in the four corners of the stage. */
.pt-corners i {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(242, 236, 226, 0.45);
  border-style: solid;
  border-width: 0;
}

.pt-corners i:nth-child(1) {
  top: calc(var(--nav-h) + 3.25rem);
  left: var(--gutter);
  border-top-width: 1px;
  border-left-width: 1px;
}

.pt-corners i:nth-child(2) {
  top: calc(var(--nav-h) + 3.25rem);
  right: var(--gutter);
  border-top-width: 1px;
  border-right-width: 1px;
}

.pt-corners i:nth-child(3) {
  bottom: 4.5rem;
  left: var(--gutter);
  border-bottom-width: 1px;
  border-left-width: 1px;
}

.pt-corners i:nth-child(4) {
  bottom: 4.5rem;
  right: var(--gutter);
  border-bottom-width: 1px;
  border-right-width: 1px;
}

/* Step captions — one visible at a time, stacked in the same cell. */
.pt-steps {
  align-self: center;
  display: grid;
  width: min(25rem, 38vw);
  margin-left: clamp(0rem, 1.5vw, 1.5rem);
}

.pt-step {
  grid-area: 1 / 1;
  display: grid;
  gap: 0.85rem;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out);
}

.pt-step.is-active {
  opacity: 1;
  transform: none;
}

.pt-step .pt-step-num {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--stage-hl);
}

.pt-step .pt-step-num::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--stage-hl) 45%, transparent);
}

.pt-step h3 {
  font-family: var(--f-display);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(2rem, 4.6vw, 4.25rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--night-fg);
}

.pt-step p {
  max-width: 34ch;
  font-family: var(--f-sans);
  font-size: clamp(0.98rem, 0.9rem + 0.25vw, 1.1rem);
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(242, 236, 226, 0.78);
}

.pt-hud-foot {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(242, 236, 226, 0.16);
}

.pt-progress {
  position: relative;
  flex: 1;
  height: 2px;
  margin: 0 1rem;
  background: rgba(242, 236, 226, 0.14);
}

.pt-progress-fill {
  position: absolute;
  inset: 0;
  background: var(--stage-hl);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}

.pt-ticks {
  position: absolute;
  inset: -4px 0;
  display: flex;
  justify-content: space-between;
}

.pt-ticks i {
  width: 1px;
  height: 10px;
  background: rgba(242, 236, 226, 0.45);
}

.pt-count {
  min-width: 4.5ch;
  text-align: right;
  color: var(--night-fg);
  font-variant-numeric: tabular-nums;
}

.pt-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.pt-hint::after {
  content: "";
  width: 1px;
  height: 1.1rem;
  background: currentColor;
  animation: pt-drip 1.8s var(--ease-wipe) infinite;
  transform-origin: 50% 0;
}

@keyframes pt-drip {
  0% {
    transform: scaleY(0);
  }
  50% {
    transform: scaleY(1);
    transform-origin: 50% 0;
  }
  51% {
    transform-origin: 50% 100%;
  }
  100% {
    transform: scaleY(0);
    transform-origin: 50% 100%;
  }
}

/* Annotations pinned to points on the model; positioned from JS. */
.pt-tags {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.pt-tag {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  gap: 0.2rem;
  padding-left: 1.15rem;
  opacity: 0;
  transition: opacity 0.45s ease;
  white-space: nowrap;
  will-change: transform;
}

.pt-tag.is-on {
  opacity: 1;
}

.pt-tag::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--stage-hl);
  border-radius: 50%;
  background: rgba(13, 12, 10, 0.6);
}

.pt-tag::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  width: 0.75rem;
  height: 1px;
  background: var(--stage-hl);
}

.pt-tag span {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stage-hl);
  transform: translateY(-0.55rem);
}

.pt-tag b {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--night-fg);
  text-shadow: 0 1px 12px rgba(13, 12, 10, 0.9);
  transform: translateY(-0.55rem);
}

.pt-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  text-align: center;
  font-family: var(--f-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(242, 236, 226, 0.7);
}

.pt-ready .pt-fallback {
  display: none;
}

@media (max-width: 760px) {
  .js .pt-stage {
    height: 560vh;
  }

  .pt-hud {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .pt-hud-foot {
    grid-row: 4;
  }

  .pt-steps {
    grid-row: 3;
    align-self: end;
    width: 100%;
    margin: 0 0 1rem;
  }

  .pt-step h3 {
    font-size: clamp(1.7rem, 9vw, 2.4rem);
  }

  .pt-step p {
    font-size: 0.95rem;
  }

  .pt-hud-top span:last-child,
  .pt-hint {
    display: none;
  }

  .pt-tag b {
    font-size: 0.8125rem;
  }

  .pt-corners {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Domains — a list of big display words
   -------------------------------------------------------------------------- */

.pt-domains li {
  position: relative;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding: clamp(0.9rem, 2vw, 1.4rem) 0;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
}

.pt-domains li::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.6s var(--ease-out);
}

.pt-domains li:hover::before {
  transform: scaleY(1);
}

.pt-domains li:hover,
.pt-domains li:hover .label {
  color: var(--on-accent);
}

.pt-domains strong {
  font-family: var(--f-display);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(1.6rem, 5.2vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.pt-domains em {
  font-style: normal;
  font-size: 1rem;
  color: var(--fg-mute);
  text-align: right;
}

.pt-domains li:hover em {
  color: var(--on-accent-mute);
}

@media (max-width: 760px) {
  .pt-domains li {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }

  .pt-domains em {
    grid-column: 2;
    text-align: left;
  }
}

/* --------------------------------------------------------------------------
   Record — the public bibliographic data, laid out like a gazette entry
   -------------------------------------------------------------------------- */

.pt-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--fg);
}

.pt-record > div {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.pt-record > div:nth-child(odd) {
  border-right: 1px solid var(--rule);
}

.pt-record .pt-wide {
  grid-column: 1 / -1;
  border-right: 0;
}

.pt-record dt {
  grid-row: span 2;
  font-family: var(--f-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--hl);
  padding-top: 0.15rem;
}

.pt-record dt + dd {
  font-family: var(--f-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.pt-record dd + dd {
  font-size: 1.0625rem;
  line-height: 1.45;
}

.pt-record .pt-title {
  font-family: var(--f-display);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(1.15rem, 2.2vw, 1.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.pt-sealed {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-top: clamp(2rem, 4vw, 3rem);
  padding: 1.25rem 1.4rem;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 10px,
    color-mix(in srgb, var(--fg) 5%, transparent) 10px 11px
  );
  border: 1px dashed var(--line-strong);
}

.pt-sealed svg {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: var(--hl);
  stroke-width: 1.5;
}

.pt-sealed p {
  max-width: 70ch;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.pt-sealed .label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--hl);
}

@media (max-width: 760px) {
  .pt-record {
    grid-template-columns: minmax(0, 1fr);
  }

  .pt-record > div:nth-child(odd) {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pt-status::before,
  .pt-hint::after {
    animation: none;
  }
}

/* Tags near the right edge (or flagged in JS) read leftward from the dot. */
.pt-tag--left {
  padding: 0 1.15rem 0 0;
  text-align: right;
  translate: -100% 0;
}

.pt-tag--left::before {
  left: auto;
  right: -4px;
}

.pt-tag--left::after {
  left: auto;
  right: 5px;
}
