/* =====================================================================
   base.css  -  design system for the immersive redesign.
   Near-white pastels, muted greens, coral, powder blue, soft charcoal, gentle
   light. Lora (display serif) + Nunito Sans (body).
   Every colour is a CSS variable; components never hardcode a colour.
   =====================================================================*/
:root {
  /* Surfaces */
  --cream: #ffffff;
  --mist: #e8eef3;
  --white: #ffffff;
  --charcoal: #38352f;
  --ink-soft: #6b665c;

  /* Palette */
  --sage: #9aad9b;
  --sage-deep: #5c7261;
  --sage-wash: #eef1ea;
  --coral: #e8747c;
  --coral-soft: #f2a3a8;
  --gold: #d9ac6a;
  --gold-light: #f8f2df;

  /* Semantic (a theme must define text-on-accent, a light on-dark
     accent, and a soft hover wash) */
  --text: var(--charcoal);
  --text-soft: var(--ink-soft);
  --text-on-accent: #ffffff;
  --accent: var(--sage-deep);       /* overridden per book via --book-accent */
  --accent-2: var(--coral);
  --accent-on-dark: var(--gold-light);
  --hover-wash: rgba(92, 114, 97, 0.09);

  /* Shape + depth */
  --card-border: rgba(56, 53, 47, 0.09);
  --shadow-card: 0 22px 48px -24px rgba(56, 53, 47, 0.28);
  --shadow-pop: 0 26px 60px -22px rgba(92, 114, 97, 0.38);
  --radius-card: 26px;
  --radius-pill: 999px;

  /* Type */
  --font-head: "Lora", "Georgia", serif;
  --font-body: "Nunito Sans", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 550;
  line-height: 1.06;
  margin: 0 0 .4em;
  color: var(--charcoal);
  letter-spacing: -0.01em;
}

p { line-height: 1.7; margin: 0 0 1em; }

a { color: var(--accent); text-decoration: none; }

/* -------- Buttons / pills -------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .98rem;
  letter-spacing: .02em;
  padding: .8em 1.7em;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  transition: transform .25s ease, background .25s ease;
}
.btn:hover { transform: translateY(-2px); background: var(--sage); }
.btn.pop { background: var(--coral); }
.btn.pop:hover { background: var(--coral-soft); }
.btn.ghost {
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn.ghost:hover { background: var(--hover-wash); transform: translateY(-2px); }

/* -------- Top bar (shared) -------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem clamp(1rem, 4vw, 2.6rem);
  pointer-events: none;
}
/* Soft fade so content dissolves as it scrolls under the title bar. */
.topbar::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 210%;
  background: linear-gradient(to bottom,
    var(--cream) 0%,
    color-mix(in srgb, var(--cream) 82%, transparent) 55%,
    transparent 100%);
  z-index: -1;
  pointer-events: none;
}
.topbar .brand, .topbar .bar-actions { pointer-events: auto; }
.topbar .brand {
  display: flex; align-items: baseline; gap: .6rem;
  font-family: var(--font-head);
  color: var(--charcoal);
}
.topbar .brand .name { font-size: 1.3rem; font-weight: 600; }
.topbar .brand .role {
  font-family: var(--font-body);
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--sage-deep); font-weight: 700;
}
.bar-actions { display: flex; align-items: center; gap: .8rem; }

/* Top-bar link (e.g. "All books") */
.barlink {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .82rem;
  border: 2px solid var(--card-border);
  background: color-mix(in srgb, var(--white) 75%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text-soft);
  border-radius: var(--radius-pill);
  padding: .42em 1.1em;
  text-decoration: none;
  transition: border-color .2s, color .2s;
}
.barlink:hover { border-color: var(--sage-deep); color: var(--charcoal); }

/* Utility */
.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
