/* ============================================================
   The Test Equipment Addict — Site Styles
   Simple CSS, no framework. Learn-friendly structure.
   ============================================================ */

/* --- CSS Variables (easy theming) --- */
:root {
  --bg-dark: #060a0f;
  --bg-card: #0d1520;
  --bg-card-hover: #111c2a;
  --phosphor: #00ff66;
  --phosphor-dim: rgba(0, 255, 102, 0.15);
  --accent-blue: #3d9fd4;
  --accent-blue-light: #6ec4f0;
  --text-primary: #e8eef4;
  --text-muted: #8899aa;
  --border: rgba(0, 255, 102, 0.12);
  --font-display: 'Share Tech Mono', 'Courier New', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --max-width: 1100px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background: var(--bg-dark);
}

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Site-wide oscilloscope background (remove body.has-scope to revert) */
body.has-scope {
  background: transparent;
}

.scope-bg--site {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg-dark);
}

.scope-bg--site #scope-canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.55;
}

.scope-overlay--site {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 55% 85% at 40% 50%,
    rgba(6, 10, 15, 0.92) 0%,
    rgba(6, 10, 15, 0.55) 42%,
    transparent 72%
  );
}

body.has-scope.page-inner .scope-overlay--site {
  background: radial-gradient(
    ellipse 65% 55% at 50% 28%,
    rgba(6, 10, 15, 0.92) 0%,
    rgba(6, 10, 15, 0.55) 42%,
    transparent 72%
  );
}

body.has-scope .site-header,
body.has-scope main,
body.has-scope .site-footer {
  position: relative;
  z-index: 2;
}

a {
  color: var(--accent-blue-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--phosphor);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
}

h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--phosphor); }
h3 { font-size: 1.1rem; color: var(--accent-blue-light); }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* --- Layout wrapper --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   HEADER & NAVIGATION
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(6, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo:hover { color: var(--phosphor); }

.logo-icon {
  width: 28px;
  height: 28px;
  border: 2px solid var(--phosphor);
  border-radius: 50%;
  position: relative;
}

.logo-icon::after {
  content: '~';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--phosphor);
  font-size: 14px;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.site-nav a {
  display: block;
  padding: 0.5rem 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--phosphor);
  background: var(--phosphor-dim);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--phosphor);
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
}

/* ============================================================
   HERO (home page)
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 64px;
}

.scope-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#scope-canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.55;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 4rem 0;
}

.avatar-wrap {
  position: relative;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid var(--phosphor);
  box-shadow: 0 0 30px rgba(0, 255, 102, 0.25), var(--shadow);
  object-fit: cover;
}

.avatar-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 255, 102, 0.3);
  animation: spin 20s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hero-text .brand {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--phosphor);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.hero-text h1 {
  margin-bottom: 0.75rem;
  line-height: 1.15;
}

.hero-text .tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.scroll-hint {
  position: absolute;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.scroll-hint:hover {
  color: var(--phosphor);
}

.scroll-hint.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
}

.scroll-hint-arrow {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  border-right: 2px solid var(--phosphor);
  border-bottom: 2px solid var(--phosphor);
  transform: rotate(45deg);
  animation: scroll-bounce 2.2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% {
    transform: rotate(45deg) translate(0, 0);
    opacity: 0.65;
  }
  50% {
    transform: rotate(45deg) translate(3px, 3px);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .scroll-hint {
    bottom: 4.5rem;
  }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  text-decoration: none;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--phosphor);
  color: var(--bg-dark);
  box-shadow: 0 4px 20px rgba(0, 255, 102, 0.3);
}

.btn-primary:hover {
  color: var(--bg-dark);
  box-shadow: 0 6px 28px rgba(0, 255, 102, 0.45);
}

.btn-outline {
  background: transparent;
  color: var(--phosphor);
  border: 1px solid var(--phosphor);
}

.btn-outline:hover {
  background: var(--phosphor-dim);
  color: var(--phosphor);
}

/* --- YouTube channel stats --- */
.channel-stats {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-display);
  overflow: hidden;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.55rem 1rem;
  min-width: 5.5rem;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--border);
}

.stat-value {
  color: var(--phosphor);
  font-size: 1rem;
  line-height: 1.2;
}

.stat-label {
  margin-top: 0.15rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.channel-stats.loading .stat-value {
  animation: pulse 1s ease-in-out infinite;
}

.channel-stats.error {
  border-color: rgba(255, 80, 80, 0.3);
}

.channel-stats.error .stat-value {
  color: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (max-width: 480px) {
  .channel-stats {
    width: 100%;
    justify-content: space-between;
  }

  .stat-item {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.4rem;
  }

  .stat-value {
    font-size: 0.9rem;
  }
}

/* ============================================================
   SECTIONS (shared)
   ============================================================ */
main {
  flex: 1;
}

.page-hero {
  position: relative;
  padding: 8rem 0 3rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.page-hero h1 { margin-bottom: 0.5rem; }
.page-hero p { color: var(--text-muted); font-size: 1.1rem; }

.section {
  padding: 4rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title p {
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* --- Card grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 255, 102, 0.25);
  transform: translateY(-3px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.card h3 { margin-bottom: 0.75rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; }

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.card-link:hover {
  color: inherit;
  border-color: rgba(0, 255, 102, 0.4);
}

.card-link-hint {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--phosphor);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s, transform 0.2s;
}

.card-link:hover .card-link-hint {
  opacity: 1;
  transform: translateX(0);
}

/* --- Popular brand tiles (compact, 4 per row) --- */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.brand-card {
  position: relative;
  padding: 0.75rem 0.65rem;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 3.5rem;
}

.brand-card.card-link::after {
  content: '▶';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  font-size: 0.45rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 102, 0.4);
  background: rgba(0, 255, 102, 0.08);
  color: var(--phosphor);
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.brand-card.card-link:hover::after {
  background: rgba(0, 255, 102, 0.18);
  border-color: var(--phosphor);
  transform: scale(1.08);
}

.brand-card h3 {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--accent-blue-light);
}

.brand-card:hover h3 {
  color: var(--phosphor);
}

.brand-card.card-link:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 255, 102, 0.35);
}

@media (max-width: 768px) {
  .brand-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Topic pills --- */
.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin-top: 1rem;
}

.pill-list li {
  padding: 0.35rem 0.85rem;
  background: var(--phosphor-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--phosphor);
}

/* --- About page --- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 2.5rem;
  align-items: start;
}

.workshop-feature {
  margin: 0;
}

.workshop-photo {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.workshop-caption {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.about-content h2 {
  margin: 2rem 0 1rem;
}

.about-content h2:first-child {
  margin-top: 0;
}

.about-content p {
  color: var(--text-muted);
}

.info-box {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border-left: 3px solid var(--phosphor);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.info-box dt {
  font-family: var(--font-display);
  color: var(--phosphor);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.info-box dd {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.info-box dd:last-child { margin-bottom: 0; }

/* --- Videos page --- */
.video-cta {
  text-align: center;
  padding: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 2rem;
}

.video-cta h2 { margin-bottom: 1rem; }
.video-cta p { color: var(--text-muted); margin-bottom: 1.5rem; }

.topic-section {
  margin-bottom: 3rem;
}

.topic-section h2 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* --- Home features strip --- */
.features-strip {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: auto;
}

body.has-scope .site-footer {
  background: rgba(6, 10, 15, 0.75);
  backdrop-filter: blur(8px);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links a:hover { color: var(--phosphor); }

.footer-copy {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .site-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(6, 10, 15, 0.97);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .site-nav.is-open { max-height: 300px; }

  .site-nav ul {
    flex-direction: column;
    padding: 1rem;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .hero-actions { justify-content: center; }

  .hero-overlay,
  .scope-overlay--site {
    background: radial-gradient(
      ellipse 95% 65% at 50% 42%,
      rgba(6, 10, 15, 0.92) 0%,
      rgba(6, 10, 15, 0.55) 42%,
      transparent 72%
    );
  }

  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .workshop-feature {
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .avatar { width: 140px; height: 140px; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}
