/* === Theme Variables === */
:root {
  --bg-body: #09090b;
  --bg-surface: #111113;
  --bg-elevated: #1a1a1e;
  --bg-overlay: rgba(255, 255, 255, 0.06);

  --border: #222225;
  --border-hover: #333338;
  --border-subtle: #1a1a1e;

  --text-primary: #fafafa;
  --text-secondary: #d4d4d8;
  --text-muted: #71717a;
  --text-faint: #52525b;
  --text-ghost: #3f3f46;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;

  --tag-bg: #1a1a1e;
  --tag-text: #a1a1aa;

  --terminal-title: rgba(255, 255, 255, 0.4);

  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --terminal-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);

  --hero-gradient-from: #fafafa;
  --hero-gradient-to: #3b82f6;

  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-body: #fafafa;
    --bg-surface: #ffffff;
    --bg-elevated: #f4f4f5;
    --bg-overlay: rgba(0, 0, 0, 0.04);

    --border: #e4e4e7;
    --border-hover: #d4d4d8;
    --border-subtle: #f4f4f5;

    --text-primary: #09090b;
    --text-secondary: #27272a;
    --text-muted: #71717a;
    --text-faint: #a1a1aa;
    --text-ghost: #d4d4d8;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;

    --tag-bg: #f4f4f5;
    --tag-text: #52525b;

    --terminal-title: rgba(0, 0, 0, 0.4);

    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --terminal-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);

    --hero-gradient-from: #09090b;
    --hero-gradient-to: #3b82f6;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* === Layout === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === Header === */
.site-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-name {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--hero-gradient-from) 0%, var(--hero-gradient-to) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity 0.15s ease;
}

.site-name:hover {
  opacity: 0.8;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* === Hero === */
.hero {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--hero-gradient-from) 0%, var(--hero-gradient-to) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-text {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

.hero-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.hero-link:hover {
  color: var(--accent-hover);
}

.hero-browse {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.hero-browse:hover {
  color: #fff;
  background: var(--accent-hover);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-top: 2rem;
}

/* === Search & Filter === */
.filter-bar {
  padding-top: 1.5rem;
}

.filter-search {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  font-size: 0.9375rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.filter-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding-top: 0.75rem;
}

.filter-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  letter-spacing: 0.01em;
}

.filter-tag:hover {
  color: var(--text-secondary);
  border-color: var(--border-hover);
}

.filter-tag.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.filter-tag.unavailable {
  display: none;
}

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}

/* === Hidden Card === */
.theme-card.hidden {
  display: none;
}

/* === Theme Grid === */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 2rem 0 4rem;
}

@media (min-width: 640px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .theme-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === Theme Card === */
.theme-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  color: inherit;
}

.theme-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow);
  color: inherit;
}

.card-info {
  padding: 1rem 1.25rem 1.25rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card-description {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--tag-text);
  background: var(--tag-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

/* === Terminal Widget === */
.terminal {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--terminal-shadow);
}

.terminal-titlebar {
  height: 36px;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--terminal-title);
  font-family: 'Inter', sans-serif;
  margin-right: 54px;
}

.terminal-body {
  background: var(--bg);
  color: var(--fg);
  padding: 0.75rem 1rem;
  font-family: 'JetBrains Mono', monospace;
}

.terminal-content {
  margin: 0;
  white-space: pre;
  line-height: 1.6;
  font-family: inherit;
  font-size: inherit;
}

/* Terminal size variants */
.terminal-small .terminal-body {
  font-size: 0.6875rem;
  max-height: 140px;
  overflow: hidden;
}

.terminal-small .terminal-titlebar {
  height: 30px;
}

.terminal-small .dot {
  width: 10px;
  height: 10px;
}

.terminal-large .terminal-body {
  font-size: 0.875rem;
  padding: 1rem 1.25rem;
}

/* Terminal color classes */
.c0  { color: var(--c0); }
.c1  { color: var(--c1); }
.c2  { color: var(--c2); }
.c3  { color: var(--c3); }
.c4  { color: var(--c4); }
.c5  { color: var(--c5); }
.c6  { color: var(--c6); }
.c7  { color: var(--c7); }
.c8  { color: var(--c8); }
.c9  { color: var(--c9); }
.c10 { color: var(--c10); }
.c11 { color: var(--c11); }
.c12 { color: var(--c12); }
.c13 { color: var(--c13); }
.c14 { color: var(--c14); }
.c15 { color: var(--c15); }

/* === Section Title === */
.section-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-top: 3rem;
}

/* === Popular Sections Ordering === */
.popular-sections {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.popular-sections > section {
  width: 100%;
}

.popular-dark { order: 1; }
.popular-light { order: 2; }

@media (prefers-color-scheme: light) {
  .popular-light { order: 1; }
  .popular-dark { order: 2; }
}

/* === Theme Detail Page === */
.theme-detail {
  padding: 3rem 0 4rem;
  max-width: 800px;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .theme-detail {
    padding: 0 1.5rem;
    padding-top: 3rem;
    padding-bottom: 4rem;
  }
}

.theme-name {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.theme-description {
  color: var(--text-muted);
  font-size: 1.0625rem;
  margin-bottom: 2rem;
}

.theme-detail .terminal {
  margin-bottom: 2.5rem;
}

/* Meta */
.theme-meta {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.meta-value {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.meta-value .tag {
  font-size: 0.75rem;
}

/* Color Palette */
.color-palette {
  margin-bottom: 2.5rem;
}

.color-palette h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
  border: 1px solid var(--border);
}

.swatch-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
  mix-blend-mode: difference;
  filter: invert(1) grayscale(1) contrast(9);
}

/* Config Block */
.config-section {
  margin-bottom: 2rem;
}

.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.config-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.config-command {
  position: relative;
}

.config-command .config-block {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
  padding: 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  line-height: 0;
}

.copy-btn:hover {
  background: var(--border-hover);
  border-color: var(--text-faint);
}

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

.config-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* === Setup Steps === */
.setup-section {
  margin-bottom: 2.5rem;
}

.ad-container {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

/* === Similar Themes === */
.similar-themes {
  margin-bottom: 2.5rem;
}

.similar-themes h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.similar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.setup-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.setup-steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.setup-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.25rem;
}

.setup-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-text {
  display: block;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.config-inline {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.setup-steps .config-header {
  margin-bottom: 0.5rem;
  justify-content: flex-end;
}

/* === Footer === */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.site-footer p {
  font-size: 0.8125rem;
  color: var(--text-ghost);
}

.site-footer a {
  color: var(--text-ghost);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text-secondary);
}

/* === Page Content === */
.page-content {
  padding: 3rem 1.5rem;
  max-width: 720px;
}

.page-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.page-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.page-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.page-content p,
.page-content li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.page-content p {
  margin-bottom: 1rem;
}

.page-content ul {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.page-content li {
  margin-bottom: 0.25rem;
}

.page-content a {
  color: var(--accent);
  text-decoration: none;
}

.page-content a:hover {
  text-decoration: underline;
}

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  animation: fadeIn 0.4s ease;
}

.theme-card {
  animation: fadeIn 0.4s ease backwards;
}

.theme-card:nth-child(2) { animation-delay: 0.05s; }
.theme-card:nth-child(3) { animation-delay: 0.1s; }


/* === Responsive === */
@media (max-width: 639px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .theme-name {
    font-size: 1.75rem;
  }

  .theme-detail {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

}
