/* landing.css — front-door page for Anser Rossii
   Used by: /, /keynote, /contact (shared visual language) */

:root {
  --landing-bg: #000;
  --landing-fg: #f5f5f5;
  --landing-fg-dim: rgb(245 245 245 / 78%);
  --landing-fg-muted: rgb(245 245 245 / 45%);
  --landing-accent: #6ab4d4;
  --landing-line: rgb(245 245 245 / 18%);
  --landing-line-strong: rgb(245 245 245 / 32%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body.landing-body {
  min-height: 100%;
  background: var(--landing-bg);
  color: var(--landing-fg);
  font-family:
    Inter, system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizelegibility;
  overflow: hidden;
}

/* Hero video background */
.hero-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  filter: saturate(0.95) contrast(1.05);
  transition: opacity 1.4s ease;
  pointer-events: none;
}

.hero-bg.is-loaded {
  opacity: 0.6;
}

.hero-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse at center,
      transparent 35%,
      rgb(0 0 0 / 50%) 100%
    ),
    linear-gradient(
      180deg,
      rgb(0 0 0 / 55%) 0%,
      rgb(0 0 0 / 20%) 35%,
      rgb(0 0 0 / 40%) 65%,
      rgb(0 0 0 / 85%) 100%
    );
}

/* Layout — single frame, three rows */
.landing {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  place-items: center;
  text-align: center;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4rem)
    clamp(4rem, 8vh, 6rem);
  gap: clamp(2rem, 5vh, 4rem);
}

/* Brand */
.landing-brand {
  align-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.25rem, 3vh, 2rem);
  max-width: 36rem;
}

/* Placeholder mode — when nav is hidden, recenter the brand vertically
   so the page reads as an intentional landing card, not a top-anchored
   fragment with empty space below. */
.landing:has(.landing-nav[hidden]) .landing-brand {
  grid-row: 1 / -1;
  align-self: center;
}

/* Logo — inlined SVG keeps the original two-tone (deep + bright)
   character; the muted off-whites sit between the tagline (62%) and
   the nav links (100%) so the wordmark feels integrated, not loud.
   A narrow shine band sweeps across via screen-blend overlay so it
   adds light without flattening the two tones. */
.landing-mark {
  position: relative;
  display: block;
  width: clamp(220px, 30vw, 340px);
  aspect-ratio: 2048 / 595;
  filter: drop-shadow(0 2px 14px rgb(0 0 0 / 50%));
}

.landing-mark-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.landing-mark-deep {
  fill: rgb(245 245 245 / 52%);
}

.landing-mark-bright {
  fill: rgb(245 245 245 / 76%);
}

.landing-mark-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    rgb(255 255 255 / 0%) 35%,
    rgb(255 255 255 / 22%) 48%,
    rgb(255 255 255 / 28%) 50%,
    rgb(255 255 255 / 22%) 52%,
    rgb(255 255 255 / 0%) 65%
  );
  background-size: 250% 100%;
  background-position: 200% 0;
  background-repeat: no-repeat;
  mask-image: url('/img/anser-rossii-logo.svg');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mix-blend-mode: screen;
  will-change: background-position;
}

.landing-tagline {
  margin: 0;
  font-family: Inter, Roboto, system-ui, -apple-system, sans-serif;
  font-size: clamp(11px, 1vw, 13px);
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgb(245 245 245 / 62%);
  line-height: 1.5;
  text-shadow: 0 2px 18px rgb(0 0 0 / 50%);
  white-space: nowrap;
}

/* Navigation */
.landing-nav {
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding-top: clamp(0.5rem, 2vh, 1.5rem);
  border-top: 1px solid var(--landing-line);
}

/* `display: flex` above is a class selector — same specificity as the
   UA `[hidden]` rule, so author CSS wins and `<nav hidden>` would still
   render. This explicit rule restores the standard `hidden` behavior. */
.landing-nav[hidden] {
  display: none;
}

.landing-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem 0.5rem;
  text-decoration: none;
  color: var(--landing-fg);
  position: relative;
  transition: color 280ms ease;
  -webkit-tap-highlight-color: transparent;
}

.landing-link::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--landing-accent);
  transform: translateX(-50%);
  transition: width 320ms ease;
}

.landing-link:hover,
.landing-link:focus-visible {
  color: var(--landing-accent);
  outline: none;
}

.landing-link:hover::after,
.landing-link:focus-visible::after {
  width: 100%;
}

.landing-num {
  font-family: Orbitron, system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--landing-fg-muted);
}

.landing-name {
  font-family: Orbitron, system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: clamp(0.95rem, 1.3vw, 1.15rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* Footer */
.landing-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: clamp(1rem, 2vh, 1.5rem);
  z-index: 3;
  text-align: center;
  pointer-events: none;
}

.landing-footer p {
  margin: 0;
  font-family: Orbitron, system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--landing-fg-muted);
}

/* Entry sequence — only when motion allowed */
@media (prefers-reduced-motion: no-preference) {
  .landing-brand {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    animation: landing-brand-enter 1100ms cubic-bezier(0.2, 0.7, 0.2, 1) 200ms
      forwards;
  }

  .landing-mark-shine {
    animation: landing-mark-shine 14s linear 2000ms infinite;
  }

  .landing-tagline {
    opacity: 0;
    animation: landing-fade-in 700ms ease 700ms forwards;
  }

  .landing-nav,
  .landing-footer p {
    opacity: 0;
    transform: translateY(8px);
    animation: landing-enter 700ms ease forwards;
  }

  .landing-nav {
    animation-delay: 800ms;
  }

  .landing-link {
    opacity: 0;
    animation: landing-enter 600ms ease forwards;
  }

  .landing-link:nth-child(1) {
    animation-delay: 950ms;
  }

  .landing-link:nth-child(2) {
    animation-delay: 1050ms;
  }

  .landing-link:nth-child(3) {
    animation-delay: 1150ms;
  }

  .landing-footer p {
    animation-delay: 1300ms;
  }

  @keyframes landing-enter {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes landing-fade-in {
    to {
      opacity: 1;
    }
  }

  @keyframes landing-brand-enter {
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes landing-mark-shine {
    0% {
      background-position: 200% 0;
    }

    55%,
    100% {
      background-position: -50% 0;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg {
    display: none;
  }

  .hero-scrim {
    background:
      linear-gradient(
        180deg,
        rgb(0 0 0 / 65%) 0%,
        rgb(0 0 0 / 45%) 50%,
        rgb(0 0 0 / 85%) 100%
      );
  }
}

/* Mobile */
@media (width <= 640px) {
  .landing {
    grid-template-rows: 1fr auto 1fr;
    gap: clamp(2rem, 6vh, 3rem);
    padding-bottom: 5rem;
  }

  .landing-nav {
    flex-direction: column;
    gap: clamp(1.25rem, 4vh, 2rem);
    padding-top: 1.5rem;
    width: 100%;
    max-width: 18rem;
  }

  .landing-name {
    font-size: 1rem;
  }

  .landing-tagline {
    letter-spacing: 0.22em;
  }
}

/* Very narrow — allow tagline to wrap when nowrap would overflow */
@media (width <= 420px) {
  .landing-tagline {
    white-space: normal;
    text-wrap: balance;
  }
}

/* Stub pages — /keynote, /contact (shared shell, simpler layout) */
.page-stub {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(2rem, 6vw, 5rem);
  gap: clamp(1.5rem, 4vh, 2.5rem);
}

.page-stub-brand {
  position: fixed;
  top: clamp(1.25rem, 3vh, 2rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
}

.page-stub-brand a {
  display: inline-block;
  text-decoration: none;
  color: var(--landing-fg);
  -webkit-tap-highlight-color: transparent;
}

.page-stub-brand img {
  display: block;
  width: auto;
  height: clamp(28px, 4vh, 36px);
  opacity: 0.85;
  transition: opacity 220ms ease;
}

.page-stub-brand a:hover img,
.page-stub-brand a:focus-visible img {
  opacity: 1;
}

.page-stub-brand a:focus-visible {
  outline: 1px solid var(--landing-accent);
  outline-offset: 6px;
}

.page-stub-title {
  margin: 0;
  font-family: Orbitron, system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 3rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--landing-fg);
}

.page-stub-lede {
  margin: 0;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.55;
  color: var(--landing-fg-dim);
  max-width: 32em;
}

.page-stub-back {
  margin-top: clamp(1rem, 3vh, 2rem);
  font-family: Orbitron, system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--landing-fg-muted);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--landing-line);
  border-radius: 999px;
  transition:
    color 240ms ease,
    border-color 240ms ease;
}

.page-stub-back:hover,
.page-stub-back:focus-visible {
  color: var(--landing-accent);
  border-color: var(--landing-line-strong);
  outline: none;
}

@media (prefers-reduced-motion: no-preference) {
  .page-stub > * {
    opacity: 0;
    transform: translateY(8px);
    animation: landing-enter 700ms ease forwards;
  }

  .page-stub-title {
    animation-delay: 200ms;
  }

  .page-stub-lede {
    animation-delay: 400ms;
  }

  .page-stub-back {
    animation-delay: 600ms;
  }
}
