/* =====================================================
   Electrocreativity - Clean, Mobile-First CSS
   ===================================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a73e8;
  --primary-dark: #1558b0;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.08);
  --radius: 8px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-alt: #1e1e1e;
  --text: #e5e7eb;
  --text-light: #9ca3af;
  --border: #374151;
  --card-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Container --- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* =====================
   HEADER & NAV
   ===================== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  max-width: 900px;
  margin: 0 auto;
}

.site-logo {
  order: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.site-logo:hover { text-decoration: none; }

/* Hamburger */
.nav-toggle {
  order: 4;
  margin-left: 16px;
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}

.nav-toggle svg { display: block; }

/* Desktop nav */
.site-nav {
  order: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* Theme Toggle Switch */
.theme-switch {
  order: 3;
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  margin-left: 12px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  transition: .3s;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
}

.theme-switch .icon-sun, .theme-switch .icon-moon {
  font-size: 12px;
  z-index: 1;
}

.theme-switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: .3s;
  border-radius: 50%;
  z-index: 2;
}

[data-theme='dark'] .theme-switch .slider:before {
  background-color: #333;
}

.theme-switch input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.theme-switch input:checked + .slider:before {
  transform: translateX(24px);
  background-color: white;
}

.theme-switch input:focus-visible + .slider {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--bg-alt);
  text-decoration: none;
  color: var(--primary);
}

/* Mobile nav */
@media (max-width: 700px) {
  .nav-toggle { display: block; order: 3; margin-left: 16px; }
  .theme-switch { order: 2; margin-left: auto; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 0;
  }

  .site-nav.open { display: flex; }

  .site-nav a {
    width: 100%;
    padding: 10px 20px;
    border-radius: 0;
    font-size: 1rem;
  }

  .site-nav a:hover,
  .site-nav a.active {
    background: var(--bg-alt);
  }
}

/* =====================
   HERO SECTION
   ===================== */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 56px 16px 48px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero h1 span { color: #60a5fa; }

.hero p {
  font-size: 1rem;
  color: #cbd5e1;
  max-width: 560px;
  margin: 0 auto 24px;
}

.hero-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
}

.btn-outline:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

/* Filter Buttons */
.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  background: var(--bg-alt);
}
.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* =====================
   SECTIONS
   ===================== */
.section {
  padding: 40px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.section-title::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: var(--primary);
  margin-top: 6px;
  border-radius: 2px;
}

/* =====================
   TOPIC GRID (Category Cards)
   ===================== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  color: var(--text);
}

.topic-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(26,115,232,0.12);
  text-decoration: none;
  color: var(--primary);
}

.topic-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.topic-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

/* =====================
   VIDEO GRID
   ===================== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-decoration: none;
  color: inherit;
}

.video-thumb {
  position: relative;
  padding-top: 56.25%;
  background: #111;
  overflow: hidden;
}

.video-thumb img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

.play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  background: rgba(0,0,0,0.65);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.video-card:hover .play-btn { background: var(--primary); }

.play-btn svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }

.video-info {
  padding: 12px;
}

.video-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =====================
   ABOUT SECTION
   ===================== */
.about-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.about-text { flex: 1; }

.about-text h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.about-text p {
  color: var(--text-light);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.about-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.about-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  transition: border-color 0.15s, color 0.15s;
}

.about-links a:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

@media (max-width: 600px) {
  .about-layout { flex-direction: column; }
}

/* =====================
   PAGE HERO (inner pages)
   ===================== */
.page-hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 40px 16px;
  text-align: center;
}

.page-hero a {
  color: #60a5fa;
}
.page-hero a:hover {
  color: #93c5fd;
}

.page-hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
  margin-top: 12px;
}

.page-hero p {
  color: #cbd5e1;
  font-size: 0.95rem;
}

/* =====================
   FOOTER
   ===================== */
.video-modal-content {
  background: var(--bg);
  width: 100%;
  max-width: 800px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.video-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.site-footer {
  background: #1a1a2e;
  color: #9ca3af;
  padding: 32px 16px;
  font-size: 0.875rem;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.footer-brand p {
  font-weight: 400;
  color: #9ca3af;
  font-size: 0.8rem;
  margin-top: 4px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links a {
  color: #9ca3af;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: #fff;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-bottom a {
  color: #9ca3af;
}

.footer-bottom a:hover {
  color: #60a5fa;
  text-decoration: none;
}

/* =====================
   UTILITY
   ===================== */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--bg-alt);
  border-radius: 4px;
  color: var(--text-light);
}

.view-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  margin-top: 16px;
}

.view-all:hover { text-decoration: underline; }

/* =====================
   RESPONSIVE TWEAKS
   ===================== */
@media (max-width: 480px) {
  .hero { padding: 40px 16px 32px; }
  .section { padding: 28px 0; }
  .video-grid {
    grid-template-columns: 1fr;
  }
  .topic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =====================
   MODAL & FORM
   ===================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-box {
  background: var(--bg);
  padding: 32px;
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transform: translateY(20px);
  transition: transform 0.3s;
  border: 1px solid var(--border);
}
.modal-overlay.active .modal-box {
  transform: translateY(0);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* =====================
   YouTube Player Modal
   ===================== */
#yt-player-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 16px;
}
#yt-player-modal.active {
  opacity: 1;
  visibility: visible;
}
.yt-player-box {
  background: #000;
  border-radius: 12px;
  width: 100%;
  max-width: 880px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.94) translateY(20px);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
#yt-player-modal.active .yt-player-box {
  transform: scale(1) translateY(0);
}
.yt-player-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  background: #111;
}
.yt-player-title {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-player-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.yt-player-close:hover {
  background: rgba(255,255,255,0.22);
}
.yt-iframe-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  background: #000;
}
.yt-iframe-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.yt-player-footer {
  padding: 10px 16px;
  background: #111;
  text-align: right;
}
.yt-player-footer a {
  color: #aaa;
  font-size: 0.78rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.yt-player-footer a:hover {
  color: #fff;
  text-decoration: none;
}
