/* Token Palette */
:root {
  --bg: #0a0a1a;
  --bg-2: #1a0e2a;
  --bg-3: #0b0a20;
  --text: #eaf6ff;
  --muted: #b6bfd1;
  --accent: #39ff78;
  --accent-2: #7affc3;
  --card: rgba(255, 255, 255, 0.08);
  --card-opaque: rgba(0, 0, 0, 0.25);
  --border: rgba(255, 255, 255, 0.25);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --radius-sm: 10px;
  --focus: 0 0 0 3px rgba(57, 255, 120, 0.55);
  --gap: 1rem;
  --maxw: clamp(320px, 92vw, 1100px);
}

/* Base / Layout (Mobile-First) */
* { box-sizing: border-box; }
html { font-size: clamp(14px, 1.2vw + 8px, 18px); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-system, system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, rgba(60,0,120,.95) 0%, rgba(12,0,40,.95) 60%, rgba(0,60,40,.95) 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  isolation: isolate;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 4px; outline: none; }

/* Layered background: subtle galactic gradient + CSS noise/scanlines (pure CSS) */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
body::before {
  background: 
    radial-gradient(circle at 20% 12%, rgba(0,255,128,.14) 0 25%, transparent 26%),
    radial-gradient(circle at 70% 40%, rgba(100,0,200,.10) 0 25%, transparent 26%),
    linear-gradient(135deg, rgba(60,0,120,.85), rgba(0,0,0,.0) 60%);
  mix-blend-mode: screen;
  opacity: 0.9;
  filter: saturate(110%);
}
body::after {
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.04) 0 1px, transparent 1px 2px);
  opacity: 0.6;
  mix-blend-mode: overlay;
  filter: saturate(90%);
}
@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none !important; }
  * { transition: none !important; animation: none !important; }
}

/* Fluid container & utilities */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--gap);
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@supports not (backdrop-filter: blur(12px)) {
  .card { background: rgba(255,255,255,.12); }
}
header, main, footer, aside { display: block; }

/* Header / Hero styling (glass panel look) */
header {
  padding: 1rem;
  margin: 1rem auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
header h1 {
  font-size: clamp(1.4rem, 1.6vw + 1rem, 2.5rem);
  line-height: 1.08;
  margin: 0 0 .25rem;
  font-weight: 900;
  letter-spacing: .2px;
}
header .meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 .75rem;
}
nav a { display: inline-flex; align-items: center; padding: .4rem .6rem; border-radius: 999px; }
nav a:hover { text-decoration: underline; }

/* Main article content layout */
main {
  padding: 0.5rem 0 1rem;
}
article { width: 100%; }

/* Featured image framing (image-frame fallback for requirement) */
.featured-image {
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: var(--shadow);
}
.featured-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
.image-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.image-frame img { width: 100%; height: 100%; object-fit: cover; }

/* Typography & content helpers */
.content { color: var(--text); }
h2 { font-size: clamp(1.25rem, 1.2vw + 1rem, 2rem); margin: .75rem 0 .5rem; }
p { color: var(--muted); line-height: 1.6; margin: .5rem 0 1rem; }
blockquote {
  border-left: 4px solid var(--accent);
  padding: .25rem 0 .25rem .75rem;
  margin: .5rem 0 1rem;
  color: #eafff5;
  font-style: italic;
  background: rgba(0,0,0,.15);
}
ul { padding-left: 1.25rem; margin: .25rem 0 1rem; }
li { margin: .25rem 0; }

/* Link and button accessibility */
a, button, .btn, .cta {
  cursor: pointer;
  transition: transform .18s ease, background-color .2s ease, color .2s ease;
  font-weight: 600;
}
a { text-decoration: none; color: var(--accent-2); }
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  outline-offset: 0;
}
.btn, .cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .7rem 1.1rem;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #062b12;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(57,255,120,.8);
}
.btn.secondary:hover { background: rgba(255,255,255,.08); }

/* Utility / content blocks in footer regions */
.product-ad, .sponsored-page {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  padding: .75rem;
  text-align: center;
  box-shadow: var(--shadow);
  text-decoration: none;
}
.product-ad p, .sponsored-page p { margin: 0; font-size: 1rem; line-height: 1.25; }
footer {
  padding: 1rem 0 2rem;
  border-top: 1px solid rgba(255,255,255,.15);
}
footer p { text-align: center; color: var(--muted); font-size: .9rem; margin: .75rem 0 0; }

/* Layout helpers (grid / card / tag) */
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); }
.card { display: block; padding: .75rem; }

/* Tag chips (tiny UI) */
.tag {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  background: rgba(0,0,0,.25);
  color: #eafff6;
  border: 1px solid rgba(255,255,255,.25);
}

/* Print styles (basic readability) */
@media print {
  body { background: #fff; color: #000; }
  a { text-decoration: underline; color: #000; }
}

/* Reduced motion when user prefers it */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}