  /* =====================================================
     HONEY BADGER & BUTTERFLY — STORYBOOK
     Aesthetic: warm cream paper, ink type, hand-drawn warmth
     ===================================================== */

  :root {
    --paper: #fbf6e8;
    --paper-warm: #f3ecd6;
    --paper-shadow: #d9cdb3;
    --ink: #1f1a14;
    --ink-soft: #54493a;
    --ink-faint: #897c66;
    --honey: #b78448;
    --honey-light: #d9b27a;
    --butterfly: #a87770;
    --butterfly-soft: #c89991;
    --leaf: #8a9560;
    --olive: #b5a872;
    --rust: #b85a3a;
    --rule: #cebf9c;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'EB Garamond', 'Hoefler Text', Georgia, serif;
    font-size: 19px;
    line-height: 1.6;
    min-height: 100vh;
  }

  /* Paper texture using layered gradients */
  body {
    background:
      radial-gradient(circle at 20% 30%, rgba(183, 132, 72, 0.05) 0%, transparent 45%),
      radial-gradient(circle at 80% 70%, rgba(201, 95, 126, 0.04) 0%, transparent 45%),
      radial-gradient(circle at 50% 50%, rgba(0,0,0,0.012) 0%, transparent 60%),
      var(--paper);
    background-attachment: fixed;
    position: relative;
  }

  /* Subtle grain overlay */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.18 0 0 0 0 0.12 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  

  /* ---------- LIBRARY VIEW ---------- */

  .library {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px 120px;
    position: relative;
    z-index: 2;
  }

  /* ---------- BANNER (top of page) ---------- */
  /* The title + tagline are composed into the artwork, so the banner is
     simply the image shown full width (no text overlay). */
  .banner {
    position: relative;
    z-index: 2;
    background: var(--paper-warm);
    border-bottom: 1px solid var(--rule);
  }

  .banner-img {
    display: block;
    width: 100%;
    height: auto;
  }

  /* Visually hidden, kept for document outline / SEO */
  .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;
  }

  /* Story grid heading */
  .shelf-label {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .shelf-label .shelf-title {
    font-family: 'Caveat', cursive;
    font-size: 32px;
    color: var(--ink-soft);
  }

  .shelf-label .shelf-desc {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 17px;
    color: var(--ink-faint);
  }

  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 32px;
    margin-bottom: 80px;
  }

  /* Story card — flat parchment "cover" in the book-cover-no1 style */
  .book {
    background: #f6efdc;
    border: 1px solid var(--rule);
    border-radius: 6px;
    aspect-ratio: 3 / 4;
    padding: 22px 22px 20px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(42, 36, 24, 0.10);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
  }

  .book:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 22px rgba(42, 36, 24, 0.16);
  }

  .book .book-number {
    font-family: 'Caveat', cursive;
    font-size: 20px;
    color: var(--honey);
    letter-spacing: 1px;
  }

  .book .book-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: 27px;
    line-height: 1.08;
    color: var(--ink);
    margin-top: 2px;
    letter-spacing: -0.01em;
  }

  .book .book-illustration {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
  }

  .book .book-illustration img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
  }

  .book .book-illustration svg {
    width: 100%;
    height: 100%;
    max-height: 150px;
  }

  .book .book-lesson {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 14.5px;
    color: var(--ink-soft);
    border-top: 1px solid var(--rule);
    padding-top: 12px;
    line-height: 1.35;
  }

  /* Footer in library */
  .library-foot {
    text-align: center;
    margin-top: 80px;
    color: var(--ink-faint);
  }

  .library-foot .foot-rule {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 0 0 20px;
  }

  .library-foot .copyright {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 14px;
    color: var(--ink-faint);
    letter-spacing: 0.02em;
  }

  /* ---------- STORY VIEW ---------- */

  .story-view {
    display: none;
    max-width: 1120px;
    margin: 0 auto;
    padding: 44px 32px 100px;
    position: relative;
    z-index: 2;
  }

  .story-view.active { display: block; }

  /* Two-column reading layout: sidebar + story */
  .story-layout {
    display: flex;
    gap: 44px;
    align-items: flex-start;
  }

  .story-main {
    flex: 1 1 auto;
    min-width: 0;
  }

  .story-main .story-content {
    max-width: 680px;
  }

  /* ---------- SIDEBAR (quick story switch) ---------- */
  .story-sidebar {
    flex: 0 0 220px;
    position: sticky;
    top: 24px;
    border-right: 1px solid var(--rule);
    padding-right: 20px;
  }

  .sidebar-head {
    font-family: 'Caveat', cursive;
    font-size: 24px;
    color: var(--ink-soft);
    margin-bottom: 12px;
    padding-left: 12px;
  }

  .sidebar-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    padding: 9px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    color: var(--ink-soft);
    transition: background 0.2s, color 0.2s;
  }

  .sidebar-item:hover {
    background: var(--paper-warm);
    color: var(--ink);
  }

  .sidebar-item.active {
    background: var(--honey);
    color: var(--paper);
  }

  .sidebar-num {
    font-family: 'Caveat', cursive;
    font-size: 15px;
    color: var(--honey);
  }

  .sidebar-item.active .sidebar-num { color: var(--paper); }

  .sidebar-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 17px;
    line-height: 1.15;
  }

  /* ---------- PRINT DROPDOWN (shaped button) ---------- */
  .print-menu {
    position: relative;
  }

  .print-menu > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--honey);
    color: var(--paper);
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 17px;
    padding: 9px 22px;
    border-radius: 999px;
    border: 1px solid var(--honey);
    transition: background 0.2s;
  }

  .print-menu > summary::-webkit-details-marker { display: none; }
  .print-menu > summary::after {
    content: '▾';
    font-style: normal;
    font-size: 13px;
  }
  .print-menu > summary:hover,
  .print-menu[open] > summary { background: #a5743d; }

  .print-menu-items {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 10;
    min-width: 190px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(42, 36, 24, 0.18);
    padding: 6px;
  }

  .print-menu-items button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 16px;
    color: var(--ink-soft);
    padding: 10px 12px;
    border-radius: 6px;
  }

  .print-menu-items button:hover {
    background: var(--paper-warm);
    color: var(--ink);
  }

  /* Sidebar collapses to a horizontal strip on narrow screens */
  @media (max-width: 760px) {
    .story-layout { flex-direction: column; gap: 20px; }
    .story-sidebar {
      position: static;
      flex: none;
      width: 100%;
      border-right: none;
      border-bottom: 1px solid var(--rule);
      padding-right: 0;
      padding-bottom: 12px;
      display: flex;
      gap: 8px;
      overflow-x: auto;
    }
    .sidebar-head { display: none; }
    .sidebar-item {
      flex: 0 0 auto;
      flex-direction: row;
      align-items: baseline;
      gap: 6px;
      margin-bottom: 0;
      white-space: nowrap;
    }
  }

  .top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 48px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rule);
  }

  .back-btn, .print-btn {
    background: none;
    border: none;
    color: var(--ink-soft);
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 17px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
  }

  .back-btn:hover, .print-btn:hover {
    background: var(--paper-warm);
    color: var(--ink);
  }

  .print-btn {
    border: 1px solid var(--rule);
    background: var(--paper-warm);
  }

  .print-btn:hover {
    background: var(--honey);
    color: var(--paper);
    border-color: var(--honey);
  }

  .story-content {
    font-size: 21px;
    line-height: 1.7;
  }

  .story-content .number {
    font-family: 'Caveat', cursive;
    font-size: 24px;
    color: var(--honey);
    margin-bottom: 8px;
  }

  .story-content h2 {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(38px, 6vw, 56px);
    line-height: 1.05;
    margin-bottom: 40px;
    letter-spacing: -0.01em;
  }

  .story-content p {
    margin-bottom: 18px;
  }

  .story-content p.narrator {
    font-style: italic;
    color: var(--ink-soft);
    border-left: 2px solid var(--honey);
    padding-left: 20px;
    margin: 28px 0;
    font-size: 19px;
  }

  .story-content .lesson {
    margin-top: 56px;
    padding-top: 28px;
    text-align: center;
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 21px;
    line-height: 1.5;
    position: relative;
  }

  .story-content .lesson::before {
    content: '✦';
    display: block;
    color: var(--honey);
    font-size: 18px;
    margin-bottom: 16px;
    font-style: normal;
  }


  /* ---------- DECORATIVE SVG STYLES ---------- */
  .deco-svg .body { fill: #3a342a; }
  .deco-svg .stripe { fill: #e8dec5; }
  .deco-svg .face { fill: #1a1610; }
  .deco-svg .wing { fill: #d97a96; }
  .deco-svg .wing-spot { fill: #f4b6c5; }

  /* ---------- RESPONSIVE ---------- */
  @media (max-width: 600px) {
    .library { padding: 50px 20px 80px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
    .book { padding: 22px 18px 18px; }
    .book .book-title { font-size: 22px; }
    .story-view { padding: 40px 20px 80px; }
    .story-content { font-size: 19px; }
  }
