/* User Guide page (sceneplanner.app/guide). Builds on style.css: same colors, fonts and header. */

.guide {
  max-width: var(--max); margin: 0 auto;
  padding: 48px max(16px, env(safe-area-inset-right, 0px)) 72px max(16px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 72px; align-items: start;
}
.guide-main { max-width: 720px; min-width: 0; }

/* title, intro, search */
.guide-head .eyebrow { margin: 0 0 10px; }
.guide-head h1 { font-size: calc(clamp(44px, 6vw, 64px) * var(--ds, 1)); line-height: 1; }
.intro { margin-top: 18px; color: var(--ink-2); font-size: 18px; }
.intro p { margin: 0; }
.search { position: relative; margin: 28px 0 8px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; padding: 13px 96px 13px 42px; font: 400 16px/1.3 var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--ink-2); opacity: .8; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search .count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 500 12px/1 var(--font-label); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

/* chapters and topics */
.guide-main section { scroll-margin-top: calc(var(--hdr, 58px) + 24px); }
.chapter { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--line); }
.ch-no { margin: 0 0 8px; font: 500 12px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.chapter h2 { font-size: calc(clamp(32px, 4vw, 42px) * var(--ds, 1)); line-height: 1.05; margin-bottom: 14px; }
.topic { margin-top: 40px; }
.topic h3 { margin: 0 0 10px; font: 600 21px/1.3 var(--font-body); color: var(--ink); letter-spacing: -0.01em; }
.guide-main p { margin: 0 0 14px; }
.guide-main ul, .guide-main ol { margin: 0 0 14px; padding-left: 22px; }
.guide-main li { margin-bottom: 6px; }
.guide-main li ul { margin: 6px 0 0; }
.guide-main li::marker { color: var(--ink-2); }
.guide-main strong { font-weight: 600; color: var(--ink); }
.guide-main code {
  font: 500 .84em/1 var(--font-label); padding: 2px 6px; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--line); white-space: nowrap;
}
.tip {
  margin: 0 0 16px; padding: 14px 18px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-left: 3px solid var(--accent);
}
.table { overflow-x: auto; margin: 4px 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table table { border-collapse: collapse; width: 100%; font-size: 15px; }
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table th { font: 500 11px/1.2 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

/* search results */
mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.ctx { margin: 0 0 4px !important; font: 500 11px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.searching .chapter, .searching .topic { margin-top: 28px; padding-top: 0; border-top: 0; }
.searching .ch-no { display: none; }
.empty { margin-top: 32px; color: var(--ink-2); }

/* the chapter rail */
.rail {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--hdr, 58px) + 40px);
  max-height: calc(100vh - var(--hdr, 58px) - 80px); overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 4px 4px 2px;
}
.rail-title { margin: 0 0 14px; font: 500 12px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail li { position: relative; padding-bottom: 6px; }
.rail a {
  display: flex; align-items: flex-start; gap: 14px; padding: 6px 0;
  color: var(--ink-2); text-decoration: none; font: 500 15px/1.3 var(--font-body);
  transition: color .2s ease;
}
.rail a:hover { color: var(--ink); }
.rail .dot {
  flex: none; width: 12px; height: 12px; margin-top: 3.5px; border-radius: 50%;
  border: 1.5px solid currentColor; background: var(--bg); position: relative; z-index: 1;
  transition: background-color .2s ease, border-color .2s ease;
}
/* the line between this chapter's dot and the next: dotted ahead of you, solid behind */
.rail .seg { position: absolute; left: 5px; top: 27px; bottom: -6px; width: 2px; pointer-events: none;
  background: linear-gradient(to bottom, var(--ink-2) 50%, transparent 0) 0 0 / 2px 5px repeat-y; opacity: .45; }
.rail .seg i { position: absolute; inset: 0; background: var(--accent); transform-origin: top; transform: scaleY(var(--p, 0)); transition: transform .12s linear; }
.rail li.done .seg, .rail li.current .seg { opacity: 1; background: var(--line); }
.rail li:last-child .seg { display: none; }
.rail li.done a, .rail li.current a { color: var(--accent); }
.rail li.current a { font-weight: 600; }
.rail li.done .dot, .rail li.current .dot { background: var(--accent); border-color: var(--accent); }
.searching .rail li { --p: 0 !important; }
.searching .rail li a { color: var(--ink-2); font-weight: 500; }
.searching .rail .dot { background: var(--bg) !important; border-color: currentColor !important; }
.searching .rail .seg { display: none; }


/* the bar for narrow screens */
.gbar { display: none; }
@media (max-width: 999px) {
  .guide { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 32px; }
  .guide-main { max-width: none; }
  .gbar {
    display: block; position: sticky; z-index: 9; top: calc(env(safe-area-inset-top, 0px) + var(--hdr, 58px));
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .gbar button {
    display: flex; align-items: baseline; gap: 10px; width: 100%; margin: 0; border: 0; background: none; cursor: pointer; text-align: left;
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); color: var(--ink);
  }
  .gbar-no { flex: none; font: 500 11px/1 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
  .gbar-name { flex: 1; min-width: 0; font: 600 15px/1.2 var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gbar svg { flex: none; align-self: center; width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
  .gbar button[aria-expanded="true"] svg { transform: rotate(180deg); }
  .gbar-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
  .gbar-progress i { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); }
  .rail {
    display: none; position: fixed; z-index: 12;
    top: calc(env(safe-area-inset-top, 0px) + var(--hdr, 58px) + 52px);
    left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
    max-height: calc(100vh - var(--hdr, 58px) - 80px); max-height: calc(100dvh - var(--hdr, 58px) - 80px);
    padding: 18px 20px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 18px 50px -20px rgba(0, 0, 0, .35);
  }
  .rail.open { display: block; }
  .chapter { margin-top: 48px; padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) { .rail .seg i, .rail a, .rail .dot { transition: none; } }

/* undo the home page's pricing-table styles inside the guide's tables */
.table table { table-layout: auto; }
.table thead th:first-child { width: auto; }
.table tbody td:last-child { background: none; }
.table tbody td { text-align: left; vertical-align: top; padding: 10px 14px; font-variant-numeric: normal; }

/* narrow screens: headings land below the chapter bar, not under it */
@media (max-width: 999px) { .guide-main section { scroll-margin-top: calc(var(--hdr, 58px) + 64px); } }

/* wide layout, like a reading app: chapters pinned left, text centered, topics right */
.guide-page .top { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
@media (min-width: 1000px) {
  .guide-page .top { padding-left: 48px; padding-right: 48px; }
  .guide {
    max-width: none; padding-left: 48px; padding-right: 48px;
    grid-template-columns: 240px minmax(0, 1fr) 240px; gap: 48px;
  }
  .guide-main { max-width: 760px; width: 100%; justify-self: center; font-size: 18px; }
  .guide-main .table table { font-size: 16px; }
}
.toprail { display: none; }
@media (min-width: 1240px) {
  .toprail {
    display: block; position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--hdr, 58px) + 40px);
    max-height: calc(100vh - var(--hdr, 58px) - 80px); overflow-y: auto; text-align: right;
  }
  .toprail ol { list-style: none; margin: 0; padding: 0; }
  .toprail li { margin: 0 0 4px; }
  .toprail a { display: block; padding: 6px 0; color: var(--ink-2); text-decoration: none; font: 500 14px/1.35 var(--font-body); transition: color .2s ease; }
  .toprail a:hover { color: var(--ink); }
  .toprail a.on { color: var(--accent); font-weight: 600; }
  .searching .toprail { visibility: hidden; }
}
@media (min-width: 1000px) and (max-width: 1239px) {
  .guide { grid-template-columns: 220px minmax(0, 1fr); }
}

/* desktop: both side lists sit in the middle of the window, top to bottom */
@media (min-width: 1000px) {
  .rail, .toprail {
    top: calc(env(safe-area-inset-top, 0px) + var(--hdr, 58px));
    height: calc(100vh - var(--hdr, 58px)); max-height: none;
    display: flex; flex-direction: column; justify-content: safe center;
    padding-block: 24px; margin-top: -48px;
  }
  .rail ol, .toprail ol { flex: none; }
}
@media (min-width: 1000px) and (max-width: 1239px) { .toprail { display: none; } }

/* guide tables: columns size to their contents (the home page's pricing table fixes them at 52/24/24) */
.table thead th { width: auto; text-align: left; padding: 12px 16px 10px; font: 500 11px/1.3 var(--font-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); background: none; }
.table thead th:first-child { width: auto; }
.table tbody td { padding: 12px 16px; border-bottom: 0; }
.table tbody td:first-child { font-weight: 600; white-space: nowrap; padding-right: 24px; }
.table tbody tr + tr td { border-top: 1px solid var(--line); }
.table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
@media (max-width: 600px) { .table tbody td:first-child { white-space: normal; } }

/* pictures: iPhone screenshots shown narrow and centered, slides at full text width */
.pics { margin: 24px 0 28px; display: grid; gap: 20px; justify-items: center; }
.pics img { display: block; height: auto; }
.pics .shots { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; }
.pics .shots img { width: 280px; max-width: 100%; filter: drop-shadow(0 14px 24px rgba(15, 30, 45, .16)); }
.pics .shots.wide img { width: 560px; }
.pics .slide { width: 100%; }
.pics .slide img { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.pics figcaption { max-width: 560px; text-align: center; font-size: 15px; color: var(--ink-2); }
@media (max-width: 600px) {
  .pics .shots { gap: 16px; }
  .pics .shots img { width: 240px; }
  .pics .shots.pair img { width: calc(50% - 8px); }
  .pics .shots.wide img { width: 100%; }
}
.searching .pics { display: none; }
