/* Espirai layer over the Earendil styles.css. Only deliberate espirai
   decisions live here; everything else is Earendil's CSS verbatim. */


:root {
  --mono-font: 'ABC Areal Mono', 'SFMono-Regular', ui-monospace, monospace;
}

/* ==========================================================================
   HOME: fixed text stage over the water
   Earendil anchors .home-hero-text above the WebGL horizon. Espirai keeps
   that anchor but holds the stage fixed: paragraphs cross-fade in place as
   the page scrolls, instead of a column running down over the water.
   ========================================================================== */

.page[data-page-type="home"] .home-hero {
  position: fixed;
  inset: 0;
  flex: none;
  text-align: start;
}

/* Long Lake keeps one left column, about 520px, not a centered line. */
.page[data-page-type="home"] .home-hero-text {
  position: fixed;
  inset-inline: auto;
  left: var(--frame-inline);
  right: auto;
  /* Stable sky position. Do not follow the shader horizon: on mobile that
     value jumps as the browser chrome shows and hides, and the line lands
     on the water before it climbs back. */
  bottom: 42svh;
  width: min(32.5rem, calc(100vw - (var(--frame-inline) * 2)));
  text-align: start;
  font-size: 1.25rem;
  line-height: 1.5;
  z-index: 120;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 0 16px rgba(0, 0, 0, 0.35);
}

body:not(.theme-night) .page[data-page-type="home"] .home-hero-text {
  color: var(--color-text-day);
  text-shadow: none;
}

/* Scroll length: one viewport per paragraph step. */
.page[data-page-type="home"] .home-scroll {
  height: auto;
}

.page[data-page-type="home"] .home-scroll-step {
  height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

html:has(.page[data-page-type="home"]) {
  scroll-snap-type: y mandatory;
}

/* The home sentences are mono, not the Earendil serif italic. */
.home-hero-text {
  font-family: var(--mono-font);
  font-style: normal;
  font-weight: 400;
  line-height: var(--leading-body);
}

/* One step is visible at a time; the rest wait above the horizon.
   visibility (not opacity alone) hides waiting steps from assistive tech
   and removes their tab stops; the delayed transition keeps the outgoing
   step paintable while it fades. CSS owns the cross-fade, matched to the
   Earendil page transition. */
.home-step {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.52s ease, visibility 0s linear 0.52s;
}

.home-step.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.52s ease;
}

.home-step--beat .home-step-title {
  font-family: inherit;
  font-size: inherit;
  font-weight: 400;
  margin: 0 0 0.7em;
}

.home-step--beat .home-step-body {
  margin: 0;
}

/* ==========================================================================
   LOGO: the espirai mark plus the name, larger than the Earendil emblem
   ========================================================================== */

/* Earendil pulls a 32px emblem up 35px so it sits on the MENU row.
   That offset lifts this larger lockup above MENU. Center the lockup
   on the MENU line box instead. Same rule on corner-logo pages, or the
   mark drops back to the viewport center once you leave home. */
body:has(.page[data-page-type="home"]) .center-logo,
body:has(.page[data-page-type="corner-logo"]) .center-logo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-block-start: 0;
  height: 48px;
}

body:has(.page[data-page-type="home"]) .menu-trigger-toggle,
body:has(.page[data-page-type="corner-logo"]) .menu-trigger-toggle {
  display: inline-flex;
  align-items: center;
  height: 48px;
  margin-block-start: 0;
}

body:has(.page[data-page-type="home"]) .main-logo,
body:has(.page[data-page-type="corner-logo"]) .main-logo {
  width: 48px;
}

.logo-name {
  font-family: var(--mono-font);
  font-size: var(--font-size-lg);
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* Day theme: the wordmark repaints with the rest of the chrome, like the
   menu label and the mark's #logo-day-color filter. */
body:not(.theme-night) .logo-name {
  color: var(--color-text-day);
  text-shadow: none;
}


.loaded .logo-name {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .home-step,
  .logo-name {
    transition: none;
  }
}

@media (max-width: 800px) {
  body:has(.page[data-page-type="home"]) .center-logo,
  body:has(.page[data-page-type="corner-logo"]) .center-logo {
    margin-block-start: 0;
    height: 36px;
  }

  body:has(.page[data-page-type="home"]) .menu-trigger-toggle,
  body:has(.page[data-page-type="corner-logo"]) .menu-trigger-toggle {
    margin-block: 0;
    min-height: 36px;
    height: 36px;
    padding-block: 0;
  }

  body:has(.page[data-page-type="home"]) .main-logo,
  body:has(.page[data-page-type="corner-logo"]) .main-logo {
    width: 36px;
  }

  .logo-name {
    font-size: var(--font-size-md);
    letter-spacing: 0.14em;
  }

  /* Earendil makes the footer relative on mobile because its home is one
     viewport. The espirai home is eight viewports tall, so pin the bar
     or the theme toggle sits at the end of the story. */
  body:has(.page[data-page-type="home"]) .site-footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
}

/* Inner pages. Earendil's veil is already in styles.css. These only keep
   the reading column in the espirai mono face. */
.content-page .letter-body h1,
.content-page .letter-body h2 {
  font-family: var(--mono-font);
  font-weight: 500;
  line-height: var(--leading-tight);
}

.content-page .letter-body h1 {
  font-size: var(--text-title);
  margin: 0 0 1.25em;
}

.content-page .letter-body h2 {
  font-size: var(--text-body);
  margin: 1.75em 0 0.6em;
}

.content-page .letter-body hr {
  border: 0;
  border-top: 1px solid currentColor;
  opacity: 0.25;
  margin: 1.75em 0;
}

/* The lockup is wider than Earendil's emblem. On a scrolling veil page,
   text would run through it. Fade the header with the same paper as the veil. */
body:has(.content-page) .site-header {
  --header-veil: 250, 249, 246;
  padding-bottom: calc(var(--frame-chrome-fade) + 8px);
  background: linear-gradient(
    to bottom,
    rgba(var(--header-veil), 0.96) 0%,
    rgba(var(--header-veil), 0.96) 58%,
    rgba(var(--header-veil), 0) 100%
  );
}

body.theme-night:has(.content-page) .site-header {
  --header-veil: 46, 45, 43;
}

.top-nav.has-overlap-backdrop::before {
  display: none;
}

.home-step--beats {
  font-size: 1rem;
}

.home-step--beats .home-step-title,
.home-step--beats .home-step-body {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

.home-step--beats .home-step-title {
  font-weight: 500;
  margin: 1.15em 0 0.3em;
}

.home-step--beats .home-step-title:first-child {
  margin-top: 0;
}

.home-step--beats .home-step-body {
  margin: 0;
}

.home-step--open .home-step-lead {
  margin: 0 0 0.75em;
}

.home-step--open .home-step-body {
  margin: 0;
}

.home-hero-text .home-step-body {
  margin: 0 0 0.75em;
}

.home-hero-text .home-step-body:last-child {
  margin-bottom: 0;
}

.home-step-quote {
  margin: 0;
  font-style: italic;
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 400;
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 12px;
  overflow: visible;
  clip: auto;
  background: #fff;
  color: #111;
}

#fps {
  display: none;
}

#fps.visible {
  display: block;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 400;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
}

.manifesto-fr { display: none; }
html[lang="fr"] .manifesto-en { display: none; }
html[lang="fr"] .manifesto-fr { display: block; }

.letter-body .manifesto-num {
  font-family: var(--mono-font);
  font-size: var(--text-meta);
  letter-spacing: 0.14em;
  margin: 2em 0 0.75em;
}

@media (max-width: 480px) and (max-height: 700px) {
  html[lang="fr"] .page[data-page-type="home"] .home-hero-text {
    font-size: 1rem;
    line-height: 1.4;
  }
}
