/* uPEG — terminal/bitmap aesthetic */
:root {
  --bg: #0a0a0a;
  --bg-2: #0f0f0f;
  --ink: #e8dfc9;
  --ink-dim: #8a8270;
  --ink-mute: #5a5446;
  --line: #e8dfc9;
  --accent: #e8dfc9;

  --font-pixel: "VT323", "Press Start 2P", ui-monospace, monospace;
  --font-mono: "VT323", ui-monospace, monospace;
  --font-display: "Bruno Ace SC", "Megrim", "Audiowide", sans-serif;
  --font-jp: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;

  --pad: clamp(16px, 2vw, 28px);
  --maxw: 1400px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #050505;
  color: var(--ink);
  font-family: var(--font-pixel);
  font-size: 18px;
  line-height: 1.25;
  -webkit-font-smoothing: none;
  font-smooth: never;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ── grainy noise (animated) ── */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.91 0 0 0 0 0.87 0 0 0 0 0.79 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 240px 240px;
  mix-blend-mode: screen;
  opacity: 0.18;
  animation: grain 0.7s steps(6) infinite;
}
@keyframes grain {
  0%   { transform: translate(0,0); }
  16%  { transform: translate(-3%,-2%); }
  33%  { transform: translate(-6%,2%); }
  50%  { transform: translate(2%,-4%); }
  66%  { transform: translate(4%,3%); }
  83%  { transform: translate(-2%,4%); }
  100% { transform: translate(0,0); }
}
/* static dust on bg */
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.91 0 0 0 0 0.87 0 0 0 0 0.79 0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.7;
}
/* faint scanlines */
.scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0 2px,
    rgba(0,0,0,0.18) 2px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.4;
}

/* CRT vignette */
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 9997;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.6) 100%);
}

/* shell */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  position: relative;
  z-index: 1;
}

/* panels */
.panel {
  border: 1.5px solid var(--line);
  border-radius: 22px;
  background: #0a0a0a;
  position: relative;
  overflow: hidden;
}
.panel-tight { border-radius: 16px; }

/* fonts assignments */
.pixel { font-family: var(--font-pixel); letter-spacing: 0.04em; }
.display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 400;
}
.jp { font-family: var(--font-jp); letter-spacing: 0.1em; }

/* text-with-bracket boxes (like THOMAS DUBOIS in image) */
.bracket {
  display: inline-block;
  border: 1.5px solid var(--ink);
  padding: 0 8px;
  margin: 0 4px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.1;
}

/* arrow chevrons >>>>> */
.chevs::before {
  content: ">>>>>>>>>>>>>>>>>>>>>>>>";
  letter-spacing: 0;
  color: var(--ink);
}

/* ghost outlined display text */
.ghost {
  -webkit-text-stroke: 1px var(--ink);
  color: transparent;
}

/* hairline divider */
hr.line {
  border: 0; height: 0; border-top: 1.5px solid var(--ink);
  margin: 0;
}

/* selection */
::selection { background: var(--ink); color: #050505; }

/* hide the default tweaks panel scrollbars when we don't want them */
.no-uppercase { text-transform: none; }

/* ────────── TV STATIC OVERLAY (vintage CRT noise) ────────── */
.tv-static {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* mix-blend lets the noise sit naturally on top of dark + light areas */
  mix-blend-mode: screen;
  /* opacity is set inline from the tweak */
  transition: opacity 200ms ease;
}

/* ────────── Embedded LCD pet (imported from uPET project) ────────── */
@keyframes petBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.pet-screen {
  width: 100%;
  height: 100%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.3),
              inset 0 0 80px rgba(0,0,0,0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  box-sizing: border-box;
  user-select: none;
  font-family: 'Silkscreen', monospace;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
}

.pet-screen::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.02) 0px,
    rgba(0,0,0,0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* ────────── HERO SPLASH (uFREN wordmark + hovering tamagotchi) ────────── */
.hero-splash {
  position: relative;
  width: 100%;
  height: clamp(560px, 88vh, 900px);
  margin: 8px 0 22px;
  border: 1.5px solid var(--ink);
  border-radius: 22px;
  background: #050505;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
}

/* corner crosshairs */
.hero-splash .crosshair {
  position: absolute;
  width: 18px; height: 18px;
  pointer-events: none;
  z-index: 5;
  color: var(--ink);
}
.hero-splash .crosshair::before,
.hero-splash .crosshair::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.hero-splash .crosshair::before { left: 0; right: 0; top: 50%; height: 1.5px; transform: translateY(-50%); }
.hero-splash .crosshair::after  { top: 0; bottom: 0; left: 50%; width: 1.5px; transform: translateX(-50%); }
.hero-splash .crosshair.tl { top: 16px; left: 16px; }
.hero-splash .crosshair.tr { top: 16px; right: 16px; }
.hero-splash .crosshair.bl { bottom: 16px; left: 16px; }
.hero-splash .crosshair.br { bottom: 16px; right: 16px; }

/* corner labels */
.hero-splash .corner-label {
  position: absolute;
  font-family: var(--font-pixel);
  font-size: 14px;
  letter-spacing: 0.18em;
  color: var(--ink);
  opacity: 0.7;
  z-index: 5;
}
.hero-splash .corner-label.tl { top: 18px; left: 46px; }
.hero-splash .corner-label.tr { top: 18px; right: 46px; }
.hero-splash .corner-label.bl { bottom: 18px; left: 46px; }
.hero-splash .corner-label.br { bottom: 18px; right: 46px; }

/* dither/halftone background overlay sitting BEHIND wordmark+image */
.hero-splash .dither-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(232,223,201,0.07) 0%, transparent 60%),
    repeating-radial-gradient(circle at 50% 50%, rgba(232,223,201,0.05) 0 1px, transparent 1px 4px);
  z-index: 0;
  pointer-events: none;
}

/* hovering image */
@keyframes heroFloat {
  0%, 100% { transform: translateY(-10px); }
  50%      { transform: translateY(14px); }
}
@keyframes heroFloatShadow {
  0%, 100% { transform: translateX(-50%) scaleX(0.85); opacity: 0.45; }
  50%      { transform: translateX(-50%) scaleX(1.05); opacity: 0.7; }
}

.hero-splash .pet-art-wrap {
  position: relative;
  z-index: 1;
  width: clamp(380px, 46vw, 620px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.hero-splash .pet-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 30px 40px rgba(0,0,0,0.65))
    drop-shadow(0 0 60px rgba(232,223,201,0.08));
  animation: heroFloat 5.5s ease-in-out infinite;
  will-change: transform;
}
.hero-splash .pet-shadow {
  position: absolute;
  bottom: -2%;
  left: 50%;
  width: 62%;
  height: 28px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 70%);
  filter: blur(4px);
  transform: translateX(-50%);
  animation: heroFloatShadow 5.5s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}

/* the giant uFREN wordmark — sits ON TOP of image, like the DRAGONFLY ref */
.hero-splash .wordmark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  pointer-events: none;
}

/* ───── Glitchy ASCII wordmark ───── */
.ascii-stack {
  position: relative;
  display: inline-block;
  user-select: none;
  filter: drop-shadow(0 0 30px rgba(255, 90, 31, 0.35));
}
.ascii-layer {
  margin: 0;
  font-family: "VT323", "Press Start 2P", ui-monospace, monospace;
  font-size: clamp(14px, 2.2vw, 34px);
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: geometricPrecision;
}
.ascii-main {
  position: relative;
  color: #ff5a1f;
  text-shadow:
    0 0 8px rgba(255, 90, 31, 0.55),
    0 2px 0 rgba(0, 0, 0, 0.55);
  z-index: 3;
  animation: asciiJitter 1.2s steps(1) infinite;
}
.ascii-back {
  position: absolute;
  inset: 0;
  color: rgba(255, 90, 31, 0.18);
  transform: translate(0.6px, 0.6px);
  z-index: 0;
}
.ascii-cyan {
  position: absolute;
  inset: 0;
  color: #00e0ff;
  mix-blend-mode: screen;
  transform: translate(-2px, 0);
  opacity: 0.55;
  z-index: 1;
  animation: asciiChroma1 0.9s steps(1) infinite;
}
.ascii-magenta {
  position: absolute;
  inset: 0;
  color: #ff00d4;
  mix-blend-mode: screen;
  transform: translate(2px, 0);
  opacity: 0.55;
  z-index: 2;
  animation: asciiChroma2 0.9s steps(1) infinite;
}
.ascii-slice {
  position: absolute;
  left: -4%;
  right: -4%;
  height: 6px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.45),
    transparent
  );
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 4;
}
@keyframes asciiJitter {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-1px, 0); }
  22%  { transform: translate(0, 1px); }
  35%  { transform: translate(1px, -1px); }
  48%  { transform: translate(0, 0); }
  62%  { transform: translate(-1px, 1px); }
  75%  { transform: translate(0, 0); }
  88%  { transform: translate(1px, 0); }
  100% { transform: translate(0, 0); }
}
@keyframes asciiChroma1 {
  0%, 100% { transform: translate(-2px, 0); opacity: 0.55; }
  20%      { transform: translate(-5px, 1px); opacity: 0.85; }
  40%      { transform: translate(-1px, 0); opacity: 0.4; }
  60%      { transform: translate(-3px, -1px); opacity: 0.7; }
  80%      { transform: translate(-2px, 0); opacity: 0.5; }
}
@keyframes asciiChroma2 {
  0%, 100% { transform: translate(2px, 0); opacity: 0.55; }
  25%      { transform: translate(5px, -1px); opacity: 0.85; }
  50%      { transform: translate(1px, 0); opacity: 0.4; }
  75%      { transform: translate(3px, 1px); opacity: 0.7; }
}

/* small meta strip across the bottom (subtle, like ref's tiny "L ... Y") */
.hero-splash .meta-strip {
  position: absolute;
  left: 46px;
  right: 46px;
  bottom: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--ink);
  opacity: 0.55;
  z-index: 4;
  pointer-events: none;
}

/* tagline below the wordmark */
.hero-splash .hero-tagline {
  position: absolute;
  bottom: clamp(80px, 12vh, 130px);
  left: 0; right: 0;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: clamp(16px, 1.4vw, 22px);
  letter-spacing: 0.3em;
  color: var(--ink);
  opacity: 0.75;
  z-index: 4;
  pointer-events: none;
}

/* scanline + grain locked to the splash so it has its own texture */
.hero-splash .splash-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.18) 0px,
    rgba(0,0,0,0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: multiply;
}

/* ──────────────────────────────────────────────────────────────
   RESPONSIVE BEHAVIOUR
   The page uses inline `grid-template-columns` everywhere for the
   editorial multi-column panels. Below ~1100px those columns get
   squashed. We override them here per-breakpoint and re-flow into
   stacked rows, swapping right→bottom borders so the editorial grid
   feel survives.
   ─────────────────────────────────────────────────────────────── */

/* Tablet / smaller laptop — single column where multi-col was 3+
   and tighten paddings. */
@media (max-width: 1180px) {
  :root {
    --pad: clamp(12px, 2vw, 22px);
  }

  /* Hero corner labels too far in on smaller screens */
  .hero-splash .corner-label.tl,
  .hero-splash .corner-label.bl { left: 32px; }
  .hero-splash .corner-label.tr,
  .hero-splash .corner-label.br { right: 32px; }
  .hero-splash .meta-strip { left: 32px; right: 32px; bottom: 38px; }

  /* Hero outer 3-column grid → stack: image / pet / sidebar */
  .hero-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
  }
  .hero-grid > * { border-right: none !important; }
  .hero-grid > .hero-cell { border-bottom: 1.5px solid var(--ink) !important; }
  .hero-grid > .hero-side { border-bottom: none !important; }

  /* Right sidebar (circle + JP text) — was a tall narrow column,
     becomes a short wide row when stacked. Lay it out side-by-side. */
  .hero-grid > .hero-side {
    grid-template-rows: auto !important;
    grid-template-columns: auto 1fr !important;
    min-height: 120px;
  }
  .hero-grid > .hero-side > div:first-child {
    aspect-ratio: auto !important;
    border-bottom: none !important;
    border-right: 1.5px solid var(--ink) !important;
    width: 120px;
    height: 100%;
  }
  .hero-grid > .hero-side > div:last-child > .jp {
    writing-mode: horizontal-tb !important;
    height: auto !important;
    padding: 14px 22px !important;
  }

  /* Featured triangle middle row → stack */
  .featured-mid {
    grid-template-columns: 1fr !important;
  }
  .featured-mid > :first-child {
    border-right: none !important;
    border-bottom: 1.5px solid var(--ink) !important;
    aspect-ratio: 2 / 1;
  }

  /* Device band 3-col → 1-col, with row borders */
  .device-band-grid {
    grid-template-columns: 1fr !important;
  }
  .device-band-grid > * {
    border-right: none !important;
  }
  .device-band-grid > *:not(:last-child) {
    border-bottom: 1.5px solid rgba(232,223,201,0.18) !important;
  }
  /* Center column gets less vertical real estate when stacked */
  .device-band-grid .device-band-center {
    min-height: 420px !important;
    padding: 36px 24px !important;
  }

  /* Gameplay synthesis 3-col → 1-col */
  .gameplay-top {
    grid-template-columns: 1fr !important;
  }
  .gameplay-top > * {
    border-right: none !important;
  }
  .gameplay-top > *:not(:last-child) {
    border-bottom: 1.5px solid var(--ink) !important;
  }

  /* Tokenomics 2-col → 1-col */
  .tokenomics-grid {
    grid-template-columns: 1fr !important;
  }
  .tokenomics-grid > :first-child {
    border-right: none !important;
    border-bottom: 1.5px solid var(--ink) !important;
  }

  /* Mechanic 3-col → 1-col */
  .mechanic-grid {
    grid-template-columns: 1fr !important;
  }
  .mechanic-grid > *:not(:last-child) {
    border-right: none !important;
    border-bottom: 1.5px solid var(--ink) !important;
  }

  /* Roadmap 4-col → 2-col */
  .roadmap-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .roadmap-grid > * {
    border-right: none !important;
    border-bottom: 1.5px solid var(--ink) !important;
  }
  .roadmap-grid > *:nth-child(odd) {
    border-right: 1.5px solid var(--ink) !important;
  }
  .roadmap-grid > *:nth-last-child(-n+2) {
    border-bottom: none !important;
  }

  /* CTA 2-col → stack */
  .cta-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    text-align: left !important;
  }

  /* Footer marquee — collapse spacer cells */
  .footer-grid {
    grid-template-columns: 50px 1fr 50px 1fr !important;
  }
  .footer-grid > *:nth-child(n+5) { display: none !important; }
}

/* Phone / small tablet portrait — further compressions */
@media (max-width: 720px) {
  /* Roadmap 2-col → 1-col */
  .roadmap-grid {
    grid-template-columns: 1fr !important;
  }
  .roadmap-grid > * {
    border-right: none !important;
    border-bottom: 1.5px solid var(--ink) !important;
  }
  .roadmap-grid > *:last-child { border-bottom: none !important; }

  /* Allocation 2-col → 1-col */
  .alloc-grid {
    grid-template-columns: 1fr !important;
  }

  /* Gameplay numbered rules: tighten 2-col internals */
  .gp-rule {
    grid-template-columns: 1fr !important;
  }

  /* Featured panel top status strip — kill spacer 64px columns */
  .featured-top {
    grid-template-columns: 1.2fr 1fr 1.1fr !important;
  }
  .featured-top > *:nth-child(2),
  .featured-top > *:nth-child(4) { display: none !important; }

  /* Footer — only marquee strip remains */
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
  .footer-grid > *:not(:nth-child(2)) { display: none !important; }

  /* Hero splash gets shorter on phones */
  .hero-splash {
    height: clamp(420px, 70vh, 640px);
  }
  .hero-splash .pet-art-wrap {
    width: clamp(240px, 70vw, 380px);
  }

  /* Device band telemetry rows: smaller font */
  .device-band-grid .pixel { font-size: 12px; }
  .device-band-grid h3.display { font-size: 24px !important; }
}
