/**
 * File: guides.css
 * Purpose: Guides hub + single-guide + sources page styling for
 *          columbusremodelcost.com (reads the --crc-* tokens defined in
 *          site.css :root; loaded per-view by guides/index.php,
 *          guides/show.php, guides/sources.php). Body typography reuses
 *          the existing .guide-prose / .guide-subheading rules already
 *          in site.css — this file covers hub layout, the single-guide
 *          e-reader toolbar, and the off-canvas section drawer, ported
 *          from the columbusroofcost.com guides pattern and re-themed
 *          to the crc-teal palette.
 * Author: iSpec LLC
 * Created: 2026-08-10
 * Last Modified: 2026-08-10
 */

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

/* ── HUB — CATEGORY GROUPS + LIST ────────────────────── */
.guide-cat-group { margin-bottom: 2.5rem; }
.guide-cat-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--crc-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(--crc-border);
  border-radius: 0.75rem;
  background: #ffffff;
  text-decoration: none;
  color: var(--crc-ink-mid);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.guide-list-item:hover {
  border-color: var(--crc-teal);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  color: var(--crc-ink-mid);
}
.guide-list-item h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--crc-ink);
  margin: 0 0 0.375rem;
}
.guide-list-item p {
  font-size: 0.875rem;
  color: var(--crc-muted);
  margin: 0 0 0.5rem;
}
.guide-list-meta {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--crc-teal-dark);
}

/* ── 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(--crc-teal-dark);
  margin-bottom: 0.625rem;
}
.guide-article-title {
  font-size: 2rem;
  color: var(--crc-ink);
  margin-bottom: 0.625rem;
}
.guide-article-sub {
  font-size: 1.05rem;
  color: var(--crc-muted);
  max-width: 640px;
}

/* ── SOURCES + RELATED + BACK LINK ───────────────────── */
.guide-sources {
  margin: 2.5rem 0 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--crc-border);
}
.guide-sources h2 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.guide-sources h2 a { color: var(--crc-ink); text-decoration: none; }
.guide-sources h2 a:hover { color: var(--crc-teal-dark); }
.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(--crc-ink-mid); }
.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(--crc-teal-dark); text-decoration: none; font-weight: 600; }
.guide-hub-foot a:hover,
.guide-sources-foot a:hover,
.guide-back a:hover { color: var(--crc-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(--crc-teal-dark); text-decoration: none; }
.guide-related a:hover { color: var(--crc-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(--crc-border);
  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(--crc-ink-mid);
  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(--crc-teal-dark); }
.guide-toolbar-ico { font-size: 1rem; line-height: 1; color: var(--crc-teal-dark); 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(--crc-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(--crc-teal);
  border-radius: 999px;
  background: var(--crc-teal-tint);
  color: var(--crc-teal-dark);
  font-weight: 600;
}
.guide-toolbar-sections:hover { background: var(--crc-teal-tint); color: var(--crc-teal-dark); }
.guide-toolbar-sections .guide-toolbar-ico { color: var(--crc-teal-dark); }
.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(--crc-teal-dark); 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(--crc-border);
    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(--crc-border);
}
.guide-toolbar-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--crc-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(28, 28, 30, 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(--crc-border);
}
.guide-section-nav-title { font-weight: 700; color: var(--crc-ink); }
.guide-section-nav-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--crc-muted);
  cursor: pointer;
  padding: 0.1rem 0.4rem;
}
.guide-section-nav-close:hover { color: var(--crc-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(--crc-ink-mid);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
}
.guide-section-link:hover { background: var(--crc-surface); color: var(--crc-ink-mid); }
.guide-section-link.is-current {
  background: var(--crc-teal-tint);
  color: var(--crc-teal-dark);
  border-left-color: var(--crc-teal);
  font-weight: 600;
}
.guide-section-link--top { font-weight: 700; color: var(--crc-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; }
