/* ═══════════════════════════════════════════════════════════════
   cipher — space rock skin — UK minimalist/drone branch
   Fixed viewport environment. No scroll. Zoom is a cut closer.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;700&family=Questrial&display=swap');

:root {
  --bg:          #06080f;
  --bg-elevated: #0b0f1c;
  --bg-card:     #101627;
  --bg-drawer:   #080b14;
  --text:        #e8eaf2;
  --text-dim:    #8891a8;
  --text-faint:  #4a5368;
  --accent:      #c4b5fd;
  --accent-dim:  rgba(196, 181, 253, 0.16);
  --border:      #1a2236;

  /* Six wordmark colors, one per letter */
  --c: #c4b5fd; /* violet */
  --i: #93c5fd; /* sky */
  --p: #f0abfc; /* magenta */
  --h: #fde68a; /* gold */
  --e: #86efac; /* sage */
  --r: #fda4af; /* rose */

  --fade: 0.55s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ═══ Animations — breathing, jiggling, pulsing ═══ */

@keyframes pin-jiggle {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-2.5px); }
  70% { transform: translateY(1.5px); }
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes pin-idle-a {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes pin-idle-b {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Questrial', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

/* ═══ The Desk — full viewport layout ═══ */

.desk {
  display: grid;
  grid-template-rows: 64px 1fr 148px;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* ═══ Top chrome ═══ */

.chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}
.chrome-wordmark {
  font-family: 'Syne', sans-serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
}
.chrome-wordmark span { display: inline-block; animation: pin-jiggle ease-in-out infinite; }
.chrome-wordmark .c { color: var(--c); animation-duration: 2.3s; animation-delay: 0s; }
.chrome-wordmark .i { color: var(--i); animation-duration: 1.8s; animation-delay: 0.4s; }
.chrome-wordmark .p { color: var(--p); animation-duration: 2.7s; animation-delay: 0.15s; }
.chrome-wordmark .h { color: var(--h); animation-duration: 2.1s; animation-delay: 0.6s; }
.chrome-wordmark .e { color: var(--e); animation-duration: 2.5s; animation-delay: 0.25s; }
.chrome-wordmark .r { color: var(--r); animation-duration: 1.9s; animation-delay: 0.75s; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.breadcrumb .crumb {
  color: var(--text-faint);
  transition: color var(--fade);
}
.breadcrumb .crumb.current {
  color: var(--accent);
}
.breadcrumb .sep {
  color: var(--text-faint);
  opacity: 0.4;
}

/* Chrome links — secondary nav (confusions, about, return) */
.chrome-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.chrome-link {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  font-family: 'Questrial', sans-serif;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--fade);
}
.chrome-link:hover { color: var(--accent); }

/* ═══ Stage — where views live ═══ */

.stage {
  position: relative;
  overflow: hidden;
}

.view {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 40px;
  width: 100%;
  height: 100%;
}
.view.active {
  display: flex;
}

.view-inner {
  max-width: 1200px;
  width: 100%;
  height: 100%;
}

/* ═══ Front door — the confession ═══ */

.view.front-door .view-inner {
  max-width: 720px;
  height: auto;
}
.confession {
  font-size: 21px;
  line-height: 1.6;
  text-wrap: pretty;
}
.confession p { margin: 0 0 1.1em 0; }
.confession em { color: var(--accent); font-style: italic; }
.confession-kicker {
  margin-top: 44px;
  display: inline-block;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 14px 28px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: background var(--fade);
}
.confession-kicker:hover { background: var(--accent-dim); }
.confession-kicker { animation: breathe 3s ease-in-out infinite; }

/* ═══ Object view — cross-section + zoom content ═══ */

.object-view-inner {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  height: 100%;
  width: 100%;
  max-width: 1200px;
}

.object-header {
  text-align: left;
}
.page-number {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.object-header h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 4px 0;
  color: var(--text);
  text-wrap: balance;
}
.object-header .subhead {
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  margin: 0;
}

/* ═══ Zoom content (inside an object view) ═══ */

.zoom-stack {
  min-height: 0;
  flex: 1;
}
.zoom-level {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 40px;
  align-items: center;
  width: 100%;
  height: 100%;
}
.zoom-level.active {
  display: grid;
}
.zoom-level.text-only {
  grid-template-columns: 1fr;
  max-width: 780px;
}

.zoom-text h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 18px 0;
  color: var(--text);
  text-wrap: balance;
}
.zoom-text p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  text-wrap: pretty;
  margin: 0 0 14px 0;
  max-width: 640px;
}
.zoom-text em { color: var(--accent); font-style: italic; }

/* Skeptic voice */
aside.skeptic {
  margin-top: 18px;
  padding: 16px 22px;
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  text-wrap: pretty;
  max-width: 560px;
}
aside.skeptic::before {
  content: 'skeptic';
  display: block;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ═══ Cross-section figures ═══ */

.cross-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 28px 32px;
}
.cross-section-title {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.cross-section-svg {
  width: 100%;
  height: auto;
  stroke: var(--text);
  stroke-width: 0.8;
  fill: none;
  display: block;
}
.cross-section-svg text {
  fill: var(--text-faint);
  stroke: none;
  font-family: 'Questrial', sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.cross-section-svg .callout {
  stroke: var(--accent);
  stroke-width: 0.6;
  stroke-dasharray: 2 2;
}
.cross-section-svg .annotation {
  fill: var(--accent);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ═══ Zoom controls — step through levels ═══ */

.zoom-controls {
  padding-top: 12px;
}
.zoom-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.zoom-arrow {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: 'Questrial', sans-serif;
  transition: color var(--fade);
}
.zoom-arrow:hover { color: var(--accent); }
.zoom-arrow:not(:disabled) { animation: breathe 3.5s ease-in-out infinite; }
.zoom-arrow:disabled {
  color: var(--text-faint);
  opacity: 0.4;
  cursor: default;
}
.zoom-indicator {
  width: 100%;
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  margin-top: 18px;
  order: 1;
}
.zoom-indicator .current { color: var(--accent); }

/* ═══ Stub views ═══ */

.view.stub .view-inner {
  max-width: 560px;
  text-align: left;
}
.stub-number {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.stub h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 4px 0;
  color: var(--text-dim);
}
.stub .subhead {
  color: var(--text-faint);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  margin: 0 0 24px 0;
}
.stub p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-dim);
  max-width: 520px;
  text-wrap: pretty;
  margin: 0 0 18px 0;
}
.stub-status {
  display: inline-block;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 5px 14px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ═══ The Drawer — persistent bottom row ═══ */

.drawer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 40px 24px 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-drawer);
  z-index: 10;
}
.drawer-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-width: 120px;
  opacity: 0.45;
  transition: opacity var(--fade), transform var(--fade);
  cursor: pointer;
  background: none;
  border: none;
}
.drawer-item:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}
.drawer-item:not(.active) { animation: breathe 4s ease-in-out infinite; }
.drawer-item.active {
  opacity: 1;
  transform: translateY(-4px);
}
.drawer-item.active .drawer-icon { stroke: var(--accent); }
.drawer-item.active .drawer-label { color: var(--accent); }
.drawer-icon {
  width: 48px;
  height: 48px;
  stroke: var(--text);
  stroke-width: 1.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--fade);
}
.drawer-label {
  color: var(--text-dim);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  transition: color var(--fade);
  white-space: nowrap;
}
.drawer-note {
  color: var(--text-faint);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-align: center;
}

/* ═══ Interactive pin-tumbler lock ═══ */

.lock-controls {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.lock-btn {
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Questrial', sans-serif;
}
.lock-btn:hover { border-color: var(--accent); color: var(--accent); }
.lock-btn:not(.active) { animation: breathe 3s ease-in-out infinite; }
.lock-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Idle pin pulse — waiting for input */
.lock-svg[data-state="none"] [data-pin="0"] .driver-pin,
.lock-svg[data-state="none"] [data-pin="0"] .key-pin { animation: pin-idle-a 1.9s ease-in-out infinite 0s; }
.lock-svg[data-state="none"] [data-pin="1"] .driver-pin,
.lock-svg[data-state="none"] [data-pin="1"] .key-pin { animation: pin-idle-b 2.3s ease-in-out infinite 0.3s; }
.lock-svg[data-state="none"] [data-pin="2"] .driver-pin,
.lock-svg[data-state="none"] [data-pin="2"] .key-pin { animation: pin-idle-a 2.6s ease-in-out infinite 0.15s; }
.lock-svg[data-state="none"] [data-pin="3"] .driver-pin,
.lock-svg[data-state="none"] [data-pin="3"] .key-pin { animation: pin-idle-b 2.0s ease-in-out infinite 0.55s; }

/* Pin animation — CSS transforms on SVG groups */
.lock-svg .driver-pin,
.lock-svg .key-pin,
.lock-svg .key-shape {
  transition: transform 0.55s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.4s ease;
}
.lock-svg .key-shape { opacity: 0; transform: translateX(-40px); }
.lock-svg .shear-line { transition: stroke 0.4s ease; }
.lock-svg .plug-label { transition: fill 0.4s ease; }

/* Correct key: pins aligned, key visible, shear line lights up */
.lock-svg[data-state="correct"] .key-shape { opacity: 1; transform: translateX(0); }
.lock-svg[data-state="correct"] .shear-line { stroke: #86efac; }
.lock-svg[data-state="correct"] .plug-label { fill: #86efac; }

/* Pin 0 transforms: correct pushes UP so gap hits shear */
.lock-svg[data-state="correct"] [data-pin="0"] .driver-pin { transform: translateY(-22px); }
.lock-svg[data-state="correct"] [data-pin="0"] .key-pin { transform: translateY(-22px); }
.lock-svg[data-state="correct"] [data-pin="1"] .driver-pin { transform: translateY(-14px); }
.lock-svg[data-state="correct"] [data-pin="1"] .key-pin { transform: translateY(-14px); }
.lock-svg[data-state="correct"] [data-pin="2"] .driver-pin { transform: translateY(-20px); }
.lock-svg[data-state="correct"] [data-pin="2"] .key-pin { transform: translateY(-20px); }
.lock-svg[data-state="correct"] [data-pin="3"] .driver-pin { transform: translateY(-16px); }
.lock-svg[data-state="correct"] [data-pin="3"] .key-pin { transform: translateY(-16px); }

/* Wrong key: pins at different (misaligned) heights, key visible */
.lock-svg[data-state="wrong"] .key-shape { opacity: 1; transform: translateX(0); }
.lock-svg[data-state="wrong"] .shear-line { stroke: #fda4af; }
.lock-svg[data-state="wrong"] .plug-label { fill: #fda4af; }

.lock-svg[data-state="wrong"] [data-pin="0"] .driver-pin { transform: translateY(-10px); }
.lock-svg[data-state="wrong"] [data-pin="0"] .key-pin { transform: translateY(-10px); }
.lock-svg[data-state="wrong"] [data-pin="1"] .driver-pin { transform: translateY(-20px); }
.lock-svg[data-state="wrong"] [data-pin="1"] .key-pin { transform: translateY(-20px); }
.lock-svg[data-state="wrong"] [data-pin="2"] .driver-pin { transform: translateY(-6px); }
.lock-svg[data-state="wrong"] [data-pin="2"] .key-pin { transform: translateY(-6px); }
.lock-svg[data-state="wrong"] [data-pin="3"] .driver-pin { transform: translateY(-24px); }
.lock-svg[data-state="wrong"] [data-pin="3"] .key-pin { transform: translateY(-24px); }

/* ═══ Hash demo (wax seal) ═══ */

.hash-demo {
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.hash-demo .hash-label {
  display: block;
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hash-demo .hash-input {
  width: 100%;
  max-width: 360px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Questrial', sans-serif;
  font-size: 18px;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.3s ease;
}
.hash-demo .hash-input:focus { border-color: var(--accent); }
.hash-demo .hash-output {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.hash-demo .hash-prefix {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.hash-demo .hash-value {
  font-family: 'Syne', monospace;
  font-size: 11px;
  color: var(--accent);
  word-break: break-all;
  line-height: 1.5;
  letter-spacing: 0.04em;
  transition: color 0.15s ease;
}
.hash-demo .hash-value.changed {
  color: #fde68a;
}
.hash-demo .hash-note {
  color: var(--text-faint);
  font-size: 11px;
  margin: 10px 0 0 0;
  letter-spacing: 0.06em;
}

/* ═══ Responsive ═══ */

@media (max-width: 900px) {
  .desk { grid-template-rows: 56px 1fr 128px; }
  .chrome { padding: 0 24px; }
  .chrome-wordmark { font-size: 22px; }
  .view { padding: 24px 28px; }
  .confession { font-size: 18px; }
  .object-header h2, .stub h2 { font-size: 30px; }
  .zoom-level { grid-template-columns: 1fr; gap: 20px; }
  .cross-section { padding: 16px 20px; }
  .cross-section-svg { max-height: 200px; }
  .drawer { padding: 12px 16px 18px 16px; gap: 4px; }
  .drawer-item { min-width: 80px; padding: 6px 8px; }
  .drawer-icon { width: 36px; height: 36px; }
  .drawer-label { font-size: 8px; letter-spacing: 0.1em; }
  .drawer-note { display: none; }
}

@media (max-height: 640px) {
  .view { padding: 20px 40px; }
  .confession { font-size: 18px; line-height: 1.55; }
  .object-header h2 { font-size: 32px; }
}
