/* glass-lesson.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --clr-bg:        #f5f0eb;
  --clr-ink:       #1a1410;
  --clr-muted:     #7a6e65;
  --clr-cc:        #4e8ed4;
  --clr-card-bg:   rgba(255,255,255,0.60);
  --clr-border:    rgba(26,20,16,0.09);
  --radius:        16px;
  --shadow:        0 8px 32px rgba(30,20,10,0.10);
  --safe-top:      env(safe-area-inset-top, 0px);
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}
/* ── RESPONSIVE MEDIA FIX ── */
img, picture, video, iframe {
  max-width: 100% !important;
  height: auto;
  display: block;
  border-radius: 12px; /* Matches the glassmorphism curves */
  box-shadow: 0 4px 12px rgba(0,0,0,0.06); /* Adds a subtle depth to lesson images */
}
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background-color: var(--clr-bg); color: var(--clr-ink);
  min-height: 100vh; overflow-x: hidden;
  padding-top: var(--safe-top); padding-bottom: calc(40px + var(--safe-bottom)); 
}

/* Background Blobs */
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.28; }
.bg-blobs .b1 { width: 520px; height: 520px; background: #b8d9f8; top: -120px; left: -120px; }
.bg-blobs .b2 { width: 400px; height: 400px; background: #a7f3d0; bottom: 5%; right: -80px; } 
.bg-blobs .b3 { width: 300px; height: 300px; background: #f0d9f8; top: 40%; left: 55%; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0;
  background-image: radial-gradient(circle, rgba(80,60,40,0.09) 1px, transparent 1px);
  background-size: 32px 32px; pointer-events: none;
}

/* ── LAYOUT SHELL ── */
.app-layout {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  width: 100%; max-width: 1400px; margin: 0 auto;
}

.main-content {
  width: 100%;
  max-width: 860px !important; /* Strictly locks the desktop reading width */
  margin: 0 auto;
  position: relative;
  box-sizing: border-box;
}

/* Adds breathing room for older, raw lesson text */
.main-content > main,
.main-content > .page-content {
  padding: 1.5rem;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* Prevents long unbreakable text/URLs from stretching the mobile screen */
}

@media (min-width: 1080px) {
  .app-layout { padding: 1.5rem; align-items: start; }
  .main-content {
    background: var(--clr-card-bg); border: 1px solid var(--clr-border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
  }
}

/* Top Bar */
.topbar {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem; background: rgba(245,240,235,0.80);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(26,20,16,0.07);
}
@media (min-width: 1080px) { .topbar { background: rgba(255,255,255,0.6); } }
.back-btn {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 500; color: var(--clr-muted);
  text-decoration: none; padding: 0.4rem 0.85rem 0.4rem 0.6rem; border: 1.5px solid var(--clr-border);
  border-radius: 100px; background: rgba(255,255,255,0.5); transition: all 0.2s ease; -webkit-tap-highlight-color: transparent;
}
.back-btn:hover { background: white; color: var(--clr-ink); border-color: rgba(26,20,16,0.22); }
.topbar-brand { font-family: 'Playfair Display', serif; font-size: 1.05rem; font-weight: 700; color: var(--clr-ink); text-decoration: none; }

/* Bookmark Button */
.icon-btn {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1.5px solid var(--clr-border); border-radius: 10px; background: rgba(255,255,255,0.5);
  cursor: pointer; transition: all 0.2s ease; color: var(--clr-muted); -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: white; border-color: rgba(26,20,16,0.22); color: var(--clr-ink); }
.icon-btn svg { width: 18px; height: 18px; transition: all 0.2s; }
.icon-btn.saved { color: var(--clr-lesson); border-color: color-mix(in srgb, var(--clr-lesson) 30%, transparent); background: color-mix(in srgb, var(--clr-lesson) 10%, white); }
.icon-btn.saved svg { fill: var(--clr-lesson); stroke: var(--clr-lesson); }

/* Lesson Hero */
.lesson-hero { color: white; padding: 2rem 1.5rem; text-align: center; box-shadow: inset 0 -10px 20px rgba(0,0,0,0.1); }
.lesson-hero h1 { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; line-height: 1.2;}
.lesson-hero p { font-size: 0.95rem; color: rgba(255,255,255,0.85); font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase;}

/* Generic Cards */
.glass-card, .card {
  background: rgba(255,255,255,0.7); border: 1px solid var(--clr-border);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}