:root {
  --ink: #070d0b;
  --fog: #d6e0da;
  --mist: #8ba096;
  --mist-dim: #5f7268;
  --brass: #d7a75a;
  --brass-hi: #f1cf8d;
  --line: rgba(214, 224, 218, 0.14);
  --panel: rgba(8, 16, 13, 0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--ink);
  color: var(--fog);
  font-family: "Outfit", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.no-webgl { overflow: auto; }
a { color: inherit; text-decoration: none; }

.stage {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: auto; /* crystals are hit-tested in scene.js; overlay passes through except links */
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#scene.is-hot { cursor: pointer; }
.no-webgl #scene { display: none; }
.no-webgl .stage {
  background:
    radial-gradient(900px 600px at 80% 40%, rgba(215,167,90,0.1), transparent 55%),
    linear-gradient(170deg, var(--ink), #0a1512 70%, #07100d);
}

.stage::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(5,10,8,0.82) 0%, rgba(5,10,8,0.35) 42%, transparent 68%),
    linear-gradient(180deg, rgba(5,10,8,0.55) 0%, transparent 22%, transparent 70%, rgba(5,10,8,0.75) 100%);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.85fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "top top"
    "hero projects"
    "foot foot";
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(1.1rem, 3.2vw, 2.4rem) clamp(1.2rem, 4vw, 3.2rem);
  pointer-events: none;
}
.overlay a { pointer-events: auto; }

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.mark {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  color: var(--fog);
}
.mark b { color: var(--brass); }
.status {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--mist);
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 0 rgba(215,167,90,0.55);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(215,167,90,0.55); }
  70% { box-shadow: 0 0 0 9px rgba(215,167,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(215,167,90,0); }
}

.hero {
  grid-area: hero;
  align-self: center;
  max-width: 14ch;
  animation: rise 0.9s 0.1s cubic-bezier(.2,.7,.2,1) both;
}
.brand {
  font-family: "Syne", sans-serif;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-size: clamp(3.6rem, 12vw, 9.5rem);
  margin: 0;
  color: #f3efe6;
  text-shadow: 0 2px 40px rgba(0,0,0,0.45);
}
.brand em { font-style: normal; color: var(--brass); }
.brand, .hero .line { transition: opacity .5s cubic-bezier(.2,.7,.2,1); }
/* focused crystal takes center stage — the wordmark steps back behind it */
.crystal-focus .brand { opacity: 0.16; }
.crystal-focus .hero .line { opacity: 0.45; }
.hero .line {
  margin: 1.15rem 0 0;
  max-width: 28ch;
  font-size: clamp(1rem, 1.45vw, 1.22rem);
  line-height: 1.5;
  color: var(--fog);
}
.hint {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin: 1.4rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--mist);
  transition: color .3s ease;
}
.has-webgl .hint { display: inline-flex; }
.hint::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  border: 1px solid var(--brass);
  transform: rotate(45deg);
  transition: background .3s ease, box-shadow .3s ease;
}
.hint.is-on { color: var(--brass-hi); }
.hint.is-on::before {
  background: var(--brass);
  box-shadow: 0 0 12px rgba(215,167,90,0.6);
}

/* --- clear, always-clickable project panel --- */
.projects {
  grid-area: projects;
  /* four entries — keep compact */
  align-self: center;
  justify-self: end;
  width: min(100%, 26rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: rise 0.9s 0.22s cubic-bezier(.2,.7,.2,1) both;
  z-index: 5;
}
.project {
  display: grid;
  grid-template-columns: 3.4rem 1fr auto;
  align-items: center;
  gap: 0.9rem 1rem;
  padding: 0.55rem 0.9rem 0.55rem 0.55rem;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 2px;
  color: var(--fog);
  transition: border-color .2s ease, background .2s ease, transform .2s ease, opacity .25s ease;
  cursor: pointer;
}
.projects.has-focus .project:not(.is-active) { opacity: 0.55; }
.project .thumb {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(215,167,90,0.25);
}
.thumb-noxtrava { background-image: url("/img/noxtrava.jpg?v=4"); }
.thumb-astraquell { background-image: url("/img/astraquell.jpg?v=5"); }
.thumb-najgastro { background-image: url("/img/najgastro.jpg?v=4"); }
.thumb-wafryon { background-image: url("/img/wafryon.jpg?v=1"); }
.project:hover,
.project:focus-visible,
.project.is-active {
  border-color: rgba(215,167,90,0.55);
  background: rgba(14, 24, 20, 0.78);
  transform: translateX(-4px);
  outline: none;
}
.project:focus-visible {
  box-shadow: 0 0 0 2px rgba(215,167,90,0.35);
}
.project .idx {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--mist-dim);
}
.project .name {
  display: block;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  letter-spacing: -0.02em;
  color: #f2ede3;
}
.project .type {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--mist);
  line-height: 1.35;
}
.project .go {
  font-size: 1.25rem;
  color: var(--brass);
  transition: transform .2s ease;
}
.project:hover .go,
.project:focus-visible .go,
.project.is-active .go {
  transform: translateX(4px);
  color: var(--brass-hi);
}

.foot {
  grid-area: foot;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--mist);
  animation: rise 0.9s 0.35s cubic-bezier(.2,.7,.2,1) both;
}
.foot a {
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.foot a:hover, .foot a:focus-visible {
  color: var(--fog);
  border-bottom-color: var(--brass);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  body { overflow: auto; }
  .stage { height: auto; min-height: 100svh; }
  .overlay {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "top"
      "hero"
      "projects"
      "foot";
    min-height: 100svh;
  }
  .hero { max-width: none; align-self: start; }
  .brand { font-size: clamp(3rem, 18vw, 5.5rem); }
  .projects { justify-self: stretch; width: 100%; }
  .project:hover,
  .project:focus-visible,
  .project.is-active { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .status .dot { animation: none; }
}
