/* Base tokens */
:root {
  --bg: #0a102f;
  --bg-2: #141a3a;
  --text: #e9e6ff;
  --muted: #c9c5e0;
  --accent: #7a6bff;
  --accent-2: #8a3aff;
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.28);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  --ring: 0 0 0 3px rgba(122, 106, 255, 0.75);
  --space: 1rem;
}

/* Section: Base */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { line-height: 1.4; }
body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  /* Layered background: gradient + grid paper + subtle noise */
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.04), rgba(255,255,255,0) 40%),
    linear-gradient(135deg, rgba(10,14,38,.95), rgba(8,6,20,.95)),
    repeating-linear-gradient(to right, rgba(122,106,255,.22) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(to bottom, rgba(122,106,255,.22) 0 1px, transparent 1px 40px);
  background-blend-mode: overlay, overlay, normal, normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

/* Section: Layout utilities */
.container {
  width: 100%;
  max-width: clamp(320px, 90vw, 1100px);
  margin-inline: auto;
  padding-inline: 1rem;
}
.grid {
  display: grid;
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
@supports not (backdrop-filter: blur(12px)) {
  .card { background: rgba(255,255,255,.14); }
}
header, main, footer, aside { display: block; }

/* Section: Typography & headings */
h1, h2, h3 { margin: 0 0 .5rem 0; font-weight: 700; color: var(--text); }
h1 { font-size: clamp(2rem, 2.6vw + 1rem, 3.5rem); line-height: 1.05; letter-spacing: .2px; }
h2 { font-size: clamp(1.4rem, 1.2vw + 1rem, 2.2rem); line-height: 1.15; }
p { color: var(--muted); font-size: clamp(1rem, .6vw + .9rem, 1.125rem); line-height: 1.6; margin: .5rem 0 1rem; }
blockquote {
  margin: .5rem 0 1rem;
  padding: .75rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
  background: rgba(122,106,255,.08);
}
ul { margin: .5rem 0 1rem 1.25rem; padding: 0; color: var(--muted); }

/* Section: Background helpers (for printed focus+contrast) */
@media print {
  body { background: #fff; color: #000; }
  a { text-decoration: underline; }
}

/* Section: Interactive controls */
a, button, .btn, .cta {
  color: inherit;
  text-decoration: none;
}
a { color: var(--accent); }
a:hover, a:focus { text-decoration: underline; color: var(--accent-2); }

/* Primary/secondary controls */
.btn, .cta {
  display: inline-block;
  padding: .75rem 1.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.45);
  background: linear-gradient(to bottom right, rgba(122,106,255,.95), rgba(138,58,255,.85));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 4px 12px rgba(0,0,0,.25);
}
.btn:hover, .cta:hover { transform: translateY(-1px); }
.btn:active, .cta:active { transform: translateY(0); }
.btn.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(122,106,255,.75);
  box-shadow: none;
}
.btn:focus-visible, .cta:focus-visible, a:focus-visible, button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  outline-offset: 2px;
}
.ghost { background: transparent; border-color: rgba(255,255,255,.3); }

/* Section: Image frame styling */
.image-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.28);
  background: #0b0f22;
  display: block;
  margin: 0;
  box-shadow: inset 0 0 12px rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.25);
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
}
@media (max-width: 720px) {
  .image-frame { border-radius: 12px; }
}

/* Section: Content area */
.content {
  padding: 0;
  color: var(--text);
}
.content p, .content ul, .content ol { margin-block: .5rem 1rem; }

/* Section: Page structure selectors (as required) */
html, body, header, nav, main, article, footer, aside {
  /* structural defaults handled above; leaving rule blocks for clarity. */
}

/* Section: Product ad & utility blocks */
.product-ad, .sponsored-page {
  display: block;
  width: max-content;
  padding: .5rem .75rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(0,0,0,.15);
  text-align: center;
  color: #fff;
}
.product-ad a, .sponsored-page a {
  color: #fff;
  text-decoration: none;
}
.product-ad:hover, .sponsored-page:hover {
  transform: translateY(-1px);
}
footer p {
  color: var(--muted);
  font-size: .9rem;
  margin: 0.5rem 0 0;
}

/* Section: Responsive layout helpers */
@media (min-width: 720px) {
  main { padding: 1.25rem 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (max-width: 599px) {
  h1 { text-align: center; }
  header { padding: 1.25rem 0; }
}
