/* ==========================================================================
   The gate — unlock, sign in, first-run notice.

   One panel, held slightly above centre so it reads as a faceplate rather
   than a dialog. Behind it: an engraved grid and a slow vignette, so the
   dark field has depth without any imagery.
   ========================================================================== */

body.gate {
  display: grid;
  place-items: center;
  padding: var(--pad);
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(240, 162, 60, 0.055), transparent 62%),
    radial-gradient(80% 60% at 50% 110%, rgba(95, 220, 174, 0.035), transparent 70%),
    var(--ink-050);
  position: relative;
  overflow-x: hidden;
}

/* Engraved graph paper. Two hairline gradients, no image. */
body.gate::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.4;
  mask-image: radial-gradient(90% 70% at 50% 40%, #000 20%, transparent 78%);
}

.gate__shell {
  position: relative;
  width: 100%;
  max-width: 412px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  /* Optical centring: sit a little above true centre. */
  margin-block: auto clamp(2rem, 12vh, 7rem);
  animation: gate-in var(--slow) var(--ease-out) both;
}

@keyframes gate-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* --- the seal -------------------------------------------------------- */

.seal {
  width: 78px;
  height: 78px;
  align-self: center;
  position: relative;
  display: grid;
  place-items: center;
}

.seal__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--hairline-bright);
}

/* Two arcs counter-rotating: a mechanism still searching for its key. */
.seal__arc {
  position: absolute;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: var(--amber);
  border-right-color: var(--amber);
  animation: seal-spin 5.5s linear infinite;
}

.seal__arc--outer {
  inset: 6px;
}

.seal__arc--inner {
  inset: 16px;
  border-top-color: var(--amber-dim);
  border-right-color: transparent;
  border-left-color: var(--amber-dim);
  animation-duration: 8s;
  animation-direction: reverse;
}

.seal__glyph {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px var(--amber-glow));
}

/* Settled state: arcs stop, everything turns jade. */
.seal[data-state='open'] .seal__arc {
  animation-play-state: paused;
  border-color: transparent;
  border-top-color: var(--jade);
}

.seal[data-state='open'] .seal__glyph {
  stroke: var(--jade);
  filter: drop-shadow(0 0 8px var(--jade-glow));
}

@keyframes seal-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- panel ----------------------------------------------------------- */

.gate__head {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.gate__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5.5vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.gate__title em {
  font-style: italic;
  color: var(--amber);
}

.gate__sub {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--paper-mute);
  max-width: 34ch;
  margin-inline: auto;
}

.panel {
  background: linear-gradient(var(--ink-200), var(--ink-100));
  border: 1px solid var(--hairline-bright);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.035) inset,
    0 24px 60px -24px rgba(0, 0, 0, 0.9);
}

.panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--hairline);
  margin-top: 2px;
  padding-top: 14px;
}

.gate__meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.gate__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gate__meta svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

/* The submit button spans the panel — one obvious action per screen. */
.btn--block {
  width: 100%;
}

/* Small helper row under the second-factor field. */
.gate__alt {
  display: flex;
  justify-content: center;
}

.linkish {
  background: none;
  border: none;
  padding: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--paper-mute);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--fast) var(--ease);
}

.linkish:hover {
  color: var(--amber);
}

.codeblock {
  margin: 4px 0;
  padding: 12px 14px;
  background: var(--ink-000);
  border: 1px solid var(--hairline-bright);
  border-left: 2px solid var(--amber);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--jade);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 420px) {
  .panel {
    padding: 20px 16px;
  }
}
