/* Astrelorn — deep space, carved gold, ember light */
:root {
  --void: #05060a;
  --deep: #0b0c13;
  --bone: #ddd2b9;
  --bone-dim: #9a9080;
  --gold: #c9a45c;
  --gold-hi: #f1d898;
  --gold-lo: #6e5732;
  --ember: #e2662a;
  --blood: #6d1210;
  --hud: #8fbfe0;
  --pad: clamp(18px, 3.2vw, 44px);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --serif: "Cormorant Garamond", Garamond, Georgia, serif;
  --mono: "Share Tech Mono", ui-monospace, Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--void);
  color: var(--bone);
  font-family: var(--serif);
  overflow-x: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--blood); color: var(--gold-hi); }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- backdrop layers ---------- */
#sky, .nebula, .planet, .vignette, .grain, .frame {
  position: fixed;
  pointer-events: none;
}
#sky { inset: 0; width: 100%; height: 100%; z-index: 0; }

.nebula {
  inset: -10%;
  z-index: 1;
  background:
    radial-gradient(38% 30% at 72% 22%, rgba(109, 18, 16, .30), transparent 70%),
    radial-gradient(30% 24% at 84% 40%, rgba(226, 102, 42, .10), transparent 70%),
    radial-gradient(42% 36% at 18% 12%, rgba(30, 58, 80, .22), transparent 72%),
    radial-gradient(26% 20% at 8% 70%, rgba(40, 22, 48, .25), transparent 70%);
  filter: blur(8px);
  animation: drift 60s ease-in-out infinite alternate;
}

.planet {
  z-index: 2;
  width: min(124vmin, 1500px);
  aspect-ratio: 1;
  right: -40vmin;
  bottom: -84vmin;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 24%, #1a1110 0%, #0a0708 30%, #040304 58%, #020203 80%);
  box-shadow:
    inset 18px 16px 34px -14px rgba(226, 102, 42, .55),
    inset 4px 4px 10px -4px rgba(241, 216, 152, .55),
    0 0 60px 0 rgba(226, 102, 42, .14),
    0 0 240px 30px rgba(109, 18, 16, .28);
}
.planet::before { /* night side swallowed by shadow */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 78% 82%, rgba(0, 0, 0, .85), transparent 62%);
}
.planet__atmo {
  position: absolute;
  inset: -2%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 67.5%, rgba(226, 102, 42, .28) 70%, transparent 73%);
  mask-image: linear-gradient(135deg, #000 0%, transparent 42%);
  -webkit-mask-image: linear-gradient(135deg, #000 0%, transparent 42%);
  animation: breathe 9s ease-in-out infinite;
}

.vignette {
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(120% 90% at 40% 45%, transparent 45%, rgba(0, 0, 0, .78) 100%),
    linear-gradient(to top, rgba(5, 6, 10, .85), transparent 30%);
}

.grain {
  inset: -50%;
  z-index: 4;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

/* ---------- gothic frame ---------- */
.frame {
  inset: calc(var(--pad) * .45);
  z-index: 5;
  border: 1px solid rgba(110, 87, 50, .38);
  color: var(--gold-lo);
}
.frame::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(110, 87, 50, .16);
}
.corner { position: absolute; width: clamp(38px, 5vw, 64px); height: auto; color: var(--gold); opacity: .8; }
.corner--tl { top: -1px; left: -1px; }
.corner--tr { top: -1px; right: -1px; transform: scaleX(-1); }
.corner--bl { bottom: -1px; left: -1px; transform: scaleY(-1); }
.corner--br { bottom: -1px; right: -1px; transform: scale(-1, -1); }

/* ---------- content ---------- */
.bar, .hero { position: relative; z-index: 6; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(var(--pad) * 1.15) calc(var(--pad) * 1.5) 0;
}
.bar--foot { padding: 0 calc(var(--pad) * 1.5) calc(var(--pad) * 1.15); align-items: flex-end; flex-wrap: wrap; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  text-decoration: none;
  min-height: 44px;
}
.brand:focus-visible { outline: 1px solid var(--gold); outline-offset: 6px; }

.hud {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.hud b { color: var(--hud); font-weight: 400; }
.hud .sep { color: var(--gold-lo); margin: 0 .5em; }
.hud--status { margin-left: auto; color: var(--hud); display: inline-flex; align-items: center; gap: 10px; }
.hud--telemetry { display: flex; flex-wrap: wrap; justify-content: flex-end; }
.hud--telemetry .sep { margin: 0 .7em; }

.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--hud);
  box-shadow: 0 0 10px var(--hud);
  animation: pulse 2.4s ease-in-out infinite;
}

.hero {
  align-self: center;
  padding: var(--pad) calc(var(--pad) * 1.5);
  padding-left: clamp(32px, 9vw, 160px);
  max-width: 1100px;
}

.hud--eyebrow {
  color: var(--gold);
  opacity: .85;
  margin-bottom: clamp(14px, 2vw, 22px);
  animation: rise 1.4s .2s both cubic-bezier(.2, .7, .2, 1);
}

.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(46px, 11.5vw, 168px);
  line-height: .92;
  letter-spacing: .06em;
  text-transform: uppercase;
  animation: rise 1.6s .35s both cubic-bezier(.2, .7, .2, 1);
}
.title__carve {
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 42%, #8a6a35 58%, #c9a45c 76%, #5a4526 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 rgba(0, 0, 0, .9))
    drop-shadow(0 0 28px rgba(226, 102, 42, .22));
}

.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(520px, 78%);
  margin: clamp(18px, 2.6vw, 30px) 0 clamp(14px, 2vw, 22px);
  animation: unfurl 1.6s .7s both cubic-bezier(.2, .7, .2, 1);
  transform-origin: left center;
}
.rule span { flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-lo), var(--gold), var(--gold-lo)); }
.rule span:first-child { flex: 0 0 18%; background: linear-gradient(90deg, transparent, var(--gold)); }
.rule span:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.rule i { width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid var(--gold); background: var(--blood); box-shadow: 0 0 12px rgba(226, 102, 42, .5); }

.motto {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(26px, 3.6vw, 50px);
  line-height: 1.1;
  color: var(--bone);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .9);
  animation: rise 1.6s .9s both cubic-bezier(.2, .7, .2, 1);
}

.lede {
  margin: clamp(14px, 1.8vw, 22px) 0 0;
  max-width: 34ch;
  font-size: clamp(17px, 1.45vw, 21px);
  line-height: 1.5;
  color: var(--bone-dim);
  text-wrap: pretty;
  animation: rise 1.6s 1.15s both cubic-bezier(.2, .7, .2, 1);
}

.hail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin: clamp(26px, 3.4vw, 44px) 0 0;
  animation: rise 1.6s 1.4s both cubic-bezier(.2, .7, .2, 1);
}
.hail__label { color: var(--gold); opacity: .8; }
.hail__label::after { content: " \2192"; color: var(--gold-lo); }
.hail__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: clamp(13px, 1.1vw, 15px);
  letter-spacing: .12em;
  color: var(--hud);
  text-decoration: none;
  border-bottom: 1px solid rgba(143, 191, 224, .25);
  transition: color .25s ease, border-color .25s ease, text-shadow .25s ease;
}
.hail__link:hover, .hail__link:focus-visible {
  color: #d6ecff;
  border-color: var(--hud);
  text-shadow: 0 0 12px rgba(143, 191, 224, .55);
  outline: none;
}

/* ---------- motion ---------- */
@keyframes rise   { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes unfurl { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }
@keyframes pulse  { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes breathe{ 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes drift  { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-2%, 1.5%, 0) scale(1.05); } }
@keyframes grain  { 0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); } 60% { transform: translate(-1%, 4%); } 80% { transform: translate(3%, 1%); } 100% { transform: translate(0, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .planet { width: 160vmin; right: -70vmin; bottom: -106vmin; }
  .hero { padding-left: calc(var(--pad) * 1.5); }
  .hud--status { display: none; }
  .bar--foot { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hud--telemetry { justify-content: flex-start; }
  .hud { font-size: 11px; letter-spacing: .16em; }
}
