/* Base tokens and global styles */
:root {
  --bg: #0a1a3a;
  --bg-2: #0a2b66;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-2: rgba(255, 255, 255, 0.14);
  --text: #e9f3ff;
  --muted: #b9d4ff;
  --accent: #58c3ff;
  --accent-2: #bfe8ff;
  --border: rgba(255, 255, 255, 0.25);
  --shadow: 0 8px 24px rgba(0,0,0,.28);
  --radius: 14px;
  --radius-sm: 12px;
  --gap: 1rem;
  --focus: 3px solid var(--accent-2);
}

html, body {
  height: 100%;
}

html, body, header, nav, main, article, footer, aside {
  box-sizing: border-box;
}

/* Layered, performance-friendly background (gradient + subtle scanlines) */
body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.6;
  background:
    linear-gradient(135deg, #0b1a3a 0%, #0b2b66 60%, #0a1b37 100%),
    radial-gradient(circle at 20% 0%, rgba(80,180,255,.25), transparent 40%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,.04) 0 1px, transparent 1px 2px);
  background-color: #0a1a3a;
  background-blend-mode: screen, overlay, normal;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Subtle blue energy wave overlay for cyberpunk feel */
body::before {
  content: "";
  position: fixed;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background: radial-gradient(circle at 60% 20%, rgba(60,180,255,.25), transparent 40%),
              radial-gradient(circle at 20% 80%, rgba(120,200,255,.15), transparent 40%);
  filter: blur(60px);
  z-index: -1;
  animation: drift 40s linear infinite;
  pointer-events: none;
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0); opacity: .9; }
  50% { transform: translate3d(-15px, 10px, 0); opacity: .75; }
  100% { transform: translate3d(0, 0, 0); opacity: .9; }
}

/* Layout helpers */
.container {
  width: 90%;
  max-width: clamp(680px, 92vw, 1120px);
  margin: 0 auto;
  padding: 0 0.5rem;
}

/* Header (glass) */
header {
  margin: 1.25rem auto;
  padding: 1.75rem 1rem;
  text-align: center;
  border-radius: calc(var(--radius) + 4px);
  background: rgba(8, 16, 40, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  max-width: 1080px;
  width: 100%;
}

header h1 {
  margin: 0 0 .35rem;
  font-size: clamp(1.8rem, 3vw + 0.5rem, 3.2rem);
  line-height: 1.05;
  letter-spacing: .2px;
}
header .meta {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
}

/* Main content and article styling */
main {
  padding: 1rem 0 2rem;
  display: grid;
  place-items: center;
}

article {
  width: 100%;
  max-width: 1080px;
  padding: 0;
  margin: 0;
  display: block;
}

/* Glass content panel (fallback-friendly) */
article {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Featured image frame (uses .image-frame pattern for compatibility) */
.image-frame, .featured-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .28);
  background: #0a1b2b;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
  margin: .5rem 0 1rem;
}
.image-frame img, .featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: translateZ(0);
}
.image-frame { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
@media (prefers-reduced-motion: reduce) {
  .image-frame, .featured-image { animation: none; }
}
  
/* Content typography helpers */
.content {
  color: var(--text);
  font-size: clamp(0.95rem, 1vw + 0.95rem, 1.08rem);
  line-height: 1.6;
}
h2, h3 {
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: .5rem;
}
p { margin: 0 0 1rem; }

ul, ol { margin: 0 0 1rem 1.25rem; padding: 0; }

/* Link and button styles (accessibility) */
a, button, .btn, .cta {
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  display: inline-block;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(120,200,255,.65);
  background: rgba(80,160,255,.25);
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
  cursor: pointer;
  font-weight: 600;
}
a:hover, button:hover, .btn:hover, .cta:hover {
  transform: translateY(-1px);
  text-decoration: underline;
  background: rgba(110,190,255,.32);
}
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0 transparent;
  border-color: rgba(140,210,255,.95);
  outline: var(--focus);
  outline-offset: 2px;
  background: rgba(80,170,255,.5);
}
a:focus-visible { text-decoration: underline; }

/* Outline variant helper (for sections that might use a link-styled CTA) */
.btn--outline {
  background: transparent;
  border: 1px solid rgba(120,200,255,.85);
  color: var(--text);
}
.btn--outline:hover { background: rgba(120,200,255,.15); }

/* Utility grid and cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
}
.card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tag {
  display: inline-block;
  font-size: .75rem;
  padding: .25em .5em;
  border-radius: 999px;
  background: rgba(60,180,255,.25);
  color: var(--text);
  border: 1px solid rgba(120,200,255,.6);
}

/* Image frame fallback for any generic image areas */
.image-frame, .image-frame img { }

.image-frame { position: relative; }

/* Footer and ads (glass panels) */
footer {
  padding: 1.25rem 1rem 2rem;
  display: grid;
  gap: 1rem;
  justify-items: center;
}
footer > .product-ad, footer > .sponsored-page {
  width: min(100%, 1080px);
  display: inline-block;
}
footer .product-ad a, footer .sponsored-page a {
  text-align: center;
  width: 100%;
}
footer p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}
.sponsored-page { justify-self: center; }

/* Print styles (basic readability) */
@media print {
  body { background: #fff; color: #000; }
  header, main, footer { background: transparent; box-shadow: none; }
  a { text-decoration: underline; color: #000; }
}
  
/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}