/* 1. Base tokens & resets */
:root {
  --bg: #f7f2e0;            /* parchment-like paper (light) */
  --bg-2: #f2ead2;
  --text: #0b1020;
  --muted: #4b5a85;
  --accent: #3b82f6;         /* primary blue */
  --accent-2: #93c5fd;        /* secondary blue */
  --glass: rgba(255,255,255,.14);
  --glass-strong: rgba(255,255,255,.28);
  --border: rgba(60,110,180,.45);
  --shadow: 0 6px 20px rgba(0,0,0,.25);
  --radius: 14px;
  --container: min(1100px, 92vw);
  --focus: 3px solid #fff;
}
html, body, header, nav, main, article, footer, aside { outline-color: transparent; }
* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  isolation: isolate;
  /* Layered background: gradient + subtle scanline/noise */
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.05)),
    linear-gradient(135deg, rgba(40,90,180,.25), rgba(0,0,0,0) 60%),
    var(--bg);
  background-blend-mode: overlay, overlay, normal;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1a;
    --bg-2: #111725;
    --text: #e8f0ff;
    --muted: #9fb8ff;
    --accent: #4cc9f0;
    --accent-2: #87d0ff;
    --glass: rgba(255,255,255,.08);
    --glass-strong: rgba(255,255,255,.18);
    --border: rgba(100,150,255,.45);
    --shadow: 0 8px 28px rgba(0,0,0,.5);
  }
}
@media (prefers-color-scheme: light) {
  :root {
    /* keep parchment look on light; nothing drastic needed here */
  }
}
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
body::before {
  /* subtle noise-like layer */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,.08) 1px, transparent 1px),
    radial-gradient(circle at 40px 40px, rgba(255,255,255,.12) 2px, transparent 2px);
  background-size: 4px 4px, 40px 40px;
  opacity: .18;
  mix-blend-mode: overlay;
}
body::after {
  /* faint scanline effect */
  background-image: linear-gradient(to bottom, rgba(0,0,0,.04) 0 1px, transparent 1px 2px);
  background-size: 100% 2px;
  opacity: .25;
  mix-blend-mode: multiply;
}

/* 2. Layout utilities */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@supports not ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .card { background: var(--glass-strong); }
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .25em .6em;
  font-size: .75rem;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,.6);
  background: rgba(59,130,246,.25);
  color: var(--text);
}

/* 3. Core surfaces (glass panels) */
header,
nav,
main,
article,
aside,
footer {
  display: block;
  position: relative;
}
header,
.article-glass,
.main-glass,
footer-glass { /* kept for potential semantic hooks; not required by HTML */ }

/* Core glass treatment applied to key sections */
header,
footer,
article {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
@supports not ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  header,
  footer,
  article {
    background: rgba(255,255,255,.92);
  }
}
header {
  text-align: center;
  padding: 1.5rem 1rem;
  margin: 1rem auto;
}
header h1 {
  margin: 0.25rem 0;
  font-size: clamp(1.8rem, 1.2vw + 1.4rem, 3rem);
  line-height: 1.04;
  letter-spacing: .2px;
}
header .meta {
  margin-top: .25rem;
  color: var(--muted);
  font-size: clamp(0.8rem, 0.8vw + 0.5rem, 1rem);
}

/* 4. Page sections & content */
main {
  padding: 1rem 0 2rem;
}
article {
  max-width: var(--container);
  margin: 0 auto;
}
.image-frame {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(60,120,255,.55);
  background: #0b1020;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}
h2 {
  font-size: clamp(1.25rem, 0.8vw + 1rem, 2rem);
  margin: 1rem 0 .5rem;
}
p {
  margin: .75rem 0;
  color: var(--text);
}
ul {
  margin: .75rem 0 1.25rem 1.25rem;
  color: var(--text);
}
li { margin: .4rem 0; }

/* 5. CTAs, links, and interactive elements */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover,
a:focus-visible {
  text-decoration: underline;
}
a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Buttons / CTAs (solid & outline variants) */
.btn,
.cta,
a.btn,
a.cta {
  display: inline-block;
  padding: .75em 1.25em;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,.7);
  background: rgba(59,130,246,.85);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.btn:hover,
.cta:hover,
a.btn:hover,
a.cta:hover {
  transform: translateY(-1px);
  background: rgba(59,130,246,.95);
}
.btn:focus-visible,
.cta:focus-visible,
a.btn:focus-visible,
a.cta:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.btn.outline,
a.btn.outline,
.btn-outline,
a.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(59,130,246,.8);
}
.btn.outline:hover,
a.btn.outline:hover {
  background: rgba(59,130,246,.08);
}
.product-ad {
  display: block;
  margin: .75rem 0;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--border);
  text-align: center;
}
.product-ad a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .6em 1.1em;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: rgba(59,130,246,.75);
  border: 1px solid rgba(80,140,255,.9);
}
.product-ad a:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* Magazine-like lists */
ol, ul { padding-left: 1.25rem; }

/* 6. Header/section-specific styles (navigation could be added if present) */
nav { display: block; }

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

/* 8. Print styles */
@media print {
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
  header, main, article, footer { background: none; border: none; box-shadow: none; }
  .image-frame { page-break-inside: avoid; }
}
