:root {
  --bg-hue: 262;
  --bg-shift: 0px;
  --paper: hsl(43, 42%, 93%);
  --paper-deep: hsl(42, 38%, 88%);
  --ink: #2c2318;
  --ink-dim: rgba(44, 35, 24, 0.62);
  --ink-faint: rgba(44, 35, 24, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Inter", "Helvetica Neue", Helvetica, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, hsla(var(--bg-hue), 45%, 60%, 0.07), transparent 58%),
    radial-gradient(circle at 50% 110%, hsla(40, 50%, 60%, 0.16), transparent 60%),
    radial-gradient(rgba(44, 35, 24, 0.05) 1px, transparent 1px);
  background-size: auto, auto, 90px 90px;
  background-position: 0 0, 0 0, var(--bg-shift) 0;
  pointer-events: none;
}

#world {
  position: fixed;
  inset: 0;
}

/* Shared ground line that every object stands on */
#world::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--ground, 72%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(44, 35, 24, 0.3) 18%, rgba(44, 35, 24, 0.3) 82%, transparent);
  box-shadow: 0 1px 18px rgba(44, 35, 24, 0.08);
  pointer-events: none;
}

.obj {
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  will-change: transform, opacity;
}

.obj-fig,
.obj-fig svg,
.obj-art {
  width: 100%;
  height: 100%;
  display: block;
}

.obj-fig svg {
  filter: drop-shadow(0 5px 18px rgba(44, 35, 24, 0.18));
}

.obj-art {
  object-fit: contain;
  filter: drop-shadow(0 5px 18px rgba(44, 35, 24, 0.16));
}

.obj.focused {
  cursor: default;
}

/* ─── HUD ─────────────────────────────────────────────────── */

.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  padding: 28px 32px 0;
  pointer-events: none;
  z-index: 2000;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.005em;
  font-size: 34px;
}


#card {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  width: min(540px, calc(100vw - 32px));
  text-align: center;
  z-index: 2000;
  pointer-events: none;
  padding: 18px 28px 8px;
  background: radial-gradient(closest-side, hsla(43, 42%, 93%, 0.94), hsla(43, 42%, 93%, 0.65) 70%, transparent);
  border-radius: 24px;
}

#card-name {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 600;
  margin: 0;
}

#card-length {
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: hsl(var(--bg-hue), 55%, 42%);
  font-variant-numeric: tabular-nums;
}

#card-fact {
  margin: 10px auto 0;
  max-width: 480px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}

.card-in {
  animation: card-rise 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ─── Navigation ──────────────────────────────────────────── */

.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(44, 35, 24, 0.28);
  background: rgba(255, 253, 247, 0.55);
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  z-index: 2000;
  backdrop-filter: blur(6px);
  transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.nav-arrow:hover:not(:disabled) {
  background: rgba(255, 253, 247, 0.95);
  border-color: rgba(44, 35, 24, 0.55);
}

.nav-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

#btn-prev {
  left: 22px;
}

#btn-next {
  right: 22px;
}


/* ─── Intro ───────────────────────────────────────────────── */

#intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, hsla(43, 45%, 95%, 0.96), hsla(42, 40%, 89%, 0.99));
  z-index: 3000;
  cursor: pointer;
  transition: opacity 650ms ease;
}

#intro.intro-out {
  opacity: 0;
  pointer-events: none;
}

.intro-inner {
  text-align: center;
  max-width: 560px;
  padding: 0 24px;
}

.intro-inner h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(38px, 6.5vw, 64px);
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.intro-inner p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-dim);
  margin: 0 0 30px;
}

.intro-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid rgba(44, 35, 24, 0.32);
  border-radius: 999px;
  padding: 10px 22px;
  background: rgba(255, 253, 247, 0.6);
  animation: hint-pulse 2.2s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%,
  100% {
    border-color: rgba(44, 35, 24, 0.32);
  }
  50% {
    border-color: rgba(44, 35, 24, 0.65);
  }
}

.hint-touch {
  display: none;
}

@media (pointer: coarse) {
  .hint-keys {
    display: none;
  }

  .hint-touch {
    display: inline;
  }
}

@media (max-width: 640px) {
  .nav-arrow {
    top: 42%;
    width: 42px;
    height: 42px;
    font-size: 17px;
  }

  #btn-prev {
    left: 10px;
  }

  #btn-next {
    right: 10px;
  }

  /* Center the text block vertically between the ground line and the
     bottom edge instead of pinning it to the bottom. */
  #card {
    bottom: auto;
    top: calc(var(--ground, 62%) + (100% - var(--ground, 62%)) / 2);
    transform: translate(-50%, -50%);
    width: calc(100vw - 20px);
    padding: 14px 16px 6px;
  }

  .card-in {
    animation-name: card-rise-mobile;
  }

  #card-name {
    font-size: 24px;
  }

  #card-length {
    font-size: 12px;
  }

  #card-fact {
    font-size: 13px;
    line-height: 1.5;
  }

  .hud-top {
    justify-content: flex-start;
    padding: 22px 20px 0;
  }

  .brand {
    font-size: 28px;
  }
}

@keyframes card-rise-mobile {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}
