@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&family=Space+Mono:wght@400;700&family=Orbitron:wght@400;700;900&family=Caveat:wght@400;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: auto;
  min-height: 100%;
}

body {
  display: block;
  font-family: 'Space Mono', monospace;
  background: #0a0a0a;
}

/* The window scrolls this page, the same way every other page scrolls.
   #root must not be its own scroller, or a footer after it can never be reached. */
#biography,
#timeline,
#instruments,
#archive,
#incident,
#impossible,
#case-board {
  scroll-margin-top: 1rem;
}

#root {
  height: auto;
  overflow: visible;
  overflow-wrap: break-word;
}

.glitch {
  animation: glitch 0.3s cubic-bezier(.25, .46, .45, .94) both;
}

@keyframes glitch {
  0%, 100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

.quantum-waveform-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.quantum-lab-shake {
  animation: quantumShake 2.6s ease-in-out;
}

@keyframes quantumShake {
  0%, 100% { transform: translate(0, 0); }
  12% { transform: translate(-5px, 3px) rotate(-0.4deg); }
  24% { transform: translate(6px, -4px) rotate(0.5deg); }
  36% { transform: translate(-4px, -3px) rotate(-0.3deg); }
  48% { transform: translate(5px, 2px) rotate(0.4deg); }
  60% { transform: translate(-3px, 4px); }
  72% { transform: translate(3px, -2px); }
  84% { transform: translate(-2px, 1px); }
}

.hypersonic-overlay {
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.95) 0%, rgba(180, 80, 255, 0.45) 35%, rgba(255, 40, 80, 0.2) 60%, transparent 80%);
  animation: hypersonicPulse 2.6s ease-out forwards;
}

.hypersonic-crack {
  background:
    linear-gradient(125deg, transparent 46%, rgba(255, 255, 255, 0.85) 46.5%, rgba(255, 255, 255, 0.85) 47.5%, transparent 48%),
    linear-gradient(55deg, transparent 58%, rgba(200, 180, 255, 0.7) 58.5%, rgba(200, 180, 255, 0.7) 59.5%, transparent 60%),
    linear-gradient(165deg, transparent 72%, rgba(255, 255, 255, 0.6) 72.3%, rgba(255, 255, 255, 0.6) 73%, transparent 73.5%);
  opacity: 0;
  animation: hypersonicCrack 2.6s ease-out forwards;
}

@keyframes hypersonicPulse {
  0% { opacity: 0.95; }
  18% { opacity: 0.75; }
  45% { opacity: 0.35; }
  100% { opacity: 0; }
}

@keyframes hypersonicCrack {
  0%, 8% { opacity: 0; }
  12% { opacity: 1; }
  35% { opacity: 0.85; }
  100% { opacity: 0; }
}

.gear {
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.particle {
  animation: drift 15s linear infinite;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(360deg);
    opacity: 0;
  }
}



.shatter {
  animation: shatter 2.6s ease-out forwards;
  mix-blend-mode: screen;
}

@keyframes shatter {
  0% {
    opacity: 0.85;
    transform: scale(1);
  }
  12% {
    opacity: 0.55;
    transform: scale(1.04) rotate(2deg);
  }
  35% {
    opacity: 0.25;
    transform: scale(1.08) rotate(-3deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.12) rotate(1deg);
  }
}

.monitor-scroll {
  animation: scroll 20s linear infinite;
}

@keyframes scroll {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

.glow-cyan {
  box-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
}

.glow-amber {
  box-shadow: 0 0 10px #ffbf00, 0 0 20px #ffbf00, 0 0 30px #ffbf00;
}

/* Portaled modals render on document.body (outside #root text-white).
   Tailwind CDN may inject utilities after this sheet — use !important so
   dossier copy stays readable on the dark panel in Safari/iframes. */
.workbench-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.92) !important;
  color: #e5e7eb !important;
}

dialog.workbench-modal-overlay {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  overflow: hidden;
}

dialog.workbench-modal-overlay:not([open]) {
  display: none;
}

dialog.workbench-modal-overlay::backdrop {
  background: transparent;
}

.workbench-modal-panel {
  max-height: min(90vh, 900px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #111827 !important;
  color: #d1d5db !important;
}

.workbench-modal-kicker {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #22d3ee !important;
}

.workbench-modal-title {
  margin-top: 0.25rem;
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  font-weight: 700;
  color: #f3f4f6 !important;
  font-family: Orbitron, sans-serif;
}

.workbench-modal-body {
  font-size: 0.875rem;
  line-height: 1.625;
  color: #d1d5db !important;
}

.workbench-modal-content {
  color: #d1d5db !important;
}

.workbench-modal-content p,
.workbench-modal-content li,
.workbench-modal-content dd,
.workbench-modal-content dt {
  color: #d1d5db !important;
}

.workbench-modal-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 1rem;
  border: 2px solid #22c55e;
  border-radius: 0.5rem;
}

.workbench-handwritten-excerpt {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(145deg, #fef9e7 0%, #f3e4c4 48%, #ebe0c8 100%);
  border: 1px solid #b8956a;
  border-left: 4px solid #7c4a1e;
  border-radius: 3px;
  box-shadow:
    2px 4px 12px rgba(0, 0, 0, 0.45),
    inset 0 0 40px rgba(124, 74, 30, 0.06);
  transform: rotate(-0.75deg);
  font-family: Caveat, "Segoe Script", "Bradley Hand", cursive;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: #1e2a44 !important;
  white-space: pre-wrap;
  word-break: break-word;
}

.workbench-handwritten-excerpt::before {
  content: "Marginalia — recovered addendum";
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b4423 !important;
  opacity: 0.85;
  border-bottom: 1px dashed #b8956a;
  padding-bottom: 0.5rem;
}

.timeline-dossier-card {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #0891b2 #1f2937;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #1f2937;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #0891b2;
  border-radius: 4px;
}

.text-glow-cyan {
  text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
}

.text-glow-amber {
  text-shadow: 0 0 10px #ffbf00, 0 0 20px #ffbf00;
}

/* Touch-friendly interactions */
.touch-manipulation {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Minimum touch targets for primary controls (not every anchor) */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
select,
textarea {
  min-height: 44px;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  min-width: 44px;
}

html {
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

/* Better text rendering across browsers */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Fix for iOS input zoom */
@media screen and (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

input[type="range"] {
  min-height: 44px;
  touch-action: manipulation;
}

.vault-playing {
  animation: vault-pulse 0.7s ease-in-out infinite;
}

@keyframes vault-pulse {
  0%,
  100% { scale: 1; }
  50% { scale: 1.035; }
}

@media (prefers-reduced-motion: reduce) {
  .quantum-lab-shake,
  .hypersonic-overlay,
  .hypersonic-crack,
  .shatter,
  .gear,
  .particle,
  .monitor-scroll,
  .vault-playing {
    animation: none;
  }
}

/* Better backdrop blur fallback */
@supports not (backdrop-filter: blur(10px)) {
  .backdrop-blur-sm {
    background-color: rgba(0, 0, 0, 0.95);
  }
}

.workbench-door {
  margin: 0 0 1rem;
}

.workbench-door img {
  display: block;
  width: 100%;
  max-height: 22rem;
  object-fit: cover;
  object-position: 28% 32%;
  border: 4px solid #22d3ee;
}

.case-board {
  margin: 0 0 0;
}

.case-board-heading {
  margin: 0 0 0.75rem;
  font-family: Orbitron, sans-serif;
  font-size: 1.15rem;
  color: #fbbf24;
}

.case-board-frame {
  position: relative;
  padding: 1rem 0.75rem 1.15rem;
  background: #5a3a22 url("./section-stills/corkboard.jpg") center / cover;
  border: 4px solid #3f2a18;
}

.case-board-strings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.case-board-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.case-card {
  display: block;
  min-height: 7.5rem;
  padding: 0.7rem 0.75rem;
  background: #f3e6c4;
  border: 1px solid #c4a574;
  color: #2a1c10;
  text-decoration: none;
  box-shadow: 2px 3px 0 rgb(0 0 0 / 0.18);
}

.case-card-q {
  background: #fff8e7;
  border-color: #8b1e1e;
}

.case-card-hand .case-card-text {
  font-family: Caveat, cursive;
  font-size: 1.15rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

.case-card-src {
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a5a32;
}

.case-card-title {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  line-height: 1.25;
}

.case-card-text {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .case-board-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
  }
}

.workbench-section-still {
  margin: 0 0 1rem;
}

.workbench-section-still img {
  display: block;
  width: 100%;
  max-height: 10rem;
  object-fit: cover;
  border: 2px solid rgba(251, 191, 36, 0.55);
}

.gersh-handshake {
  margin: 1.5rem 0 1rem;
  padding: 0.9rem 1rem;
  border: 2px solid #f59e0b;
  background: rgba(120, 53, 15, 0.28);
  color: #fde68a;
}

.gersh-handshake-role,
.gersh-handshake-line {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.gersh-handshake-link {
  margin-top: 0.65rem;
}

.gersh-handshake-link a {
  color: #fde68a;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.gersh-review,
.gersh-approval {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border: 2px solid #f59e0b;
  background: rgba(120, 53, 15, 0.28);
  color: #fde68a;
}

.gersh-review-kicker,
.gersh-approval-sig {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fbbf24;
}

.gersh-review-line,
.gersh-approval p {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.gersh-approval-date {
  color: #fcd34d;
}

.picture-answer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid rgba(52, 211, 153, 0.45);
}

.picture-answer-hinge {
  margin: 0 0 1rem;
}

.picture-answer-prompt {
  font-family: Orbitron, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: #e9d5ff;
}

.picture-answer-blank {
  width: 4.5rem;
  min-height: 2.75rem;
  margin: 0 0.25rem;
  padding: 0.35rem 0.4rem;
  border: 2px solid #c084fc;
  background: #111827;
  color: #f5d0fe;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.picture-answer-are {
  display: inline-block;
  min-width: 4.5rem;
  margin: 0 0.25rem;
  color: #86efac;
  font-weight: 700;
}

.picture-answer-submit {
  margin-top: 0.75rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 2px solid #c084fc;
  background: #6b21a8;
  color: #fff;
  font-weight: 700;
}

.picture-answer-msg,
.picture-answer-note {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #d8b4fe;
}

.picture-answer-plates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.picture-answer-crop {
  overflow: hidden;
  aspect-ratio: 1;
  border: 2px solid #a855f7;
}

.picture-answer-crop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.picture-answer-crop.robert-eyes img {
  object-position: 62% 14%;
  transform: scale(2.15);
  transform-origin: 62% 14%;
}

.picture-answer-crop.lab-face img {
  object-position: 28% 28%;
  transform: scale(1.85);
  transform-origin: 28% 28%;
}

.picture-answer-crop.young-face img {
  object-position: 48% 22%;
  transform: scale(1.7);
  transform-origin: 48% 22%;
}

.picture-answer-plates figcaption {
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: #e9d5ff;
}

.incident-recordings {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 2px solid #c084fc;
  background: rgba(88, 28, 135, 0.28);
}

.incident-recordings p {
  margin-bottom: 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e9d5ff;
}

.incident-recordings ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.incident-recordings a {
  color: #f5d0fe;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.impossible-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.impossible-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.impossible-card-summary {
  display: block;
}

@media (min-width: 1024px) {
  .impossible-pair {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .impossible-cards {
    position: relative;
    min-height: 0;
  }

  .impossible-cards-stack {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  .impossible-card {
    container-type: size;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .impossible-card-summary {
    display: -webkit-box !important;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(1.25rem * 3);
    overflow: hidden;
    line-height: 1.25rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  @container (min-height: 220px) {
    .impossible-card-summary {
      max-height: calc(1.25rem * 5);
      -webkit-line-clamp: 5;
    }
  }

  @container (min-height: 280px) {
    .impossible-card-summary {
      max-height: calc(1.25rem * 7);
      -webkit-line-clamp: 7;
    }
  }
}

@media (min-width: 768px) {
  .picture-answer-plates {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.site-chrome-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-chrome {
  position: sticky;
  top: 0;
  z-index: 100;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  height: 3.5rem;
  padding: 0 0.75rem;
  border: 2px solid #000;
  background: #e0e0db;
  color: #000;
  font-family: Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
}

.file-link {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 0.85rem 1.5rem 0.95rem;
  border-bottom: 1px solid #222;
  background: #0a0a0a;
  color: #d1d5db;
  font-family: Poppins, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
}

.file-link a {
  color: #fff;
  text-underline-offset: 3px;
}

.site-chrome a {
  color: inherit;
  text-decoration: none;
}

.site-chrome a:hover,
.site-chrome a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}

.site-chrome-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex: none;
  min-width: 2.75rem;
  min-height: 2.75rem;
}

.site-chrome-logo img {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
}

.site-chrome-nav {
  display: none;
  align-items: center;
  min-width: 0;
  gap: 0.75rem;
}

.site-chrome-nav > a {
  white-space: nowrap;
}

.site-chrome-social {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-chrome-social a {
  display: block;
  width: 1rem;
  height: 1rem;
}

.site-chrome-social svg {
  display: block;
  width: 100%;
  height: 100%;
}

.site-chrome-toggle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
}

.site-chrome-toggle-mark {
  position: relative;
  display: block;
  width: 1.75rem;
  height: 0.75rem;
}

.site-chrome-toggle-mark span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #000;
}

.site-chrome-toggle-mark span:first-child {
  top: 0;
}

.site-chrome-toggle-mark span:last-child {
  bottom: 0;
}

.site-chrome-panel {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  right: 0;
  top: 3.5rem;
  bottom: 0;
  overflow-y: auto;
  background: #e0e0db;
  -webkit-overflow-scrolling: touch;
}

.site-chrome-panel.is-open {
  display: block;
}

.site-chrome-panel nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  min-height: 100%;
  padding: 3rem 1rem;
  font-size: 1.875rem;
}

.site-chrome-panel .site-chrome-social {
  gap: 2rem;
  padding-top: 1rem;
}

.site-chrome-panel .site-chrome-social a {
  width: 1.75rem;
  height: 1.75rem;
}

@media (min-width: 640px) {
  .site-chrome {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .site-chrome-nav {
    display: flex;
    gap: 0.85rem;
  }

  .site-chrome-toggle,
  .site-chrome-panel {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .site-chrome {
    padding: 0 2rem;
    font-size: 1rem;
  }
}

@media (min-width: 1280px) {
  .site-chrome {
    font-size: 1.125rem;
  }

  .site-chrome-nav {
    gap: 1.25rem;
  }
}
/* Site footer — same structure as SiteFooter on the Next pages. */
.site-footer {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
  border-top: 2px solid #000;
  background: #e0e0db !important;
  color: #000 !important;
  font-family: Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: center;
}
.site-footer a { color: #000 !important; text-decoration: none; }
.site-footer-note { max-width: 42rem; margin: 0; font-size: 0.875rem; line-height: 1.45; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.site-footer-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 1rem 2rem; width: 100%; max-width: 120rem;
}
.site-footer-name { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }
.site-footer-side { display: flex; align-items: center; gap: 1.25rem; }
.site-footer .site-chrome-social a { width: 1.25rem; height: 1.25rem; }
.site-footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.25rem; font-size: 0.875rem; }
.site-footer-logo { display: block; width: 3.5rem; height: 3.5rem; flex: none; }
.site-footer-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 768px) {
  .site-footer-top { justify-content: space-between; text-align: left; }
  .site-footer-name { font-size: 1.875rem; }
  .site-footer-logo { width: 4rem; height: 4rem; }
}
