/* Base tokens */
:root {
  --bg: #0a0f0a;
  --bg-2: #12170f;
  --text: #e9f1e0;
  --muted: #b7c6ac;
  --accent: #7f1f1f;      /* maroon */
  --accent-2: #4c8f3a;     /* olive accent */
  --panel: rgba(18, 25, 18, 0.28);
  --panel-border: rgba(128, 0, 0, 0.45);
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  --focus: #4ce6a8;
}

/* Base page setup */
html, body { height: 100%; }
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

html, body, header, nav, main, article, aside, footer {
  /* ensure elements participate in flow and sizing predictably */
}

html, body {
  margin: 0;
  padding: 0;
  background-attachment: fixed;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Helvetica Neue", sans-serif;
  color: var(--text);
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.5;
  background-color: var(--bg);
  background-image:
    linear-gradient(135deg, rgba(10, 15, 10, 0.95), rgba(16, 22, 16, 0.95)),
    repeating-linear-gradient(to bottom, rgba(0,0,0,0.08) 0 1px, transparent 1px 2px),
    linear-gradient(180deg, rgba(0,0,0,0.25), rgba(0,0,0,0.25));
  background-blend-mode: normal, overlay, overlay;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

/* Layered background (olive checkerboard hint + subtle scanlines) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    /* olive checkerboard base */
    linear-gradient(45deg, rgba(124, 147, 66, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(124, 147, 66, 0.08) 25%, transparent 25%);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  mix-blend-mode: overlay;
  opacity: 0.9;
  content: "";
  filter: saturate(105%);
}

/* Light/dark preference handling */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7f2;
    --bg-2: #eef3ec;
    --text: #1b1f18;
    --muted: #555f49;
    --panel: rgba(255, 255, 255, 0.8);
    --panel-border: rgba(20, 20, 20, 0.25);
    --shadow: 0 6px 16px rgba(0,0,0,0.15);
  }
  body {
    background-image:
      linear-gradient(135deg, rgba(230, 240, 220, 0.95), rgba(210, 220, 210, 0.95)),
      repeating-linear-gradient(to bottom, rgba(0,0,0,0.04) 0 1px, transparent 1px 2px),
      linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0.4));
  }
  body::before { opacity: 0.9; }
}

/* Layout scaffolding */
.container {
  width: 100%;
  max-width: clamp(320px, 92vw, 1100px);
  margin-inline: auto;
  padding-inline: 1rem;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
@supports not (backdrop-filter: blur(8px)) {
  .card { background: rgba(18, 24, 18, 0.86); border-color: rgba(128,0,0,0.6); }
}
.card:hover { transform: translateY(-2px); }

.tag {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 999px;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(124, 25, 25, 0.55);
  border: 1px solid rgba(128, 0, 0, 0.6);
  margin-right: .25em;
}

/* Core page sections */
header, main, footer, aside {
  display: block;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.8rem);
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}

main { padding: 1rem 0 2rem; }

/* Image frame / glass panel with fallback */
.image-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  margin: 0 auto;
  display: block;
  background: rgba(12, 16, 12, 0.22);
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  isolation: isolate;
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
}

/* Backdrop-filter support with graceful fallback */
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .image-frame {
    background: rgba(12, 16, 12, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}
@supports not (backdrop-filter: blur(8px)) and (not (-webkit-backdrop-filter: blur(8px))) {
  .image-frame {
    background: rgba(12, 16, 12, 0.48);
  }
}

/* Content area (glass panel candidate) */
.content {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(15, 22, 15, 0.28);
  border: 1px solid rgba(128,0,0,0.4);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
}

/* Product ad area in footer as glass panel */
.product-ad {
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(18, 25, 18, 0.28);
  border: 1px solid rgba(128,0,0,0.4);
  text-align: center;
  transition: transform .2s ease;
}
.product-ad a { color: inherit; text-decoration: none; display: block; padding: 0.5rem 0; }
.product-ad:hover { transform: translateY(-1px); }

/* Links and buttons (interactive elements) */
a, button, .btn, .cta {
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
a:hover, a:focus-visible, .btn:hover, .cta:hover {
  text-decoration: underline;
}
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.btn, .cta {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(128,0,0,.6);
  background: linear-gradient(to bottom, rgba(120,0,0,.95), rgba(64,0,0,.95));
  font-weight: 600;
}
.btn:hover, .cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
}
.btn:active, .cta:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* Utility helpers */
.ul { margin: 0; padding-left: 1.25rem; }
ul, li { margin: 0; padding: 0; list-style: disc; }
li { margin: .25rem 0; }

/* Layout helpers (responsive) */
@media (min-width: 640px) {
  .container { padding-inline: 1.25rem; }
}
@media (min-width: 768px) {
  footer { padding: 1rem 0 2rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
}
@media (min-width: 1024px) {
  main { padding: 2rem 0; }
  header { padding: 3rem 0 1.5rem; }
}

/* Print-friendly (basic readability) */
@media print {
  body { background: #fff; color: #000; }
  a { text-decoration: underline; }
}
  
/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; transform: none !important; }
}