:root {
  --ink: #f4efe6;
  --ink-soft: rgba(244, 239, 230, 0.82);
  --night: #050507;
  --gutter: clamp(20px, 4vw, 56px);
  --fade: 1.6s; /* keep in sync with FADE_MS in main.js */
}

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--night);
  color: var(--ink);
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Background videos, stacked; only .is-active is visible. */
.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--night);
}

.backdrop video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--fade) ease-in-out;
}

.backdrop video.is-active {
  opacity: 1;
}

/* Darken the top and bottom edges so the text stays readable on bright frames. */
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0) 28%,
    rgba(0, 0, 0, 0.1) 55%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

/* Page text */
.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 32px;
  padding: var(--gutter);
  padding-top: max(var(--gutter), env(safe-area-inset-top));
  padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
  /* Lifts the text off bright frames (the galaxy clip) without a visible box. */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 28px rgba(0, 0, 0, 0.45);
}

.wordmark {
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
}

.motto {
  align-self: end;
  margin: 0;
  max-width: 1100px;
  text-wrap: balance;
}

.motto-lead {
  display: block;
  font-size: clamp(2.75rem, 7.5vw, 6.5rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  max-width: 13ch;
}

.motto-lead em {
  font-style: italic;
}

.motto-body {
  display: block;
  margin-top: clamp(16px, 2vw, 28px);
  max-width: 30ch;
  font-size: clamp(1.25rem, 1.9vw, 1.75rem);
  line-height: 1.25;
  color: var(--ink-soft);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  font-size: 1.125rem;
  color: var(--ink-soft);
}

.footer a {
  color: var(--ink);
  font-size: 1.25rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 239, 230, 0.4);
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

.footer a:hover {
  border-bottom-color: var(--ink);
}

.footer a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .backdrop video {
    transition: none;
  }
}
