/* ==========================================================================
   Fronkon Games: visual layer (accent, CRT touches, store cards, buy bar,
   compare slider, TOC, editor window frames). Loaded after custom-effects.css
   ========================================================================== */

:root {
  --fg-accent: #f2920b;
  --fg-accent-rgb: 242, 146, 11;
  --fg-accent-soft: rgba(242, 146, 11, 0.12);
  --fg-phosphor: #df870a;
}

/* ---- 5. One accent color ------------------------------------------------ */
[data-bs-theme="dark"] {
  --bs-link-color: var(--fg-accent);
  --bs-link-color-rgb: var(--fg-accent-rgb);
  --bs-link-hover-color: #ffb347;
  --bs-link-hover-color-rgb: 255, 179, 71;
}

::selection {
  background: rgba(var(--fg-accent-rgb), 0.35);
}

/* ---- 4. CRT touches across the site ------------------------------------ */
/* Phosphor line under the navbar. */
.navbar.navbar-fixed-top {
  position: relative;
}

.navbar.navbar-fixed-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  pointer-events: none;
  background:
    repeating-linear-gradient(to right, rgba(0, 0, 0, 0.35) 0 2px, transparent 2px 4px),
    linear-gradient(to right, transparent, rgba(var(--fg-accent-rgb), 0.75) 20%, rgba(var(--fg-accent-rgb), 0.75) 80%, transparent);
  opacity: 0.55;
}

/* Section headings glow like the hero. */
h2.heading {
  text-shadow: 0 0 0.9rem rgba(var(--fg-accent-rgb), 0.28);
}

h2.heading::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 0.35rem;
  border-radius: 2px;
  background: linear-gradient(to right, var(--fg-accent), transparent);
  box-shadow: 0 0 0.6rem rgba(var(--fg-accent-rgb), 0.6);
}

/* Home hero: CRT power-on, once. */
.crt-screen--hero.fg-power-on {
  animation: fg-crt-on 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transform-origin: center;
}

@keyframes fg-crt-on {
  0%   { transform: scale(1, 0.004); filter: brightness(3) saturate(0); opacity: 0.2; }
  35%  { transform: scale(1, 0.004); filter: brightness(3) saturate(0); opacity: 1; }
  60%  { transform: scale(1, 1.02);  filter: brightness(1.6); }
  100% { transform: scale(1, 1);     filter: none; }
}

/* ---- 2. + 7. Store cards: hover effects and badges --------------------- */
.card.fg-fx .card-img-wrap {
  position: relative;
  overflow: hidden;
}

.card.fg-fx .card-img-top {
  transition: filter 0.3s ease, transform 0.4s ease;
}

.card.fg-fx .card-img-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card.fg-fx:hover .card-img-wrap::after {
  opacity: 1;
}

/* Glitches: RGB split and jitter. */
.fg-fx--glitch:hover .card-img-top {
  animation: fg-glitch 0.45s steps(2, end) infinite;
}

@keyframes fg-glitch {
  0%   { transform: translate(0, 0);     filter: drop-shadow(3px 0 0 rgba(255, 0, 60, 0.75)) drop-shadow(-3px 0 0 rgba(0, 255, 255, 0.75)); clip-path: inset(0 0 0 0); }
  25%  { transform: translate(-3px, 1px); clip-path: inset(12% 0 58% 0); }
  50%  { transform: translate(3px, -1px); filter: drop-shadow(-4px 0 0 rgba(255, 0, 60, 0.75)) drop-shadow(4px 0 0 rgba(0, 255, 255, 0.75)); clip-path: inset(0 0 0 0); }
  75%  { transform: translate(-1px, 0);  clip-path: inset(64% 0 8% 0); }
  100% { transform: translate(0, 0);     clip-path: inset(0 0 0 0); }
}

/* Retro: CRT scanlines and flicker. */
.fg-fx--crt .card-img-wrap::after {
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55));
}

.fg-fx--crt:hover .card-img-top {
  filter: saturate(1.3) contrast(1.15) blur(0.4px);
  animation: fg-flicker 0.12s infinite;
}

@keyframes fg-flicker {
  50% { opacity: 0.93; }
}

/* LUTs: color grading cycle. */
.fg-fx--hue:hover .card-img-top {
  animation: fg-hue 2.4s linear infinite;
}

@keyframes fg-hue {
  0%   { filter: hue-rotate(0deg) saturate(1.3); }
  100% { filter: hue-rotate(360deg) saturate(1.3); }
}

/* Artistic: painted, posterized look. */
.fg-fx--paint:hover .card-img-top {
  filter: saturate(1.6) contrast(1.15) brightness(1.05);
  transform: scale(1.04);
}

/* Spice Up: heat and shake. */
.fg-fx--heat .card-img-wrap::after {
  background: radial-gradient(ellipse at center, transparent 40%, rgba(220, 20, 20, 0.55));
}

.fg-fx--heat:hover .card-img-top {
  animation: fg-shake 0.3s linear infinite;
  filter: saturate(1.5) contrast(1.1);
}

@keyframes fg-shake {
  0%, 100% { transform: translate(0, 0) scale(1.03); }
  25% { transform: translate(-2px, 1px) scale(1.03); }
  50% { transform: translate(2px, -1px) scale(1.03); }
  75% { transform: translate(-1px, -2px) scale(1.03); }
}

/* Weird: wobble. */
.fg-fx--wobble:hover .card-img-top {
  animation: fg-wobble 1.6s ease-in-out infinite;
  filter: hue-rotate(40deg) saturate(1.4);
}

@keyframes fg-wobble {
  0%, 100% { transform: scale(1.06) skew(0deg, 0deg); }
  33% { transform: scale(1.06) skew(3deg, -1deg); }
  66% { transform: scale(1.06) skew(-3deg, 1deg); }
}

/* Camera Transitions: zoom and blur. */
.fg-fx--warp:hover .card-img-top {
  animation: fg-warp 1.4s ease-in-out infinite alternate;
}

@keyframes fg-warp {
  0%   { transform: scale(1);    filter: blur(0); }
  100% { transform: scale(1.15); filter: blur(2px) brightness(1.2); }
}

/* Local AI: scanning line. */
.fg-fx--scan .card-img-wrap::after {
  background: linear-gradient(to bottom, transparent 0%, rgba(80, 220, 255, 0.0) 40%, rgba(80, 220, 255, 0.55) 50%, transparent 52%);
  background-size: 100% 220%;
  animation: fg-scan 1.6s linear infinite;
}

@keyframes fg-scan {
  0%   { background-position: 0 120%; }
  100% { background-position: 0 -20%; }
}

/* True Ballistics: scope. */
.fg-fx--scope .card-img-wrap::after {
  background:
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) center / 1px 60% no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)) center / 40% 1px no-repeat,
    radial-gradient(circle at center, transparent 34%, rgba(0, 0, 0, 0.85) 35%);
}

.fg-fx--scope:hover .card-img-top {
  transform: scale(1.12);
}

/* Audio: equalizer bars. */
.fg-fx--wave .card-img-wrap::after {
  background: repeating-linear-gradient(to right, rgba(var(--fg-accent-rgb), 0.85) 0 6px, transparent 6px 10px);
  -webkit-mask: linear-gradient(to top, #000 0%, #000 var(--fg-eq, 30%), transparent var(--fg-eq, 30%));
  mask: linear-gradient(to top, #000 0%, #000 var(--fg-eq, 30%), transparent var(--fg-eq, 30%));
  top: auto;
  height: 45%;
  animation: fg-eq 0.6s ease-in-out infinite alternate;
}

@property --fg-eq {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 30%;
}

@keyframes fg-eq {
  0%   { --fg-eq: 15%; }
  100% { --fg-eq: 85%; }
}

.fg-fx--wave:hover .card-img-top {
  filter: brightness(0.8);
}

/* Badges. */
.fg-badges {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  display: flex;
  gap: 0.35rem;
  pointer-events: none;
}

.fg-badge {
  font-family: "VT323", monospace;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.45rem 0.2rem;
  border-radius: 0.25rem;
  color: #111;
  background: var(--fg-accent);
  box-shadow: 0 0 0.6rem rgba(var(--fg-accent-rgb), 0.6);
}

.fg-badge--bundle {
  color: var(--fg-accent);
  background: rgba(17, 17, 17, 0.85);
  box-shadow: inset 0 0 0 1px rgba(var(--fg-accent-rgb), 0.7);
}

.fg-badge--updated {
  color: #111;
  background: #4fd1c5;
  box-shadow: 0 0 0.6rem rgba(79, 209, 197, 0.55);
}

/* ---- 3. Sticky buy bar -------------------------------------------------- */
.fg-buybar {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--fg-navbar-h, 72px);
  z-index: 1020;
  transform: translateY(-120%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  background: rgba(20, 20, 22, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(var(--fg-accent-rgb), 0.35);
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.35);
}

.fg-buybar.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.fg-buybar__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
}

.fg-buybar__title {
  font-family: "VT323", monospace;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--fg-phosphor);
  text-shadow: 0 0 0.6rem rgba(var(--fg-accent-rgb), 0.6);
  margin-right: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fg-buybar .btn {
  white-space: nowrap;
}

.fg-buybar__top {
  color: var(--bs-secondary-color);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
}

.fg-buybar__top:hover {
  color: var(--fg-accent);
}

/* ---- 1. Compare slider -------------------------------------------------- */
.fg-compare {
  --pos: 50%;
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  user-select: none;
  touch-action: pan-y;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.4);
  margin: 1.5rem auto;
}

.fg-compare img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.fg-compare__before {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.fg-compare__before img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fg-compare__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--fg-accent);
  box-shadow: 0 0 0.8rem rgba(var(--fg-accent-rgb), 0.9);
  pointer-events: none;
}

.fg-compare__handle::after {
  content: "\2194";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.4rem;
  height: 2.4rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: #111;
  background: var(--fg-accent);
  box-shadow: 0 0 0.8rem rgba(var(--fg-accent-rgb), 0.9);
}

.fg-compare__label {
  position: absolute;
  top: 0.6rem;
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  background: rgba(0, 0, 0, 0.65);
  color: #eee;
  pointer-events: none;
}

.fg-compare__label--before { left: 0.6rem; }
.fg-compare__label--after  { right: 0.6rem; }

.fg-compare__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

.fg-compare__range:focus-visible + .fg-compare__handle {
  outline: 2px solid #fff;
}

/* ---- 6. Cleaner table of contents -------------------------------------- */
.toc-sidebar #TableOfContents li:empty,
.toc-panel #TableOfContents li:empty {
  display: none;
}

.toc-sidebar #TableOfContents ul {
  padding-left: 0.6rem;
}

.toc-sidebar #TableOfContents > ul {
  padding-left: 0;
}

.toc-sidebar #TableOfContents a {
  display: block;
  white-space: normal;
  line-height: 1.3;
  padding: 0.12rem 0.5rem;
  border-left: 2px solid transparent;
  border-radius: 0 0.25rem 0.25rem 0;
  color: var(--bs-secondary-color);
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.toc-sidebar #TableOfContents a:hover {
  color: var(--bs-body-color);
}

.toc-sidebar #TableOfContents a.fg-active {
  color: var(--fg-accent);
  border-left-color: var(--fg-accent);
  background: var(--fg-accent-soft);
}

/* ---- 9. Editor screenshots in a window frame --------------------------- */
.fg-window {
  position: relative;
  padding: 1.75rem 0 0 !important;
  margin-bottom: 1.5rem;
  border-radius: 0.5rem;
  background: #1b1b1d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.fg-window::before {
  content: "";
  position: absolute;
  top: 0.6rem;
  left: 0.75rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 1rem 0 0 #febc2e, 2rem 0 0 #28c840;
}

.fg-window img {
  display: block;
  width: 100%;
  border-radius: 0;
}

/* ---- 8. Reveal on scroll ------------------------------------------------ */
.fg-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fg-reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .crt-screen--hero.fg-power-on,
  .card.fg-fx .card-img-top,
  .card.fg-fx .card-img-wrap::after {
    animation: none !important;
  }
  .fg-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .fg-buybar {
    transition: none;
  }
}
