/* ============================================
   QELNOR — Invention Laboratory Styles
   ============================================ */

:root {
  --copper: #C96A2D;
  --turquoise: #4E8B87;
  --paper: #F4EBDD;
  --text: #2B2622;
  --brass: #D9B44A;
  --wood-dark: #6B4C30;
  --wood-light: #A67C52;
  --shadow: rgba(43, 38, 34, 0.2);
  --shadow-deep: rgba(43, 38, 34, 0.35);

  --font-heading: 'Fraunces', 'Abril Fatface', Georgia, serif;
  --font-display: 'Abril Fatface', 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', 'Nunito Sans', system-ui, sans-serif;

  --ease-mechanical: cubic-bezier(0.34, 1.2, 0.64, 1);
  --transition-fast: 0.25s var(--ease-mechanical);
  --transition-med: 0.45s var(--ease-mechanical);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--copper);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover, a:focus-visible {
  color: var(--turquoise);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: var(--copper);
  color: var(--paper);
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus {
  top: 1rem;
}

/* ---- Typography ---- */
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--copper);
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.section-intro {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
  font-size: 1.1rem;
  opacity: 0.85;
}

h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* ---- Sections ---- */
.section {
  position: relative;
  padding: 5rem 1.5rem;
  min-height: 100vh;
}

/* ============================================
   COMPASS NAVIGATION
   ============================================ */
.compass-nav {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  width: 80px;
  height: 80px;
}

.compass-toggle {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--copper);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--shadow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  margin-left: auto;
}

.compass-toggle:hover,
.compass-toggle:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--shadow-deep);
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

.compass-icon {
  width: 48px;
  height: 48px;
  animation: compass-wobble 4s ease-in-out infinite;
}

.compass-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  list-style: none;
  width: 280px;
  height: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-med);
}

.compass-nav.is-open .compass-menu {
  pointer-events: auto;
  opacity: 1;
}

.compass-menu[hidden] {
  display: block;
  visibility: hidden;
}

.compass-nav.is-open .compass-menu[hidden] {
  visibility: visible;
}

.compass-menu li {
  position: absolute;
  top: 50%;
  left: 50%;
}

.compass-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  border: 2px solid var(--turquoise);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform var(--transition-fast), background var(--transition-fast);
  transform: translate(-50%, -50%);
}

.compass-menu a:hover,
.compass-menu a:focus-visible {
  background: var(--brass);
  color: var(--text);
  transform: translate(-50%, -50%) scale(1.1);
}

.compass-menu li:nth-child(1) a { transform: translate(-50%, -50%) translate(0, -110px); }
.compass-menu li:nth-child(2) a { transform: translate(-50%, -50%) translate(95px, -55px); }
.compass-menu li:nth-child(3) a { transform: translate(-50%, -50%) translate(95px, 55px); }
.compass-menu li:nth-child(4) a { transform: translate(-50%, -50%) translate(0, 110px); }
.compass-menu li:nth-child(5) a { transform: translate(-50%, -50%) translate(-95px, 55px); }
.compass-menu li:nth-child(6) a { transform: translate(-50%, -50%) translate(-95px, -55px); }

.compass-menu li:nth-child(1) a:hover { transform: translate(-50%, -50%) translate(0, -110px) scale(1.1); }
.compass-menu li:nth-child(2) a:hover { transform: translate(-50%, -50%) translate(95px, -55px) scale(1.1); }
.compass-menu li:nth-child(3) a:hover { transform: translate(-50%, -50%) translate(95px, 55px) scale(1.1); }
.compass-menu li:nth-child(4) a:hover { transform: translate(-50%, -50%) translate(0, 110px) scale(1.1); }
.compass-menu li:nth-child(5) a:hover { transform: translate(-50%, -50%) translate(-95px, 55px) scale(1.1); }
.compass-menu li:nth-child(6) a:hover { transform: translate(-50%, -50%) translate(-95px, -55px) scale(1.1); }

/* ============================================
   SECTION 1 — THE INVENTOR'S DESK
   ============================================ */
.desk {
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.desk-surface {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(217, 180, 74, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(201, 106, 45, 0.06) 0%, transparent 40%),
    linear-gradient(135deg, var(--wood-light) 0%, var(--wood-dark) 50%, #5A3D25 100%);
  perspective: 800px;
}

.desk-grain {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      88deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.03) 3px,
      rgba(0, 0, 0, 0.03) 4px
    );
  pointer-events: none;
}

.desk-object {
  position: absolute;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

button.desk-object {
  padding: 0;
}

button.desk-object:hover,
button.desk-object:focus-visible {
  transform: scale(1.08) translateY(-4px);
  filter: drop-shadow(0 8px 16px var(--shadow-deep));
  outline: 2px solid var(--brass);
  outline-offset: 4px;
  z-index: 10;
}

.blueprint-sheet {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(260px, 40vw, 380px);
}

.blueprint-sheet:hover {
  transform: translate(-50%, -50%) scale(1.05) translateY(-4px);
}

.blueprint-paper {
  background: #E8F0F0;
  border: 1px solid var(--turquoise);
  padding: 2rem 1.5rem;
  box-shadow: 0 8px 24px var(--shadow-deep);
  position: relative;
}

.blueprint-paper::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 20%;
  width: 60%;
  height: 16px;
  background: rgba(217, 180, 74, 0.5);
  transform: rotate(-1deg);
}

.blueprint-grid {
  position: absolute;
  inset: 0;
  opacity: 0.6;
}

.desk-logo {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--copper);
  text-align: center;
  position: relative;
  z-index: 1;
  letter-spacing: 0.15em;
}

.desk-tagline {
  font-family: var(--font-heading);
  text-align: center;
  color: var(--turquoise);
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.gear-small { top: 15%; left: 10%; width: 60px; }
.gear-large { bottom: 20%; right: 8%; width: 80px; }

.sketchbook {
  top: 12%;
  right: 18%;
  width: 100px;
}

.sketchbook-cover {
  background: #8B4513;
  border: 2px solid var(--text);
  border-radius: 2px 8px 8px 2px;
  padding: 0.75rem;
  box-shadow: 3px 3px 0 var(--shadow);
}

.sketchbook-label {
  font-size: 0.65rem;
  color: var(--paper);
  display: block;
  margin-bottom: 0.25rem;
  font-style: italic;
}

.magnifier {
  bottom: 25%;
  left: 15%;
  width: 50px;
}

.mech-drawing {
  bottom: 18%;
  left: 35%;
  width: 110px;
}

.mech-paper {
  background: var(--paper);
  padding: 0.5rem;
  border: 1px solid var(--text);
  box-shadow: 2px 2px 6px var(--shadow);
  transform: rotate(-8deg);
}

.gadget-ticker {
  top: 40%;
  right: 12%;
  width: 40px;
  height: 40px;
}

.ticker-body {
  position: relative;
  width: 100%;
  height: 100%;
}

.ticker-gear {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: conic-gradient(var(--brass) 0deg, var(--copper) 90deg, var(--brass) 180deg, var(--copper) 270deg);
  border: 2px solid var(--text);
}

.ticker-arm {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 3px;
  background: var(--text);
  transform-origin: left center;
  animation: ticker-swing 2s ease-in-out infinite;
}

.pencil {
  top: 55%;
  left: 8%;
  width: 80px;
  height: 8px;
  background: linear-gradient(90deg, #F4D03F 0%, #E67E22 60%, #F5B7B1 95%, #2C3E50 100%);
  border-radius: 2px;
  transform: rotate(35deg);
  box-shadow: 1px 2px 4px var(--shadow);
}

.ruler {
  top: 65%;
  right: 25%;
  width: 120px;
  height: 14px;
  background: var(--brass);
  border: 1px solid var(--text);
  transform: rotate(-12deg);
  box-shadow: 1px 2px 4px var(--shadow);
}

.ruler::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: repeating-linear-gradient(90deg, var(--text) 0, var(--text) 1px, transparent 1px, transparent 10px);
  opacity: 0.3;
}

.desk-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: var(--paper);
  opacity: 0.7;
  text-align: center;
  animation: hint-pulse 3s ease-in-out infinite;
}

/* ============================================
   SECTION 2 — THE MACHINE HALL
   ============================================ */
.machine-hall {
  background:
    linear-gradient(180deg, var(--paper) 0%, #E8DFD0 50%, var(--paper) 100%);
}

.machine-hall-inner {
  max-width: 700px;
  margin: 0 auto;
}

.vertical-machine {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4rem;
  padding: 2rem 0;
}

.machine-pipe {
  position: absolute;
  width: 12px;
  background: linear-gradient(90deg, #8B7355, var(--brass), #8B7355);
  border-radius: 6px;
  box-shadow: inset 0 0 4px var(--shadow);
}

.pipe-left {
  left: 10%;
  top: 0;
  height: 100%;
}

.pipe-right {
  right: 10%;
  top: 0;
  height: 100%;
}

.machine-component {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem;
  background: var(--paper);
  border: 2px solid var(--turquoise);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--shadow);
  opacity: 0.3;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s var(--ease-mechanical);
}

.machine-component.is-revealed {
  opacity: 1;
  transform: translateX(0);
}

.machine-component:nth-child(even) {
  flex-direction: row-reverse;
  transform: translateX(30px);
}

.machine-component:nth-child(even).is-revealed {
  transform: translateX(0);
}

.machine-gear {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.piston-assembly {
  width: 60px;
  height: 100px;
  position: relative;
  flex-shrink: 0;
}

.piston-rod {
  width: 8px;
  height: 60px;
  background: var(--brass);
  margin: 0 auto;
  animation: piston-move 2s ease-in-out infinite;
}

.piston-head {
  width: 40px;
  height: 20px;
  background: var(--copper);
  border: 2px solid var(--text);
  border-radius: 4px;
  margin: 0 auto;
  animation: piston-move 2s ease-in-out infinite;
}

.flywheel {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 6px solid var(--copper);
  border-style: double;
  flex-shrink: 0;
  position: relative;
}

.flywheel::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--brass);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.lever-arm {
  width: 80px;
  height: 12px;
  background: var(--wood-dark);
  border-radius: 6px;
  flex-shrink: 0;
  transform-origin: left center;
  animation: lever-rock 3s ease-in-out infinite;
  position: relative;
}

.lever-arm::after {
  content: '';
  position: absolute;
  right: -8px;
  top: -8px;
  width: 24px;
  height: 24px;
  background: var(--brass);
  border-radius: 50%;
  border: 2px solid var(--text);
}

.steam-burst {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.steam-burst span {
  width: 20px;
  height: 20px;
  background: rgba(244, 235, 221, 0.8);
  border-radius: 50%;
  animation: steam-rise 2s ease-out infinite;
}

.steam-burst span:nth-child(2) { animation-delay: 0.4s; }
.steam-burst span:nth-child(3) { animation-delay: 0.8s; }

.machine-content h3 {
  color: var(--copper);
}

/* ============================================
   SECTION 3 — THE IDEA INCUBATOR
   ============================================ */
.idea-incubator {
  background: radial-gradient(ellipse at center, rgba(78, 139, 135, 0.08) 0%, var(--paper) 70%);
  overflow: hidden;
}

.jar-field {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem 0;
}

.idea-jar {
  width: 160px;
  text-align: center;
  animation: jar-float 6s ease-in-out infinite;
  cursor: default;
}

.idea-jar:nth-child(1) { animation-delay: 0s; }
.idea-jar:nth-child(2) { animation-delay: 1.2s; }
.idea-jar:nth-child(3) { animation-delay: 2.4s; }
.idea-jar:nth-child(4) { animation-delay: 0.6s; }
.idea-jar:nth-child(5) { animation-delay: 1.8s; }

.jar-glass {
  width: 100px;
  height: 120px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(78,139,135,0.15) 100%);
  border: 2px solid rgba(78, 139, 135, 0.5);
  border-radius: 10px 10px 40px 40px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}

.idea-jar:hover .jar-glass,
.idea-jar:focus-visible .jar-glass {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(217, 180, 74, 0.4);
}

.jar-lid {
  width: 110px;
  height: 12px;
  background: var(--brass);
  border: 2px solid var(--text);
  border-radius: 4px;
  margin: -2px auto 0;
}

.jar-contents {
  padding: 1rem 0.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.jar-sketch {
  width: 60px;
  height: 60px;
  transition: transform var(--transition-med);
}

.idea-jar:hover .jar-sketch,
.idea-jar:focus-visible .jar-sketch {
  animation: sketch-wiggle 0.5s ease-in-out;
}

.jar-bubbles span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--turquoise);
  border-radius: 50%;
  margin: 0 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.idea-jar:hover .jar-bubbles span,
.idea-jar:focus-visible .jar-bubbles span {
  opacity: 0.6;
  animation: bubble-rise 1s ease-out infinite;
}

.jar-bubbles span:nth-child(2) { animation-delay: 0.3s; }
.jar-bubbles span:nth-child(3) { animation-delay: 0.6s; }

.jar-title {
  margin-top: 0.75rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--copper);
}

.jar-concept {
  font-size: 0.8rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity var(--transition-med), max-height var(--transition-med);
  padding: 0 0.5rem;
}

.idea-jar:hover .jar-concept,
.idea-jar:focus-visible .jar-concept {
  opacity: 0.85;
  max-height: 120px;
  margin-top: 0.5rem;
}

/* ============================================
   SECTION 4 — THE EXPERIMENT TRACK
   ============================================ */
.experiment-track {
  background: linear-gradient(180deg, var(--paper), #EDE4D3);
  overflow: hidden;
}

.track-container {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  min-height: 400px;
}

.track-path {
  width: 100%;
  height: auto;
}

.track-stations {
  position: absolute;
  inset: 0;
}

.station {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  background: var(--paper);
  border: 2px solid var(--copper);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  max-width: 160px;
  text-align: center;
}

.station:hover,
.station:focus-visible {
  transform: scale(1.05);
  box-shadow: 5px 5px 0 var(--shadow-deep);
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.station:nth-child(1) { top: 55%; left: 2%; }
.station:nth-child(2) { top: 15%; left: 28%; }
.station:nth-child(3) { top: 45%; left: 48%; }
.station:nth-child(4) { top: 10%; left: 68%; }
.station:nth-child(5) { top: 30%; left: 82%; }

.station-marker {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--brass);
}

.station-name {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.station-detail {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  text-align: left;
  line-height: 1.4;
}

.station-detail:not([hidden]) {
  animation: station-expand 0.4s var(--ease-mechanical);
}

.station[aria-expanded="true"] {
  max-width: 220px;
  z-index: 5;
  background: #FFF8EE;
  border-color: var(--brass);
}

.track-cart {
  position: absolute;
  width: 24px;
  height: 16px;
  offset-path: path('M50,250 C150,250 200,50 350,80 S550,200 650,100 S750,150 780,120');
  offset-distance: 0%;
  animation: cart-ride 12s linear infinite;
}

.cart-body {
  width: 100%;
  height: 100%;
  background: var(--copper);
  border-radius: 4px;
  border: 2px solid var(--text);
}

/* ============================================
   SECTION 5 — THE BLUEPRINT WALL
   ============================================ */
.blueprint-wall {
  background: #3D4F5F;
  color: var(--paper);
}

.blueprint-wall .section-title {
  color: var(--brass);
}

.blueprint-wall .section-intro {
  color: rgba(244, 235, 221, 0.8);
}

.blueprint-archive {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.blueprint-pin {
  transform: rotate(var(--rotation, 0deg));
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.blueprint-pin:hover {
  transform: rotate(0deg) scale(1.03);
  z-index: 5;
}

.pin-tape {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 50px;
  height: 18px;
  background: rgba(217, 180, 74, 0.6);
  z-index: 2;
}

.blueprint-sheet-inner {
  background: #D6E8E8;
  color: var(--text);
  padding: 1.25rem;
  border: 1px solid var(--turquoise);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.bp-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--turquoise);
  letter-spacing: 0.1em;
}

.blueprint-sheet-inner h3 {
  font-family: var(--font-heading);
  color: var(--copper);
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.bp-note {
  font-size: 0.8rem;
  font-style: italic;
  margin-bottom: 0.25rem;
}

.bp-annotation {
  font-family: 'Nunito Sans', cursive;
  font-size: 0.75rem;
  color: var(--copper);
  transform: rotate(-1deg);
  display: inline-block;
}

.blueprint-sheet-inner svg {
  margin: 0.5rem 0;
  width: 100%;
  height: auto;
}

/* ============================================
   SECTION 6 — THE TEST LAB
   ============================================ */
.test-lab {
  background: linear-gradient(180deg, var(--paper) 0%, rgba(78, 139, 135, 0.06) 100%);
}

.lab-apparatus {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

.lab-tubes {
  position: relative;
  margin-bottom: 3rem;
}

.tube-svg {
  width: 100%;
  height: auto;
}

.tube-path {
  fill: none;
  stroke: rgba(78, 139, 135, 0.3);
  stroke-width: 16;
  stroke-linecap: round;
}

.tube-joint {
  fill: var(--brass);
  stroke: var(--text);
  stroke-width: 2;
}

.liquid-flow {
  position: absolute;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle, var(--turquoise) 30%, var(--copper) 70%);
  border-radius: 50%;
  offset-path: path('M80,100 L200,100 Q220,100 220,80 L220,60 Q220,40 240,40 L400,40 Q420,40 420,60 L420,100 Q420,120 440,120 L600,120 Q620,120 620,100 L620,80 Q620,60 640,60 L800,60');
  offset-distance: 0%;
  animation: liquid-travel 8s linear infinite;
  box-shadow: 0 0 12px rgba(78, 139, 135, 0.5);
}

.lab-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.lab-module {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--paper);
  border: 2px solid var(--turquoise);
  border-radius: 12px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.lab-module:hover {
  transform: translateY(-4px);
  border-color: var(--copper);
}

.module-flask {
  width: 50px;
  height: 70px;
  margin: 0 auto 1rem;
  border: 2px solid var(--turquoise);
  border-radius: 8px 8px 20px 20px;
  position: relative;
  overflow: hidden;
}

.flask-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  animation: liquid-slosh 3s ease-in-out infinite;
}

.question-liquid { background: linear-gradient(180deg, var(--turquoise), #3A6B68); }
.experiment-liquid { background: linear-gradient(180deg, var(--copper), #A05020); animation-delay: 0.5s; }
.discovery-liquid { background: linear-gradient(180deg, var(--brass), #B8942F); animation-delay: 1s; }
.outcome-liquid { background: linear-gradient(180deg, #6B8E23, #4A6B15); animation-delay: 1.5s; }

.module-step {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--brass);
  display: block;
  margin-bottom: 0.25rem;
}

.lab-module h3 {
  color: var(--copper);
}

.lab-module p {
  font-size: 0.85rem;
}

/* ============================================
   SECTION 7 — THE CONTRAPTION GALLERY
   ============================================ */
.contraption-gallery {
  background: linear-gradient(180deg, #E0D5C4 0%, var(--paper) 100%);
  position: relative;
}

.gallery-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(43, 38, 34, 0.06));
  pointer-events: none;
}

.contraptions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 0;
}

.contraption {
  position: relative;
  text-align: center;
  padding-top: 2rem;
}

.contraption-body {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  animation: contraption-spin 20s linear infinite;
  transition: animation-duration var(--transition-fast);
}

.contraption:hover .contraption-body,
.contraption:focus-visible .contraption-body {
  animation-duration: 8s;
}

.contraption-shadow {
  width: 100px;
  height: 20px;
  background: radial-gradient(ellipse, var(--shadow-deep) 0%, transparent 70%);
  margin: 1rem auto 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.contraption:hover .contraption-shadow,
.contraption:focus-visible .contraption-shadow {
  transform: scale(1.2);
  opacity: 0.8;
}

.contraption-info {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--turquoise);
  border-radius: 8px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity var(--transition-med), max-height var(--transition-med), padding var(--transition-med);
  text-align: left;
  font-size: 0.85rem;
}

.contraption:hover .contraption-info,
.contraption:focus-visible .contraption-info {
  opacity: 1;
  max-height: 300px;
  padding: 1rem;
}

.contraption-info h3 {
  color: var(--copper);
  margin-bottom: 0.75rem;
}

.contraption-info p {
  margin-bottom: 0.35rem;
}

/* ============================================
   SECTION 8 — THE INVENTORS CLUB
   ============================================ */
.inventors-club {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(201, 106, 45, 0.03) 40px,
      rgba(201, 106, 45, 0.03) 41px
    ),
    var(--paper);
}

.badge-wall {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  background: #8B6914;
  border: 8px solid var(--wood-dark);
  border-radius: 4px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2), 0 8px 24px var(--shadow);
}

.inventor-badge {
  position: relative;
  width: 140px;
  cursor: default;
}

.badge-shape {
  background: var(--brass);
  border: 3px solid var(--text);
  padding: 1rem 0.75rem;
  text-align: center;
  clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.badge-round {
  clip-path: circle(50%);
  border-radius: 50%;
}

.badge-shield {
  clip-path: polygon(50% 0%, 100% 20%, 100% 70%, 50% 100%, 0% 70%, 0% 20%);
}

.inventor-badge:hover .badge-shape,
.inventor-badge:focus-visible .badge-shape {
  transform: scale(1.1) rotate(3deg);
  background: var(--copper);
}

.badge-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.25rem;
}

.badge-name {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  display: block;
}

.badge-story {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  padding: 0.75rem;
  background: var(--paper);
  border: 2px solid var(--copper);
  border-radius: 8px;
  font-size: 0.75rem;
  box-shadow: 0 4px 12px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 10;
}

.inventor-badge:hover .badge-story,
.inventor-badge:focus-visible .badge-story {
  opacity: 1;
}

/* ============================================
   SECTION 9 — THE SCRAPBOOK
   ============================================ */
.scrapbook {
  background: var(--paper);
  overflow: hidden;
}

.scrapbook-collage {
  position: relative;
  max-width: 900px;
  height: 600px;
  margin: 0 auto;
}

.scrap-item {
  position: absolute;
  transform: rotate(var(--scrap-rotate, 0deg));
  transition: transform var(--transition-fast), z-index 0s;
}

.scrap-item:hover {
  transform: rotate(0deg) scale(1.05);
  z-index: 20;
}

.scrap-note {
  top: 10%;
  left: 5%;
  background: #FFFACD;
  padding: 1rem 1.25rem;
  max-width: 220px;
  font-family: 'Nunito Sans', cursive;
  font-size: 0.9rem;
  box-shadow: 2px 3px 8px var(--shadow);
  border: 1px solid rgba(201, 106, 45, 0.2);
}

.scrap-note-small {
  top: 60%;
  right: 10%;
  max-width: 140px;
  padding: 0.75rem;
  font-size: 0.8rem;
}

.scrap-photo {
  top: 5%;
  right: 15%;
  background: var(--paper);
  padding: 0.5rem;
  border: 1px solid var(--text);
  box-shadow: 3px 4px 10px var(--shadow);
}

.photo-placeholder {
  text-align: center;
  font-size: 0.7rem;
  color: var(--turquoise);
  padding: 0.5rem;
}

.scrap-photo-small {
  bottom: 15%;
  left: 20%;
  padding: 0.4rem;
}

.scrap-ticket {
  top: 35%;
  left: 30%;
}

.ticket-stub {
  background: var(--brass);
  border: 2px dashed var(--text);
  padding: 0.75rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: 2px 3px 6px var(--shadow);
}

.ticket-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.ticket-date, .ticket-seat {
  font-size: 0.7rem;
}

.scrap-newspaper {
  bottom: 25%;
  right: 5%;
  max-width: 240px;
}

.news-clipping {
  background: #F5F0E6;
  padding: 1rem;
  border: 1px solid #CCC;
  font-family: 'Times New Roman', Georgia, serif;
  box-shadow: 2px 3px 8px var(--shadow);
}

.news-clipping h4 {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.news-clipping p {
  font-size: 0.75rem;
  font-style: italic;
}

.scrap-drawing {
  top: 45%;
  left: 8%;
  background: var(--paper);
  padding: 0.75rem;
  border: 1px solid var(--turquoise);
  box-shadow: 2px 3px 6px var(--shadow);
}

.scrap-stamp {
  bottom: 10%;
  right: 30%;
}

.rubber-stamp {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--copper);
  border: 3px solid var(--copper);
  padding: 0.5rem 0.75rem;
  text-align: center;
  transform: rotate(-8deg);
  opacity: 0.7;
  letter-spacing: 0.05em;
}

/* ============================================
   SECTION 10 — THE GRAND ACTIVATION SWITCH
   ============================================ */
.activation {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center bottom, rgba(201, 106, 45, 0.15) 0%, transparent 60%),
    var(--paper);
}

.activation-chamber {
  text-align: center;
  padding: 2rem;
}

.activation-heading {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--copper);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.activation-sub {
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto 3rem;
  opacity: 0.85;
}

.activation-switch {
  display: inline-block;
  padding: 0;
}

.switch-housing {
  position: relative;
  width: 200px;
  height: 280px;
  background: linear-gradient(180deg, #8B7355, #5A4A3A);
  border: 4px solid var(--text);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 12px 30px var(--shadow-deep), inset 0 2px 4px rgba(255,255,255,0.1);
  transition: box-shadow var(--transition-fast);
}

.activation-switch:hover .switch-housing,
.activation-switch:focus-visible .switch-housing {
  box-shadow: 0 16px 40px var(--shadow-deep), inset 0 0 20px rgba(217, 180, 74, 0.2);
}

.switch-lights {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1rem;
}

.light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #555;
  border: 2px solid var(--text);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.activation-switch:hover .light-1,
.activation-switch:focus-visible .light-1 {
  background: #4CAF50;
  box-shadow: 0 0 10px #4CAF50;
}

.activation-switch:hover .light-2,
.activation-switch:focus-visible .light-2 {
  background: var(--brass);
  box-shadow: 0 0 10px var(--brass);
  transition-delay: 0.1s;
}

.activation-switch:hover .light-3,
.activation-switch:focus-visible .light-3 {
  background: var(--copper);
  box-shadow: 0 0 10px var(--copper);
  transition-delay: 0.2s;
}

.switch-gears {
  position: absolute;
  top: 20px;
  right: 15px;
  width: 50px;
  height: 50px;
}

.switch-gear {
  position: absolute;
  border-radius: 50%;
  border: 3px solid var(--brass);
  background: conic-gradient(var(--copper) 0deg, var(--brass) 120deg, var(--copper) 240deg);
}

.sg-1 {
  width: 30px;
  height: 30px;
  top: 0;
  left: 0;
}

.sg-2 {
  width: 22px;
  height: 22px;
  bottom: 0;
  right: 0;
}

.activation-switch:hover .sg-1,
.activation-switch:focus-visible .sg-1 {
  animation: spin 2s linear infinite;
}

.activation-switch:hover .sg-2,
.activation-switch:focus-visible .sg-2 {
  animation: spin-reverse 1.5s linear infinite;
}

.switch-steam {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.activation-switch:hover .switch-steam,
.activation-switch:focus-visible .switch-steam {
  opacity: 1;
}

.switch-steam span {
  width: 16px;
  height: 16px;
  background: rgba(244, 235, 221, 0.7);
  border-radius: 50%;
  animation: steam-rise 1.5s ease-out infinite;
}

.switch-steam span:nth-child(2) { animation-delay: 0.3s; }
.switch-steam span:nth-child(3) { animation-delay: 0.6s; }

.switch-lever {
  position: relative;
  margin-top: 2rem;
}

.lever-base {
  width: 60px;
  height: 20px;
  background: var(--brass);
  border: 2px solid var(--text);
  border-radius: 4px;
  margin: 0 auto;
}

.lever-handle {
  width: 20px;
  height: 80px;
  background: linear-gradient(90deg, var(--copper), #E08040, var(--copper));
  border: 2px solid var(--text);
  border-radius: 10px;
  margin: 0 auto;
  transform-origin: bottom center;
  transition: transform var(--transition-med);
  position: relative;
  top: 4px;
}

.activation-switch:hover .lever-handle,
.activation-switch:focus-visible .lever-handle {
  transform: rotate(-35deg);
}

.activation-switch.is-activated .lever-handle {
  transform: rotate(-55deg);
}

.switch-label {
  display: block;
  margin-top: 1.5rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--brass);
  letter-spacing: 0.2em;
}

.activation-contact {
  margin-top: 2rem;
  animation: station-expand 0.5s var(--ease-mechanical);
}

.activation-contact:not([hidden]) {
  display: block;
}

.contact-link {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--text);
  color: var(--paper);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--brass);
}

.footer-whisper {
  margin-top: 0.5rem;
  opacity: 0.5;
  font-style: italic;
  font-size: 0.75rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */
.spinning-slow { animation: spin 12s linear infinite; }
.spinning-reverse { animation: spin-reverse 10s linear infinite; }
.spinning-fast { animation: spin 3s linear infinite; }

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

@keyframes spin-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes compass-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(3deg); }
  75% { transform: rotate(-3deg); }
}

@keyframes ticker-swing {
  0%, 100% { transform: rotate(-30deg); }
  50% { transform: rotate(30deg); }
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

@keyframes piston-move {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(15px); }
}

@keyframes lever-rock {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

@keyframes steam-rise {
  0% { transform: translateY(0) scale(1); opacity: 0.8; }
  100% { transform: translateY(-30px) scale(1.5); opacity: 0; }
}

@keyframes jar-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes sketch-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

@keyframes bubble-rise {
  0% { transform: translateY(0); opacity: 0.6; }
  100% { transform: translateY(-20px); opacity: 0; }
}

@keyframes cart-ride {
  to { offset-distance: 100%; }
}

@keyframes station-expand {
  from { opacity: 0; transform: scaleY(0.8); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes liquid-travel {
  to { offset-distance: 100%; }
}

@keyframes liquid-slosh {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.1); }
}

@keyframes contraption-spin {
  to { transform: rotateY(360deg); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .section {
    padding: 4rem 1rem;
  }

  .compass-nav {
    top: 1rem;
    right: 1rem;
  }

  .compass-menu {
    width: 240px;
    height: 240px;
  }

  .compass-menu li:nth-child(1) a { transform: translate(-50%, -50%) translate(0, -90px); }
  .compass-menu li:nth-child(2) a { transform: translate(-50%, -50%) translate(78px, -45px); }
  .compass-menu li:nth-child(3) a { transform: translate(-50%, -50%) translate(78px, 45px); }
  .compass-menu li:nth-child(4) a { transform: translate(-50%, -50%) translate(0, 90px); }
  .compass-menu li:nth-child(5) a { transform: translate(-50%, -50%) translate(-78px, 45px); }
  .compass-menu li:nth-child(6) a { transform: translate(-50%, -50%) translate(-78px, -45px); }

  .gear-small { width: 45px; top: 10%; left: 5%; }
  .gear-large { width: 55px; bottom: 15%; right: 5%; }
  .sketchbook { width: 70px; top: 8%; right: 10%; }
  .magnifier { width: 40px; bottom: 30%; left: 8%; }
  .mech-drawing { width: 80px; bottom: 12%; left: 25%; }
  .gadget-ticker { display: none; }
  .pencil, .ruler { display: none; }

  .machine-component {
    flex-direction: column !important;
    text-align: center;
  }

  .track-container {
    min-height: 500px;
  }

  .station {
    max-width: 130px;
    font-size: 0.85rem;
  }

  .station:nth-child(1) { top: 60%; left: 0; }
  .station:nth-child(2) { top: 10%; left: 20%; }
  .station:nth-child(3) { top: 40%; left: 40%; }
  .station:nth-child(4) { top: 5%; left: 60%; }
  .station:nth-child(5) { top: 25%; left: 75%; }

  .scrapbook-collage {
    height: auto;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
  }

  .scrap-item {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
  }

  .badge-wall {
    gap: 1rem;
    padding: 1.5rem;
  }

  .inventor-badge {
    width: 120px;
  }

  .badge-story {
    width: 160px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .desk-logo {
    font-size: 2rem;
    letter-spacing: 0.1em;
  }

  .blueprint-archive {
    grid-template-columns: 1fr;
  }

  .jar-field {
    gap: 2rem;
  }

  .idea-jar {
    width: 140px;
  }
}

/* ============================================
   ACCESSIBILITY — Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .machine-component {
    opacity: 1;
    transform: none;
  }
}

/* Focus visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}
