/* =========================================================
   ZLT Co. — Apps Section Styles
   Scope: .resources
   Enhanced with Galaxy Edition Theme System
   ========================================================= */

/* ---------- CSS VARIABLES (scoped fallback) ---------- */
.resources {
  --radius: 14px;
  --radius-sm: 10px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   GALAXY EDITION THEME SYSTEM
   ========================================================= */

/* Galaxy Background Layer */
.galaxy-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-edition="galaxy"] .galaxy-bg {
  opacity: 1;
}

.galaxy-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 60%),
    linear-gradient(180deg, #050b14 0%, #0a1628 40%, #0f1f3d 100%);
}

/* Stars — pure CSS box-shadow */
.stars,
.stars-2 {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  background: transparent;
  pointer-events: none;
}

.stars {
  box-shadow:
    100px 200px #fff, 400px 100px #a5f3fc, 700px 300px #fff,
    900px 150px #bae6fd, 1200px 400px #fff, 150px 600px #7dd3fc,
    500px 700px #fff, 800px 500px #a5f3fc, 1100px 800px #fff,
    300px 900px #bae6fd, 600px 1000px #fff, 1000px 600px #7dd3fc,
    200px 300px #fff, 450px 450px #a5f3fc, 750px 250px #fff,
    950px 550px #bae6fd, 1300px 200px #fff, 250px 750px #7dd3fc,
    550px 350px #fff, 850px 850px #a5f3fc, 1150px 950px #fff,
    50px 500px #bae6fd, 350px 800px #fff, 650px 150px #7dd3fc,
    1050px 350px #fff, 1250px 650px #a5f3fc, 150px 950px #fff,
    450px 250px #bae6fd, 850px 450px #fff, 950px 750px #7dd3fc,
    50px 50px #fff, 350px 150px #a5f3fc, 650px 50px #fff,
    450px 550px #bae6fd, 750px 650px #fff, 1050px 850px #7dd3fc,
    250px 450px #fff, 550px 950px #a5f3fc, 850px 150px #fff,
    1150px 450px #bae6fd, 1350px 750px #fff, 150px 350px #7dd3fc,
    950px 250px #fff, 1250px 550px #a5f3fc, 350px 650px #fff,
    650px 850px #bae6fd, 850px 950px #fff, 150px 150px #7dd3fc,
    450px 50px #fff, 1150px 150px #a5f3fc, 1350px 350px #fff,
    550px 150px #bae6fd, 850px 350px #fff, 1050px 150px #7dd3fc,
    250px 550px #fff, 650px 450px #a5f3fc, 950px 550px #fff,
    350px 350px #bae6fd, 750px 150px #fff, 1150px 850px #7dd3fc,
    150px 750px #fff, 550px 550px #a5f3fc, 950px 350px #fff;
  animation: twinkle 4s ease-in-out infinite alternate;
}

.stars-2 {
  width: 2px;
  height: 2px;
  box-shadow:
    200px 100px #fff, 600px 400px #7dd3fc, 1000px 200px #fff,
    1400px 600px #bae6fd, 300px 800px #fff, 700px 1000px #a5f3fc,
    1100px 700px #fff, 1300px 300px #7dd3fc, 100px 400px #fff,
    500px 200px #a5f3fc, 900px 900px #fff, 1200px 500px #bae6fd,
    400px 700px #fff, 800px 300px #7dd3fc, 150px 900px #fff,
    600px 600px #a5f3fc, 1000px 800px #fff, 1400px 400px #bae6fd;
  animation: twinkle 6s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Nebula orbs */
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  pointer-events: none;
  animation: float 20s ease-in-out infinite;
}

.nebula-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation-delay: 0s;
}

.nebula-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: -15%;
  right: -10%;
  animation-delay: -7s;
}

.nebula-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  top: 40%;
  left: 50%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ---------- EDITION VARIABLE OVERRIDES ---------- */
[data-edition="galaxy"].resources {
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.18);
  --accent-cyan: #06b6d4;
  --accent-secondary: #8b5cf6;
  --border: rgba(59, 130, 246, 0.1);
  --text-muted: #94a3b8;
  --text-dim: #64748b;
}

[data-edition="galaxy"] {
  background: #050b14;
  color: #f0f4f8;
}

[data-edition="galaxy"] .zlt-nav {
  background: rgba(5, 11, 20, 0.85);
  border-bottom-color: rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(20px) saturate(1.2);
}

[data-edition="galaxy"] .zlt-footer {
  background: rgba(10, 22, 40, 0.8);
  border-top-color: rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(12px);
}

[data-edition="galaxy"] .nav-links a:hover {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.08);
}

[data-edition="galaxy"] ::selection {
  background: #3b82f6;
  color: white;
}

[data-edition="galaxy"] ::-webkit-scrollbar-track {
  background: #050b14;
}

[data-edition="galaxy"] ::-webkit-scrollbar-thumb {
  background: #1a3a6e;
  border-radius: 4px;
}

[data-edition="galaxy"] ::-webkit-scrollbar-thumb:hover {
  background: #3b82f6;
}

/* ---------- HERO ---------- */
.resources .resources-hero {
  position: relative;
  text-align: center;
  padding: 140px 20px 80px;
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

/* Hero Badge */
.hero-badge-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  min-height: 32px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.5s ease, transform 0.5s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.hero-badge.visible {
  opacity: 1;
  transform: translateY(0);
}

[data-edition="galaxy"] .hero-badge {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border-color: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.resources .resources-hero h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 0.5s ease;
}

[data-edition="galaxy"] .resources .resources-hero h2 {
  background: linear-gradient(135deg, #f0f4f8 0%, #60a5fa 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.typewriter {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1.05rem;
  min-height: 1.6em;
  transition: color 0.5s ease;
}

[data-edition="galaxy"] .typewriter {
  color: #94a3b8;
}

/* Search */
.search-wrapper {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
  transition: color 0.3s ease;
}

#search {
  width: 100%;
  padding: 15px 16px 15px 46px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background 0.5s ease;
}

[data-edition="galaxy"] #search {
  background: rgba(15, 31, 61, 0.75);
  border-color: rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(12px);
}

[data-edition="galaxy"] #search:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: rgba(15, 31, 61, 0.8);
}

.search-kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-family: var(--font);
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--border);
  color: var(--text-muted);
  border: 1px solid var(--border);
  pointer-events: none;
  user-select: none;
  transition: all 0.3s ease;
}

[data-edition="galaxy"] .search-kbd {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* Search Suggestions */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  z-index: 100;
  display: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  backdrop-filter: blur(12px);
  transition: background 0.5s ease, border-color 0.3s ease;
}

[data-edition="galaxy"] .search-suggestions {
  background: rgba(10, 22, 40, 0.95);
  border-color: rgba(59, 130, 246, 0.15);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(59, 130, 246, 0.05);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  outline: none;
}

.suggestion-item:hover,
.suggestion-item:focus {
  background: var(--accent-glow);
}

[data-edition="galaxy"] .suggestion-item:hover,
[data-edition="galaxy"] .suggestion-item:focus {
  background: rgba(59, 130, 246, 0.1);
}

.suggestion-item img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--border);
}

.suggestion-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.suggestion-title mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.suggestion-cat {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--border);
  padding: 2px 8px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

[data-edition="galaxy"] .suggestion-cat {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

/* ---------- STATS ---------- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 6vw, 56px);
  padding: 36px 20px;
  max-width: 900px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.5s ease;
}

[data-edition="galaxy"] .stats-bar {
  border-color: rgba(59, 130, 246, 0.1);
}

.stat {
  text-align: center;
  transition: transform 0.3s ease;
}

.stat:hover {
  transform: translateY(-2px);
}

.stat span {
  display: block;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.5s ease;
}

[data-edition="galaxy"] .stat span {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 600;
  transition: color 0.5s ease;
}

[data-edition="galaxy"] .stat label {
  color: #94a3b8;
}

/* ---------- RECENTLY VIEWED ---------- */
.recently-viewed {
  max-width: 1100px;
  margin: 60px auto 0;
  padding: 0 20px;
}

.recently-viewed .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.btn-text:hover {
  color: var(--accent);
}

.recent-list {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.recent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow 0.3s ease;
}

.recent-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
}

[data-edition="galaxy"] .recent-card {
  background: rgba(15, 31, 61, 0.8);
  border-color: rgba(59, 130, 246, 0.12);
  backdrop-filter: blur(8px);
}

[data-edition="galaxy"] .recent-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
}

.recent-card img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--border);
}

/* ---------- FEATURED ---------- */
.featured {
  max-width: 1100px;
  margin: 60px auto 0;
  padding: 0 20px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  transition: color 0.5s ease;
}

.section-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 20px;
  transition: all 0.5s ease;
}

[data-edition="galaxy"] .section-badge {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.featured-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--border);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.featured-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 32px var(--accent-glow);
}

[data-edition="galaxy"] .featured-card {
  background: rgba(15, 31, 61, 0.85);
  border-color: rgba(59, 130, 246, 0.12);
  backdrop-filter: blur(12px);
}

[data-edition="galaxy"] .featured-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1);
}

.featured-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: box-shadow 0.3s ease;
}

[data-edition="galaxy"] .featured-icon {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.featured-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-content {
  flex: 1;
  min-width: 0;
}

.featured-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.featured-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.featured-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 8px;
  border-radius: 20px;
  transition: all 0.5s ease;
}

[data-edition="galaxy"] .featured-badge {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
}

.featured-content p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------- CONTROLS ---------- */
.controls {
  max-width: 1100px;
  margin: 50px auto 0;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.filter-pill:hover {
  background: var(--accent);
  color: white;
}

.filter-pill.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}

[data-edition="galaxy"] .filter-pill {
  background: rgba(15, 31, 61, 0.5);
  border: 1px solid rgba(59, 130, 246, 0.1);
  color: #94a3b8;
}

[data-edition="galaxy"] .filter-pill:hover {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.25);
}

[data-edition="galaxy"] .filter-pill.active {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.filter-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  color: inherit;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-toggle,
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-toggle svg,
.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.view-toggle[aria-pressed="true"],
.theme-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

[data-edition="galaxy"] .view-toggle,
[data-edition="galaxy"] .theme-toggle {
  background: rgba(15, 31, 61, 0.5);
  border-color: rgba(59, 130, 246, 0.15);
  color: #94a3b8;
}

[data-edition="galaxy"] .view-toggle[aria-pressed="true"],
[data-edition="galaxy"] .theme-toggle[aria-pressed="true"] {
  border-color: #3b82f6;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.view-toggle:hover,
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: '▼';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--text-muted);
  pointer-events: none;
}

#sort {
  appearance: none;
  padding: 9px 32px 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

#sort:focus {
  border-color: var(--accent);
}

[data-edition="galaxy"] #sort {
  background: rgba(15, 31, 61, 0.5);
  border-color: rgba(59, 130, 246, 0.15);
  color: #f0f4f8;
}

[data-edition="galaxy"] #sort:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.theme-icon-sun,
.theme-icon-moon {
  grid-area: 1 / 1;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0);
}

[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg);
}

[data-theme="light"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(-90deg);
}

[data-theme="light"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0);
}

/* ---------- GRID ---------- */
.resources-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.articles-grid.list-view {
  grid-template-columns: 1fr;
}

/* ---------- CARD ---------- */
.resource-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), background 0.5s ease;
  outline: none;
}

[data-edition="galaxy"] .resource-card {
  background: rgba(15, 31, 61, 0.85);
  border-color: rgba(59, 130, 246, 0.12);
  backdrop-filter: blur(12px);
}

.resource-card:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-glow);
  border-color: var(--accent);
}

[data-edition="galaxy"] .resource-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
}

.card-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: box-shadow 0.3s ease;
}

[data-edition="galaxy"] .card-icon-wrap {
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.08);
}

.card-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-body h3 mark {
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.card-body p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 14px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body p mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tag-color, var(--accent));
  background: color-mix(in srgb, var(--tag-color, var(--accent)) 12%, transparent);
  padding: 4px 10px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

[data-edition="galaxy"] .tag {
  background: color-mix(in srgb, var(--tag-color, #3b82f6) 12%, transparent);
}

.tag-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

[data-edition="galaxy"] .tag-chip {
  background: rgba(59, 130, 246, 0.08);
  color: #94a3b8;
}

[data-edition="galaxy"] .card-meta .tag,
[data-edition="galaxy"] .featured-meta .tag {
  color: #60a5fa !important;
  background: rgba(59, 130, 246, 0.12) !important;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  transition: border-color 0.3s ease;
}

[data-edition="galaxy"] .card-footer {
  border-color: rgba(59, 130, 246, 0.06);
}

.version {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

[data-edition="galaxy"] .version {
  color: #64748b;
}

.copy-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

.copy-btn:hover {
  background: var(--accent-glow);
  color: var(--accent);
}

[data-edition="galaxy"] .copy-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.copy-btn.copied {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

[data-edition="galaxy"] .copy-btn.copied {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

/* Glow */
.card-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  background: radial-gradient(
    500px circle at var(--glow-x, 50%) var(--glow-y, 50%),
    var(--accent-glow) 0%,
    transparent 60%
  );
  z-index: 0;
}

[data-edition="galaxy"] .card-glow {
  background: radial-gradient(
    500px circle at var(--glow-x, 50%) var(--glow-y, 50%),
    rgba(59, 130, 246, 0.12) 0%,
    transparent 60%
  );
}

.resource-card:hover .card-glow,
.resource-card:focus-visible .card-glow {
  opacity: 1;
}

.resource-card > * {
  position: relative;
  z-index: 1;
}

/* Hover lift (when not tilting via JS) */
.resource-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
}

[data-edition="galaxy"] .resource-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3), 0 0 40px rgba(59, 130, 246, 0.08);
}

/* List view overrides */
.articles-grid.list-view .resource-card {
  flex-direction: row;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
}

.articles-grid.list-view .card-icon-wrap {
  width: 52px;
  height: 52px;
  margin-bottom: 0;
}

.articles-grid.list-view .card-body {
  flex: 1;
  flex-direction: row;
  align-items: center;
  gap: 24px;
}

.articles-grid.list-view .card-body h3 {
  margin-bottom: 0;
  min-width: 180px;
}

.articles-grid.list-view .card-body p {
  margin-bottom: 0;
  -webkit-line-clamp: 1;
  flex: 1;
}

.articles-grid.list-view .card-meta {
  margin-bottom: 0;
  min-width: 120px;
  justify-content: flex-end;
}

.articles-grid.list-view .card-footer {
  display: none;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  transition: color 0.5s ease;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-dim);
  margin-bottom: 20px;
  transition: color 0.5s ease;
}

[data-edition="galaxy"] .empty-icon {
  color: #3b82f6;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 8px;
  transition: color 0.5s ease;
}

.empty-state p {
  max-width: 400px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.6;
}

.btn-reset {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-reset:hover {
  background: var(--accent);
  color: white;
}

[data-edition="galaxy"] .btn-reset {
  border-color: #3b82f6;
  color: #60a5fa;
}

[data-edition="galaxy"] .btn-reset:hover {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.25);
}

/* ---------- BACK TO TOP ---------- */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: all var(--transition-base);
  z-index: 90;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

[data-edition="galaxy"] .back-to-top {
  background: rgba(15, 31, 61, 0.7);
  border-color: rgba(59, 130, 246, 0.2);
  color: #f0f4f8;
  backdrop-filter: blur(12px);
}

[data-edition="galaxy"] .back-to-top:hover {
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ---------- SCROLL REVEAL ---------- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- ARTICLE PAGE ISOLATION ---------- */
.resources:has(.article-container) main,
.resources:has(.article-container) .resources-grid,
.resources:has(.article-container) #articles,
.resources:has(.article-container) .featured,
.resources:has(.article-container) .paths,
.resources:has(.article-container) .filters,
.resources:has(.article-container) .stats-bar,
.resources:has(.article-container) .recently-viewed,
.resources:has(.article-container) .controls,
.resources:has(.article-container) .back-to-top,
.resources:has(.article-container) .zlt-footer {
  display: none !important;
}

.resources:has(.article-container) {
  display: block;
}

.resources .article-container {
  max-width: 800px;
  margin: 100px auto 60px;
  padding: 40px 20px;
  display: block !important;
  animation: fadeIn 0.5s ease;
}

.resources .article-container h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.15;
}

.resources .article-container .article-meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.resources .article-container h2 {
  color: var(--accent);
  margin-top: 40px;
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 700;
}

.resources .article-container h2::after {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin-top: 10px;
  opacity: 0.5;
  border-radius: 2px;
}

.resources .article-container p {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 24px;
  font-size: 16px;
}

.resources .article-container a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.resources .article-container ul,
.resources .article-container ol {
  margin-bottom: 24px;
  padding-left: 24px;
  color: var(--text-muted);
}

.resources .article-container li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.resources .article-container img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 20px 0;
}

.resources .article-container blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-muted);
  font-style: italic;
}

.resources .back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--accent);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.resources .back-btn:hover {
  background: var(--accent);
  color: white;
}

/* ---------- KEYFRAMES ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- MOBILE ---------- */
@media (max-width: 740px) {
  .resources .resources-hero {
    padding: 110px 20px 50px;
  }

  .stats-bar {
    gap: 24px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-group {
    justify-content: flex-end;
  }

  .featured-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .articles-grid.list-view .resource-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .articles-grid.list-view .card-body {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .articles-grid.list-view .card-body h3 {
    min-width: unset;
  }

  .articles-grid.list-view .card-meta {
    justify-content: flex-start;
  }

  .articles-grid.list-view .card-footer {
    display: flex;
    width: 100%;
  }

  .search-kbd {
    display: none;
  }

  .hero-badge-wrapper {
    margin-bottom: 14px;
  }
}

@media (max-width: 480px) {
  .filters {
    gap: 8px;
  }

  .filter-pill {
    padding: 8px 12px;
    font-size: 12px;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  #hero-canvas {
    display: none !important;
  }

  .resource-card,
  .resource-card:hover {
    transform: none !important;
  }

  .galaxy-bg,
  .stars,
  .stars-2,
  .nebula {
    animation: none !important;
  }

  .hero-badge {
    transition: none !important;
  }

  .galaxy-bg::before {
    background: linear-gradient(180deg, #050b14 0%, #0a1628 40%, #0f1f3d 100%);
  }
}

/* ---------- GALAXY EDITION RESPONSIVE TWEAKS ---------- */
@media (max-width: 740px) {
  [data-edition="galaxy"] .nebula {
    opacity: 0.08;
  }

  .nebula-1 {
    width: 250px;
    height: 250px;
  }

  .nebula-2 {
    width: 300px;
    height: 300px;
  }

  .nebula-3 {
    width: 200px;
    height: 200px;
  }
}

/* ---------- EDITION TRANSITIONS ---------- */
/* Smooth theme transitions for elements that change color/background with edition */
body.resources,
.resources .zlt-nav,
.resources .zlt-footer,
.filter-pill,
#search,
.search-suggestions,
.btn-reset,
#sort,
.view-toggle,
.theme-toggle,
.stat span,
.stat label,
.section-badge,
.hero-badge,
.empty-state,
.empty-state h3,
.empty-icon,
.typewriter,
.resources .resources-hero h2,
.section-header h2,
.tag-chip,
.version,
.card-footer,
.copy-btn,
.search-kbd,
.suggestion-cat {
  transition: color 0.5s ease, background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
