/* Tokens & Base
   - Indigo + Brown themed, dark cyber default
*/
:root {
  --bg: #0b1020;
  --bg-2: #14162e;
  --text: #e9e3ff;
  --muted: #b5a9b6;
  --accent: #4f46e5;      /* indigo */
  --accent-2: #8b5e2b;    /* brown */
  --surface: rgba(14, 10, 28, 0.72);
  --surface-2: rgba(14, 10, 28, 0.88);
  --border: rgba(255, 255, 255, 0.28);
  --glass: rgba(20, 12, 40, 0.66);
  --card: rgba(16, 12, 28, 0.72);
  --shadow: 0 8px 22px rgba(0,0,0,.32);
  --radius: 14px;
}

/* 1. Global resets & layered background */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

html, body, header, nav, main, article, footer, aside {
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  /* Layered background: gradient + subtle scanlines + soft noise vibe */
  background-image:
    linear-gradient(135deg, rgba(9,6,20,.92), rgba(8,6,18,.92)),
    repeating-linear-gradient(to bottom, rgba(255,255,255,.04) 0 1px, transparent 1px 2px),
    repeating-linear-gradient(to right, rgba(255,255,255,.04) 0 1px, transparent 1px 2px);
  background-blend-mode: normal, overlay, overlay;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  overflow-x: hidden;
  /* Respect prefers-color-scheme below for light mode tweaks */
}

/* Subtle, GPU-friendly motion handling */
@media (prefers-reduced-motion: reduce) {
  html, body { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* 2. Layout helpers */
.container {
  width: 100%;
  max-width: clamp(320px, 88vw, 1120px);
  margin-inline: auto;
  padding-inline: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: var(--shadow);
}

/* 3. Glass panels (fallback included) */
header, main, footer, aside {
  background: rgba(12, 8, 28, 0.66);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 1rem;
  position: relative;
  z-index: 0;
}

/* Fallback for environments without backdrop-filter */
@supports not ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  header, main, footer, aside {
    background: rgba(12,8,28,.82);
    border-color: rgba(255,255,255,.45);
  }
}

/* 4. Typography scale (fluid) */
h1, h2, h3 {
  margin: 0 0 .5rem;
  color: #fff;
  line-height: 1.15;
}
h1 {
  font-size: clamp(1.75rem, 2.4vw + 1rem, 2.95rem);
  letter-spacing: .2px;
}
p {
  margin: 0 0 1rem;
  color: var(--muted);
}
.content {
  padding: 0.25rem 0 0;
  color: var(--text);
}

/* 5. Image frame styling */
.image-frame {
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  margin: 1rem auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
  background: #000;
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
  /* subtle glow on edges for depth */
  filter: saturate(1.05);
}
.content img { max-width: 100%; height: auto; }

/* 6. Links, buttons, and interactive elements (focus accessible) */
a, button, .btn, .cta {
  font-family: inherit;
  color: #fff;
  text-decoration: none;
  outline: none;
}
a { color: var(--accent); }
a:hover, a:focus { text-decoration: underline; text-underline-offset: 2px; }

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

/* Button variants */
.btn {
  display: inline-block;
  padding: .68rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.42);
  background: linear-gradient(135deg, rgba(79,70,229,.95), rgba(60,40,180,.95));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }

.btn.outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,.6);
  color: var(--text);
}
.cta { padding: .8rem 1.2rem; border-radius: 10px; border: 1px solid rgba(255,255,255,.45); background: rgba(0,0,0,.25); }

/* 7. Misc helpers / utilities */
ul { margin: 0; padding-left: 1.25rem; }
li { margin: .25rem 0; }

/* tag chips */
.tag {
  display: inline-block;
  padding: .15em .6em;
  border-radius: 999px;
  font-size: .75rem;
  background: rgba(79,70,229,.25);
  color: #e9e6ff;
  border: 1px solid rgba(255,255,255,.3);
}

/* 8. Layout specifics for provided HTML structure
   - Centered container, hero header, image block, and grid footer items
*/
header {
  text-align: center;
  max-width: 1100px;
  margin: 1rem auto;
  padding: 1.25rem;
}
header h1 { margin: 0; font-weight: 700; }

/* main content wrapper (article) */
main { padding: 0.5rem 0 1rem; }

/* footer sections (product-ad, sponsored-page) */
footer {
  padding: 0.75rem 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  align-items: stretch;
  max-width: 1100px;
  margin: 0.5rem auto 1.25rem;
}
.product-ad a, .sponsored-page a {
  display: block;
  text-align: center;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(12, 8, 28, 0.65);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
  transition: transform .2s ease, background .2s ease;
}
.product-ad a:hover { transform: translateY(-2px); background: rgba(12,8,28,.75); }
.sponsored-page a { background: rgba(8,8,12,.7); }
footer p { text-align: center; color: var(--muted); margin: .25rem 0 0; }

/* 9. Print styles (basic readability) */
@media print {
  body { background: #fff; color: #000; }
  header, main, footer { background: transparent; border: none; box-shadow: none; }
  a { text-decoration: underline; }
}
  
/* 10. Light-mode tweaks (prefers-color-scheme) */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f3f8;
    --bg-2: #e9e2ef;
    --text: #0b1020;
    --muted: #4a4552;
    --accent: #4f46e5;
    --accent-2: #8b5e2b;
    --glass: rgba(255,255,255,.75);
    --card: rgba(255,255,255,.85);
    --border: rgba(0,0,0,.15);
  }
  body {
    background-image:
      linear-gradient(135deg, rgba(255,255,255,.9), rgba(245,245,255,.9)),
      repeating-linear-gradient(to bottom, rgba(0,0,0,.04) 0 1px, transparent 1px 2px),
      repeating-linear-gradient(to right, rgba(0,0,0,.04) 0 1px, transparent 1px 2px);
    color: var(--text);
  }
  header, main, footer { background: rgba(255,255,255,.75); border-color: rgba(0,0,0,.15); }
  a { color: var(--accent); }
  .btn { background: linear-gradient(135deg, rgba(79,70,229,.9), rgba(60,40,200,.95)); }
}