/* ============================================================
   GRIMLIGHT — placeholder
   Palette drawn from the GRIMLIGHT poster (violet/lavender)
   and the PROJECT GRIMLIGHT lantern key art (gold/cream).
   ============================================================ */
:root {
  --bg:        #0a0612;   /* near-black, violet tint */
  --bg-2:      #150b28;   /* deep violet */
  --violet:    #2a1a4a;
  --lavender:  #b9a3e8;   /* poster title */
  --lavender-2:#8b6fc4;
  --gold:      #f5d77a;   /* lantern glow */
  --cream:     #f5e8c8;   /* PROJECT GRIMLIGHT type */
  --ember:     #ff8c3a;   /* flame */
  --ink:       #e9def7;

  --blood:     #b3282f;   /* the crossed-out NOT */
  --blood-2:   #d8353d;

  --font: "Inknut Antiqua", Georgia, "Times New Roman", serif;
  --font-title: "Fredericka the Great", "Inknut Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(120% 90% at 50% 18%, var(--bg-2) 0%, var(--bg) 55%, #050309 100%);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  /* No text selection — a drag is for sweeping the flashlight, not highlighting */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
/* …but form fields still need to be selectable/editable */
input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

/* ---- Three.js low-res wireframe canvas ---- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* The PS1 "blur": the canvas is rendered at a fraction of native
     resolution, then stretched up with a touch of bilinear softening. */
  image-rendering: auto;
  filter: blur(0.5px) saturate(1.15);
  opacity: 0.92;
}

/* ============================================================
   PS1 / composite-video post overlays
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

/* Darkening wash over the 3D room, sinking it deeper into the violet gloom */
.scene-tint {
  background: rgba(7, 4, 14, 0.42);
  z-index: 1;
}

/* Scanlines */
.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0)        0px,
    rgba(0,0,0,0)        2px,
    rgba(0,0,0,0.18)     3px,
    rgba(0,0,0,0.18)     4px
  );
  mix-blend-mode: multiply;
  opacity: 0.7;
}

/* Ordered-dither speckle, classic PS1 banding hider */
.dither {
  background-image:
    radial-gradient(rgba(185,163,232,0.06) 1px, transparent 1px),
    radial-gradient(rgba(245,215,122,0.05) 1px, transparent 1px);
  background-size: 3px 3px, 3px 3px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: screen;
  opacity: 0.5;
  animation: jitter 0.5s steps(2) infinite;
}

/* Smooth half of the CRT vignette — a deep, curved fall-off into black.
   The dithered canvas below adds the chunky stepped texture on top. */
.vignette {
  background:
    radial-gradient(135% 120% at 50% 50%,
      transparent 38%,
      rgba(5,3,9,0.40) 66%,
      rgba(3,2,6,0.80) 86%,
      #000 100%);
  z-index: 3;
}

/* Chunky Bayer-dithered vignette — stepped darkness sinking the whole edge */
.vignette-dither {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  z-index: 3;
  opacity: 0.9;
}

/* Convex-glass sheen of an old tube TV — sits over everything, very faint */
.glass-shine {
  z-index: 6;
  background:
    /* soft top-left reflection */
    radial-gradient(70% 55% at 26% 16%, rgba(255,255,255,0.06), transparent 60%),
    /* faint diagonal streak down the glass */
    linear-gradient(125deg, rgba(255,255,255,0.05) 0%, transparent 18%),
    /* gentle bulge: brighter centre, cooler rim */
    radial-gradient(120% 120% at 50% 45%, rgba(255,255,255,0.03) 0%, transparent 55%);
  mix-blend-mode: screen;
}

@keyframes jitter {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(0.5px, -0.5px); }
  100% { transform: translate(-0.5px, 0.5px); }
}

/* ============================================================
   Foreground content
   ============================================================ */
.stage {
  position: relative;
  z-index: 4;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6vh 5vw;
  gap: clamp(0.3rem, 0.9vh, 0.6rem);
}

/* The title centres on screen; the flame floats to its right as an accent so
   it never shoves the wordmark off-centre. The brand's font-size is the single
   master scale — the title is 1em of it and the flame is sized in em too, so
   the wordmark + flame shrink together as one object on smaller screens. */
.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* smaller master scale than the GRIMLIGHT days — the wordmark is longer */
  font-size: clamp(1.9rem, 7vw, 5.6rem);
}

.flame-wrap {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: clamp(0.1rem, 1vw, 0.6rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flame {
  position: relative;
  z-index: 1;
  width: 1.15em;          /* locked to the wordmark's scale (brand font-size) */
  height: auto;
  image-rendering: pixelated;
  /* keep just a tight core glow; the big halo is the dithered canvas */
  filter: drop-shadow(0 0 6px rgba(255,140,58,0.55));
}
/* old-school Bayer-dithered light pool, rendered chunky and stretched up */
.glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.6em;           /* halo scales with the flame (brand font-size) */
  height: 2.6em;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  z-index: 0;
  mix-blend-mode: screen;
  opacity: 0.3; /* dithered halo kept faint — ~70% transparent */
  pointer-events: none;
}

.title {
  position: relative;
  margin: 0;
  font-family: var(--font-title);
  font-weight: 400;        /* Fredericka the Great ships a single weight */
  letter-spacing: 0.08em;
  line-height: 1;
  font-size: 1em;          /* inherits the brand's master scale */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
  /* chromatic aberration — the cheap, beloved PS1 colour-fringe trick */
  text-shadow:
    -2px 0 rgba(139,111,196,0.55),
     2px 0 rgba(245,215,122,0.40),
     0   0 22px rgba(185,163,232,0.45);
}

/* the crossed-out NOT, scrawled in red */
.title .not {
  position: relative;
  color: var(--blood-2);
  font-size: 0.72em;
  transform: rotate(-3deg);
  text-shadow:
    -2px 0 rgba(179,40,47,0.5),
     2px 0 rgba(216,53,61,0.4),
     0   0 18px rgba(179,40,47,0.55);
}
/* two rotated/skewed strokes instead of text-decoration — reads hand-scratched */
.title .not::before,
.title .not::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  top: 50%;
  height: 0.07em;
  background: var(--blood);
  box-shadow: 0 0 10px rgba(179,40,47,0.6);
  pointer-events: none;
}
.title .not::before { transform: rotate(-9deg) skewX(-12deg); }
.title .not::after  { transform: translateY(0.08em) rotate(6deg) skewX(8deg); }

.title .rest {
  color: var(--cream);
  /* warm lantern gradient, same trick the old wordmark used */
  background: linear-gradient(180deg, var(--gold) 0%, var(--cream) 60%, #fff7e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  /* hug the wordmark so title + tagline read as one unit */
  margin: clamp(-0.5rem, -1.2vh, -0.1rem) 0 0;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.2em;
  font-size: clamp(0.7rem, 2.4vw, 1.05rem);
  color: var(--lavender-2);
  opacity: 0.85;
}

.rule {
  width: min(320px, 60vw);
  height: 1px;
  margin: clamp(0.1rem, 0.5vh, 0.35rem) 0;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold), transparent);
  opacity: 0.6;
}

.status {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  font-size: clamp(0.8rem, 3vw, 1.4rem);
  color: var(--gold);
  text-shadow: 0 0 18px rgba(245,215,122,0.4);
  animation: pulse 3.2s ease-in-out infinite;
}

.platform {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: clamp(0.6rem, 2vw, 0.85rem);
  color: var(--lavender-2);
  opacity: 0.75;
}

@keyframes pulse {
  0%, 100% { opacity: 0.78; }
  50%      { opacity: 1; }
}

.links {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2.5vw, 1.4rem);
  margin-top: clamp(0.15rem, 0.7vh, 0.45rem);
  font-size: clamp(0.7rem, 2vw, 0.95rem);
  letter-spacing: 0.1em;
}
.link {
  color: var(--lavender);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, text-shadow 0.2s ease;
}
.link:hover {
  color: var(--cream);
  border-color: var(--gold);
  text-shadow: 0 0 14px rgba(245,215,122,0.6);
}
.dot { color: var(--lavender-2); opacity: 0.5; font-size: 0.7em; }

/* Contact info printed on a sheet of parchment peeking up through the bottom
   of the screen, tilted like it was tucked under the glass. The lower part of
   the sheet runs off-screen (clipped by body overflow:hidden). */
.credit {
  position: fixed;
  left: 50%;
  bottom: -92px;                  /* push the sheet down so its base runs off-screen */
  transform: translateX(-50%) rotate(-3.5deg);
  transform-origin: bottom center;
  z-index: 4;
  width: min(540px, 92vw);
  height: 224px;                  /* tall sheet; only the top band shows */
  padding: 1.4rem 1.7rem 0;       /* keep the text near the visible top edge */
  text-align: center;
  font-size: 0.84rem;
  letter-spacing: 0.12em;
  color: #2f2113;                 /* dark ink on the paper */
  background-image: url('assets/paper.png');
  background-size: cover;
  background-position: top center;
  box-shadow: 0 -5px 24px rgba(0, 0, 0, 0.5); /* soft shadow where it lifts off the scene */
}
.credit p { margin: 0.14rem 0; }
.credit .locale {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  color: #4b3518;
}
.credit .contact { color: #2f2113; }
.credit .email {
  color: #6a2f15;                 /* oxblood ink */
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(106, 47, 21, 0.35);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.credit .email:hover { color: #8a3a18; border-color: #6a2f15; }
.credit .copy {
  display: block;
  margin-top: 0.32rem;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: #5c4424;
}

/* build version — lower-left corner */
.version {
  position: fixed;
  left: 0.9rem;
  bottom: 0.7rem;
  z-index: 5;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--lavender);
  opacity: 0.72;
  text-shadow: 0 0 8px rgba(139,111,196,0.5);
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   Contact page
   ============================================================ */
/* the form can be taller than the viewport — let this page scroll */
body.page-contact { overflow: auto; }
.contact-stage {
  justify-content: flex-start;
  min-height: 100%;
  height: auto;
  padding-top: clamp(3vh, 7vh, 9vh);
  padding-bottom: 8vh;
}

.back-link {
  align-self: center;
  color: var(--lavender-2);
  text-decoration: none;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  letter-spacing: 0.18em;
  text-transform: lowercase;
  opacity: 0.8;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.back-link:hover { color: var(--gold); text-shadow: 0 0 12px rgba(245,215,122,0.5); }

.contact-title {
  margin: 0;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.95;
  font-size: clamp(2.2rem, 9vw, 5rem);
  text-shadow:
    -2px 0 rgba(139,111,196,0.55),
     2px 0 rgba(245,215,122,0.40),
     0   0 22px rgba(185,163,232,0.45);
}
.contact-title .grim { color: var(--lavender); }
.contact-title .light {
  color: var(--cream);
  background: linear-gradient(180deg, var(--gold) 0%, var(--cream) 60%, #fff7e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.contact-form {
  width: min(560px, 92vw);
  margin-top: clamp(0.8rem, 3vh, 1.6rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 2vh, 1.1rem);
  text-align: left;
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lavender-2);
}

.contact-form input,
.contact-form textarea {
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(21, 11, 40, 0.62);
  border: 1px solid rgba(139, 111, 196, 0.45);
  border-radius: 2px;
  padding: 0.7rem 0.8rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.contact-form textarea { resize: vertical; min-height: 7rem; }
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: rgba(185,163,232,0.4); }
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--gold);
  background: rgba(21, 11, 40, 0.8);
  box-shadow: 0 0 14px rgba(245, 215, 122, 0.25);
}

.cf-send {
  margin-top: 0.4rem;
  align-self: flex-start;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--bg);
  background: linear-gradient(180deg, var(--gold) 0%, #e6c25e 100%);
  border: none;
  border-radius: 2px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  text-shadow: none;
  box-shadow: 0 0 18px rgba(245, 215, 122, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.cf-send:hover { filter: brightness(1.08); box-shadow: 0 0 26px rgba(245, 215, 122, 0.55); }
.cf-send:active { transform: translateY(1px); }

.form-note {
  margin: 0.2rem 0 0;
  min-height: 1.2em;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--lavender);
  opacity: 0.85;
}

/* ---- phones (portrait) ---- */
@media (max-width: 520px) {
  /* Mobile: the flame (with its glow) crowns the word from above. The brand
     becomes a centred column; flame-wrap is the 2nd child, so column-reverse
     lifts it over the title. */
  .brand {
    font-size: clamp(1.3rem, 9vw, 2.2rem);
    flex-direction: column-reverse;
    gap: 0.1rem;
  }
  .title { letter-spacing: 0.01em; }
  .flame-right { display: inline-flex; } /* shown again, now on top */
  .flame-wrap {
    position: static;                    /* back into the column flow */
    transform: none;
    margin: 0;
  }
  .flame { width: 1.5em; }               /* a touch larger as the crowning lantern */
  .tagline { letter-spacing: 0.1em; }
  .status { letter-spacing: 0.35em; }
  .links { flex-wrap: wrap; justify-content: center; }
  .contact-title { font-size: clamp(1.7rem, 11vw, 2.8rem); }
  .contact-form { width: 94vw; }
}

/* ---- short / landscape phones: keep everything on one screen ---- */
@media (max-height: 460px) and (orientation: landscape) {
  .stage { gap: 0.35rem; padding: 4vh 6vw; }
  .brand { font-size: clamp(1.6rem, 11vh, 3rem); }
  .tagline { font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .dither, .status { animation: none; }
}
