/* Palette & Layers */
:root {
  --bg: #1a0f0a;            /* rich brown foundation */
  --bg-2: #25120b;           /* secondary brown accent */
  --surface: rgba(26, 12, 7, 0.34); /* glass surface fallback (backdrop) */
  --text: #e9e3d8;            /* high-contrast on dark */
  --muted: #b9a990;           /* subdued body text */
  --accent: #4b50c9;           /* indigo primary */
  --accent-2: #8a72ff;         /* lighter indigo for emphasis */
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.25);
  --shadow: 0 6px 20px rgba(0,0,0,0.40);
  --focus: 2px solid var(--accent);
}

:root, * { box-sizing: border-box; }
html, body { height: 100%; }

/* Layered background: gradient + subtle scanlines/noise (pure CSS) */
html, body {
  background: 
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 60%, #0a0502 100%);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  margin: 0;
  line-height: 1.6;
  position: relative;
  isolation: isolate;
}
html::before, body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
html::before {
  /* faint noise + subtle vertical scanlines for depth */
  background:
    linear-gradient(180deg, rgba(0,0,0,0.0) 0, rgba(0,0,0,0.08) 100%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.04) 0 1px, transparent 1px 2px);
  mix-blend-mode: overlay;
  opacity: 0.35;
}
body::before {
  /* additional soft bloom to simulate glow */
  background: radial-gradient(circle at 20% 0%, rgba(255,255,255,0.06), transparent 40%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.04), transparent 40%);
  opacity: 0.25;
  filter: saturate(0.95);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5efe8;
    --bg-2: #efe4d8;
    --surface: rgba(255,255,255,0.75);
    --text: #1b1b1b;
    --muted: #585a59;
    --accent: #4b50c9;
    --accent-2: #7a5bd9;
    --card: rgba(255,255,255,0.85);
    --card-border: rgba(0,0,0,0.15);
  }
  html::before { opacity: 0.4; }
  body::before { opacity: 0.5; }
}

/* Layout & typography (mobile-first) */
* { -webkit-tcry: none; -ms-text-size-adjust: 100%; text-size-adjust: 100%; }

:where(html, body) { height: 100%; }

/* Global containers & utilities */
.container {
  max-width: clamp(320px, 92vw, 1120px);
  margin-inline: auto;
  padding-inline: 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.card.secondary {
  background: rgba(0,0,0,0.12);
}
.tag {
  display: inline-block;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(75, 96, 201, 0.42);
  border: 1px solid rgba(255,255,255,0.25);
}
.image-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  background: #000;
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Core content areas (as required selectors) */
html, body, header, nav, main, article, footer, aside {
  /* structural defaults; individual sections styled below */
}
header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
header h1 {
  font-size: clamp(1.75rem, 2.6vw + 1rem, 3rem);
  line-height: 1.05;
  margin: 0.25rem 0 0.25rem;
  font-weight: 700;
  letter-spacing: .4px;
}
header .meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: clamp(0.75rem, 0.8vw + 0.6rem, 0.95rem);
}

/* Main article content with glassy panels where appropriate */
main {
  padding: 1rem 0 2rem;
}
.featured-image { margin: 0 0 1rem; }
article {
  color: var(--text);
}
article h2 {
  font-size: 1.75rem;
  margin: 0.75rem 0 0.5rem;
}
article h3 {
  font-size: 1.25rem;
  margin-top: 1rem;
}
article p {
  color: var(--text);
  margin: 0.5rem 0;
  line-height: 1.6;
}
blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: rgba(75, 96, 201, 0.15);
  border-radius: 6px;
}
ul {
  padding-left: 1.15rem;
  margin: 0.75rem 0;
}
li { margin: 0.25rem 0; }

/* Glass panels (fallback + backdrop-filter) */
.card, .product-ad, .sponsored-page {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}
.product-ad {
  padding: 0.75rem;
  display: inline-block;
  margin: 0.25rem;
}
.product-ad a {
  color: #fff;
  text-decoration: none;
}
.product-ad a:hover, .sponsored-page a:hover, a:hover, button:hover, .cta:hover {
  text-decoration: underline;
  color: var(--accent-2);
}
a, button, .btn, .cta {
  color: #fff;
  text-decoration: none;
  outline: none;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}
a, button, .btn, .cta {
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.btn, .cta {
  display: inline-block;
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.28);
  background: linear-gradient(135deg, rgba(75,96,201,0.95), rgba(86,65,201,0.95));
  color: #fff;
  text-align: center;
  cursor: pointer;
}
.btn:hover, .cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}
.btn:active, .cta:active {
  transform: translateY(0);
  opacity: 0.95;
}
.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.6);
}
.btn:focus-visible, .btn--outline:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
}
.cta {
  font-weight: 600;
}
.image-frame + p { margin-top: .25rem; color: var(--muted); }

/* Content utility */
.content { padding: 0.5rem 0; }

/* Footer / Ad sections */
footer {
  padding: 1.25rem;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 1rem;
}
footer p {
  color: var(--muted);
  font-size: 0.92rem;
}
footer .sponsored-page {
  display: inline-block;
  margin: 0 0.5rem;
}
footer .product-ad {
  display: inline-block;
  margin: 0.5rem;
}

/* Image helpers for potential other frames */
@media (min-width: 700px) {
  .container { padding-inline: 1.25rem; }
  header h1 { letter-spacing: 0.6px; }
}

/* Grid & utility helpers for responsive sections (auto-fit) */
@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Print styles (basic readability) */
@media print {
  html, body {
    background: #fff;
    color: #000;
  }
  a, button { color: #000; text-decoration: none; }
  .card, .product-ad { background: #fff; border: 1px solid #ddd; }
}
