/* The home page intro (intro.js) - signed-out visitors only. A tall section
   whose sticky stage holds the leaf H while the page scrolls through it. */

.intro {
  display: none;
}

html.has-intro .intro {
  display: block;
  position: relative;
  height: 260vh;
  height: 260svh;
}

.intro-stage {
  --paper: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1c1410;
  font-family: "Libre Caslon Text", "Book Antiqua", Georgia, serif;
}

/* The cold-press paper, faded out at the end so the sky shows through. */
.intro-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--paper);
  background-color: #fbf7f0;
  background-image:
    radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .33  0 0 0 0 .22  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.intro-stage .cover-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  transition: opacity 500ms ease;
}

.intro-stage .cover-canvas:not(.is-drawn) {
  opacity: 0 !important;
}

.intro-stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  will-change: transform;
}

.intro-mark {
  height: min(44vh, 86vw);
  aspect-ratio: 800 / 860;
  margin-bottom: clamp(14px, 3.6vh, 44px);
}

.intro-name {
  font-size: clamp(18px, min(4.4vh, 7vw), 54px);
  letter-spacing: 0.14em;
  padding-left: 0.14em;
  line-height: 1;
  animation: intro-rise 700ms 200ms ease backwards;
}

.intro-reflection {
  transform: scaleY(-1);
  margin-top: 4px;
  opacity: 0.22;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 70%);
  mask-image: linear-gradient(to top, #000 0%, transparent 70%);
  animation: intro-fade 700ms 300ms ease backwards;
  user-select: none;
}

.intro-actions {
  display: flex;
  gap: 18px;
  margin-top: clamp(16px, 3.6vh, 40px);
  animation: intro-rise 600ms 450ms ease backwards;
}

.intro-btn {
  min-width: clamp(130px, 16vh, 190px);
  padding: 0.62em 1.6em;
  border-radius: 999px;
  font-size: clamp(15px, 2.2vh, 21px);
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.intro-login {
  color: #fffaf2;
  background: linear-gradient(120deg, #f9a23c, #ee6a1c 55%, #c8431a);
  box-shadow: 0 10px 24px rgba(150, 60, 10, 0.32);
}

.intro-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(150, 60, 10, 0.4);
}

.intro-register {
  color: #3a1e0e;
  border: 2px solid rgba(58, 30, 14, 0.82);
  box-shadow: 1px 1px 0 0 rgba(58, 30, 14, 0.28);
}

.intro-register:hover {
  background: rgba(238, 106, 28, 0.08);
}

.intro-btn:focus-visible,
.intro-hint:focus-visible {
  outline: 2px solid #ee6a1c;
  outline-offset: 3px;
}

.intro-welcome {
  position: absolute;
  left: 50%;
  top: 36%;
  z-index: 1;
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity, filter;
}

.intro-welcome-line {
  font-size: clamp(20px, min(4.6vh, 8vw), 50px);
  letter-spacing: 0.02em;
  color: rgba(28, 20, 16, 0.78);
}

.intro-welcome-name {
  margin-top: 0.12em;
  font-size: clamp(20px, min(6.4vh, 7.4vw), 72px);
  letter-spacing: 0.12em;
  padding-left: 0.12em;
  line-height: 1.05;
  background: linear-gradient(120deg, #f9a23c, #ee6a1c 55%, #c8431a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-welcome-tag {
  margin-top: 0.9em;
  font-size: clamp(15px, 2.2vh, 21px);
  font-style: italic;
  color: rgba(58, 30, 14, 0.7);
}

.intro-hint {
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 3.5vh, 34px);
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: rgba(58, 30, 14, 0.55);
  text-decoration: none;
  animation: intro-fade 600ms 900ms ease backwards;
}

.intro-hint:hover {
  color: #c8431a;
}

.intro-hint-arrow {
  font-size: 15px;
  animation: intro-nudge 1.8s ease-in-out infinite;
}

/* The header waits until the intro hands over to the page. */
html.has-intro .nav {
  transition: opacity 400ms ease;
}

html.has-intro:not(.intro-done) .nav {
  opacity: 0;
  pointer-events: none;
}

@keyframes intro-rise {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes intro-fade {
  from { opacity: 0; }
}

@keyframes intro-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* The reflection keeps its flip through the fade-in. */
.intro-reflection {
  animation-name: intro-fade;
}

@media (max-width: 520px) {
  .intro-actions {
    gap: 12px;
  }
  .intro-btn {
    min-width: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-name,
  .intro-actions,
  .intro-hint {
    animation: intro-fade 300ms ease backwards;
  }
  .intro-reflection {
    animation: none;
  }
  .intro-hint-arrow {
    animation: none;
  }
}

/* The page rises in under the end of the intro instead of waiting below it:
   the hero drops its full-window height, and the page overlaps the intro's
   last stretch, so the headline comes up as "Welcome" fades out - not a
   screen of empty background later. The page paints over the fading paper. */
html.has-intro main {
  position: relative;
  z-index: 3;
  margin-top: -62vh;
  margin-top: -62svh;
}

html.has-intro .hero {
  min-height: 0;
  padding-top: 72px;
}
