/* Analogcabin v1 light intro module.
   Swap this file, js/intro.js, and the #intro markup in index.html
   for the v1.1 camera pull-back. Do not rewrite page sections.
   Mint Phosphor (#B4E8C8) on Lava Rock (#1C1F1D) is 12.13:1 (WCAG AA/AAA). */

#intro {
  background: var(--lava-rock);
  color: var(--mint-phosphor);
  position: relative;
}

html.js.intro-active #intro,
html.js.intro-finishing #intro {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.js.intro-finishing #intro {
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

html.js.intro-done #intro,
html.js.intro-bypass #intro {
  display: none;
}

html.js.intro-active body {
  overflow: hidden;
}

html.js.intro-active {
  background: var(--lava-rock);
}

.intro-inner {
  position: relative;
  z-index: 1;
  margin: auto;
  width: min(100%, 40rem);
  padding: 4.5rem var(--page-gutter) 3rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro-skip {
  display: none;
  position: absolute;
  top: 1rem;
  right: var(--page-gutter);
  z-index: 2;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--fern);
  background: transparent;
  color: var(--sunrise);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

html.js .intro-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.js.intro-done .intro-skip,
html.js.intro-bypass .intro-skip {
  display: none;
}

.intro-skip:hover,
.intro-skip:focus-visible {
  border-color: var(--sunrise);
  color: var(--sunrise);
}

/* Full manifesto: real DOM, readable with JS off (document flow). */
#manifesto,
.intro-typewriter {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  line-height: 1.45;
  color: var(--mint-phosphor);
  text-shadow: 0 0 18px rgba(180, 232, 200, 0.18);
}

#manifesto p,
.intro-typewriter p {
  margin: 0 0 1.15rem;
}

#manifesto p:last-child,
.intro-typewriter p:last-child {
  margin-bottom: 0;
}

#manifesto .okina {
  font-size: 0.92em;
}

.intro-typewriter {
  display: none;
  font-size: clamp(1.45rem, 3.6vw, 2.15rem);
  line-height: 1.35;
}

.intro-typewriter p {
  margin: 0 0 0.85rem;
  min-height: 1.35em;
}

html.js.intro-active .intro-typewriter {
  display: block;
}

html.js.intro-active #manifesto,
html.js.intro-finishing #manifesto,
html.js.intro-done #manifesto,
html.js.intro-bypass #manifesto {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.intro-typewriter p.typing::after,
.intro-typewriter p.has-caret::after {
  content: "";
  display: inline-block;
  width: 0.7ch;
  height: 1.05em;
  margin-left: 0.15ch;
  background: var(--mint-phosphor);
  box-shadow: 0 0 10px rgba(180, 232, 200, 0.45);
  vertical-align: text-bottom;
  animation: ac-intro-caret 1s steps(1) infinite;
}

@keyframes ac-intro-caret {
  50% { opacity: 0; }
}

html.reduced-motion .intro-typewriter p.typing::after,
html.reduced-motion .intro-typewriter p.has-caret::after,
html.intro-hold .intro-typewriter p.typing::after,
html.intro-hold .intro-typewriter p.has-caret::after {
  animation: none;
  opacity: 1;
}

.intro-scan {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.08) 0 1px,
      transparent 1px 3px
    );
  opacity: 0.4;
  z-index: 0;
}

html.reduced-motion .intro-scan,
@media (prefers-reduced-motion: reduce) {
  .intro-scan { display: none; }
}

/* Nav fades in after a played intro, not on return-visit / reduced-motion bypass. */
html.js.intro-played .site-header {
  animation: ac-intro-nav-fade 0.55s ease both;
}

@keyframes ac-intro-nav-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html.js.intro-finishing #intro {
    transition: opacity 0.01ms linear;
  }

  html.js.intro-played .site-header {
    animation: none;
  }

  .intro-typewriter p.typing::after,
  .intro-typewriter p.has-caret::after {
    animation: none;
  }
}
