:root {
  --bg: #0b0b0f;
  --fg: #f3f1ea;
  --muted: #8a8690;
  --accent: #f4b942;
  --accent-bright: #ffd369;
  --font-display: "Red Hat Display", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }

/* ambient glow */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 50% 40%, rgba(244, 185, 66, 0.10), transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(244, 185, 66, 0.04), transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 1%, 0) scale(1.08); }
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: clamp(24px, 4vw, 48px);
  gap: clamp(24px, 4vh, 48px);
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 5vh, 48px);
  text-align: center;
  perspective: 1000px;
}

/* ------- LOGO ------- */
.emblem {
  width: clamp(120px, 22vmin, 200px);
  aspect-ratio: 60 / 69;
  position: relative;
  transform-style: preserve-3d;
  animation: float 6s ease-in-out infinite;
  will-change: transform;
}

.emblem-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.18s cubic-bezier(.2,.7,.2,1);
}

.logo {
  width: 100%;
  height: 100%;
  background-image: url("/logo.svg");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  user-select: none;
  -webkit-user-drag: none;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* ------- TITLE ------- */
.title {
  position: relative;
  font-weight: 800;
  font-size: clamp(28px, 5.4vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  max-width: 22ch;
  min-height: 1.2em;
}

.type { white-space: pre; }

.accent {
  position: relative;
  display: inline-block;
  color: var(--accent);
  background: linear-gradient(120deg, var(--accent) 20%, var(--accent-bright) 50%, var(--accent) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.underline {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.32em;
  width: 104%;
  height: 0.28em;
  color: var(--accent);
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 8px rgba(244, 185, 66, 0.35));
}

.underline path {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}

.underline.draw {
  opacity: 1;
}

.underline.draw path {
  animation: drawLine 0.7s cubic-bezier(.6,.1,.2,1) forwards;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* blinking caret */
.caret {
  display: inline-block;
  width: 0.08em;
  height: 1em;
  background: var(--fg);
  margin-left: 0.06em;
  vertical-align: -0.12em;
  animation: blink 0.9s steps(1) infinite;
  opacity: 0.85;
}

.caret.done {
  animation: blink 0.9s steps(1) infinite, fadeCaret 0.6s 1.2s forwards;
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes fadeCaret {
  to { opacity: 0; width: 0; margin: 0; }
}

/* ------- FOOTER ------- */
.foot {
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  text-align: center;
  padding-bottom: clamp(8px, 2vh, 24px);
}

.foot a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 185, 66, 0.4);
  transition: border-color 0.25s ease, color 0.25s ease;
}

.foot a:hover,
.foot a:focus-visible {
  color: var(--accent-bright);
  border-bottom-color: var(--accent-bright);
}

.foot a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* grain */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

@media (max-width: 480px) {
  .stage { padding: 24px 20px; }
  .title { font-size: clamp(24px, 8vw, 36px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .type::after { content: attr(data-type); }
  .caret { display: none; }
  .underline { opacity: 1; }
  .underline path { stroke-dashoffset: 0; }
}
