/* The home page (src/home.js): notice, gate scene, tiles. Loaded with site.css.
   The gate is closed only when scripts run (the "js" class on <html>) and until
   the key opens it: `.js .gate[data-state="closed"]` is the closed look,
   everything else is the open look. */

html {
  scroll-behavior: smooth;
}

.home {
  padding: 0 1.25rem 1.5rem;
}

.home section {
  scroll-margin-top: 5.5rem; /* clear of the sticky header */
}

.home-notice {
  margin: 1rem 0 0;
  padding: 0.6rem 1rem;
  border: 1px solid var(--stone);
  border-inline-start: 0.35rem solid var(--sand);
  border-radius: 0.85rem;
  background: #fffdf9;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

/* ---- Gate ---- */
.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1.1rem;
  text-align: center;
}

.gate-occasion {
  margin: 0;
  padding: 0.05rem 0.9rem;
  border: 1px solid var(--stone);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--cocoa);
  font-size: 0.85rem;
}

.gate-title {
  margin: 0.4rem 0 0;
  font-size: 1.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.gate-lines {
  display: grid;
  width: 100%;
}

.gate-lines p {
  grid-area: 1 / 1;
  margin: 0;
  overflow-wrap: anywhere;
  transition: opacity 0.6s ease;
}

.gate-tagline {
  opacity: 0;
}

.gate-welcome {
  color: var(--cocoa);
  font-weight: 700;
}

.js .gate[data-state="closed"] .gate-tagline {
  opacity: 1;
}

.js .gate[data-state="closed"] .gate-welcome {
  opacity: 0;
}

.gate-scene {
  position: relative;
  width: min(100%, 17.5rem);
  aspect-ratio: 5 / 6;
  margin-top: 0.9rem;
}

.gate-backdrop {
  position: absolute;
  inset: 1.4%;
  overflow: hidden;
  border-radius: 50% 50% 0 0 / 38.5% 38.5% 0 0;
  background: linear-gradient(#fbf1df 0%, #f6e7d2 38%, #e3ebd6 60%, #c9d9bb 100%);
  background-size: cover;
  background-position: center;
}

.gate-garden,
.gate-arch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gate-arch {
  pointer-events: none;
}

.gate-defs {
  position: absolute;
}

.gate-doors {
  position: absolute;
  inset: 0;
  perspective: 56rem;
}

.gate-door {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  opacity: 0.9;
  transition: transform 1.5s cubic-bezier(0.45, 0.05, 0.3, 1), opacity 1.5s ease;
}

.gate-door--left {
  left: 0;
  transform-origin: left center;
  transform: rotateY(76deg);
}

.gate-door--right {
  right: 0;
  transform-origin: right center;
  transform: rotateY(-76deg);
}

.js .gate[data-state="closed"] .gate-door {
  transform: none;
  opacity: 1;
}

.gate-lock {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 3rem;
  height: 3rem;
  margin: -1.5rem 0 0 -1.5rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.js .gate[data-state="closed"] .gate-lock {
  opacity: 1;
  transform: none;
}

.js .gate.gate--near .gate-lock {
  transform: scale(1.18);
}

.gate-controls {
  display: grid;
  justify-items: center;
  width: 100%;
  margin-top: 0.9rem;
}

.gate-closed,
.gate-start {
  grid-area: 1 / 1;
}

.gate-closed {
  display: none;
  flex-direction: column;
  align-items: center;
}

.js .gate[data-state="closed"] .gate-closed {
  display: flex;
}

.js .gate[data-state="closed"] .gate-start {
  display: none;
}

/* (.gate .gate-start: this file loads before site.css, so it must outweigh .button) */
.gate .gate-start {
  width: auto;
  min-width: 12rem;
  margin-top: 0.4rem;
  padding-inline: 2rem;
  border-radius: 999px;
  animation: gate-rise 0.7s ease 0.5s both;
}

.gate-key {
  position: relative;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 2px solid var(--sand);
  border-radius: 50%;
  background: #fffdf9;
  box-shadow: 0 0.35rem 0.9rem rgba(106, 76, 70, 0.22);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
  animation: gate-key-nudge 2.6s ease-in-out infinite;
}

.gate-key svg {
  pointer-events: none;
}

.gate-key--held {
  cursor: grabbing;
  animation: none;
  box-shadow: 0 0.6rem 1.4rem rgba(106, 76, 70, 0.32);
}

.gate-instruction {
  margin: 0.55rem 0 0;
  color: var(--cocoa);
  font-weight: 600;
}

@keyframes gate-key-nudge {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-0.45rem);
  }
}

@keyframes gate-rise {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}

/* A gate already opened in this visit, or a page without scripts, shows open at once. */
.gate--still *,
html:not(.js) .gate * {
  transition: none !important;
  animation: none !important;
}

.credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  width: 100%;
  margin: 1.25rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--stone);
  list-style: none;
}

.credits li {
  display: flex;
  flex-direction: column;
  min-width: 8rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.credit-role {
  font-size: 0.85rem;
  color: var(--cocoa);
}

.credit-name {
  font-weight: 700;
}

/* Ticket 09: the school and its city, under the credits. */
.gate-city {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--cocoa);
  overflow-wrap: anywhere;
}

/* ---- Tiles ---- */
.tiles {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.tile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.25rem 0.9rem;
  padding: 1rem;
  border: 1px solid var(--stone);
  border-radius: 1.25rem;
  background: #fffdf9;
  color: var(--espresso);
  text-decoration: none;
}

.tile h2 {
  margin: 0;
  font-size: 1.15rem;
}

.tile p {
  margin: 0;
  font-size: 0.95rem;
}

.tile-choices {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.tile-choices a {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  background: var(--cocoa);
  color: #fffdf9;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* The Garden slot (src/garden.js); tickets 04 and 05 style what goes in it. */
.garden {
  margin-top: 1.75rem;
}

.garden:empty {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .gate *,
  .gate-start {
    transition-duration: 0.01s !important;
    animation: none !important;
  }
}
