/* ============================================================
   TOMFOOLERING — Main Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-0:        #06060f;
  --bg-1:        #0d0d1a;
  --bg-card:     #10101e;
  --bg-card-hov: #16162e;
  --cyan:        #00d4ff;
  --purple:      #7b2fff;
  --pink:        #ff2d9b;
  --green:       #00ff88;
  --yellow:      #ffe600;
  --text:        #e0e0f0;
  --muted:       #7070a0;
  --border:      rgba(0,212,255,.12);
  --border-hov:  rgba(0,212,255,.40);
  --glow-c:      0 0 24px rgba(0,212,255,.45);
  --glow-p:      0 0 24px rgba(123,47,255,.45);
  --font-head:   'Space Grotesk', sans-serif;
  --font-body:   'Inter', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --radius:      14px;
  --ease:        cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.7;
}
img { display: block; max-width: 100%; }
a { color: var(--cyan); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: #fff; }
ul { list-style: none; }

/* ── Page Transition Overlay ───────────────────────────────── */
#page-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-0);
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }

/* ── Container ─────────────────────────────────────────────── */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ── Header ────────────────────────────────────────────────── */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  padding: 20px 0;
  transition: padding .3s var(--ease), background .3s var(--ease), backdrop-filter .3s var(--ease);
}
#header.scrolled {
  padding: 12px 0;
  background: rgba(6,6,15,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
#header .container {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Logo */
.logo {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo span { color: var(--cyan); }
.logo:hover { color: #fff; }

/* Nav links */
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav a {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color .2s var(--ease), background .2s var(--ease);
  position: relative;
}
.main-nav a::after {
  content: '';
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 0; height: 2px;
  background: var(--cyan);
  border-radius: 99px;
  transition: width .25s var(--ease);
}
.main-nav a:hover, .main-nav a.active {
  color: #fff;
  background: rgba(0,212,255,.07);
}
.main-nav a:hover::after, .main-nav a.active::after { width: 60%; }

/* Nav actions */
.nav-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 500;
  background: transparent;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.btn-outline:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,212,255,.07);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}
.hamburger span {
  display: block; width: 24px; height: 2px;
  background: var(--text);
  border-radius: 99px;
  transition: all .3s var(--ease);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 280px; z-index: 499;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  padding: 100px 32px 40px;
  transform: translateX(100%);
  transition: transform .4s var(--ease);
  display: flex; flex-direction: column; gap: 8px;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu a {
  display: block;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 500;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: color .2s var(--ease);
}
.mobile-menu a:hover { color: var(--cyan); }
.mobile-overlay {
  position: fixed; inset: 0; z-index: 498;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.mobile-overlay.active { opacity: 1; pointer-events: all; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 28px;
  border-radius: 99px;
  font-family: var(--font-head);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,.1);
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.btn:hover::before { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,212,255,.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,212,255,.4);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  transform: translateY(-2px);
}

/* ── Tags & Badges ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(0,212,255,.1);
  color: var(--cyan);
  border: 1px solid rgba(0,212,255,.2);
  transition: all .2s var(--ease);
}
.tag:hover {
  background: rgba(0,212,255,.2);
  border-color: var(--cyan);
  color: #fff;
}
.tag.purple {
  background: rgba(123,47,255,.1);
  color: var(--purple);
  border-color: rgba(123,47,255,.2);
}
.tag.pink {
  background: rgba(255,45,155,.1);
  color: var(--pink);
  border-color: rgba(255,45,155,.2);
}
.tag.green {
  background: rgba(0,255,136,.1);
  color: var(--green);
  border-color: rgba(0,255,136,.2);
}
.tag.yellow {
  background: rgba(255,230,0,.1);
  color: var(--yellow);
  border-color: rgba(255,230,0,.2);
}

/* ── Post Cards ─────────────────────────────────────────────── */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
  display: flex; flex-direction: column;
  position: relative;
}
.post-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,212,255,.04), rgba(123,47,255,.04));
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
}
.post-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hov);
  box-shadow: 0 20px 60px rgba(0,212,255,.1);
}
.post-card:hover::before { opacity: 1; }

.post-card-img {
  height: 220px; overflow: hidden;
  position: relative;
}
.post-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.post-card:hover .post-card-img img { transform: scale(1.06); }
.post-card-img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6,6,15,.8) 0%, transparent 60%);
}

.post-card-body {
  padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
  flex: 1;
}
.post-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-card-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  transition: color .2s var(--ease);
}
.post-card:hover .post-card-title { color: var(--cyan); }
.post-card-excerpt {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
}
.post-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; color: var(--muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.post-card-meta-left { display: flex; align-items: center; gap: 8px; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.read-more {
  font-size: .82rem;
  font-weight: 600;
  color: var(--cyan);
  display: flex; align-items: center; gap: 4px;
}
.read-more svg { transition: transform .2s var(--ease); }
.post-card:hover .read-more svg { transform: translateX(4px); }

/* ── Featured Card ──────────────────────────────────────────── */
.featured-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}
.featured-card .post-card-img {
  height: 100%;
  border-radius: var(--radius) 0 0 var(--radius);
}
.featured-card .post-card-body {
  padding: 40px;
  justify-content: center;
}
.featured-card .post-card-title { font-size: 1.7rem; }

/* ── Section Headings ───────────────────────────────────────── */
.section-label {
  display: flex; align-items: center; gap: 12px;
  font-size: .8rem; font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 16px;
}
.section-label::before {
  content: '';
  display: block; width: 32px; height: 2px;
  background: var(--cyan);
  border-radius: 99px;
}

.section-title {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 560px;
  margin-top: 12px;
}

.section-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 48px;
  gap: 24px;
  flex-wrap: wrap;
}

/* ── Ad Slots ───────────────────────────────────────────────── */
.ad-slot {
  background: var(--bg-1);
  border: 1px dashed rgba(0,212,255,.15);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  min-height: 90px;
  overflow: hidden;
  position: relative;
}
.ad-slot-leaderboard { min-height: 90px; }
.ad-slot-rectangle { min-height: 250px; }
.ad-slot-skyscraper { min-height: 600px; }
.ad-slot ins { display: block; width: 100%; }

/* ── Ticker ─────────────────────────────────────────────────── */
.ticker-wrap {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  overflow: hidden;
}
.ticker {
  display: flex; gap: 80px;
  animation: ticker-scroll 40s linear infinite;
  white-space: nowrap;
}
.ticker:hover { animation-play-state: paused; }
.ticker-item {
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; font-weight: 500; color: var(--muted);
  flex-shrink: 0;
}
.ticker-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }
.ticker-item span { color: var(--cyan); }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Newsletter ─────────────────────────────────────────────── */
.newsletter-section {
  padding: 100px 0;
  position: relative;
  overflow: hidden;
}
.newsletter-section::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(123,47,255,.12) 0%, transparent 70%);
  pointer-events: none;
}
.newsletter-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.newsletter-box::before {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(0,212,255,.05), transparent, rgba(123,47,255,.05), transparent);
  animation: spin 15s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.newsletter-form {
  display: flex; gap: 12px;
  max-width: 480px; margin: 32px auto 0;
}
.newsletter-input {
  flex: 1;
  padding: 14px 20px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s var(--ease);
}
.newsletter-input:focus { border-color: var(--cyan); }
.newsletter-input::placeholder { color: var(--muted); }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 80px 0 40px;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 60px;
}
.footer-brand .logo { font-size: 1.5rem; display: block; margin-bottom: 16px; }
.footer-brand p { font-size: .9rem; color: var(--muted); line-height: 1.7; max-width: 280px; }
.footer-social {
  display: flex; gap: 12px; margin-top: 24px;
}
.footer-social a {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  transition: all .2s var(--ease);
}
.footer-social a:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0,212,255,.08);
}
.footer-col h4 {
  font-family: var(--font-head);
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: .9rem; color: var(--muted); transition: color .2s var(--ease); }
.footer-col a:hover { color: var(--cyan); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--muted);
  flex-wrap: wrap; gap: 12px;
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--cyan); }

/* ── Grid Layouts ───────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.posts-grid-2 { grid-template-columns: repeat(2, 1fr); }
.posts-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Sidebar ────────────────────────────────────────────────── */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  align-items: start;
}
.sidebar { display: flex; flex-direction: column; gap: 32px; position: sticky; top: 100px; }
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.sidebar-widget h3 {
  font-family: var(--font-head);
  font-size: .85rem;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Utility ────────────────────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.text-gradient-warm {
  background: linear-gradient(135deg, var(--pink), var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.neon-cyan { color: var(--cyan); text-shadow: 0 0 20px rgba(0,212,255,.6); }
.neon-purple { color: var(--purple); text-shadow: 0 0 20px rgba(123,47,255,.6); }

.glow-border {
  border-color: var(--cyan) !important;
  box-shadow: var(--glow-c);
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Animations ─────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(40px); }
.reveal.visible { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

.reveal-left { opacity: 0; transform: translateX(-40px); }
.reveal-left.visible { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

.reveal-right { opacity: 0; transform: translateX(40px); }
.reveal-right.visible { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

.stagger-children > * { opacity: 0; transform: translateY(30px); }

/* ── Category Cards ─────────────────────────────────────────── */
.cat-card {
  padding: 32px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .3s var(--ease);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.cat-card::before {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.cat-card:hover { transform: translateY(-4px); border-color: var(--border-hov); }
.cat-card:hover::before { transform: scaleX(1); }
.cat-icon { font-size: 2.4rem; margin-bottom: 16px; }
.cat-name {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
.cat-count { font-size: .85rem; color: var(--muted); }

/* ── Code Blocks ────────────────────────────────────────────── */
pre[class*="language-"] {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 28px 0;
}
code { font-family: var(--font-mono); font-size: .875em; }

/* ── Loader Spinner ─────────────────────────────────────────── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 60px;
}
.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .blog-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .post-card-img { height: 280px; border-radius: var(--radius) var(--radius) 0 0; }
}
@media (max-width: 768px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .posts-grid { grid-template-columns: 1fr; }
  .posts-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .newsletter-form { flex-direction: column; }
  .newsletter-box { padding: 36px 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .posts-grid-4 { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
}
