/* /faq as a book (2026-10-25, Mike: "Perfect ship it"; the mockup's section 3). The chapters are the left page, the chapter's
   questions the right, each opening in place; on a phone one page at a time, chapters first, a question list turns over
   with a back button. The pages are parchment in both themes (the add-on's own book: light pages in a dark frame), lying
   on the site's leather ground (style.css). faq.js does the turning; without it every chapter and answer is open on one
   long right page, the chapters on the left are links down to them. The Willo door (willocompanion.com/faq) keeps her look
   and shows the plain list, so everything that draws the book is behind html:not([data-door="willo"]). */

/* ---- The book, on the Lore Forever side ---- */
:where(html:not([data-door="willo"])) {
  .bw .bw-in.fq-page { max-width: 1040px; width: calc(100% - 32px); margin: 28px auto 64px; padding: 0; background: none; border: 0;
    border-radius: 0; box-shadow: none; }

  .fq-book {
    /* The parchment colours are the book's own light set, whatever the site's theme: the same names style.css gives the
       paper (--pg-*), set here to the light values, so a page marked ch-paper draws in them in the dark too. */
    --pg: var(--parch); --pg-rim: #cc9e33; --pg-ink: var(--parch-ink); --pg-title: var(--parch-title); --pg-note: var(--parch-note); --pg-faded: var(--parch-faded); --pg-wax: #9e291a;
    --pg-tile: #ccb585d9; --pg-line: #73665299; --pg-new: var(--parch-green); --pg-chip: #bda370b3; --pg-paper: var(--parch-paper); --pg-muted: var(--parch-hint);
    --pg-hover: #8a2412; --pg-on: #ffedc7; --pg-edge: #736652; --pg-glow: var(--parch-glow); --pg-code: #2e1c0a1a; --pg-wash: #cc9e332e;
    --pg-fill-hover: #fff3d6; --pg-btn: var(--parch-title); --pg-btn-ink: #ffedc7; --pg-btn-hover: #8a2412; --pg-shadow: #000000aa;
    --fq-page: var(--parch); --fq-ink: #2e1c0a; --fq-title: #6b1c0d; --fq-note: #5a3a16; --fq-rule: #b99a5e; --fq-red: #9e291a;
    --fq-seal: #7a2414; --fq-hover: #c9a86a66; --fq-gold: #ffd100; --fq-frame: #15110c;
    position: relative; margin-top: 12px; background: var(--fq-frame); border: 2px solid #000; border-radius: 6px;
    box-shadow: inset 0 0 0 1px #6a5228, 0 14px 30px -16px #000; color: var(--fq-ink); font-family: var(--ch-body, "Alegreya Sans", sans-serif);
  }
  .fq-plate { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 3px 16px; white-space: nowrap;
    font: 700 0.84rem/1.4 var(--h-display, "Cinzel", Georgia, serif); letter-spacing: 0.02em; color: var(--fq-gold);
    background: linear-gradient(#2a2015, #120d08); border: 1px solid #8a6a2c; border-radius: 3px; }
  .fq-title { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 18px 18px 10px; }
  .fq-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 4px; border: 1px solid #000;
    background: linear-gradient(135deg, #8a5a2a, #3a2414); color: #f0c96b; }
  .fq-icon svg { width: 18px; height: 18px; }
  .bw .fq-book h1.fq-where { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 1.15rem/1.3 var(--h-display, "Cinzel", Georgia, serif);
    letter-spacing: 0; color: var(--fq-gold); background: none; -webkit-text-fill-color: currentColor; text-shadow: none; }
  .fq-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 0.98rem/1.3 var(--h-display, "Cinzel", Georgia, serif); color: #c9c0ad; }
  .fq-who:not(:empty)::before { content: "\00b7"; margin-right: 12px; color: #8f8169; }

  .fq-body { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); margin: 0 10px; }
  .fq-pg { position: relative; min-width: 0; min-height: 540px; padding: 20px 26px 28px; color: var(--fq-ink); background: var(--parch-bg); }
  .fq-left { box-shadow: var(--parch-spine-l); border-right: 1px solid var(--parch-fold); border-radius: var(--parch-round) 0 0 var(--parch-round); }
  .fq-right { box-shadow: var(--parch-spine-r); border-radius: 0 var(--parch-round) var(--parch-round) 0; }
  .fq-pg a { color: var(--fq-title); text-underline-offset: 3px; }
  .fq-pg a:hover { color: #8a2412; }
  .fq-pg :focus-visible, .fq-dl:focus-visible { outline: 2px solid var(--fq-title); outline-offset: 2px; border-radius: 3px; }
  .fq-pg code { padding: 0 4px; border-radius: 3px; background: #2e1c0a1a; color: var(--fq-ink); font-size: 0.92em; overflow-wrap: anywhere; }

  /* The left page: a line about the add-on, then the chapters. */
  .bw .bw-in .fq-book .fq-intro { margin: 0 0 16px; max-width: none; font: 400 1.02rem/1.5 var(--ch-read, Georgia, serif); color: var(--fq-note); text-shadow: none; }
  .fq-toc h2, .bw .fq-book .fq-toc h2 { margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--fq-rule); font: 700 1.02rem/1.3 var(--h-display, "Cinzel", Georgia, serif);
    color: var(--fq-title); text-shadow: none; }
  .fq-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
  .fq-toc a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 8px; border-radius: 2px; color: var(--fq-ink); text-decoration: none; font-size: 1.02rem; }
  .fq-toc a:hover { background: var(--fq-hover); color: var(--fq-ink); }
  .fq-toc a[aria-current="true"] { background: var(--fq-hover); font-weight: 700; }
  .fq-num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--fq-seal); color: #fff3d6;
    font: 700 0.8rem/1 var(--ch-body, sans-serif); }
  .fq-name { min-width: 0; }
  .fq-count { margin-left: auto; font-size: 0.85rem; color: var(--fq-note); white-space: nowrap; }

  /* The right page: the chapter, then its questions. */
  .fq-crumb { margin: 0; font-size: 0.86rem; color: var(--fq-note); }
  .bw .fq-book .fq-chapter h2 { margin: 0 0 10px; font: 700 clamp(1.45rem, 2.6vw, 1.75rem)/1.15 var(--h-display, "Cinzel", Georgia, serif); color: var(--fq-title); text-shadow: none; }
  .fq-chapter + .fq-chapter { margin-top: 34px; }
  .bw .fq-book .fq-q { padding: 0; border: 0; border-bottom: 1px solid #b99a5e88; scroll-margin-top: 90px; }
  .fq-q > summary { display: flex; gap: 8px; align-items: baseline; padding: 11px 2px; list-style: none; cursor: pointer; color: var(--fq-title); }
  .fq-q > summary::-webkit-details-marker { display: none; }
  .fq-q > summary::before { content: "\203a"; flex: none; width: 0.7em; color: var(--fq-red); font-weight: 700; transition: transform 0.15s; }
  .fq-q[open] > summary::before { transform: rotate(90deg); }
  .fq-q > summary:hover { color: #8a2412; }
  .bw .fq-book .fq-q > summary h3 { margin: 0; font: 700 1.03rem/1.35 var(--ch-body, "Alegreya Sans", sans-serif); color: inherit; text-shadow: none; }
  .bw .fq-book .fq-q p { margin: 0 0 10px 16px; font: 400 1.06rem/1.6 var(--ch-read, Georgia, serif); color: var(--fq-ink); }
  .bw .fq-book .fq-q p:last-child { margin-bottom: 14px; }
  .fq-turn { display: none; }

  .fq-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 10px; padding: 10px 16px 12px;
    border-top: 1px solid #3a2e1f; }
  .bw .fq-book .faq-more { margin: 0; color: #c9c0ad; font-size: 0.95rem; }
  .fq-foot a:not(.fq-dl) { color: #f0c96b; }
  .fq-dl { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 3px; background: #b8402c; color: #fff3d6; text-decoration: none;
    font: 800 0.95rem/1 var(--ch-body, sans-serif); box-shadow: inset 0 0 0 1px #ffd1007a; }
  .fq-dl:hover { background: #cf4f39; color: #fff3d6; }

  /* The book at work (faq.js): one chapter at a time on the right. */
  .fq-on .fq-chapter[hidden] { display: none; }
}

/* Narrow screens: one page at a time. Chapters first; a chapter turns to its questions, and a button turns back. */
@media (max-width: 720px) {
  :where(html:not([data-door="willo"])) {
    .bw .bw-in.fq-page { width: calc(100% - 20px); margin-block: 22px 40px; }
    .fq-title { padding: 16px 12px 8px; gap: 8px; }
    .fq-who { display: none; }
    .fq-body { grid-template-columns: minmax(0, 1fr); margin: 0 6px; }
    .fq-pg { min-height: 0; padding: 18px 16px 22px; }
    .fq-left { border-right: 0; }
    .fq-pg { box-shadow: inset 0 0 40px #5a3a161a; border-radius: var(--parch-round); }
    .fq-on[data-side="l"] .fq-right, .fq-on[data-side="r"] .fq-left { display: none; }
    .fq-on[data-side="l"] .fq-left { min-height: 380px; }
    .fq-on .fq-turn { display: block; margin: 0 0 12px; }
    .fq-back { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid #000; border-radius: 2px; background: #231b12;
      font: 700 0.9rem/1 var(--ch-body, sans-serif); text-decoration: none; }
    .fq-pg a.fq-back, .fq-pg a.fq-back:hover { color: var(--fq-gold); }
    .fq-foot { padding-inline: 12px; }
  }
}

/* ---- The Willo door: the plain list, in her look (door.css) ---- */
html[data-door="willo"] {
  .fq-plate, .fq-icon, .fq-who, .fq-turn, .fq-crumb, .fq-dl { display: none; }
  .fq-title { display: block; }
  .fq-toc { margin: 8px 0 18px; padding: 20px 24px; border: 1px solid var(--h-acc-line); border-radius: var(--h-r); background: var(--h-acc-panel); }
  .fq-toc h2 { margin: 0 0 8px; font-size: 1.1rem; }
  .fq-toc ol { margin: 0; padding: 0; list-style: none; columns: 2 260px; column-gap: 28px; }
  .fq-toc li { margin-bottom: 6px; break-inside: avoid; }
  .fq-toc a { color: var(--h-text-2); text-decoration: none; }
  .fq-toc a:hover { color: var(--h-acc-hi); }
  .fq-num { display: none; }
  .fq-count::before { content: "("; } .fq-count::after { content: ")"; }
  .fq-count { margin-left: 6px; }
  .fq-chapter { margin-top: 36px; }
  .fq-chapter h2 { margin: 0 0 4px; }
  .faq-q h3 { margin: 0 0 10px; font-size: clamp(1.25rem, 2.2vw, 1.5rem); line-height: 1.3; color: var(--h-acc-hi); }
  .faq-q > summary { cursor: pointer; }
  /* The pages carry ch-paper for the book's sake, whose code ink (chronicle.css) is dark: keep her own. */
  .fq-pg :is(code, kbd) { background: var(--c-code, #00000066); color: inherit; }
}
