/* Lambda Engineering shared theme: tokens first, then reusable pieces. */
:root {
  --color-page: #D7DCDD;
  --color-text: #4A4B4C;
  --color-accent: #FF6F61;
  --color-shadow: rgb(0 0 0 / 0.392);
  --color-panel: rgb(215 220 221 / 0.8);
  --color-elevation: rgb(0 0 0 / 0.2);
  --color-footer-edge: rgb(0 0 0 / 0.5);
  --color-surface: #fff;
  --shadow-card: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);

  --ball-1: #FF6F61;
  --ball-2: #4A4B4C;
  --ball-3: #8B9094;
  --ball-4: #B9BEC1;
  --crew-top: var(--color-accent); /* figures working on top of the logo */
  --crew-pit: var(--ball-2);       /* figures down in the pit */
  --agent-far-shade: 0.78; /* far-side limbs: crew color times this, for depth */

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --radius-panel: 10px;
  --radius-card: 0.5rem;
  --font-body: Calibri, Arial, sans-serif;
  --font-size-body: 1rem;
  --line-height-body: 1.5;

  --logo-aspect: 1920 / 495;
  --logo-max-w: 0.3;
  --logo-max-h: 0.3;
  --logo-shadow: drop-shadow(5px 5px 20px var(--color-shadow));
  --pit-height: 100vh;
  --site-logo-w: 200px;
  --site-logo-gap: 7px;
  --panel-image-max-h: 75vh;
  --focus-ring: 3px solid var(--color-accent);
}

@media (hover: none) and (pointer: coarse) {
  :root {
    --logo-max-w: 0.6;
    --logo-max-h: 0.4;
    --pit-height: 85vh;
  }
  html, body { overflow-y: hidden; overscroll-behavior: none; touch-action: none; }
  .site-footer { display: none; }
}

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

body {
  margin: 0;
  background-color: var(--color-page);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
}

img { display: block; max-width: 100%; }
p { margin: 0; }

/* Tiled panel backdrop: the pit and every plain page */
.pit, .page-tiled {
  background: var(--color-page) url("panels4k.webp") center / cover no-repeat;
}
.page-tiled { min-height: 100vh; background-attachment: fixed; }

/* Ball pit */
.pit {
  position: relative;
  width: 100%;
  height: var(--pit-height);
  border-radius: var(--radius-panel);
  overflow: hidden;
  container-type: size;
}

.pit-logo {
  --w: min(var(--logo-max-w) * 100cqw, var(--logo-max-h) * 100cqh * (1920 / 495));
  position: absolute;
  width: var(--w);
  height: auto;
  aspect-ratio: var(--logo-aspect);
  max-width: none;
  left: calc((100cqw - var(--w)) / 2);
  top: calc((100cqh - var(--w) / (1920 / 495)) / 2.5);
  filter: var(--logo-shadow);
  pointer-events: none;
  user-select: none;
}

.pit-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Motion permission button (shown only where a tap is required) */
.motion-button {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-panel);
  background-color: var(--color-panel);
  color: var(--color-text);
  box-shadow: 0 2px 5px var(--color-elevation);
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
}
.motion-button[hidden] { display: none; }
.motion-button:disabled { opacity: 0.4; cursor: not-allowed; }
.motion-button:disabled:hover, .motion-button:disabled:active { transform: none; }
.motion-button:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.motion-button:hover { transform: scale(1.05); }
.motion-button:active { transform: scale(0.95); }
.motion-button.is-on { border-color: var(--color-accent); color: var(--color-accent); }
.motion-button svg { width: 30px; height: 30px; fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  .motion-button { transition: none; }
  .motion-button:hover, .motion-button:active { transform: none; }
}

/* Top-left logo link (plain pages) */
.site-logo { display: block; width: var(--site-logo-w); margin-bottom: var(--site-logo-gap); }
.site-logo:focus-visible, .site-footer a:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

/* Centered stage and white card holding a graphic */
.stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
}
.card {
  padding: var(--space-8);
  border-radius: var(--radius-card);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-card);
}
.card img { max-height: var(--panel-image-max-h); max-width: 100%; }

/* Footer */
.site-footer {
  margin-top: 10px;
  padding: var(--space-6) var(--space-4);
  background-color: var(--color-page);
  box-shadow: 0 -5px 5px -5px var(--color-footer-edge);
}
.site-footer-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 0 auto;
  padding: 0 15px;
}
.site-footer-brand { margin-bottom: var(--space-4); }
.site-footer-brand img { width: 100px; }
.site-footer-brand p { color: var(--color-text); }

@media (min-width: 640px) { .site-footer-inner { max-width: 640px; } }
@media (min-width: 768px) {
  .site-footer-inner { max-width: 768px; flex-direction: row; }
  .site-footer-brand { margin-bottom: 0; }
}
@media (min-width: 1024px) { .site-footer-inner { max-width: 1024px; } }
@media (min-width: 1280px) { .site-footer-inner { max-width: 1280px; } }
@media (min-width: 1536px) { .site-footer-inner { max-width: 1536px; } }
