/* ==========================================================================
   FEBUCAT — comic terminal
   Custom layer on top of Tailwind (CDN). Handles the comic ink treatment,
   the 3D perspective stage and all the CRT / halftone texture work.
   ========================================================================== */

:root {
  --ink: #f2f2ec;
  --void: #050506;
  --void-2: #0b0b10;
  --cyan: #34e7ff;
  --violet: #8b5cff;
  --red: #ff2e4c;
  --amber: #ffb347;
  --line: rgba(242, 242, 236, 0.22);
  --panel-bg: rgba(6, 6, 9, 0.82);
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  background: var(--void);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, "Courier New", monospace;
  overflow-x: hidden;
}

::selection { background: var(--cyan); color: #000; }

/* ---------- scrollbar --------------------------------------------------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #08080b; }
::-webkit-scrollbar-thumb {
  background: repeating-linear-gradient(45deg, #2a2a33 0 4px, #14141a 4px 8px);
  border: 1px solid #3a3a46;
}

/* ---------- typography -------------------------------------------------- */
.font-comic { font-family: "Bangers", "JetBrains Mono", cursive; letter-spacing: .045em; }

.ink-title {
  color: var(--ink);
  text-shadow:
    3px 3px 0 #000,
    6px 6px 0 rgba(52, 231, 255, .35),
    9px 9px 0 rgba(139, 92, 255, .18);
}

.ink-title-red {
  text-shadow:
    3px 3px 0 #000,
    6px 6px 0 rgba(255, 46, 76, .38),
    9px 9px 0 rgba(139, 92, 255, .16);
}

.outline-word {
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: none;
}

.dashed-word {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(242, 242, 236, .85);
  text-shadow: 0 0 22px rgba(52, 231, 255, .35);
}

.eyebrow {
  font-size: .68rem;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: rgba(242, 242, 236, .55);
}

/* ---------- background stack -------------------------------------------- */
#bg-stack { position: fixed; inset: 0; z-index: -3; background: #000; }

#bg-stack .bg-layer {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1.06);
  filter: saturate(.85) contrast(1.05);
  transition: opacity 1.1s ease, transform 1.6s ease;
  will-change: opacity, transform;
}

#bg-stack .bg-layer.on { opacity: .42; transform: scale(1); }

#bg-veil {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(52, 231, 255, .10), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(139, 92, 255, .12), transparent 55%),
    linear-gradient(180deg, rgba(5,5,6,.72) 0%, rgba(5,5,6,.86) 40%, rgba(5,5,6,.93) 100%);
}

#rain { position: fixed; inset: 0; z-index: -2; opacity: .5; pointer-events: none; }

#grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(rgba(255,255,255,.055) 1px, transparent 1.2px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.32) 0 1px, transparent 1px 3px);
  background-size: 5px 5px, 100% 3px;
  mix-blend-mode: screen;
}

/* ---------- texture helpers --------------------------------------------- */
.halftone::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(242,242,236,.16) 1px, transparent 1.15px);
  background-size: 6px 6px;
  mask-image: linear-gradient(135deg, #000 0%, transparent 62%);
  -webkit-mask-image: linear-gradient(135deg, #000 0%, transparent 62%);
}

.crosshatch {
  background-image:
    repeating-linear-gradient(45deg, rgba(242,242,236,.07) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgba(242,242,236,.05) 0 1px, transparent 1px 9px);
}

.dashed-rule {
  height: 2px;
  background-image: linear-gradient(90deg, var(--line) 55%, transparent 0);
  background-size: 14px 2px;
}

/* ---------- comic panels ------------------------------------------------ */
.panel {
  position: relative;
  background: var(--panel-bg);
  border: 3px solid var(--ink);
  box-shadow: 10px 10px 0 #000, 10px 10px 0 3px rgba(242,242,236,.16);
  backdrop-filter: blur(3px);
}

.panel--dashed { border-style: dashed; border-width: 2.5px; }

.panel--cyan { box-shadow: 10px 10px 0 #000, 10px 10px 0 3px rgba(52,231,255,.5); }
.panel--violet { box-shadow: 10px 10px 0 #000, 10px 10px 0 3px rgba(139,92,255,.5); }
.panel--red { box-shadow: 10px 10px 0 #000, 10px 10px 0 3px rgba(255,46,76,.5); }
.panel--amber { box-shadow: 10px 10px 0 #000, 10px 10px 0 3px rgba(255,179,71,.5); }

/* small gutter tag, like a comic page marker */
.panel-tag {
  position: absolute; top: -3px; left: -3px;
  background: var(--ink); color: #000;
  font-family: "Bangers", monospace;
  font-size: .95rem; letter-spacing: .12em;
  padding: 2px 12px 1px;
  z-index: 3;
}

.panel-tag--r { left: auto; right: -3px; }

.panel-corner {
  position: absolute; width: 12px; height: 12px; border: 2px solid var(--ink); opacity: .6;
}
.panel-corner.tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.panel-corner.tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.panel-corner.bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.panel-corner.br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

/* ---------- 3D stage ---------------------------------------------------- */
.stage { perspective: 1500px; perspective-origin: 50% 45%; }
.stage-near { perspective: 900px; }

.tilt { transition: transform .55s cubic-bezier(.2,.8,.25,1); transform-style: preserve-3d; }
.tilt-l  { transform: rotateY(13deg)  rotateX(4deg)  rotateZ(-1.2deg); }
.tilt-r  { transform: rotateY(-13deg) rotateX(4deg)  rotateZ(1.2deg); }
.tilt-up { transform: rotateX(11deg); }
.tilt-dn { transform: rotateX(-9deg); }
.tilt-l:hover, .tilt-r:hover, .tilt-up:hover, .tilt-dn:hover { transform: rotateY(0) rotateX(0) rotateZ(0) translateZ(24px); }

/* scroll reveal wrapper (kept separate so permanent tilts survive) */
.rise { opacity: 0; transform: translateY(64px) scale(.965); transition: opacity .8s ease, transform .9s cubic-bezier(.2,.8,.25,1); }
.rise.in { opacity: 1; transform: none; }
.rise[data-delay="1"] { transition-delay: .1s; }
.rise[data-delay="2"] { transition-delay: .2s; }
.rise[data-delay="3"] { transition-delay: .3s; }
.rise[data-delay="4"] { transition-delay: .4s; }

/* perspective floor under the hero */
.floor {
  position: absolute; left: 50%; bottom: -6vh; width: 260vw; height: 60vh;
  transform: translateX(-50%) perspective(420px) rotateX(66deg);
  background-image:
    linear-gradient(rgba(52,231,255,.30) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,92,255,.22) 1px, transparent 1px);
  background-size: 68px 46px;
  mask-image: linear-gradient(0deg, transparent 2%, #000 45%, transparent 95%);
  -webkit-mask-image: linear-gradient(0deg, transparent 2%, #000 45%, transparent 95%);
  animation: floor-run 7s linear infinite;
  pointer-events: none;
}
@keyframes floor-run { to { background-position: 0 46px, 0 0; } }

/* ---------- nav --------------------------------------------------------- */
.nav-link {
  position: relative;
  font-size: .72rem; letter-spacing: .26em; text-transform: uppercase;
  color: rgba(242,242,236,.62);
  transition: color .2s ease;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 2px;
  background-image: linear-gradient(90deg, var(--cyan) 55%, transparent 0);
  background-size: 8px 2px;
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* ---------- buttons ----------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .82rem 1.5rem;
  border: 2.5px solid var(--ink);
  background: #08080c;
  color: var(--ink);
  font-family: "Bangers", monospace;
  font-size: 1.05rem; letter-spacing: .1em;
  box-shadow: 6px 6px 0 #000, 6px 6px 0 2px rgba(242,242,236,.35);
  transition: transform .16s ease, box-shadow .16s ease, background .2s ease, color .2s ease;
}
.btn:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0 #000, 10px 10px 0 2px rgba(242,242,236,.45); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #000, 2px 2px 0 2px rgba(242,242,236,.3); }

.btn--fill { background: var(--ink); color: #000; }
.btn--cyan { border-color: var(--cyan); color: #00131a; background: var(--cyan); box-shadow: 6px 6px 0 #000, 6px 6px 0 2px rgba(52,231,255,.45); }
.btn--cyan:hover { box-shadow: 10px 10px 0 #000, 10px 10px 0 2px rgba(52,231,255,.55); }
.btn--violet { border-color: var(--violet); color: var(--ink); box-shadow: 6px 6px 0 #000, 6px 6px 0 2px rgba(139,92,255,.5); }
.btn--red { border-color: var(--red); color: var(--ink); box-shadow: 6px 6px 0 #000, 6px 6px 0 2px rgba(255,46,76,.5); }

.btn-sm { padding: .5rem 1rem; font-size: .9rem; box-shadow: 4px 4px 0 #000, 4px 4px 0 2px rgba(242,242,236,.28); }

/* ---------- ticker ------------------------------------------------------ */
.ticker { overflow: hidden; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: var(--ink); color: #000; }
.ticker__track { display: flex; width: max-content; animation: ticker 26s linear infinite; }
.ticker__track > span { padding: .38rem 1.1rem; font-family: "Bangers", monospace; font-size: 1rem; letter-spacing: .13em; white-space: nowrap; }
@keyframes ticker { to { transform: translateX(-50%); } }
.ticker:hover .ticker__track { animation-play-state: paused; }

/* ---------- speech bubble ----------------------------------------------- */
.bubble {
  position: relative;
  background: var(--ink); color: #000;
  border: 3px solid #000;
  border-radius: 22px;
  padding: .9rem 1.15rem;
  font-size: .8rem; line-height: 1.5; font-weight: 700;
  box-shadow: 6px 6px 0 rgba(0,0,0,.9);
}
.bubble::after {
  content: ""; position: absolute; left: 30px; bottom: -20px;
  border: 10px solid transparent;
  border-top: 14px solid var(--ink);
  filter: drop-shadow(0 3px 0 #000);
}
.bubble--r::after { left: auto; right: 30px; }

/* ---------- burst sticker ----------------------------------------------- */
.burst {
  display: grid; place-items: center;
  aspect-ratio: 1; width: 108px;
  background: var(--red); color: #fff;
  font-family: "Bangers", monospace; font-size: 1.05rem; line-height: 1; text-align: center;
  clip-path: polygon(50% 0%, 60% 15%, 76% 6%, 78% 25%, 95% 22%, 88% 39%, 100% 50%, 88% 61%, 95% 78%, 78% 75%, 76% 94%, 60% 85%, 50% 100%, 40% 85%, 24% 94%, 22% 75%, 5% 78%, 12% 61%, 0% 50%, 12% 39%, 5% 22%, 22% 25%, 24% 6%, 40% 15%);
  animation: burst-pulse 2.6s ease-in-out infinite;
}
@keyframes burst-pulse { 0%,100% { transform: rotate(-9deg) scale(1); } 50% { transform: rotate(-4deg) scale(1.07); } }

/* ---------- glitch ------------------------------------------------------ */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
}
.glitch::before { color: var(--cyan); transform: translate(-3px, 1px); clip-path: inset(0 0 58% 0); opacity: .75; animation: gl-a 3.6s steps(2, end) infinite; }
.glitch::after  { color: var(--red);  transform: translate(3px, -1px); clip-path: inset(56% 0 0 0); opacity: .7; animation: gl-b 4.4s steps(2, end) infinite; }
@keyframes gl-a { 0%,92%,100% { transform: translate(-3px,1px); } 94% { transform: translate(-9px,-2px); } 97% { transform: translate(2px,2px); } }
@keyframes gl-b { 0%,90%,100% { transform: translate(3px,-1px); } 93% { transform: translate(10px,3px); } 96% { transform: translate(-3px,-3px); } }

/* ---------- terminal card ----------------------------------------------- */
.term-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .8rem;
  background: var(--ink); color: #000;
  font-size: .66rem; letter-spacing: .22em; text-transform: uppercase; font-weight: 700;
}
.term-dot { width: 9px; height: 9px; border: 2px solid #000; border-radius: 50%; }

.caret::after {
  content: "_"; margin-left: 2px; color: var(--cyan);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- step rail --------------------------------------------------- */
.step-index {
  font-family: "Bangers", monospace;
  font-size: 3.4rem; line-height: .8;
  color: transparent; -webkit-text-stroke: 2px rgba(242,242,236,.55);
}

.step-card:hover .step-index { -webkit-text-stroke-color: var(--cyan); color: rgba(52,231,255,.12); }

/* ---------- socials ----------------------------------------------------- */
.social {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border: 2.5px solid var(--ink);
  background: #08080c;
  box-shadow: 5px 5px 0 #000, 5px 5px 0 2px rgba(242,242,236,.3);
  transition: transform .18s ease, background .2s ease, color .2s ease, box-shadow .18s ease;
}
.social:hover { transform: translate(-3px,-3px) rotate(-4deg); background: var(--ink); color: #000; }

/* ---------- media frame ------------------------------------------------- */
.frame { position: relative; overflow: hidden; }
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; filter: contrast(1.08) saturate(.9); transition: transform .8s cubic-bezier(.2,.8,.25,1), filter .5s ease; }
.frame:hover img { transform: scale(1.06); filter: contrast(1.15) saturate(1.05); }
.frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 4px);
  mix-blend-mode: multiply; opacity: .7;
}

/* ---------- chart ------------------------------------------------------- */
.chart-shell { position: relative; background: #050508; border: 3px solid var(--ink); box-shadow: 14px 14px 0 #000, 14px 14px 0 3px rgba(52,231,255,.35); }
#dex-frame { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- footer paws ------------------------------------------------- */
.paw-trail { display: flex; gap: 1.4rem; opacity: .35; }
.paw-trail span { font-size: 1.1rem; animation: paw 3.2s ease-in-out infinite; }
.paw-trail span:nth-child(2) { animation-delay: .25s; }
.paw-trail span:nth-child(3) { animation-delay: .5s; }
.paw-trail span:nth-child(4) { animation-delay: .75s; }
@keyframes paw { 0%,100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* ---------- misc -------------------------------------------------------- */
.copy-flash { animation: flash .5s ease; }
@keyframes flash { 0% { background: var(--cyan); color: #000; } 100% { background: transparent; } }

.float-slow { animation: float-slow 7s ease-in-out infinite; }
@keyframes float-slow { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* ---------- responsive tuning ------------------------------------------- */
@media (max-width: 1023px) {
  .tilt-l, .tilt-r, .tilt-up, .tilt-dn { transform: none; }
  .panel { box-shadow: 7px 7px 0 #000, 7px 7px 0 2px rgba(242,242,236,.16); }
  .floor { bottom: -12vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .rise { opacity: 1; transform: none; }
}
