/* Section: Base & Palette */
:root {
  --bg: #041018;
  --bg-2: #0a1620;
  --surface: rgba(3, 11, 20, 0.60);
  --surface-2: rgba(8, 26, 38, 0.50);
  --text: #eaffff;
  --muted: #b5f6d2;
  --accent: #00e5ff;   /* cyan */
  --accent-2: #a6ff00; /* lime */
  --border: rgba(0, 255, 255, 0.40);
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --focus: 2px solid var(--accent);
}

/* Section: Global Reset & Layout Helpers */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: clamp(14px, 1.4vw, 16px); }
body {
  margin: 0;
  color: var(--text);
  background: 
    /* Space cyan gradient layers */
    linear-gradient(135deg, rgba(0, 40, 60, 0.85) 0%, rgba(0,0,0,0.85) 60%),
    radial-gradient(circle at 20% 0%, rgba(0,255,255,0.12), transparent 25%),
    radial-gradient(circle at 85% 60%, rgba(168,255,0,0.12), transparent 25%),
    /* subtle cyan scanlines */
    repeating-linear-gradient(to bottom, rgba(0,255,255,0.04) 0 2px, transparent 2px 4px),
    #050f1a;
  background-blend-mode: normal, normal, normal, overlay, normal;
  min-height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
}
body::before {
  /* Pure CSS noise-like speckle (soft) + starfield feel */
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.08) 1px, transparent 1px),
    radial-gradient(circle at 30px 60px, rgba(0,255,255,.04) 2px, transparent 2px);
  background-size: 3px 3px, 60px 60px;
  opacity: .28;
  pointer-events: none;
  mix-blend-mode: overlay;
}
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding-left: 1.25rem; }

/* Section: Utility & Layout Primitives */
.container {
  width: 100%;
  max-width: clamp(520px, 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(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tag {
  display: inline-block;
  padding: .25em .5em;
  border-radius: 999px;
  font-size: .75rem;
  line-height: 1;
  color: #042a15;
  background: rgba(166, 255, 0, 0.25);
  border: 1px solid rgba(166, 255, 0, 0.5);
}
.product-ad { display: block; }
.product-ad a { display: block; padding: .75rem 1rem; border-radius: 12px; background: rgba(0,255,255,0.08); border:1px solid rgba(0,255,255,.25); color: var(--text); text-align: center; transition: transform .2s ease, background .2s ease; }
.product-ad a:hover { transform: translateY(-1px); background: rgba(0,255,255,0.14); }

/* Section: Typography & Heading Hierarchy */
h1, h2 { margin: .75rem 0 0.25rem; letter-spacing: .2px; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.75rem); line-height: 1.08; text-align: center; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.75rem); }
p { margin: .75rem 0; color: rgba(234, 252, 252, 0.92); }

/* Section: Header & Navigation (Glass panels) */
header {
  position: sticky; top: 0; z-index: 20;
  padding: 1rem 0.5rem;
  display: block;
}
header > .inner { /* inner wrapper not in HTML; handle with container below */ }

/* Glass panels on header with graceful fallback */
header {
  display: block;
  background: rgba(3, 12, 20, 0.55);
  border: 1px solid rgba(0, 255, 255, 0.40);
  border-radius: 16px;
  padding: 1rem clamp(1rem, 2vw, 2rem);
  margin: 1rem auto;
  max-width: calc(100% - 2rem);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
header h1 { margin: .25rem 0; font-weight: 700; }
header .meta { font-size: .9rem; color: rgba(230, 250, 250, 0.85); opacity: .95; }

/* Accessibility: focus ring on interactive header links (if any) */
header nav a:focus-visible, header a:focus-visible, button:focus-visible, .btn:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Section: Main Content */
main { padding: 1.25rem 0; }
article { max-width: 860px; margin: 0 auto; padding: 0 0.25rem; }

/* Image framing (required selectors) */
.image-frame, .featured-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.35);
  box-shadow: 0 8px 22px rgba(0, 255, 255, 0.25);
  background: rgba(0,0,0,0.25);
}
.image-frame img, .featured-image img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.02);
}
.image-frame img { transition: transform .3s ease; }
.image-frame:hover img { transform: scale(1.05); }

/* Section: Content blocks (glass panels) */
.content {
  background: rgba(8, 16, 24, 0.55);
  border: 1px solid rgba(0, 255, 255, 0.30);
  border-radius: var(--radius);
  padding: 1rem 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-top: .5rem;
}
@supports not (backdrop-filter: blur(8px)) {
  .content, header { background: rgba(8,16,24,0.92); border-color: rgba(0,255,255,0.48); }
  header, .content { backdrop-filter: none; }
}

/* Section: Typography helpers for readability on glass */
.content p { color: rgba(230, 255, 255, 0.92); }

/* Lists within content */
section[aria-label="Diary rules"] p { margin-bottom: .5rem; }
section[aria-label="Diary rules"] ul { margin-top: .25rem; padding-left: 1.25rem; }

/* Section: Links & CTAs (underline on focus/hover) */
a:hover, a:focus { text-decoration: underline; text-underline-offset: 3px; }
a.cta, .cta, .btn {
  cursor: pointer;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .75em 1.25em; border-radius: 999px;
  border: 1px solid rgba(0,255,255,0.7);
  background: linear-gradient(to bottom, rgba(0,255,255,0.85), rgba(0,255,255,0.65));
  color: #002b2f; font-weight: 700; text-shadow: 0 1px 0 rgba(255,255,255,.3);
  transition: transform .2s ease, background .2s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); background: linear-gradient(to bottom, rgba(0,255,255,1.0), rgba(0,255,255,0.75)); }
.btn:active { transform: translateY(0); }
.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(0, 255, 255, 0.8);
}
.btn--solid {
  background: linear-gradient(to bottom, rgba(0,255,255,0.95), rgba(0,255,255,0.75));
  color: #001418;
  border: none;
}
a.btn { text-decoration: none; }

/* Section: Footer & promos */
footer { padding: 1.5rem 0; }
footer p { margin: .5rem 0; text-align: center; color: rgba(230,255,255,.9); }

/* Print Styles: basic readability */
@media print {
  body { background: #fff; color: #000; -webkit-print-color-adjust: exact; }
  header, main, article, footer { background: #fff; color: #000; }
  a { text-decoration: underline; }
  .image-frame { border: 1px solid #ccc; }
}

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