/* THE VOID DRAGON CHRONICLES — site styles */

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

html { background: var(--void); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--void);
  color: var(--starlight);
  font-family: var(--font-ui);
  font-weight: 300;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }

::selection { background: var(--ice); color: var(--void); }

a { color: inherit; }

/* ---------- focus — visible even in the void, ice not warm ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 1px solid var(--ice);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ================= SCENE (home) ================= */
#scene {
  position: fixed; inset: 0;
  perspective: 1200px;
  z-index: 0;
}
#scene-inner {
  position: absolute; inset: -3vh -3vw;
  transform-style: preserve-3d;
  will-change: transform;
}

#starfield {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

/* ================= LOADER ================= */
#loader {
  position: fixed; inset: 0; z-index: 90;
  background: var(--void);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.9s ease, visibility 0.9s;
}
#loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-sigil {
  width: 52px; height: 52px; margin: 0 auto 26px;
  border: 1px solid var(--abyss-edge); border-radius: 50%;
  position: relative; animation: sigilspin 6s linear infinite;
}
.loader-sigil::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 1px solid transparent; border-top-color: var(--ice);
  animation: sigilspin 2.2s linear infinite;
}
@keyframes sigilspin { to { transform: rotate(360deg); } }
.loader-text {
  font-size: 10px; letter-spacing: 0.5em; padding-left: 0.5em;
  text-transform: uppercase; color: var(--dust); margin-bottom: 16px;
}
.loader-bar { width: 180px; height: 1px; margin: 0 auto; background: rgba(123, 118, 190, 0.18); }
.loader-bar span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--violet), var(--ice)); transition: width 0.25s ease; }

/* ================= HERO — scroll-scrubbed film ================= */
/* Real scroll height, sticky viewport, no scroll-jacking. The canvas
   composites over the live starfield with screen blend: the film's
   near-black void melts into the real-time one. */
.hero-runway { height: 640vh; position: relative; }
.hero-sticky {
  position: sticky; top: 0;
  height: 100vh; overflow: hidden;
}
#heroCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%; display: block;
  mix-blend-mode: screen;
}
.hero-scroll-hint {
  position: absolute; bottom: 36px; left: 50%; z-index: 10;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 9px; letter-spacing: 0.5em; padding-left: 0.5em;
  text-transform: uppercase; color: var(--dust);
  transition: opacity 0.8s ease;
}
.hero-scroll-hint.gone { opacity: 0; }
.hint-line {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, var(--ice), transparent);
  animation: hintpulse 2.4s ease-in-out infinite;
}
@keyframes hintpulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* presence, not glow: the frame darkens toward its own edges */
#grade {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 40%, rgba(5, 5, 8, 0.62) 88%),
    linear-gradient(to bottom, rgba(5,5,8,0.55), transparent 18%, transparent 80%, rgba(5,5,8,0.72));
}

/* ================= CHROME ================= */
.chrome { position: relative; z-index: 10; }

header.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 3.2vw;
  padding: 30px 46px;
}
.nav-sigil {
  width: 30px; height: 30px; flex: none;
  color: var(--starlight);
  opacity: 0.92;
}
.nav-sigil svg { width: 100%; height: 100%; display: block; }
nav.primary { display: flex; gap: 2.6vw; align-items: center; }
nav.primary a {
  font-size: 11px; font-weight: 400;
  letter-spacing: var(--track-nav);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--dust);
  padding: 6px 2px;
  transition: color var(--dur-fast) ease;
}
nav.primary a:hover, nav.primary a[aria-current="page"] { color: var(--starlight); }
nav.primary a[aria-current="page"] {
  border-bottom: 1px solid var(--violet);
  padding-bottom: 5px;
}
.nav-spacer { flex: 1; }
.nav-cta {
  font-size: 11px; letter-spacing: var(--track-nav); text-transform: uppercase;
  text-decoration: none; color: var(--starlight);
  border: 1px solid var(--abyss-edge);
  padding: 12px 26px;
  background: rgba(18, 20, 43, 0.35);
  backdrop-filter: blur(6px);
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.nav-cta:hover { border-color: var(--ice); color: var(--ice); background: rgba(18, 20, 43, 0.6); }

/* menu toggle — touch nav */
.menu-toggle {
  display: none;
  background: none; border: 1px solid var(--abyss-edge);
  color: var(--starlight); font-family: var(--font-ui);
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  padding: 10px 16px;
}

/* ================= HOME HERO COPY ================= */
.hero-lockup {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding-bottom: 13vh;
  text-align: center;
  pointer-events: none;
}
.hero-lockup, .hero-foot { transition: opacity 1.6s var(--ease-void); }
/* title yields as soon as the scrub begins; everything yields to the eye */
body.scrubbing .hero-lockup { opacity: 0.14; }
body.act-eye .hero-lockup { opacity: 0; }
body.act-eye .hero-foot .tick { opacity: 0.4; }
.hero-kicker {
  font-size: 11px; letter-spacing: var(--track-label); padding-left: var(--track-label);
  text-transform: uppercase; color: var(--violet);
  margin-bottom: 2.6vh;
}
h1.hero-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(34px, 5.4vw, 84px);
  letter-spacing: var(--track-title); padding-left: var(--track-title);
  line-height: 1.08;
  text-transform: uppercase;
}
.hero-title .line-2 {
  display: block;
  font-size: 0.58em;
  letter-spacing: 0.58em; padding-left: 0.58em;
  color: var(--violet);
}
.hero-actions {
  margin-top: 4.2vh;
  display: flex; gap: 22px; align-items: center;
}
.btn-ghost {
  font-family: var(--font-ui); font-size: 11px;
  letter-spacing: 0.34em; padding-left: calc(28px + 0.34em);
  text-transform: uppercase; text-decoration: none;
  color: var(--starlight);
  border: 1px solid var(--abyss-edge);
  padding-top: 15px; padding-bottom: 15px; padding-right: 28px;
  background: rgba(5,5,8,0.3);
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.btn-ghost:hover { border-color: var(--ice); color: var(--ice); }

.hero-foot {
  position: absolute; left: 46px; bottom: 34px; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  font-size: 9px; letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--dust);
}
.hero-foot .tick { width: 1px; height: 34px; background: linear-gradient(to bottom, var(--violet), transparent); }

/* sound toggle — themed, quiet */
.sound-toggle {
  position: fixed; right: 46px; bottom: 30px; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: none; border: 1px solid var(--abyss-edge);
  color: var(--dust); font-family: var(--font-ui);
  font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase;
  padding: 10px 16px;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.sound-toggle:hover { color: var(--ice); border-color: var(--ice); }
.sound-toggle .bars { display: flex; gap: 2px; align-items: flex-end; height: 10px; }
.sound-toggle .bars span { width: 2px; background: currentColor; height: 3px; }
.sound-toggle.on .bars span { animation: soundbar 1.1s ease-in-out infinite; }
.sound-toggle.on .bars span:nth-child(2) { animation-delay: 0.2s; }
.sound-toggle.on .bars span:nth-child(3) { animation-delay: 0.45s; }
@keyframes soundbar { 0%,100% { height: 3px; } 50% { height: 10px; } }

/* ================= CUSTOM CURSOR ================= */
#cursor {
  position: fixed; top: 0; left: 0; z-index: 100;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--void);              /* a literal absence */
  box-shadow: 0 0 0 1px rgba(143, 217, 232, 0.65),
              0 0 10px rgba(143, 217, 232, 0.18);
  pointer-events: none;
  transition: width 0.22s var(--ease-void), height 0.22s var(--ease-void),
              margin 0.22s var(--ease-void), box-shadow 0.22s var(--ease-void);
  will-change: transform;
}
#cursor.dilated {
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  box-shadow: 0 0 0 1px rgba(143, 217, 232, 1),
              0 0 18px rgba(143, 217, 232, 0.35);
}
.cursor-echo {
  position: fixed; top: 0; left: 0; z-index: 99;
  border-radius: 50%;
  border: 1px solid rgba(143, 217, 232, 0.5);
  pointer-events: none;
  animation: echo-fade 0.28s linear forwards;
}
@keyframes echo-fade { to { opacity: 0; transform: scale(0.6); } }

/* ================= PAGE SECTIONS (one-page anchors) ================= */
.page-section {
  position: relative; z-index: 10;
  padding: 20vh 0;
  scroll-margin-top: 6vh;
}
.section-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 6vw;
}

main.page {
  position: relative; z-index: 10;
  max-width: 1160px;
  margin: 0 auto;
  padding: 22vh 6vw 16vh;
}
.page-kicker {
  font-size: 10px; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--violet);
  margin-bottom: 30px;
}
h1.page-title, h2.page-title {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(40px, 5vw, 76px);
  letter-spacing: 0.06em; line-height: 1.06;
}
.page-title em { font-style: italic; color: var(--violet); }
.page-lead {
  margin-top: 5vh; max-width: 640px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 28px); line-height: 1.6;
  color: var(--starlight);
}
.page-body { margin-top: 7vh; display: grid; gap: 34px; max-width: 620px; }
.page-body p { font-size: 15px; line-height: 2.05; color: var(--dust); }
.page-body p strong { color: var(--starlight); font-weight: 400; }

.spec-list {
  margin-top: 8vh;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px; background: var(--abyss-edge);
  border: 1px solid var(--abyss-edge);
}
.spec {
  background: rgba(5, 5, 8, 0.88);
  padding: 38px 32px 44px;
  transition: background var(--dur-base) ease;
}
.spec:hover { background: rgba(18, 20, 43, 0.55); }
.spec .idx {
  font-family: var(--font-display); font-size: 13px;
  color: var(--dust); letter-spacing: 0.2em;
}
.spec h3 {
  font-family: var(--font-display); font-weight: 500;
  font-size: 24px; margin: 14px 0 12px;
}
.spec p { font-size: 13.5px; line-height: 1.9; color: var(--dust); }

.gallery-grid {
  margin-top: 8vh;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 22px;
}
.gallery-grid figure {
  border: 1px solid var(--abyss-edge);
  background: var(--void);
  overflow: hidden;
}
.gallery-grid img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block;
  transition: transform 1.4s var(--ease-void), opacity 1.4s ease;
}
.gallery-grid figure:hover img { transform: scale(1.035); }
.gallery-grid figcaption {
  padding: 14px 18px;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--dust);
}

.journal-list { margin-top: 8vh; border-top: 1px solid var(--abyss-edge); }
.journal-entry {
  display: grid; grid-template-columns: 130px 1fr;
  gap: 4vw; padding: 44px 0;
  border-bottom: 1px solid var(--abyss-edge);
}
.journal-entry .date {
  font-size: 10px; letter-spacing: 0.3em; color: var(--dust);
  text-transform: uppercase; padding-top: 8px;
}
.journal-entry h3 {
  font-family: var(--font-display); font-weight: 400; font-size: 26px;
}
.journal-entry p { margin-top: 12px; font-size: 14px; line-height: 1.95; color: var(--dust); max-width: 560px; }

form.contact { margin-top: 8vh; display: grid; gap: 26px; max-width: 520px; }
form.contact label {
  display: grid; gap: 10px;
  font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--dust);
}
form.contact input, form.contact textarea {
  background: rgba(18, 20, 43, 0.3);
  border: 1px solid var(--abyss-edge);
  color: var(--starlight);
  font-family: var(--font-ui); font-weight: 300; font-size: 15px;
  padding: 14px 16px;
  transition: border-color var(--dur-fast) ease;
}
form.contact input:hover, form.contact textarea:hover { border-color: var(--dust); }
form.contact input:focus-visible, form.contact textarea:focus-visible {
  border-color: var(--ice); outline: none;
}
form.contact button {
  justify-self: start;
  background: none; border: 1px solid var(--abyss-edge);
  color: var(--starlight); font-family: var(--font-ui);
  font-size: 11px; letter-spacing: 0.34em; text-transform: uppercase;
  padding: 15px 30px;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
form.contact button:hover { border-color: var(--ice); color: var(--ice); }

footer.site {
  position: relative; z-index: 10;
  display: flex; justify-content: space-between; gap: 20px;
  padding: 30px 46px;
  font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--dust);
}

/* reveals — subpages only, quiet register */
.rv { opacity: 0; transform: translateY(30px); transition: opacity 1.1s var(--ease-void), transform 1.1s var(--ease-void); }
.rv.in { opacity: 1; transform: none; }

/* ================= REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  #cursor, .cursor-echo { display: none !important; }
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: auto; }
  .sound-toggle.on .bars span { animation: none; }
}

/* ================= TOUCH / SMALL ================= */
@media (hover: none), (pointer: coarse) {
  #cursor, .cursor-echo { display: none !important; }
  body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: auto; }
}
@media (max-width: 940px) {
  header.nav { padding: 20px 22px; gap: 18px; }
  nav.primary {
    display: none;
    position: fixed; inset: 0;
    background: rgba(5, 5, 8, 0.96);
    flex-direction: column; justify-content: center; align-items: center;
    gap: 30px;
  }
  nav.primary.open { display: flex; }
  nav.primary a { font-size: 14px; }
  .menu-toggle { display: block; z-index: 30; position: relative; }
  .hero-foot { display: none; }
  .sound-toggle { right: 22px; bottom: 22px; }
  .journal-entry { grid-template-columns: 1fr; gap: 10px; }
  main.page { padding-top: 18vh; }
}
