/* ==========================================================================
   Awesome Testing Tools — retro channel guide
   Palette and rules extracted from the design references:
   - deep forest green ground, mint accent, signal red, CRT cream
   - 1px borders everywhere, 4px radius on interactive elements
   - one accent at a time, subtle pixel shadows, monospace everything
   ========================================================================== */

:root {
  --bg: #0d211b;
  --bg-deep: #08160f;
  --panel: #112920;
  --panel-2: #0b1d16;
  --mint: #9fe8c6;
  --mint-bright: #5fe2a7;
  --mint-dim: #7fae99;
  --red: #f2384a;
  --red-deep: #c92438;
  --cream: #efe6d4;
  --sand: #d8caa8;
  --ink: #d9efe3;
  --line: rgba(159, 232, 198, 0.28);
  --line-faint: rgba(159, 232, 198, 0.14);
  --radius: 4px;
  --font-pixel: "Silkscreen", "Space Mono", monospace;
  --font-mono: "Space Mono", ui-monospace, monospace;
  --screen-green: #0a1f15;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -100px, rgba(159, 232, 198, 0.05), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

a { color: var(--mint); }
a:hover { color: var(--mint-bright); }

:focus-visible {
  outline: 2px solid var(--mint-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--red); color: var(--cream); }

/* --------------------------------------------------------------------------
   Label bars — the thin bordered strips from reference 1
   -------------------------------------------------------------------------- */

.label-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  padding: 7px 14px;
  margin: 28px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mint);
}

.label-bar-arrow { color: var(--mint-dim); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding: 12px 0 56px;
  border-bottom: 1px solid var(--line-faint);
  background:
    repeating-linear-gradient(0deg, rgba(159, 232, 198, 0.025) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(159, 232, 198, 0.025) 0 1px, transparent 1px 28px);
}

.hero .container {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(340px, 1.1fr);
  gap: 24px 56px;
  align-items: center;
}

.hero .label-bar { grid-column: 1 / -1; }

.hero-title {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: var(--mint);
  text-shadow: 0 0 22px rgba(95, 226, 167, 0.35);
  margin: 0 0 14px;
}

.hero-tagline {
  margin: 0 0 18px;
  max-width: 44ch;
  color: var(--mint-dim);
}

.hero-count {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--panel-2);
}

.blink-dot { color: var(--red); font-size: 10px; }
@media (prefers-reduced-motion: no-preference) {
  .blink-dot { animation: blink 1.6s steps(2, start) infinite; }
}
@keyframes blink { to { visibility: hidden; } }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  color: var(--bg-deep);
  background: var(--mint-bright);
  border-color: var(--mint-bright);
  box-shadow: 0 0 16px rgba(95, 226, 167, 0.35), 2px 2px 0 rgba(2, 8, 6, 0.8);
}
.btn-primary:hover {
  color: var(--bg-deep);
  background: var(--mint);
  box-shadow: 0 0 26px rgba(95, 226, 167, 0.55), 2px 2px 0 rgba(2, 8, 6, 0.8);
}

.btn-secondary {
  color: var(--mint);
  background: transparent;
  border-color: var(--line);
  box-shadow: 2px 2px 0 rgba(2, 8, 6, 0.6);
}
.btn-secondary:hover { border-color: var(--mint); color: var(--mint-bright); }

/* --------------------------------------------------------------------------
   The TV
   -------------------------------------------------------------------------- */

.tv {
  position: relative;
  width: min(640px, 100%);
  aspect-ratio: 760 / 640;
  margin-inline: auto;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.45));
}

.tv-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.tv-led { filter: drop-shadow(0 0 5px rgba(95, 226, 167, 0.9)); }
.tv.is-off .tv-led { fill: #8f7f60; filter: none; }

/* Screen overlays the SVG cavity: rect x=128 y=74 w=504 h=360 in a 760x640 viewBox */
.tv-screen {
  position: absolute;
  left: 16.842%;
  top: 11.563%;
  width: 66.316%;
  height: 56.25%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 9px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(159, 232, 198, 0.08), transparent 55%),
    var(--screen-green);
  color: var(--mint);
  box-shadow: inset 0 0 36px rgba(2, 8, 6, 0.65);
}

/* faint glass reflection across the tube */
.tv-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(118deg, rgba(239, 230, 212, 0.05) 0 16%, transparent 17%);
}

/* chrome bar at the top of the screen, like the browser chrome in reference 1 */
.screen-chrome {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 26px;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
  background:
    repeating-linear-gradient(90deg, rgba(159, 232, 198, 0.07) 0 1px, transparent 1px 7px),
    rgba(2, 8, 6, 0.5);
}

.screen-logo {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mint);
}

.screen-grid { flex: 1; }

.screen-channel {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  color: var(--cream);
  background: var(--red);
  padding: 2px 6px;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(242, 56, 74, 0.5);
}

.tv.is-off .screen-channel { visibility: hidden; }

.screen-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  overflow: hidden;
}

/* ---- idle: test pattern ---- */

.test-pattern {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.test-bars {
  display: flex;
  height: 56px;
  border: 1px solid var(--line);
}
.test-bars span { flex: 1; }
.test-bars span:nth-child(1) { background: #9fe8c6; }
.test-bars span:nth-child(2) { background: #5fe2a7; }
.test-bars span:nth-child(3) { background: #efe6d4; }
.test-bars span:nth-child(4) { background: #d8caa8; }
.test-bars span:nth-child(5) { background: #f2384a; }
.test-bars span:nth-child(6) { background: #38866a; }
.test-bars span:nth-child(7) { background: #122920; }

@media (prefers-reduced-motion: no-preference) {
  .test-bars { animation: barsFlicker 4s steps(1) infinite; }
}
@keyframes barsFlicker {
  0%, 92%, 100% { opacity: 0.92; }
  94% { opacity: 0.75; }
  96% { opacity: 1; }
}

.test-title {
  font-family: var(--font-pixel);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--cream);
  margin: 0;
}

.test-hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mint-dim);
}

/* ---- tuned: tool detail ---- */

.tuned { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }

.tuned-name {
  font-family: var(--font-mono);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: var(--mint);
  text-shadow: 0 0 12px rgba(95, 226, 167, 0.45);
  margin: 0;
}

.tuned-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.tuned-desc {
  flex: 1;
  min-height: 46px;
  overflow-y: auto;
  margin: 0;
  padding-right: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--mint-dim) transparent;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 12px), transparent);
}

/* footer chrome strip, echoing the bottom bar of the screens in reference 1 */
.tuned-actions {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin: 4px -14px 0;
  padding: 7px 12px 0;
}

.tuned-heart {
  color: var(--red);
  font-size: 12px;
  text-shadow: 0 0 8px rgba(242, 56, 74, 0.6);
}

.visit-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--cream);
  background: var(--red);
  border: 1px solid var(--red-deep);
  border-radius: 999px;
  padding: 6px 16px;
  box-shadow: 0 0 14px rgba(242, 56, 74, 0.45);
}
.visit-btn:hover { color: #fff; background: #ff4b5d; }

.screen-error {
  margin: auto;
  text-align: center;
  color: var(--red);
  font-size: 12px;
}

.screen-noscript { margin: auto; text-align: center; font-size: 12px; color: var(--mint-dim); }

/* ---- CRT atmosphere ---- */

.screen-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(2, 8, 6, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(110% 110% at 50% 50%, transparent 60%, rgba(2, 8, 6, 0.5) 100%);
  mix-blend-mode: multiply;
}

.screen-static {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, rgba(217, 239, 227, 0.25) 0 2px, rgba(2, 8, 6, 0.45) 2px 3px, rgba(159, 232, 198, 0.18) 3px 5px),
    repeating-linear-gradient(90deg, rgba(2, 8, 6, 0.3) 0 3px, transparent 3px 7px);
}

@media (prefers-reduced-motion: no-preference) {
  .tv-screen.is-tuning .screen-static {
    opacity: 1;
    animation: staticJitter 90ms steps(2) infinite;
  }
  .tv-screen.is-tuning .screen-body {
    animation: horizontalHold 140ms steps(3) infinite;
  }
}

@keyframes staticJitter {
  0% { background-position: 0 0, 0 0; }
  50% { background-position: 0 -7px, 5px 0; }
  100% { background-position: 0 4px, -3px 0; }
}

@keyframes horizontalHold {
  0% { transform: translateX(0) skewX(0); }
  33% { transform: translateX(-6px) skewX(-2deg); }
  66% { transform: translateX(5px) skewX(1.5deg); }
  100% { transform: translateX(0); }
}

/* ---- TV controls over the bottom bezel ---- */

.tv-controls {
  position: absolute;
  /* over the body's bottom strip, right side: ~x 500-640, y 466-510 of 760x640 */
  right: 13%;
  bottom: 17.5%;
  display: flex;
  gap: 7px;
}

.tv-knob {
  width: 34px;
  height: 26px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  color: #4d4128;
  background: linear-gradient(#f4eddc, #cabb9a);
  border: 1.5px solid #94855f;
  border-radius: var(--radius);
  box-shadow: 0 2px 0 #94855f;
  cursor: pointer;
  padding: 0;
}

.tv-knob:hover { background: linear-gradient(#fbf6e9, #d6c8a8); }
.tv-knob:active { transform: translateY(2px); box-shadow: 0 0 0 #94855f; }

.tv-knob-power { color: var(--red-deep); }

/* --------------------------------------------------------------------------
   Category filter bar
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 26px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mint);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.filter-chip:hover { border-color: var(--mint); color: var(--mint-bright); }

.filter-chip[aria-pressed="true"] {
  color: var(--bg-deep);
  font-weight: 700;
  background: var(--mint-bright);
  border-color: var(--mint-bright);
  box-shadow: 0 0 14px rgba(95, 226, 167, 0.35);
}

.filter-count { font-size: 10px; opacity: 0.65; }

/* --------------------------------------------------------------------------
   Card grid
   -------------------------------------------------------------------------- */

main { padding-bottom: 24px; }

.grid {
  list-style: none;
  margin: 0 0 48px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 18px;
}

.grid-error {
  grid-column: 1 / -1;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--red);
  text-align: center;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  height: 100%;
  text-align: left;
  font-family: var(--font-mono);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-faint);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.card:hover {
  border-color: var(--line);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(159, 232, 198, 0.08), 0 10px 24px rgba(2, 8, 6, 0.5);
}

.card[aria-pressed="true"] {
  border-color: var(--mint-bright);
  background: linear-gradient(rgba(95, 226, 167, 0.07), rgba(95, 226, 167, 0.02)), var(--panel);
  box-shadow: 0 0 0 1px var(--mint-bright), 0 0 24px rgba(95, 226, 167, 0.25);
}

.card-ch {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--mint-dim);
}

.card[aria-pressed="true"] .card-ch { color: var(--mint-bright); }

.card-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.03em;
  line-height: 1.3;
  color: var(--mint);
  padding-right: 48px;
}

.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mint-dim);
  border: 1px solid var(--line-faint);
  border-radius: 2px;
  padding: 2px 7px;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  padding: 2px 7px;
  border: 1px solid;
}

.badge-free {
  color: var(--mint-bright);
  border-color: rgba(95, 226, 167, 0.5);
  background: rgba(95, 226, 167, 0.08);
}

.badge-paid {
  color: #ff8d99;
  border-color: rgba(242, 56, 74, 0.55);
  background: rgba(242, 56, 74, 0.1);
}

.badge-freemium {
  color: var(--sand);
  border-color: rgba(216, 202, 168, 0.45);
  background: rgba(216, 202, 168, 0.08);
}

.card-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: #aacfbd;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  line-clamp: 4;
  overflow: hidden;
}

.card-onair {
  display: none;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.12em;
  margin-top: auto;
}

.card[aria-pressed="true"] .card-onair { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .card-onair { animation: blink 1.6s steps(2, start) infinite; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line-faint);
  padding: 22px 0 36px;
  font-size: 12px;
  color: var(--mint-dim);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; }
  .hero-tagline { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .tv { width: min(540px, 100%); }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .container { width: calc(100% - 28px); }
  .label-bar { letter-spacing: 0.14em; }
  .tv-knob { width: 30px; height: 24px; }
  .screen-body { padding: 8px 10px; }
  .tuned { gap: 5px; }
  .tuned-name { font-size: 14px; }
  .tuned-meta { gap: 4px; }
  .chip, .badge { font-size: 9.5px; padding: 1px 5px; }
  .tuned-desc { font-size: 12px; line-height: 1.5; }
  .tuned-actions { margin: 2px -10px 0; padding: 5px 9px 0; }
  .visit-btn { font-size: 10px; padding: 4px 12px; }
}
