/* ============================================================
   Language gate + Arevakhach lock screen
   ============================================================ */

/* ------------------------------------------------------------
   Language gate
   ------------------------------------------------------------ */

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(60rem 40rem at 50% 30%, rgba(137, 99, 69, 0.1), transparent 65%),
    var(--off-white);
  transition:
    opacity var(--duration-slow) var(--ease-out-expo),
    visibility var(--duration-slow);
}

.gate.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate__inner {
  width: min(100%, 34rem);
  text-align: center;
  animation: gate-in 1.3s var(--ease-out-expo) both;
}

@keyframes gate-in {
  from { opacity: 0; transform: translate3d(0, 1.6rem, 0); }
  to   { opacity: 1; transform: none; }
}

.gate__mark {
  width: clamp(3.6rem, 12vw, 5.2rem);
  margin: 0 auto clamp(1.4rem, 4vw, 2.2rem);
  color: var(--stone-soft);
  opacity: 0.85;
  animation: spin-slow 62s linear infinite;
}

.gate__lead {
  font-family: var(--font-display);
  font-size: var(--text-small);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--clay);
  margin-bottom: 0.9rem;
}

.gate__title {
  font-size: clamp(1.7625rem, 1.1625rem + 3vw, 2.6625rem);
  font-weight: 300;
}

.gate__sub {
  margin-top: 0.7rem;
  font-size: var(--text-small);
  letter-spacing: 0.14em;
  color: var(--stone-faint);
}

.gate__options {
  display: grid;
  gap: 0.75rem;
  margin-top: clamp(2rem, 5vw, 2.8rem);
}

.lang-choice {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.5rem;
  text-align: start;
  background: rgba(var(--ch-paper), 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(var(--ch-ink), 0.14);
  border-radius: 3px;
  overflow: hidden;
  transition:
    border-color var(--duration-normal) var(--ease-out-expo),
    transform var(--duration-normal) var(--ease-out-expo),
    background-color var(--duration-normal) var(--ease-out-expo);
}

.lang-choice::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(var(--ch-accent), 0.1) 48%,
    transparent 72%
  );
  transform: translateX(-110%);
  transition: transform 900ms var(--ease-out-expo);
  pointer-events: none;
}

.lang-choice:hover,
.lang-choice:focus-visible {
  border-color: var(--pom);
  background: var(--paper-bg);
  transform: translateY(-2px);
}

.lang-choice:hover::after,
.lang-choice:focus-visible::after {
  transform: translateX(110%);
}

.lang-choice__name {
  font-family: var(--font-display);
  font-size: clamp(1.3125rem, 1.0625rem + 1.4vw, 1.7125rem);
  letter-spacing: 0.04em;
  color: var(--stone);
}

.lang-choice[data-lang="ar"] .lang-choice__name { font-family: var(--font-ar-display); }
.lang-choice[data-lang="hy"] .lang-choice__name { font-family: var(--font-hy); font-size: clamp(1.1625rem, 0.9625rem + 1.1vw, 1.4625rem); }

.lang-choice__hint {
  font-family: var(--font-body);
  font-size: 0.7225rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--stone-faint);
  white-space: nowrap;
}

.lang-choice[data-lang="ar"] .lang-choice__hint,
.lang-choice[data-lang="hy"] .lang-choice__hint {
  letter-spacing: 0.1em;
  text-transform: none;
}

/* ------------------------------------------------------------
   Lock screen
   ------------------------------------------------------------ */

.lock {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.lock[hidden] { display: none; }

/* The two doors that split apart */
/* Each door carries half of one card. `auto 200%` makes the image exactly as
   tall as the whole lock and lets its width follow naturally — sizing it to
   `100% 200%` instead would stretch this portrait sheet by about 1.6x on a
   phone. Height is exactly 50% per panel so the two halves meet without the
   1% overlap duplicating a band right through the medallion. */
.lock__panel {
  position: absolute;
  inset-inline: 0;
  height: 50%;
  background-color: var(--parchment);
  background-image: url("../assets/lock-card.jpg");
  background-repeat: no-repeat;
  background-size: auto 200%;
  transition: transform 1500ms var(--ease-luxe);
  will-change: transform;
}

.lock__panel--top {
  top: 0;
  background-position: center top;
}

.lock__panel--bottom {
  bottom: 0;
  background-position: center bottom;
}

/* Door seam — present at the edges, invisible behind the glowing wheel */
.lock__panel--top::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(var(--ch-ink), 0.22) 0%,
    rgba(var(--ch-ink), 0.05) 32%,
    transparent 50%,
    rgba(var(--ch-ink), 0.05) 68%,
    rgba(var(--ch-ink), 0.22) 100%
  );
}

.lock.is-opening .lock__panel--top    { transform: translate3d(0, -100%, 0); }
.lock.is-opening .lock__panel--bottom { transform: translate3d(0, 100%, 0); }

/* Stage above the doors */
/* The card's engraved medallion sits at dead centre, so the wheel has to sit
   there too. The caption is lifted out of the centring flow — with it in
   place the stage centred on wheel-plus-caption, putting the wheel high. */
.lock__stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  text-align: center;
  transition:
    opacity 620ms var(--ease-out-expo),
    transform 900ms var(--ease-out-expo);
}

.lock.is-opening .lock__stage {
  opacity: 0;
  transform: scale(1.35);
}

.lock__caption {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: clamp(0.75rem, 3vh, 1.75rem);
  white-space: nowrap;
}

.lock__halo {
  position: absolute;
  width: clamp(11rem, 34vh, 20rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--ch-accent), 0.12), transparent 66%);
  filter: blur(14px);
  animation: breathe 5.5s var(--ease-out-expo) infinite;
  pointer-events: none;
}

.lock.is-opening .lock__halo { animation: flare 900ms var(--ease-out-expo) forwards; }

@keyframes flare {
  0%   { opacity: 0.6; transform: scale(1); }
  40%  { opacity: 1;   transform: scale(1.25); }
  100% { opacity: 0;   transform: scale(2); }
}

/* The key itself */
/* The padding is a generous ring of tappable space around the mark, so a
   near miss still opens the invitation. */
/* The card is sized by height, so the medallion scales with the viewport
   height — and the tap target with it. */
.lock__key {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(7rem, 20vh, 12rem);
  aspect-ratio: 1;
  border-radius: 50%;
  transition: transform var(--duration-normal) var(--ease-out-expo);
  -webkit-tap-highlight-color: transparent;
}

.lock__key:hover,
.lock__key:focus-visible {
  transform: scale(1.05);
}

/* The Arevakhach's artwork occupies only ~68% of its 200x200 viewBox, so the
   element has to run well past the bead ring for the mark itself to sit just
   inside it. At 70% the drawn mark was 74px against a 110px ring — most of
   the medallion was empty. */
.lock__wheel {
  width: 84%;
  height: auto;
  /* Pomegranate, not stone — a cold near-black sits badly on the card's warm
     sepia engraving, and this is the one element meant to invite a tap. */
  color: var(--pom);

  animation: spin-slow 34s linear infinite;
  transform-origin: 50% 50%;
}

.lock.is-opening .lock__wheel {
  animation: unlock-spin 1400ms var(--ease-luxe) forwards;
}

@keyframes unlock-spin {
  0%   { transform: rotate(0deg)   scale(1);   opacity: 1; }
  55%  { transform: rotate(430deg) scale(1.1); opacity: 1; }
  100% { transform: rotate(720deg) scale(0.6); opacity: 0; }
}}

.lock__caption {
  margin-top: clamp(1.8rem, 5vw, 2.6rem);
}

.lock__hint {
  animation: hint-pulse 2.8s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .gate__mark,
  .lock__wheel,
  .lock__halo,
  .lock__hint { animation: none !important; }

  .lock.is-opening .lock__panel--top,
  .lock.is-opening .lock__panel--bottom { transform: none; opacity: 0; transition: opacity 300ms linear; }
}
