/**
 * File: guides.css
 * Purpose: Guides hub + single-guide + sources page styling (plus the
 *          contact/estimator/faq page headers that share .guide-header) for
 *          the ispecllc.com cost subdomains. Reads the iSpec tokens declared
 *          in site-shell.css :root (--teal, --teal-deep, --teal-tint, --ink,
 *          --ink-soft, --muted, --ground, --line); loaded per-view by
 *          guides/index.php, guides/show.php, guides/sources.php, faq.php,
 *          contact.php, estimator.php. Body typography reuses the
 *          .guide-prose / .guide-subheading rules in site.css — this file
 *          covers hub layout, the single-guide e-reader toolbar, the
 *          off-canvas section drawer and the glossary first-use links.
 * Author: iSpec LLC
 * Created: 2026-08-10
 * Last Modified: 2026-10-10 — reader inner pages ([data-reader-page="inner"], set by
 *          show.php): meta + synopsis hidden, title shrunk to a kicker, section <h2>
 *          flush under it — the synopsis belongs to page 1 only
 * Last Modified: 2026-10-10 — hub is one flat grid: .guide-cat-group dropped (unused);
 *          .guide-cat-heading stays for the single-guide "More … guides" list;
 *          card titles are now <h2> so the rule covers h2 and h3
 * Last Modified: 2026-10-07 — .guide-budget-callout rule (the seeded guides end with it; it rendered as plain text)
 * Last Modified: 2026-10-07 — funnel-subdomain template: the old CRC palette
 *          variables re-mapped onto the iSpec tokens (teal → --teal,
 *          teal-dark → --teal-deep, teal-tint → --teal-tint, ink → --ink,
 *          ink-mid → --ink-soft, muted → --muted, border → --line,
 *          surface → --ground); .glossary-link moved here from site.css
 *          (guide bodies are the only place GlossaryDeepLinker writes it; the
 *          links now point at the parent glossary on ispecllc.com).
 */

/* ── HUB HEADER ──────────────────────────────────────── */
.guide-header-title {
  font-size: 2rem;
  color: var(--ink);
  margin-bottom: 0;
}
.guide-header-sub {
  color: var(--muted);
  max-width: 640px;
  margin: 0.5rem 0 0;
}
.guide-empty { color: var(--muted); }

/* ── HUB — CARD GRID (+ related-list heading on guide pages) ── */
.guide-cat-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1rem;
}
.guide-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 700px) {
  .guide-list { grid-template-columns: 1fr 1fr; }
}
.guide-list-item {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #ffffff;
  text-decoration: none;
  color: var(--ink-soft);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.guide-list-item:hover {
  border-color: var(--teal);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  color: var(--ink-soft);
}
.guide-list-item h2,
.guide-list-item h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.375rem;
}
.guide-list-item p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.guide-list-meta {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--teal-deep);
}

/* ── SINGLE GUIDE — HEADER ───────────────────────────── */
.guide-article-header { margin-bottom: 1.75rem; }
.guide-article-meta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 0.625rem;
}
.guide-article-title {
  font-size: 2rem;
  color: var(--ink);
  margin-bottom: 0.625rem;
}
.guide-article-sub {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
}
/* Inner reader pages — show.php sets data-reader-page on the article once
   the body is paginated. The synopsis belongs to page 1 only: here the meta
   line and synopsis go, the guide title drops to a small kicker, and the
   section's <h2> (base h2 size) is the page heading. No-JS and page 1 keep
   the full header. */
.guide-article[data-reader-page="inner"] .guide-article-meta,
.guide-article[data-reader-page="inner"] .guide-article-sub { display: none; }
.guide-article[data-reader-page="inner"] .guide-article-header { margin-bottom: 0.5rem; }
.guide-article[data-reader-page="inner"] .guide-article-title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 0;
}
.guide-article[data-reader-page="inner"] .guide-page > h2:first-child,
.guide-article[data-reader-page="inner"] .guide-page--wrapup > .guide-sources > h2:first-child { margin-top: 0; }

/* ── SOURCES + RELATED + BACK LINK ───────────────────── */
.guide-sources {
  margin: 2.5rem 0 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--line);
}
.guide-sources h2 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.guide-sources h2 a { color: var(--ink); text-decoration: none; }
.guide-sources h2 a:hover { color: var(--teal-deep); }
.guide-sources ul { margin: 0 0 1rem 1.1rem; padding-left: 1rem; }
.guide-sources li { margin-bottom: 0.5rem; font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft); }
.guide-sources-foot,
.guide-hub-foot,
.guide-back { margin-top: 1.25rem; font-size: 0.92rem; }
.guide-hub-foot a,
.guide-sources-foot a,
.guide-back a { color: var(--teal-deep); text-decoration: none; font-weight: 600; }
.guide-hub-foot a:hover,
.guide-sources-foot a:hover,
.guide-back a:hover { color: var(--teal); }
.guide-related { margin: 2rem 0 1.5rem; }
.guide-related ul { margin: 0.5rem 0 0 1.1rem; padding-left: 1rem; }
.guide-related li { margin-bottom: 0.4rem; }
.guide-related a { color: var(--teal-deep); text-decoration: none; }
.guide-related a:hover { color: var(--teal); }

/* ── SINGLE GUIDE — E-READER TOOLBAR ─────────────────── */
/* The toolbar lives at the end of the article column, so it spans the
   article content width and can never overlap the footer. position:sticky
   keeps it floating at the bottom of the viewport while there is guide
   left to read, then it comes to rest riding the top edge of the footer. */
body.guide-nav-open { overflow: hidden; }

.guide-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 1030;
  margin-top: 2rem;
  padding-top: 3px;   /* room for the progress strip */
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.5rem;
  background: #ffffff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.1);
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  min-height: 56px;
}
.guide-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink-soft);
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  min-width: 0;
}
.guide-toolbar-prev { justify-content: flex-start; flex: 1 1 0; }
.guide-toolbar-next { justify-content: flex-end; flex: 1 1 0; text-align: right; }
.guide-toolbar-prev .guide-toolbar-txt { align-items: flex-start; }
.guide-toolbar-next .guide-toolbar-txt { align-items: flex-end; }
.guide-toolbar-btn:hover { color: var(--teal-deep); }
.guide-toolbar-ico { font-size: 1rem; line-height: 1; color: var(--teal-deep); flex: 0 0 auto; }
.guide-toolbar-txt {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
}
.guide-toolbar-kicker {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.guide-toolbar-lbl {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.guide-toolbar-sections {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 0.25rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--teal);
  border-radius: 999px;
  background: var(--teal-tint);
  color: var(--teal-deep);
  font-weight: 600;
}
.guide-toolbar-sections:hover { background: var(--teal-tint); color: var(--teal-deep); }
.guide-toolbar-sections .guide-toolbar-ico { color: var(--teal-deep); }
.guide-toolbar-sections .guide-toolbar-lbl { white-space: nowrap; }
.guide-toolbar-sections .guide-toolbar-txt { align-items: center; line-height: 1.15; }
.guide-toolbar-sections .guide-toolbar-kicker { color: var(--teal-deep); opacity: 0.85; }
@media (max-width: 560px) {
  .guide-toolbar-prev .guide-toolbar-lbl,
  .guide-toolbar-next .guide-toolbar-lbl { display: none; }
  .guide-toolbar-sections { padding: 0.5rem 0.8rem; }
}
/* Tablet/desktop: round the corners + a small gap off the screen edge so it
   reads as a floating pill instead of a bar stuck to the viewport edge. */
@media (min-width: 768px) {
  .guide-toolbar {
    bottom: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.875rem;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.14);
    overflow: hidden;
  }
}
.guide-toolbar-progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--line);
}
.guide-toolbar-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 0.2s ease;
}

/* ── SINGLE GUIDE — OFF-CANVAS SECTION DRAWER ────────── */
/* Opened by the toolbar "Sections" button; slides in from the right. */
.guide-section-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: rgba(20, 32, 31, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.guide-section-nav-backdrop.is-open { opacity: 1; }

.guide-section-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  width: min(360px, 86vw);
  background: #ffffff;
  box-shadow: -4px 0 22px rgba(0, 0, 0, 0.16);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}
.guide-section-nav.is-open { transform: translateX(0); }
.guide-section-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.guide-section-nav-title { font-weight: 700; color: var(--ink); }
.guide-section-nav-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.4rem;
}
.guide-section-nav-close:hover { color: var(--ink); }
.guide-section-nav-list {
  overflow-y: auto;
  padding: 0.5rem 0.6rem 1.5rem;
  flex: 1 1 auto;
}
.guide-section-link {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: 0.5rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
}
.guide-section-link:hover { background: var(--ground); color: var(--ink-soft); }
.guide-section-link.is-current {
  background: var(--teal-tint);
  color: var(--teal-deep);
  border-left-color: var(--teal);
  font-weight: 600;
}
.guide-section-link--top { font-weight: 700; color: var(--ink); margin-bottom: 0.25rem; }

/* ── SINGLE GUIDE — PAGINATED "READER" MODE ──────────── */
/* One <h2> section per page once show.php's JS runs; no-JS leaves the
   whole body in normal document flow (these rules never hide content
   unless JS has already split it into .guide-page blocks). */
.guide-page { margin-bottom: 0.5rem; }
.guide-page[hidden],
.guide-section-nav[hidden],
.guide-section-nav-backdrop[hidden] { display: none !important; }
@media (min-width: 700px) {
  .guide-page { min-height: 42vh; }   /* keeps short sections from looking sparse */
}
.guide-page--wrapup { min-height: 0; }

/* ── FAQ — <details> disclosures (public/faq.php) ────── */
/* One bordered row per question; the summary is the click target and
   carries a rotating chevron. Answers reuse .guide-prose for type rhythm. */
.faq-list { border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--teal-deep);
  border-bottom: 2px solid var(--teal-deep);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}
.faq-item[open] > .faq-question::after { transform: rotate(-135deg) translateY(-2px); }
.faq-question:hover { color: var(--teal-deep); }
.faq-answer { padding: 0 0 1.1rem; }
.faq-answer > :last-child { margin-bottom: 0; }

/* ── GLOSSARY FIRST-USE DEEP LINKS ───────────────────── */
/* Minted at render time by App\Helpers\GlossaryDeepLinker on the first use
   of each glossary term in a guide body; each one opens the term's page on
   the parent glossary (ispecllc.com/glossary/<slug>). A dotted underline
   rather than the solid link underline, so a definition lookup reads
   differently from a link the author chose to place. */
.glossary-link {
  color: inherit;
  text-decoration: underline dotted var(--teal-deep);
  text-underline-offset: 0.18em;
}
.glossary-link:hover,
.glossary-link:focus-visible {
  color: var(--teal-deep);
  text-decoration: underline solid var(--teal-deep);
}

/* ── BUDGET CALLOUT ──────────────────────────────────────── */
/* Every guide ends with a "What this means for your budget" block that
   hands off to the estimator (seeders emit <div class="guide-budget-callout">). */
.guide-budget-callout {
  margin: 2rem 0 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--teal-tint);
  border-left: 4px solid var(--teal-deep);
  border-radius: 0 10px 10px 0;
}
.guide-budget-callout p:last-child { margin-bottom: 0; }
.guide-budget-callout a { color: var(--teal-deep); font-weight: 600; }
