/* CSS: Step-by-Step Guide to Understanding Nanotechnology (Pastel Cyberpunk Theme) */

/* Tokens and Base (Mobile-First) */
:root{
  --bg: #0b1220;               /* deep navy backdrop */
  --bg-2: #0e1a2b;             /* secondary backdrop layer */
  --text: #eaf4ff;              /* high-contrast text on glass */
  --muted: #a9c3e8;             /* secondary text */
  --surface: rgba(255,255,255,.08);           /* frosted glass base */
  --surface-strong: rgba(255,255,255,.20);    /* stronger glass overlay */
  --border: rgba(255,255,255,.28);            /* glass border */
  --accent: #ffd86b;             /* pastel yellow */
  --accent-2: #ffe9a1;            /* lighter yellow for accents */
  --shadow: 0 6px 18px rgba(0,0,0,.20);
  --radius: 14px;
  --focus: 2px solid rgba(255,216,107,.95);
  --focus-offset: 2px;
}

html, body, header, nav, main, article, footer, aside {
  height: auto;
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  background-color: var(--bg);
  /* Layered background: gradient + subtle noise/scanlines (pure CSS) */
  background-image:
    linear-gradient(135deg, rgba(140,210,255,.18) 0%, rgba(255,230,140,.14) 60%, rgba(140,210,255,.22) 100%),
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.08), transparent 40%),
    repeating-linear-gradient(to bottom, rgba(0,0,0,.04) 0 1px, transparent 1px 2px);
  background-blend-mode: overlay;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.5;
  -webkit-tath: none;
}

header, nav, main, article, aside, footer {
  display: block;
}

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

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

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

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* Image framing helper */
.image-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 6px 14px rgba(0,0,0,.25);
  background: #0b1220;
}
.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}
.image-frame:hover img { transform: scale(1.04); }

/* Glassy surfaces with graceful fallback */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@supports not (backdrop-filter: blur(12px)) {
  .glass {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.40);
  }
}

/* Content hierarchy */
.content {
  padding: 0.75rem 0 0.25rem;
}
h1, h2, h3 {
  margin: 0 0 .5rem;
  color: var(--text);
}
h1 {
  font-size: clamp(1.75rem, 2.2vw + 1rem, 3rem);
  line-height: 1.12;
}
h2 {
  font-size: clamp(1.25rem, 1.4vw + 1rem, 1.75rem);
  font-weight: 700;
  color: #eaf1ff;
}
p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 0.9vw + 0.9rem, 1.125rem);
  line-height: 1.6;
}
ol, ul {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}
li { margin: 0.4rem 0; }

/* Inline accents and small helpers */
.tag {
  display:inline-block;
  padding: .25rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  color: #0a1020;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(255,255,255,.95);
  margin-right: .4rem;
}
.meta { color: var(--muted); font-size: .9rem; }

/* Links and controls (a, button, .btn, .cta) */
a, button, .btn, .cta {
  font: inherit;
  color: #0b0f16;
  text-decoration: none;
  display: inline-block;
  border-radius: 999px;
  padding: .55rem . nine;
}
a, .btn, .cta {
  cursor: pointer;
}
a:focus-visible, button:focus-visible, .btn:focus-visible, .cta:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}
a:hover { text-decoration: underline; color: var(--accent-2); }

/* Button variants */
.btn {
  color: #0b0f16;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.40);
  padding: .6rem 1rem;
  border-radius: 999px;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.28); }
.btn.primary {
  background: linear-gradient(135deg, rgba(255,214,107,.95), rgba(255,214,107,.75));
  color: #1b1b1b;
  border: 1px solid rgba(0,0,0,.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.btn.primary:hover {
  background: linear-gradient(135deg, rgba(255,214,107,.98), rgba(255,214,107,.80));
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.5);
  color: #e9f0ff;
}
.btn:active { transform: translateY(0); }

/* Links with button-like feel (cta) */
.cta {
  padding: .6rem .9rem;
  border-radius: 999px;
  display: inline-block;
  background: rgba(0,0,0,.0);
  border: 1px solid rgba(255,255,255,.35);
  color: #eaf6ff;
}
.cta:hover { text-decoration: underline; }

/* Navigation and header/footer basics */
header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.15);
  background: linear-gradient(to bottom right, rgba(255,255,255,.08), rgba(255,255,255,.02));
  position: sticky;
  top: 0;
  z-index: 10;
}
header h1 {
  margin: 0 0 .25rem;
  font-weight: 700;
}
nav a {
  color: var(--text);
  padding: .25rem .5rem;
  border-radius: 6px;
}
nav a:hover { text-decoration: underline; }

/* Main layout tweaks for readability on all screens */
main {
  padding: 1rem 0;
}
article {
  display: block;
}
.featured-image { margin: .5rem 0 1rem; }

/* Footer / ad blocks with glass feel */
.product-ad, .sponsored-page {
  display: inline-block;
  vertical-align: top;
  width: calc(50% - .5rem);
  margin: .25rem;
}
footer {
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border-top: 1px solid rgba(255,255,255,.15);
  background: rgba(10,12,20,.55);
}
footer p { margin: 0; }

/* Print styles (basic readability) */
@media print {
  body {
    background: white;
    color: black;
  }
  header, nav, footer { display: block; }
  a { color: black; text-decoration: underline; }
  .glass, .card { background: white; border: 1px solid #ddd; box-shadow: none; }
}
  
/* Responsiveness helpers for content sections */
@media (min-width: 640px) {
  .container { padding-inline: 2rem; }
}
@media (min-width: 900px) {
  main { padding: 2rem 0; }
}
  
/* Accessibility niceties for contrast on glass surfaces */
@media (prefers-contrast: more) {
  :root {
    --bg: #0a0f1d;
  }
  .card, .glass { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.5); }
}
