:root {
  --cream: #fff8ea;
  --ink: #3d4a3a;
  --sage-deep: #6f8c6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #bfe3f6;
  font-family: 'Jost', 'Avenir Next', 'Helvetica Neue', system-ui, sans-serif;
  color: var(--ink);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.landing {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(26px, 6vh, 60px) 16px clamp(22px, 5vh, 48px);
  pointer-events: none;
}

.landing__title {
  text-align: center;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 1px 16px rgba(30, 80, 140, 0.85), 0 0 6px rgba(30, 80, 140, 0.6), 0 1px 1px rgba(30, 80, 140, 0.5);
}

.landing__eyebrow {
  margin: 0 0 10px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  opacity: 0.9;
}

.landing__title h1 {
  margin: 0 -0.42em 0 0;
  font-weight: 500;
  font-size: clamp(1rem, 2.1vw, 1.45rem);
  letter-spacing: 0.42em;
  line-height: 1.5;
}

.landing__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
}

.door-btn {
  font: inherit;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 13px 22px 13px calc(22px + 0.24em);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 248, 234, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 22px rgba(40, 70, 90, 0.2);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.door-btn:hover,
.door-btn:focus-visible {
  transform: translateY(-3px);
  background: var(--cream);
  box-shadow: 0 10px 28px rgba(40, 70, 90, 0.3);
  outline: none;
}

.door-btn:focus-visible { border-color: var(--sage-deep); }

@media (max-width: 560px) {
  .landing__nav { flex-direction: column; width: min(260px, 100%); }
  .door-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .door-btn { transition: none; }
}

/* --- landing fades away while travelling */
.landing { transition: opacity 0.6s ease; }
.landing.is-hidden { opacity: 0; }
.landing.is-hidden .landing__nav { pointer-events: none; }

/* --- time of day */
.time {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 248, 234, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 22px rgba(40, 70, 90, 0.2);
}

.time__btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  opacity: 0.6;
  cursor: pointer;
  transition: background 0.25s ease, opacity 0.25s ease, color 0.25s ease;
}

.time__btn:hover,
.time__btn:focus-visible { opacity: 1; outline: none; background: rgba(255, 255, 255, 0.7); }
.time__btn[aria-pressed='true'] { opacity: 1; background: var(--sage-deep); color: #fff; }

/* --- inside a room */
.hud {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(26px, 6vh, 60px) 16px clamp(22px, 5vh, 48px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hud[hidden] { display: none; }
.hud.is-on { opacity: 1; }
.hud .door-btn { pointer-events: auto; }

.hud__card {
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 14px rgba(40, 30, 20, 0.75), 0 0 5px rgba(40, 30, 20, 0.5);
}
.hud__title {
  margin: 0 -0.42em 8px 0;
  font-weight: 500;
  font-size: clamp(1rem, 2.1vw, 1.45rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
}
.hud__note[hidden] { display: none; }
.hud__note { margin: 0; font-size: 0.9rem; letter-spacing: 0.04em; opacity: 0.92; }

/* --- fade used when stepping through the door */
.fade {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--fade-color, #fff6e4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.fade.is-on { opacity: 1; }

@media (max-width: 900px) {
  .landing, .hud { padding-top: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  .landing, .hud, .fade, .time__btn { transition-duration: 0.01s; }
}

/* --- travel buttons shown inside each location */
.hud__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
}
.hud__nav .door-btn[hidden] { display: none; }
@media (max-width: 560px) {
  .hud__nav { flex-direction: column; width: min(260px, 100%); }
}

/* --- labels on clickable objects */
.tags { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 9px;
  font: inherit;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #2c3829;
  text-shadow: 0 0 6px rgba(255, 250, 238, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(40, 40, 30, 0.28);
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
}
.tag[hidden] { display: none; }
.tag::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 1px;
  height: 6px;
  background: rgba(255, 255, 255, 0.9);
}
.tag__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage-deep);
  box-shadow: 0 0 0 0 rgba(111, 140, 107, 0.6);
  animation: tag-pulse 2.2s ease-out infinite;
}
.tag:hover, .tag:focus-visible, .tag.is-hot { background: rgba(255, 248, 234, 0.72); outline: none; border-color: var(--sage-deep); }
@keyframes tag-pulse {
  0% { box-shadow: 0 0 0 0 rgba(111, 140, 107, 0.6); }
  100% { box-shadow: 0 0 0 9px rgba(111, 140, 107, 0); }
}

/* --- the card that opens when something is clicked */
.panel {
  position: fixed;
  z-index: 6;
  right: 24px;
  top: 50%;
  width: min(360px, calc(100% - 32px));
  max-height: calc(100% - 48px);
  overflow: auto;
  padding: 26px 24px 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 249, 238, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(30, 30, 20, 0.35);
  opacity: 0;
  transform: translate(16px, -50%);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.panel[hidden] { display: none; }
.panel.is-on { opacity: 1; transform: translate(0, -50%); }
.panel__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
.panel__close:hover, .panel__close:focus-visible { background: rgba(111, 140, 107, 0.18); outline: none; }
.card__kicker { margin: 0 0 6px; font-size: 0.64rem; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: var(--sage-deep); }
.card__title { margin: 0 0 10px; font-weight: 500; font-size: 1.25rem; letter-spacing: 0.04em; }
.card__text { margin: 0 0 12px; font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; }
.card__cover { display: block; width: 46%; margin: 0 0 16px; border-radius: 4px; box-shadow: 0 8px 20px rgba(30, 30, 40, 0.35); }
.card__photo { display: block; width: 100%; margin: 0 0 12px; border-radius: 8px; }
.panel__link { display: inline-block; margin-top: 4px; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--sage-deep); text-underline-offset: 4px; }
.form { display: grid; gap: 12px; }
.form__field { display: grid; gap: 5px; font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase; }
.form__field input, .form__field textarea {
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid #d5cbb5;
  background: #fffdf7;
  color: var(--ink);
  resize: vertical;
}
.form__field input:focus, .form__field textarea:focus { outline: 2px solid var(--sage-deep); outline-offset: 1px; }
.form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__send { justify-self: start; }
.form__send:disabled { opacity: 0.6; cursor: default; }
.form__status { margin: 0; min-height: 1.2em; font-size: 0.85rem; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #d5cbb5;
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
}
.choice[aria-pressed='true'] { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }

@media (max-width: 720px) {
  .panel { right: 16px; left: 16px; top: auto; bottom: 16px; width: auto; max-height: 62%; transform: translateY(16px); }
  .panel.is-on { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tag__dot { animation: none; }
  .panel { transition-duration: 0.01s; }
}

/* --- planting card: flower choices on the left, a picture of the chosen flower on the right */
.plant { display: grid; grid-template-columns: 1fr 132px; gap: 14px; align-items: start; }
.choices--stack { flex-direction: column; align-items: stretch; }
.choices--stack .choice { text-align: left; }
.plant__preview {
  margin: 0;
  padding: 8px 8px 6px;
  border-radius: 14px;
  border: 1px solid #e2d8c2;
  background: linear-gradient(#eef6ee, #f9f4e6);
  text-align: center;
}
.plant__picture { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.plant__name { margin: 4px 0 0; font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--sage-deep); }
.card__poem { font-size: 1.02rem; line-height: 1.7; }
.choice--danger { border-color: #c98a80; color: #8a3a30; }
.choice--danger:hover { background: #f8e6e2; }

/* --- weather and sound switches share the time-of-day pill */
.time__rule { width: 1px; margin: 7px 4px; background: rgba(61, 74, 58, 0.25); }
@media (max-width: 900px) {
  .landing, .hud { padding-top: 78px; }
}

/* --- résumé card: wider, with the page shown as a picture */
.panel--wide { width: min(560px, calc(100% - 32px)); }
.card__page { display: block; width: 100%; margin: 4px 0 12px; border-radius: 6px; border: 1px solid #e2d8c2; background: #fff; }
@media (max-width: 720px) { .panel--wide { width: auto; max-height: 78%; } }
