/* Section: Theme tokens */
:root{
  --bg: #0b0f1a;
  --bg-2: #14192a;
  --text: #eef2ff;
  --muted: #c7c4d8;
  --accent: #7e5cff;
  --accent-2: #4b2db2;
  --surface: rgba(18, 18, 28, 0.72);
  --glass-border: rgba(140,120,200,0.55);
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --focus: 2px solid #93e0ff;
}

/* Section: Base & Utilities */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; }
body {
  margin: 0;
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Layered galaxy background: gradient + scanlines + soft glow */
  background:
    linear-gradient(135deg, rgba(14,9,22,0.95) 0%, rgba(15,9,28,0.92) 60%, rgba(9,9,20,0.92) 100%),
    radial-gradient(circle at 20% 0%, rgba(124,92,255,0.20), transparent 40%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.04) 0 1px, transparent 1px 2px);
  background-blend-mode: normal, overlay, overlay;
  color-scheme: dark;
  padding-block: 1rem;
  /* Reduce motion respect */
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  body { background-attachment: scroll; animation: none !important; }
}

/* Section: Layout helpers */
.container {
  width: min(100%, calc( clamp(360px, 90vw, 1100px) ));
  margin-inline: auto;
  padding-inline: 1rem;
}
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(18,18,28,0.72);
  border: 1px solid rgba(180,170,210,0.28);
  box-shadow: var(--shadow);
}
.tag {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0d0b1a;
  background: linear-gradient(135deg, #c8b9ff 0%, #8b7cff 100%);
}
.image-frame { border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,0.25); box-shadow: 0 6px 16px rgba(0,0,0,0.4); background: #0b0b12; }
.image-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Section: Typographic scale (responsive) */
h1, h2, h3, h4 { color: var(--text); letter-spacing: .2px; }
h1 { font-size: clamp(1.8rem, 2.6vw + 1rem, 3.6rem); line-height: 1.08; margin: .25rem 0 0.5rem; }
h2 { font-size: clamp(1.4rem, 1.6vw + 1rem, 2.4rem); margin: .75rem 0 0.25rem; }
h3 { font-size: clamp(1.1rem, 1vw + 0.9rem, 1.6rem); margin: .75rem 0 0.25rem; }
p { margin: 0.5rem 0 1rem; color: var(--muted); }
blockquote { margin: 1rem 0; padding: .75rem 1rem; border-left: 3px solid var(--accent); background: rgba(126, 92, 255, 0.15); border-radius: 6px; color: #f5f4ff; }

/* Section: Glass panels (fallback + backdrop-filter) */
.glass {
  background: rgba(12,12,22,0.22);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1rem;
}
@supports not (backdrop-filter: blur(12px)) {
  .glass { background: rgba(12,12,22,0.34); border-color: rgba(140,120,200,0.6); }
}

/* Section: Structural elements (selectors required) */
html, body, header, nav, main, article, footer, aside {
  /* ensure semantic targets are present for styling */
}
.image-frame, .image-frame img { }

/* Section: Content wrappers */
.content {
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(20,20,28,0.65);
  border: 1px solid rgba(180,160,240,0.28);
}
@supports not (backdrop-filter: blur(8px)) {
  .content { background: rgba(20,20,28,0.88); }
}

/* Section: Specific components from the markup */
.header, header {
  padding: 1.75rem 0 1rem;
  text-align: center;
}
header h1 { margin-bottom: 0.25rem; }
header .meta { color: var(--muted); font-size: 0.85rem; }

/* Target navigation */
nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}
nav a:hover, nav a:focus-visible { text-decoration: underline; outline: none; }

/* Main content area */
main { padding: 1rem 0 2rem; }

/* Article content styling (readable glass panel feel) */
article { max-width: 700px; margin-inline: auto; }

/* Section: Interactive elements (a, button, .btn, .cta) */
a, button, .btn, .cta {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s;
}
a { color: var(--accent-2); }
a:hover, a:focus-visible { text-decoration: underline; color: #fff; outline: none; }

/* Primary and secondary button styles */
.btn, .cta {
  padding: 0.75em 1.25em;
  display: inline-block;
  line-height: 1;
}
.btn { background: rgba(0,0,0,0.2); color: #fff; border-color: rgba(255,255,255,0.25); }
.btn.primary, .cta { background: var(--accent); color: #fff; border-color: rgba(0,0,0,0.15); }
.btn.secondary { background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.22); }

/* Hover/Active states with subtle lift */
.btn:hover, .cta:hover { transform: translateY(-1px); }
.btn:active, .cta:active { transform: translateY(0); }

/* Focus visible ring for accessibility */
:focus-visible { outline: 2px solid #93e0ff; outline-offset: 2px; border-radius: 6px; }

/* Section: Lists & markup defaults */
ul { padding-left: 1.25rem; color: var(--muted); }
li { margin: .25rem 0; }
li strong { color: #fff; }

/* Section: Footer & product-ad styling (glass panels) */
footer { padding: 1.5rem 0; text-align: center; color: var(--muted); }
.product-ad, .sponsored-page { margin: 0.5rem auto; width: min(100%, 540px); }
.product-ad a, .sponsored-page a { display: block; padding: 0.75rem; text-decoration: none; border-radius: 12px; }

/* Apply glass styling to panels in footer for theme coherence */
.product-ad { background: rgba(12,12,22,0.65); border: 1px solid rgba(140,120,200,0.5); box-shadow: var(--shadow); }
.sponsored-page { background: rgba(12,12,22,0.65); border: 1px solid rgba(140,120,200,0.5); box-shadow: var(--shadow); }

/* Print: basic readability */
@media print {
  body { background: #fff; color: #000; }
  .gloss, .glass, .content, .image-frame { background: transparent; border: none; box-shadow: none; }
}
