/* 1) Theme Tokens (royal blue + gunmetal) */
:root{
  --bg: #0a0f1a;
  --bg-2: #0b1220;
  --text: #eaf2ff;
  --muted: #a9b6d1;
  --accent: #4169e1;      /* royal blue */
  --accent-2: #88b5ff;
  --surface: rgba(16,24,40,.22);
  --surface-2: rgba(18,28,60,.28);
  --panel: rgba(255,255,255,.08);
  --panel-2: rgba(200,210,255,.25);
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0,0,0,.5);
}

/* 2) Base & Layout */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
body {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  /* Layered background: gradient + subtle scanlines */
  background:
    radial-gradient(circle at 20% 0%, rgba(65,105,225,.15) 0%, transparent 40%),
    linear-gradient(135deg, #0a0f1a 0%, #0b1220 60%, #0a0b14 100%),
    repeating-linear-gradient(to bottom, rgba(255,255,255,.04) 0 1px, transparent 1px 4px);
  background-attachment: fixed;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 3) Structural selectors (header/main/article/aside/nav/footer) */
html, body, header, nav, main, article, aside, footer { }
header { padding: 2rem 1rem; text-align: center; }
main { padding: 1rem; }
footer { padding: 1rem; }

/* 4) Tokens for type scale & helpers */
.container { width: 100%; max-width: clamp(320px, 90vw, 1100px); margin-inline: auto; padding: 0 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card { background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius); padding: 1rem; }

/* 5) Image frame (aspect, glow, border) */
.image-frame { border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.3); display: block; aspect-ratio: 16/9; box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.image-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 6) Content panels (glass / frosted) */
.content {
  background: rgba(16,24,40,.22);
  border: 1px solid rgba(150,170,255,.3);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px);
}
@supports not (backdrop-filter: blur(12px)) {
  .content { background: rgba(16,24,40,.6); border-color: rgba(150,170,255,.5); }
}

/* 7) Glass panel fallback for high visibility (existing in WCAG contexts) */
.panel { background: var(--panel); border: 1px solid var(--panel-2); border-radius: var(--radius); padding: .75rem; }

/* 8) Product ad / promo blocks */
.product-ad { display: block; margin: .75rem 0; padding: .75rem; text-align: center; border-radius: 10px; background: rgba(30,60,140,.25); border: 1px solid rgba(120,160,240,.6); }
.product-ad a { color: #fff; text-decoration: none; display: inline-block; padding: .5rem 1rem; background: rgba(65,105,225,.92); border-radius: 6px; }
.product-ad a:hover { filter: brightness(1.05); }

/* 9) Typographic scale & content lists */
h1, h2 { color: var(--text); margin: 0.4em 0; }
h1 { font-size: clamp(2rem, 3vw + 1rem, 3.6rem); line-height: 1.04; }
h2 { font-size: clamp(1.25rem, 1.8vw + 1rem, 2.2rem); }
p { font-size: clamp(0.95rem, 0.8vw + .9rem, 1.15rem); margin: .25em 0 1em; color: var(--text); }
blockquote { font-style: italic; color: var(--muted); border-left: 2px solid rgba(120,170,255,.5); padding-left: .75rem; margin: .75rem 0; }

/* 10) Lists */
ul, li { margin: 0; padding: 0 0 0 1.25rem; }
li { margin: .25rem 0; color: var(--muted); }

/* 11) Interactive controls (a, button, .btn, .cta) */
a, button, .btn, .cta { color: var(--text); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

/* 12) Buttons (solid + outline variants) */
.btn, .cta { display: inline-block; padding: .6em 1em; border-radius: 8px; border: 1px solid rgba(120,170,255,.7); background: var(--accent); color: #fff; transition: transform .2s ease, background .2s ease, box-shadow .2s; text-align: center; }
.btn:hover, .cta:hover { transform: translateY(-1px); background: #315bd6; }
.btn--outline { background: transparent; color: var(--text); border: 1px solid rgba(120,170,255,.8); }

/* 13) Form elements (base) */
input, select, textarea { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25); color: var(--text); padding: .5em .75em; border-radius: 6px; outline: none; font: inherit; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* 14) Print */
@media print {
  body { background: #fff; color: #000; }
  header, nav, main, footer { display: block; }
  .content, .card { background: #fff; border: 1px solid #ddd; }
}

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

/* 16) Light-mode tweaks (prefers-color-scheme) */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f9ff;
    --bg-2: #eef4ff;
    --text: #0b1220;
    --muted: #4b5b79;
    --accent: #2147e1;
    --accent-2: #2a6cff;
  }
  body {
    background:
      linear-gradient(135deg, #f7f9ff 0%, #eef4ff 60%),
      radial-gradient(circle at 20% 0%, rgba(33,71,225,.08) 0%, transparent 40%),
      repeating-linear-gradient(to bottom, rgba(0,0,0,.03) 0 1px, transparent 1px 4px);
  }
  .content { background: rgba(255,255,255,.9); border-color: rgba(0,0,0,.08); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
  a { color: var(--accent); }
}