:root {
  --bg: #0b0f19;
  --surface: #151b2b;
  --surface-2: #1e2640;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #8b5cf6;
  --accent-2: #06b6d4;
  --border: #2a324c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 12px;
}

html.light {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-2: #eef2f7;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(1100px, 92%);
  margin-inline: auto;
}

.narrow {
  width: min(720px, 92%);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.75rem;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.main-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.main-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--text);
  text-decoration: none;
}

.menu-toggle,
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.45rem;
  display: grid;
  place-items: center;
}

.menu-toggle {
  display: none;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.theme-toggle {
  font-size: 1.1rem;
  line-height: 1;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: grid;
    order: 1;
  }

  .theme-toggle {
    order: 2;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
    display: none;
  }

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

  .main-nav a {
    padding: 0.5rem;
  }
}

/* Hero */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, var(--surface-2), transparent 60%);
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  box-shadow: none;
  background: var(--surface-2);
}

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

/* Sections */
.section {
  padding: 3rem 0;
}

.page-header {
  background: var(--surface);
  text-align: center;
  padding: 4rem 0 2.5rem;
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 0.5rem;
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.1rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.75rem;
}

/* Grid & Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

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

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-image {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.card:hover .card-image img {
  transform: scale(1.03);
}

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

.card-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.card h3 a {
  color: var(--text);
}

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

.card p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.card time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Newsletter */
.newsletter {
  background: var(--surface);
  text-align: center;
}

.newsletter-form,
.contact-form,
.join-form,
.submit-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.newsletter-form {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.newsletter-form input,
.contact-form input,
.contact-form textarea,
.join-form input,
.submit-form input,
.submit-form select,
.submit-form textarea {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  width: 100%;
}

.newsletter-form input {
  flex: 1 1 260px;
  max-width: 360px;
}

.contact-form label span {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.contact-form input:focus,
.contact-form textarea:focus,
.newsletter-form input:focus,
.join-form input:focus,
.submit-form input:focus,
.submit-form select:focus,
.submit-form textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.form-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.form-note code {
  background: var(--surface-2);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

/* Article */
.article {
  padding-top: 2rem;
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-header h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin: 0.5rem 0 0.75rem;
  line-height: 1.1;
}

.featured-image {
  margin: 0 0 2rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.featured-image img {
  width: 100%;
}

.media-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin-bottom: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.media-embed iframe,
.media-embed > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.article-body {
  font-size: 1.05rem;
}

.article-body h2,
.article-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.35rem;
}

.article-body code {
  background: var(--surface-2);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.back-link {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Comments */
.comments-section {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comments-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.disqus-thread {
  min-height: 200px;
}

/* Static pages */
.lead {
  font-size: 1.15rem;
  color: var(--text-muted);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.links-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.15s, background 0.15s;
}

.link-card:hover {
  text-decoration: none;
  transform: translateX(4px);
  background: var(--surface-2);
}

.link-title {
  font-weight: 700;
  color: var(--text);
}

.link-url {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* Enhanced hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 7rem 0 5rem;
}

.hero-glow {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 30% 20%, rgba(139, 92, 246, 0.22), transparent 40%),
              radial-gradient(circle at 70% 80%, rgba(6, 182, 212, 0.18), transparent 45%);
  animation: glowMove 12s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes glowMove {
  from { transform: translate(-5%, -5%) scale(1); }
  to { transform: translate(5%, 5%) scale(1.1); }
}

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

.hero-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  line-height: 1;
  margin: 0 0 1.25rem;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 50%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* Stats bar */
.stats-bar {
  background: var(--surface);
  border-block: 1px solid var(--border);
  padding: 2rem 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1.5rem;
  text-align: center;
}

.stats strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  color: var(--text);
}

.stats span {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Bento grid */
.bento-section {
  padding-top: 4rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  gap: 1.25rem;
}

.bento-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.bento-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.bento-card.bento-large {
  grid-column: span 2;
  grid-row: span 2;
}

.bento-card.bento-medium {
  grid-column: span 2;
}

.bento-card.bento-small {
  grid-column: span 1;
}

.bento-image {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.bento-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity 0.3s, transform 0.5s;
}

.bento-card:hover .bento-image img {
  opacity: 0.75;
  transform: scale(1.05);
}

.bento-body {
  position: relative;
  z-index: 1;
  padding: 1.25rem;
  background: linear-gradient(to top, rgba(11, 15, 25, 0.95), rgba(11, 15, 25, 0.4) 70%, transparent);
}

.light .bento-body {
  background: linear-gradient(to top, rgba(248, 250, 252, 0.95), rgba(248, 250, 252, 0.4) 70%, transparent);
}

.bento-body span {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.bento-body h3 {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--text);
}

.bento-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.bento-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
}

.bento-cta .bento-body {
  background: transparent;
}

.bento-cta .bento-body span,
.bento-cta .bento-body h3,
.bento-cta .bento-body p {
  color: #fff;
}

@media (max-width: 900px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-card.bento-large,
  .bento-card.bento-medium,
  .bento-card.bento-small {
    grid-column: span 1;
    grid-row: span 1;
  }
}

@media (max-width: 500px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
}

/* Marquee */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  padding: 1.25rem 0;
  border-block: 1px solid var(--border);
  background: var(--surface);
}

.marquee-track {
  display: inline-flex;
  gap: 3rem;
  animation: marquee 22s linear infinite;
}

.marquee span {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Selection */
::selection {
  background: var(--accent);
  color: #fff;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}
