/* Global Book Learning background system */
:root {
  --app-background-image: url('/assets/book-learning-soft-background.svg');
  --app-background-base: #f7f3ec;
  --app-background-overlay: rgba(248, 246, 240, .78);
  --app-glass: rgba(255, 254, 250, .84);
  --app-glass-strong: rgba(255, 254, 250, .93);
  --app-glass-border: rgba(140, 126, 103, .18);
  --app-glass-shadow: 0 20px 60px rgba(67, 55, 37, .08);
}

html {
  min-height: 100%;
  background: var(--app-background-base);
}

body {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  background: transparent;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(var(--app-background-overlay), var(--app-background-overlay)),
    var(--app-background-image) center / cover no-repeat;
  transform: translateZ(0);
}

#app {
  min-height: 100vh;
}

main {
  position: relative;
  background: transparent;
}

.site-header {
  background: rgba(247, 246, 241, .82);
  border-bottom-color: rgba(187, 179, 164, .42);
  box-shadow: 0 8px 30px rgba(67, 55, 37, .025);
  backdrop-filter: blur(18px) saturate(1.04);
  -webkit-backdrop-filter: blur(18px) saturate(1.04);
}

/* Primary surfaces stay readable while allowing the artwork to remain visible. */
.discovery-panel,
.lesson-card,
.saved-card,
.form-panel,
.workflow-card,
.setup-card,
.login-card,
.studio-table,
.account-table,
.access-request-admin-panel,
.content-block,
.completion-card,
.search-panel {
  background: var(--app-glass);
  border-color: var(--app-glass-border);
  box-shadow: var(--app-glass-shadow);
  backdrop-filter: blur(14px) saturate(1.03);
  -webkit-backdrop-filter: blur(14px) saturate(1.03);
}

/* Dense reading/editing surfaces get a stronger veil for contrast. */
.reader-article .reader-section,
.admin-editor .form-panel,
.admin-shell .studio-table,
.account-admin-shell .account-table {
  background-color: rgba(255, 254, 250, .72);
}

.site-footer {
  background: rgba(247, 246, 241, .34);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Keep photography quieter on content-heavy routes. */
body:has(.reader-layout)::before,
body:has(.admin-editor)::before,
body:has(.admin-shell)::before {
  --app-background-overlay: rgba(248, 246, 240, .86);
}

/* Login and account gates intentionally reveal more of the artwork. */
body:has(.studio-auth-gate)::before,
body:has(.reader-access-gate)::before {
  --app-background-overlay: rgba(248, 246, 240, .52);
}

@media (max-width: 900px) {
  :root {
    --app-background-overlay: rgba(248, 246, 240, .84);
  }

  body::before {
    background-position: 62% center;
  }

  body:has(.studio-auth-gate)::before,
  body:has(.reader-access-gate)::before {
    --app-background-overlay: rgba(248, 246, 240, .72);
  }
}

@media (max-width: 620px) {
  body::before {
    background-position: 58% center;
  }

  .site-header {
    background: rgba(247, 246, 241, .90);
  }

  .discovery-panel,
  .lesson-card,
  .saved-card,
  .form-panel,
  .setup-card,
  .login-card,
  .studio-table,
  .account-table,
  .access-request-admin-panel,
  .content-block {
    background: var(--app-glass-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before { transform: none; }
}
