/* ==========================================================================
   Opening screen: the school's opening animation and the former cover in ONE view. It plays once per visit,
   then the map site appears directly (no separate cover dialog). Loaded after styles.css.
   Markup: index.html (#intro), behaviour: js/intro.js (skip, auto close, inert page behind it).
   ========================================================================== */
.opening {
  position: fixed; inset: 0; z-index: 2000; overflow-y: auto; cursor: pointer;
  background: radial-gradient(ellipse at 75% 50%, #2a3850 0%, var(--ink) 62%); color: var(--on-ink);
  opacity: 1; transition: opacity 0.6s ease;
}
.opening.is-leaving { opacity: 0; pointer-events: none; }
body.hc .opening { background: #000; }

.opening__inner {
  min-height: 100%; box-sizing: border-box; max-width: 76rem; margin: 0 auto; padding: 3rem 2rem;
  display: grid; align-items: center; gap: 1.5rem 3rem;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-areas: "text figure" "text motto";
}
.opening__text { grid-area: text; min-width: 0; }
.opening__figure { grid-area: figure; align-self: end; margin: 0; text-align: center; }
.opening__motto { grid-area: motto; align-self: start; }

/* school identity */
.opening__brand { display: flex; align-items: center; gap: 1.3rem; }
.opening__emblem { position: relative; flex: none; width: 5.5rem; aspect-ratio: 1 / 1; animation: opening-pop 1.1s cubic-bezier(.2,.8,.2,1) 0.2s both; }
.opening__emblem img { width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); }
.opening__ring { position: absolute; inset: -9%; width: 118%; height: 118%; transform: rotate(-90deg); }
.opening__ring circle { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 654; stroke-dashoffset: 654; animation: opening-ring 1.9s ease-out 0.5s forwards; }
.opening__eyebrow { margin: 0 0 0.35rem; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); animation: opening-rise 0.8s ease 1.5s both; }
.opening__school { margin: 0; font-family: var(--serif); font-size: clamp(1.5rem, 3.4vw, 2.2rem); line-height: 1.1; letter-spacing: 0.03em; color: #fff; animation: opening-rise 0.9s ease 1.8s both; }
.opening__rule { width: 5rem; height: 3px; margin: 1.6rem 0 1.4rem; background: var(--gold); transform-origin: left center; animation: opening-rule 0.8s ease 2.4s both; }

/* the cover's content */
.opening__title { margin: 0; font-family: var(--serif); font-size: clamp(1.9rem, 3.8vw, 3rem); line-height: 1.1; font-weight: 700; letter-spacing: 0.01em; color: #fff; animation: opening-rise 0.9s ease 3s both; }
.opening__lead { max-width: 34rem; margin: 1rem 0 0; font-size: 1.05rem; line-height: 1.6; color: #d9d1bb; animation: opening-rise 0.9s ease 3.4s both; }
.opening__team { display: flex; flex-wrap: wrap; gap: 0.8rem 2.6rem; margin: 1.4rem 0 0; }
.opening__team div { animation: opening-rise 0.9s ease both; }
.opening__team div:nth-child(1) { animation-delay: 3.9s; }
.opening__team div:nth-child(2) { animation-delay: 4.5s; }
.opening__team dt { margin-bottom: 0.2rem; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.opening__team dd { margin: 0; font-size: 1.1rem; color: #fff; }
.opening__legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin: 1.6rem 0 0.9rem; padding: 0; animation: opening-rise 0.9s ease 5.1s both; }
.opening__legend li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--on-ink); }
.opening .mk--approximate { background: color-mix(in srgb, var(--c) 22%, #fff); }
.opening__note { max-width: 34rem; margin: 0 0 1.5rem; padding-left: 0.8rem; border-left: 2px solid var(--gold); font-size: 0.85rem; line-height: 1.5; color: #b7ae96; animation: opening-rise 0.9s ease 5.4s both; }
.opening__actions { animation: opening-rise 0.9s ease 5.8s both; }
.btn--cover { display: inline-flex; align-items: center; gap: 0.6rem; background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 700; font-size: 1rem; padding: 0.6rem 1.2rem; min-height: 2.9rem; letter-spacing: 0.02em; }
.btn--cover:hover { background: #d5b765; border-color: #d5b765; }

/* the map picture and the motto */
.opening__figure { animation: opening-figure 1.2s cubic-bezier(.2,.8,.2,1) 3s both; }
.opening__figure img { width: min(100%, 26rem); height: auto; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 50%; border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 0 0 10px rgba(194, 162, 78, 0.18), var(--shadow-lg); filter: saturate(0.92); }
.opening__figure figcaption { margin-top: 1rem; font-size: 0.75rem; color: #a79f88; }
.opening__motto { max-width: 26rem; margin: 0 auto; padding-top: 1.2rem; border-top: 1px solid rgba(194, 162, 78, 0.45); font-family: var(--serif); font-style: italic; font-size: 1.1rem; line-height: 1.6; text-align: center; color: #e6dec8; animation: opening-rise 1s ease 6.2s both; }

.opening__skip {
  position: fixed; right: 1.25rem; bottom: 1.25rem; font: inherit; font-size: 0.9rem; color: var(--on-ink); background: rgba(23, 32, 46, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 999px; padding: 0.45rem 1.1rem; cursor: pointer; animation: opening-rise 0.6s ease 1s both;
}
.opening__skip:hover { background: rgba(255, 255, 255, 0.14); }
.opening__skip:focus-visible, .opening .btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@keyframes opening-pop { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: scale(1); } }
@keyframes opening-ring { to { stroke-dashoffset: 0; } }
@keyframes opening-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes opening-rule { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }
@keyframes opening-figure { from { opacity: 0; transform: translateX(26px) scale(0.94); } to { opacity: 1; transform: none; } }

/* short windows: a smaller picture so everything fits without scrolling */
@media (max-height: 720px) and (min-width: 861px) {
  .opening__inner { padding-block: 1.5rem; }
  .opening__figure img { width: min(100%, 19rem); }
  .opening__rule { margin-block: 1.1rem 1rem; }
}

/* phones: one column; the small picture first, the motto last */
@media (max-width: 860px) {
  .opening__inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "figure" "text" "motto"; gap: 1.5rem; padding: 3.25rem 1.25rem 2rem; }
  .opening__figure { align-self: center; }
  .opening__figure img { width: min(44vw, 10rem); box-shadow: 0 0 0 6px rgba(194, 162, 78, 0.18); }
  .opening__figure figcaption { display: none; }
  .opening__emblem { width: 4.2rem; }
  .opening__title { font-size: 2rem; }
  .opening__skip { top: 0.75rem; bottom: auto; right: 0.75rem; }
}

/* Reduced motion (and the skip-friendly static mode): everything is shown at once, nothing moves. */
@media (prefers-reduced-motion: reduce) {
  .opening, .opening * { animation: none !important; transition: none !important; }
  .opening__ring circle { stroke-dashoffset: 0; }
}
.opening.is-static, .opening.is-static * { animation: none !important; }
.opening.is-static .opening__ring circle { stroke-dashoffset: 0; }
