/* guide.css — shared styles for the public product guides (/docs/*).
 *
 * Uses ONLY the app's theme tokens from layout.html (--bg, --text, --gold,
 * --accent, …) and its two brand families (DM Serif Display / Outfit), so the
 * guides follow the app's light/dark behaviour with no parallel palette.
 * Deliberately unlayered: layout.html's @layer base styles h2 as a small
 * uppercase label; guide headings override that inside .guide only.
 *
 * Three parts: site chrome (docs-nav / docs-footer), the reading layout
 * (.guide), and presentation mode (html.guide-presenting — driven by the
 * docs-guide island; the same DOM, no forked content).
 */

/* ─── Site chrome ─────────────────────────────────────────────────────── */
.docs-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding: 0.85rem max(1rem, calc((100% - 72rem) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.docs-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.2rem;
  color: var(--text);
}
.docs-nav-brand:hover { color: var(--text); }
.docs-nav-brand .star { color: var(--gold); font-size: 1rem; }
.docs-nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.1rem;
  font-size: 0.95rem;
}
.docs-nav-links a {
  color: var(--text-secondary);
  padding: 0.35rem 0;
}
.docs-nav-links a:hover,
.docs-nav-links a[aria-current="page"] { color: var(--text); }
.docs-nav-links a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 0.35em; }
.docs-nav-links .docs-nav-cta {
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-weight: 500;
}
.docs-nav-links .docs-nav-cta:hover { background: var(--accent-hover); color: var(--on-accent); }

.docs-footer {
  margin-top: 4rem;
  padding: 2rem 1rem 3.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.8;
}
.docs-footer a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 0.2em; }
.docs-footer a:hover { color: var(--text); }
.docs-footer-guides { margin-bottom: 0.4rem; }

/* Older guides keep their card layout; this just gives them room. */
.docs-page { padding-top: 2rem; }

/* ─── Reading layout ──────────────────────────────────────────────────── */
.guide {
  --guide-prose: 68ch;
  --guide-wide: 70rem;
  box-sizing: border-box; /* width:100% + side padding must not overflow a 390px viewport */
  width: 100%;
  max-width: var(--guide-wide);
  margin: 0 auto;
  padding: 3rem 1rem 0;
  font-size: 1.125rem;
  line-height: 1.6;
  font-weight: 400;
  color: var(--text);
}
.guide > * { max-width: var(--guide-prose); margin-left: auto; margin-right: auto; }
.guide > .guide-step { max-width: var(--guide-wide); }
.guide p, .guide li { color: var(--text); }
.guide p { margin: 0 0 1rem; }
.guide strong { font-weight: 600; }
.guide a:not(.guide-anchor):not(.guide-btn):not(.guide-figure-link):not(.guide-card) {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.guide a:not(.guide-anchor):not(.guide-btn):not(.guide-figure-link):not(.guide-card):hover { color: var(--accent-hover); }
.guide ul, .guide ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.guide ul { list-style: disc; }
.guide ol { list-style: decimal; }
.guide ul.guide-cards { list-style: none; padding: 0; }
.guide li { margin-bottom: 0.45rem; }
.guide li::marker { color: var(--gold); }
.guide blockquote {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--gold-border);
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}
.guide blockquote p { margin: 0; color: var(--text-secondary); }
/* A compact comparison table inside a step (Sharing: Gem / chat / round). */
.guide-table { width: 100%; border-collapse: collapse; margin: 0 0 1rem; font-size: 0.95rem; }
.guide-table th, .guide-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.guide-table th { font-weight: 600; color: var(--text-secondary); }

.guide-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.6rem;
}
.guide h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 1rem;
}
.guide h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.65rem, 1.3rem + 1.2vw, 2.1rem);
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin: 0 0 0.9rem;
  scroll-margin-top: 1.5rem;
}
.guide h3 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
}
.guide-lede { font-size: 1.25rem; color: var(--text-secondary); }
.guide-meta { font-size: 0.9rem; color: var(--text-muted); }

.guide-hero { padding-bottom: 1rem; }
.guide-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.25rem; }

.guide-block { margin-top: 3rem; }

/* Section heading copy-link: visible on hover/focus (and faintly on touch). */
.guide-anchor {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.25rem;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.7em;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
  vertical-align: middle;
}
h2:hover .guide-anchor,
.guide-anchor:focus-visible { opacity: 1; }
@media (hover: none) { .guide-anchor { opacity: 0.6; } }
.guide-anchor[data-copied]::after {
  content: 'Link copied';
  margin-left: 0.4rem;
  font-size: 0.8rem;
  color: var(--gold);
}

/* Buttons: blue for actions (the landing's CTA convention). */
.guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.guide-btn:hover { color: var(--text); border-color: var(--text-muted); }
.guide-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.guide-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.guide-btn[hidden] { display: none; }

/* "In this guide" chapter list. */
.guide-toc {
  margin-top: 2.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.guide-toc h2 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.guide-toc ol { margin: 0; padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; }
.guide-toc li { break-inside: avoid; margin-bottom: 0.3rem; }

/* Walkthrough step: text column + screenshot. */
.guide-step {
  margin-top: 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 1rem;
}
.guide-step-text { max-width: var(--guide-prose); }
.guide-step-num {
  display: inline-block;
  min-width: 1.6em;
  margin-right: 0.35rem;
  color: var(--gold);
}
.guide-figures { display: grid; gap: 1.5rem; margin-top: 1.5rem; }
.guide-figures-pair { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); align-items: start; }
.guide-figures-two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.guide-figure { margin: 0; }
.guide-figure-link { display: block; border-radius: 10px; }
.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  background: var(--bg-surface);
}
[data-theme="light"] .guide-figure img { box-shadow: 0 6px 20px rgba(15, 28, 54, 0.12); }
.guide-figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.guide-note {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 1rem;
}
.guide-note p:last-child { margin-bottom: 0; }

.guide-try {
  margin-top: 4rem;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  background: var(--gold-glow);
}
.guide-try p:last-child { margin-bottom: 0; }

/* Index page cards. */
.guide-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
}
.guide-cards li { margin: 0; }
.guide-card {
  display: block;
  box-sizing: border-box; /* height:100% + padding must stay inside its grid cell */
  height: 100%;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.guide .guide-card { text-decoration: none; }
.guide-card:hover { border-color: var(--gold-border); background: var(--bg-card-hover); color: var(--text); }
.guide-card-title { font-family: 'DM Serif Display', Georgia, serif; font-size: 1.4rem; display: block; margin-bottom: 0.35rem; color: var(--text); }
.guide-card-summary { display: block; font-size: 1rem; color: var(--text-secondary); }

/* The fixed build-stamp/contact pills sit over the last line on phones;
   leave them room. */
@media (max-width: 767px) {
  .guide { padding-top: 2rem; font-size: 1.0625rem; }
  .guide-lede { font-size: 1.125rem; }
  .guide-step { margin-top: 3rem; padding-top: 2rem; }
  .guide-figures-pair,
  .guide-figures-two { grid-template-columns: minmax(0, 1fr); }
  .guide-figures-pair .guide-figure:last-child { max-width: 22rem; }
}

/* ─── Presentation mode ───────────────────────────────────────────────── */
.guide-present-bar[hidden] { display: none; }

html.guide-presenting,
html.guide-presenting body { overflow: hidden; }
html.guide-presenting .docs-nav,
html.guide-presenting .docs-footer,
html.guide-presenting .build-stamp,
html.guide-presenting .site-contact,
html.guide-presenting .guide > :not([data-slide]) { display: none; }
html.guide-presenting [data-slide] { display: none; }
html.guide-presenting [data-slide].is-current {
  display: grid;
  position: fixed;
  inset: 0;
  z-index: 60;
  margin: 0;
  max-width: none;
  border: 0;
  padding: 5vh 4vw 10vh;
  grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
  align-items: center;
  gap: 3vw;
  overflow: auto;
  background: var(--bg);
  font-size: clamp(1.1rem, 0.6rem + 0.8vw, 1.45rem);
  animation: guide-slide-in 0.25s ease-out;
}
html.guide-presenting [data-slide].is-current:not(:has(.guide-figures)) {
  grid-template-columns: minmax(0, 52rem);
  justify-content: center;
  align-content: center;
}
html.guide-presenting [data-slide].is-current h1 { font-size: clamp(2.4rem, 1rem + 3.4vw, 4.2rem); }
html.guide-presenting [data-slide].is-current h2 { font-size: clamp(1.9rem, 0.8rem + 2vw, 3rem); }
html.guide-presenting [data-slide].is-current h1:focus,
html.guide-presenting [data-slide].is-current h2:focus { outline: none; }
html.guide-presenting [data-slide].is-current .guide-anchor,
html.guide-presenting [data-slide].is-current .guide-hero-actions { display: none; }
html.guide-presenting .guide-figures {
  display: flex;
  gap: 1.5vw;
  margin: 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
html.guide-presenting .guide-figure { flex: 0 1 auto; min-width: 0; }
/* One screenshot per slide: a supplementary view (e.g. the phone shot) stays
   in the reading page only. */
html.guide-presenting .guide-figure-secondary { display: none; }
html.guide-presenting .guide-figure img {
  width: auto;
  max-width: 100%;
  max-height: 78vh;
}
html.guide-presenting .guide-figures-two .guide-figure img,
html.guide-presenting .guide-figures-pair .guide-figure img { max-height: 70vh; }
html.guide-presenting .guide-figure figcaption { font-size: 0.8em; }

.guide-present-bar {
  position: fixed;
  left: 50%;
  bottom: 2.5vh;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.guide-present-bar .guide-btn { padding: 0.3rem 0.8rem; font-size: 0.9rem; border-radius: 999px; }
.guide-present-bar .guide-btn:disabled { opacity: 0.45; cursor: default; }
.guide-present-position { min-width: 3.5rem; text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 800px) {
  html.guide-presenting [data-slide].is-current {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    padding: 4vh 1rem 5.5rem;
  }
  html.guide-presenting .guide-figures { flex-direction: column; }
  html.guide-presenting .guide-figure img { max-height: 50vh; }
}

@keyframes guide-slide-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html.guide-presenting [data-slide].is-current { animation: none; }
  .guide-anchor, .guide-btn, .guide-card { transition: none; }
}

@media print {
  .docs-nav, .guide-present-bar, [data-present-toggle], .guide-anchor { display: none !important; }
}
