/* Base & Tokens */
:root {
  --bg: #0b0f14;
  --bg-2: #141824;
  --text: #e9ebf0;
  --muted: #b6bdd1;
  --surface: rgba(255,255,255,.08);
  --surface-2: rgba(255,255,255,.14);
  --border: rgba(255,255,255,.28);
  --shadow: 0 8px 28px rgba(0,0,0,.28);
  --radius: 14px;

  /* Palette derived from silver / gold accents */
  --silver: #cbd5e1;
  --gold: #d4af37;
  --gold-dark: #b8922e;
  --accent: #ffd166;       /* bright gold-ish for emphasis */
  --accent-2: #f9d64b;     /* secondary gold for accents */
  --focus: 2px solid var(--gold);
  --code: #a0a6b8;
}

/* Theme + composition layers */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  color: var(--text);
  background: linear-gradient(135deg, rgba(9,12,18,.95) 0%, rgba(18,21,30,.95) 60%, rgba(9,12,18,.95) 100%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  position: relative;
  isolation: isolate;
}

/* Silver polka dots background baked as a layer (polka dots) */
html::before,
html::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
html::before {
  /* silver polka-dot pattern */
  background-image: radial-gradient(circle at 1px 1px, rgba(192,192,192,.55) 2px, transparent 3px);
  background-size: 20px 20px;
  opacity: .25;
  mix-blend-mode: overlay;
}
html::after {
  /* subtle scanline / noise overlay */
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,.04) 0 1px,
    transparent 1px 2px
  );
  opacity: .18;
  mix-blend-mode: overlay;
  filter: saturate(105%);
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html::before, html::after { display: none; }
  * { animation: none !important; transition: none !important; }
}

/* Layout helpers & utilities */
.container {
  width: 100%;
  max-width: clamp(640px, 86vw, 1100px);
  padding-inline: 1rem;
  margin-inline: auto;
}

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

.card {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Glass panels with fallback */
.glass {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  padding: 1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
@supports not (backdrop-filter: blur(10px)) {
  .glass {
    background: rgba(255,255,255,.16);
  }
}

/* Core layout regions (must style) */
html, body, header, nav, main, article, footer, aside {
  /* reset defaults where helpful; actual visuals via modules below */
}
header {
  padding: 1.25rem 0;
  text-align: center;
  z-index: 1;
  position: relative;
}
main {
  padding: 1.25rem 0 2rem;
}
article {
  padding: 0;
}
footer {
  padding: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}
nav a {
  color: var(--accent-2);
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.15);
}
nav a:hover, nav a:focus-visible {
  text-decoration: underline;
  outline: none;
  color: var(--accent);
}
a, button, .btn, .cta {
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}
a:hover { text-decoration: underline; }

/* Content styling */
.content {
  color: var(--text);
  max-width: 70ch;
  margin-inline: auto;
  padding: 0 0.5rem;
}
.image-frame {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.28);
  background: #111;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
h1, h2, h3 {
  line-height: 1.15;
  margin: .4em 0 .6em;
  color: var(--text);
}
h1 { font-size: clamp(1.75rem, 3.2vw + 1rem, 3.25rem); text-wrap: balance; }
h2 { font-size: clamp(1.4rem, 2.4vw + .8rem, 2.4rem); }
h3 { font-size: clamp(1.1rem, 2vw + .6rem, 1.5rem); font-weight: 600; }

/* Text & lists */
p { color: var(--muted); font-size: clamp(0.95rem, 0.9vw + 0.8rem, 1.1rem); margin: .6em 0; }
ul, li { margin: 0.5em 0; padding-left: 1.25rem; }
ul { list-style: disc; }
li { line-height: 1.6; }

/* Utility elements in footer (ad blocks) */
.product-ad, .sponsored-page {
  padding: .75rem;
}
.product-ad a, .sponsored-page a {
  display: block;
  padding: .75rem;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.28);
  text-align: center;
  transition: transform .2s ease, background .2s ease;
}
.product-ad a:hover, .sponsored-page a:hover {
  transform: translateY(-1px);
  background: rgba(0,0,0,.35);
}
.product-ad p, .sponsored-page p {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
footer p {
  margin: .5rem 0 0;
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
}

/* Buttons & CTAs (solid and outline variants) */
.btn, .cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.28);
  background: linear-gradient(135deg, rgba(212,175,55,.95), rgba(212,175,55,.85));
  color: #1a1a1a;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255,255,255,.3);
  transition: transform .15s ease, background .2s ease;
  text-decoration: none;
}
.btn:hover, .cta:hover { transform: translateY(-1px); }
.btn:active, .cta:active { transform: translateY(0); }
.btn.outline, .cta.outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(212, 175, 55, 0.8);
}
.btn:focus-visible, .cta:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn + .btn { margin-left: .5rem; }

/* Polished link states for accessibility */
a:focus-visible { text-decoration: underline; }

/* Print styles (basic readability) */
@media print {
  html, body { background: white; color: black; }
  header, nav, main, article, footer { background: transparent; color: black; }
  a { text-decoration: underline; }
}

/* Reduced-motion overrides for interactive elements (repeat-safe) */
@media (prefers-reduced-motion: reduce) {
  .btn, .cta { transition: none; }
  .image-frame, header, footer, .glass { transition: none; }
}
