/* CPQ Redwood Guide. Tokens first; dark mode redefines them. */

:root {
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #f0f2f1;
  --line: #dde1df;
  --line-soft: #e9ecea;
  --fg: #1d2320;
  --fg-dim: #4d5752;
  --fg-faint: #75807a;
  --accent: #127a6e;
  --accent-strong: #0e6157;
  --accent-fg: #ffffff;
  --accent-soft: #e2f1ee;
  --amber: #8a5a00;
  --amber-soft: #fbefd8;
  --blue: #2557a7;
  --blue-soft: #e5edfa;
  --done: #2f7d32;
  --done-soft: #e3f2e3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}

/*
 * Dark only when chosen with the theme button, never from the system setting:
 * this is a reading site and light reads best for long stretches.
 *
 * The dark palette is tuned for reading, not for drama: off-white text on dark
 * grey at about 10.6:1 (near-white on near-black, 13.7:1 before, makes letters
 * glow), muted accents, and dimmed screenshots so white images do not glare.
 */
:root[data-theme="dark"] {
  --bg: #1a1e1c; --surface: #212624; --surface-2: #2a302d; --line: #3a423e; --line-soft: #2f3633;
  --fg: #d2d8d4; --fg-dim: #aab3ae; --fg-faint: #8c9691;
  --accent: #6fc0b2; --accent-strong: #86cdc1; --accent-fg: #0f1c19; --accent-soft: #263a36;
  --amber: #e0b866; --amber-soft: #3b3222; --blue: #94b5e6; --blue-soft: #253247;
  --done: #88c98c; --done-soft: #24331f; --shadow: none;
  color-scheme: dark;
}
:root[data-theme="dark"] body { -webkit-font-smoothing: antialiased; }
:root[data-theme="dark"] .content img.shot { filter: brightness(.86) contrast(.95); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15.5px/1.6 var(--sans); }
a { color: var(--blue); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.25; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-fg); padding: 6px 10px; border-radius: 6px; z-index: 20; }
.skip:focus { left: 8px; }

/* --- top bar ---------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; flex-shrink: 0; }
.brand-name { font-weight: 700; font-size: 16px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); position: relative; flex-shrink: 0; }
.logo::after {
  content: ""; position: absolute; left: 9px; top: 5px; width: 7px; height: 13px;
  border: solid var(--accent-fg); border-width: 0 3px 3px 0; transform: rotate(45deg);
}

.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search input {
  width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
}
.search input:focus { background: var(--surface); }
.search-icon { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--fg-faint); stroke-width: 2; pointer-events: none; }
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 11;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .14);
  padding: 6px; max-height: 70vh; overflow-y: auto;
}
.suggest a { display: block; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--fg); }
.suggest a:hover, .suggest a.active { background: var(--accent-soft); }
.suggest .s-title { display: block; font-weight: 600; font-size: 14.5px; }
.suggest .s-page { display: block; font-size: 12.5px; color: var(--fg-faint); }
.suggest .s-all { color: var(--blue); font-size: 13.5px; }
.suggest .s-none { padding: 8px 10px; color: var(--fg-dim); font-size: 14px; }

.top-nav a { color: var(--fg-dim); text-decoration: none; font-weight: 600; font-size: 14.5px; padding: 6px 8px; border-radius: 6px; }
.top-nav a:hover, .top-nav a.current { color: var(--fg); background: var(--surface-2); }
.icon-btn { display: inline-flex; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }


main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; min-height: 60vh; }
/* Focus moves to the content after every page change, for keyboard and screen
   reader users; it is a landing point, not a control, so it gets no ring.
   The id outranks the general :focus-visible rule above. */
#view:focus, #view:focus-visible { outline: none; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--fg-faint); margin-bottom: 14px; }
.crumbs a { color: var(--fg-dim); text-decoration: none; }
.crumbs a:hover { color: var(--fg); text-decoration: underline; }
.crumbs .sep { color: var(--line); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--fg); font-weight: 600; font-size: 14.5px;
}
.btn:hover { border-color: var(--fg-faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.done-on { background: var(--done-soft); border-color: var(--done); color: var(--done); }

.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--done); width: 0; transition: width .25s; }

/* --- home ------------------------------------------------------------------- */

.hero { text-align: center; max-width: 720px; margin: 20px auto 32px; }
.hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -.01em; }
.hero p { font-size: 17px; color: var(--fg-dim); margin: 0; }

.start-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 860px; margin: 0 auto; }
.start-card {
  display: flex; flex-direction: column; gap: 6px; padding: 24px; border-radius: 14px; text-decoration: none; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.start-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.start-card .sc-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px;
}
.start-card .sc-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.start-card h2 { margin: 0; font-size: 21px; }
.start-card p { margin: 0; color: var(--fg-dim); }
.start-card .sc-areas { font-size: 13px; color: var(--fg-faint); }
.start-card .sc-foot { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.start-card .sc-foot .bar { flex: 1; }
.start-card .go { font-weight: 700; color: var(--accent); white-space: nowrap; }

.continue {
  max-width: 860px; margin: 18px auto 0; padding: 12px 16px; border-radius: 10px; background: var(--surface);
  border: 1px dashed var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14.5px;
}
.continue a { font-weight: 600; }

.jet-hint { max-width: 860px; margin: 16px auto 0; font-size: 14.5px; color: var(--fg-dim); }
.jet-hint a { font-weight: 600; }
.path-sub + .jet-hint { margin: -10px 0 20px; }

/* --- from JET -------------------------------------------------------------------- */

.jet-tools { display: flex; justify-content: flex-end; margin: -8px 0 8px; font-size: 14px; }
.jet-group { margin: 0 0 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.jet-group > summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none;
}
.jet-group > summary::-webkit-details-marker { display: none; }
.jet-group > summary::before {
  content: ""; width: 8px; height: 8px; flex-shrink: 0; border-right: 2px solid var(--fg-faint); border-bottom: 2px solid var(--fg-faint);
  transform: rotate(-45deg); transition: transform .15s;
}
.jet-group[open] > summary::before { transform: rotate(45deg); }
.jet-group > summary h2 { margin: 0; font-size: 17px; }
.jet-group > summary .count { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--fg-faint); }
.jet-group > summary:hover h2 { color: var(--accent); }
.jet-group > ul { margin: 0; padding: 0 12px 12px; }
.jet-group .say, .jet-group .pair, .jet-group .elsewhere-list li { background: var(--bg); }
.says, .pairs { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 10px; }
.say, .pair { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.say blockquote, .p-why blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--accent); }
.say .meta, .p-why .meta { margin: 0; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 14px; align-items: start; }
.p-side { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.p-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); }
.p-side a, .p-name { font-weight: 600; }
.p-arrow { align-self: center; color: var(--fg-faint); font-size: 18px; }
.p-why { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--fg-dim); }
.p-why blockquote { border-left-color: var(--line); }

.elsewhere-note { margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius); border: 1px dashed var(--line); background: var(--surface); color: var(--fg-dim); font-size: 14px; }
.elsewhere-list { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 8px; }
.elsewhere-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.elsewhere-list a { font-weight: 600; }
.elsewhere-summary { margin: 2px 0 0; font-size: 14px; line-height: 1.5; }
.elsewhere-list mark { background: var(--amber-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Support and forum: search and sort above the list. */
.forum-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; }
.forum-tools .ask-input { flex: 1 1 320px; }
.forum-sort { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--fg-dim); white-space: nowrap; }
.forum-sort select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer;
}
.forum-sort select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.forum-count { margin: 0 0 10px; }
.reader .elsewhere { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }
.reader .elsewhere summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--fg-dim); }
.reader .elsewhere summary:hover { color: var(--fg); }
.reader .elsewhere summary .meta { font-weight: 400; }
.reader .elsewhere > .meta { margin: 10px 0; }
.reader .elsewhere .elsewhere-list { margin: 0; }

.home-more { max-width: 860px; margin: 40px auto 0; }
.home-more h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint); margin: 0 0 12px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mini-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); text-decoration: none; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s;
}
.mini-card:hover { border-color: var(--accent); }
.mini-card strong { font-size: 15px; }
.meta { font-size: 13px; color: var(--fg-faint); }
.mini-card .meta { font-size: 12.5px; }
.mini-card .bar { margin-top: 6px; height: 4px; }
.mini-card.complete { border-color: var(--done); }

/* --- path (flow diagram) ------------------------------------------------------ */

.path-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.path-head h1 { margin: 0; font-size: 28px; }
.switch { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); }
.switch a { padding: 5px 12px; border-radius: 7px; text-decoration: none; color: var(--fg-dim); font-size: 13.5px; font-weight: 600; }
.switch a.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.path-sub { color: var(--fg-dim); margin: 0 0 20px; }

.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: 26px; overflow-x: auto; overflow-y: hidden; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; text-decoration: none; color: var(--fg-dim);
  font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--fg); }
.tabs a.on { color: var(--fg); border-bottom-color: var(--accent); }
.tabs .count { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--fg-faint); }
.tabs .count.complete { background: var(--done-soft); color: var(--done); }

.flow-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 32px; align-items: start; }
.flow-side { position: sticky; top: 84px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.flow-side h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint); margin: 0 0 8px; }
.flow-side .big { font-size: 26px; font-weight: 700; }
.flow-side p { margin: 6px 0 12px; color: var(--fg-dim); }

.flow { list-style: none; margin: 0; padding: 0; }
.stage { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 18px; position: relative; padding-bottom: 30px; }
.stage:not(:last-child)::before { content: ""; position: absolute; left: 19px; top: 44px; bottom: 4px; width: 2px; background: var(--line); }
.stage.done:not(:last-child)::before { background: var(--done); }
.marker {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--surface); border: 2px solid var(--line); color: var(--fg-dim); position: relative; z-index: 1;
}
.stage.current .marker { border-color: var(--accent); color: var(--accent); }
.stage.done .marker { background: var(--done); border-color: var(--done); color: #fff; }
.stage-label { margin: 8px 0 4px; font-size: 18px; }
.stage-kind { margin: 0 0 12px; font-size: 13px; color: var(--fg-faint); }

.nodes { display: grid; gap: 10px; }
.nodes.choice { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; }
.or { align-self: center; font-size: 12px; font-weight: 700; color: var(--fg-faint); text-transform: uppercase; padding: 4px 8px; border-radius: 12px; background: var(--surface-2); }

.node {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--radius); text-decoration: none; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.node:hover { border-color: var(--accent); transform: translateY(-1px); }
.node .n-title { font-weight: 700; font-size: 15.5px; }
.node .n-page { font-size: 12.5px; color: var(--fg-faint); }
.node .n-blurb { font-size: 14px; color: var(--fg-dim); border-left: 3px solid var(--line); padding-left: 10px; margin: 2px 0; }
.node .n-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 13px; }
.node .n-go { margin-left: auto; color: var(--accent); font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--fg-faint); }
.status.done { background: var(--done-soft); color: var(--done); }
.status.partial { background: var(--amber-soft); color: var(--amber); }
.node.is-done { border-color: var(--done); }

.topics-label { margin: 16px 0 8px; font-size: 13px; font-weight: 700; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .05em; }

/* --- topic reader ------------------------------------------------------------- */

.topic { display: grid; grid-template-columns: 260px minmax(0, 780px); gap: 36px; justify-content: center; align-items: start; }
.local { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; font-size: 14px; }
.local summary { list-style: none; cursor: pointer; }
.local summary::-webkit-details-marker { display: none; }
.local .l-page { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.local ol { list-style: none; margin: 12px 0 0; padding: 0; border-left: 2px solid var(--line-soft); }
.local li a {
  display: flex; gap: 8px; align-items: baseline; padding: 5px 10px; margin-left: -2px; border-left: 2px solid transparent;
  text-decoration: none; color: var(--fg-dim);
}
.local li a:hover { color: var(--fg); background: var(--surface-2); }
.local li a.on { color: var(--fg); font-weight: 600; border-left-color: var(--accent); background: var(--accent-soft); }
.local li a .tick { width: 14px; flex-shrink: 0; color: var(--done); font-weight: 700; }
.local .l-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); padding: 10px 12px 2px; }

.reader { min-width: 0; }
.reader .eyebrow { font-size: 13px; color: var(--fg-faint); margin: 0 0 4px; }
.reader h1 { font-size: 27px; margin: 0 0 10px; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; font-size: 13.5px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 10px; background: var(--surface-2); color: var(--fg-dim); white-space: nowrap; }
.chip.path { background: var(--accent-soft); color: var(--accent); }
.chip.rel { background: var(--blue-soft); color: var(--blue); }
.topic-meta .oracle { margin-left: auto; }

.mode { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.mode .label { color: var(--fg-dim); }

.content { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.content > :first-child { margin-top: 0; }
.content p { margin: 0 0 12px; }
.content ul, .content ol { margin: 0 0 12px; padding-left: 24px; }
.content li { margin-bottom: 8px; }
.content li > p:last-child { margin-bottom: 0; }
.content h4, .content h5, .content h6 { margin: 20px 0 8px; font-size: 16px; }
.content .sub { border-left: 3px solid var(--line); padding-left: 14px; margin: 14px 0; }
.content code { font-family: var(--mono); font-size: 13.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.content pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.content pre code { background: none; padding: 0; }
.content .table-wrap { overflow-x: auto; margin: 0 0 14px; }
.content table { border-collapse: collapse; font-size: 14.5px; min-width: 50%; }
.content th, .content td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--surface-2); }
.content tr > :first-child { min-width: 9em; }
.content td > p:last-child, .content th > p:last-child { margin-bottom: 0; }
.content img.icon { height: 1.15em; width: auto; vertical-align: -0.2em; margin: 0 2px; }
:root[data-theme="dark"] .content img.icon { filter: invert(.82); }
.content img.shot { display: block; max-width: 100%; height: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: zoom-in; }

/* Numbered steps you can tick off. */
/* Each step carries its own number (data-n): hidden steps would not advance a CSS counter. */
.content ol:has(> li.step) { list-style: none; padding-left: 0; }
.content li.step {
  position: relative; padding: 10px 12px 10px 74px; margin-bottom: 8px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface);
}
.content li.step::before {
  content: attr(data-n); position: absolute; left: 12px; top: 9px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--fg-dim);
}
.content li.step > .step-check { position: absolute; left: 46px; top: 14px; width: 17px; height: 17px; accent-color: var(--done); cursor: pointer; margin: 0; }
.content li.step.checked { background: var(--done-soft); border-color: transparent; }
.content li.step.checked::before { background: var(--done); color: #fff; content: "\2713"; }

/* One step at a time. */
.content.stepmode li.step { display: none; }
.content.stepmode li.step.current { display: block; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.content.stepmode li.step.checked::before { content: "\2713"; }
.step-nav { display: none; }
.content.stepmode .step-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.step-nav .where { font-weight: 700; }
.step-nav .dots { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; min-width: 120px; }
.step-nav .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); border: none; padding: 0; cursor: pointer; }
.step-nav .dot.done { background: var(--done); }
.step-nav .dot.on { outline: 2px solid var(--accent); outline-offset: 2px; }

.reader-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.pager a {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); text-decoration: none; color: var(--fg);
  border: 1px solid var(--line); background: var(--surface);
}
.pager a:hover { border-color: var(--accent); }
.pager .dir { font-size: 12.5px; color: var(--fg-faint); }
.pager .next { text-align: right; grid-column: 2; }
.path-next {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.path-next .label { color: var(--fg-dim); font-size: 14px; }
.path-next .back { margin-left: auto; font-size: 14px; }

/* Screenshot zoom. */
.zoom { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .8); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }

/* --- browse and search ---------------------------------------------------------- */

.page-title { font-size: 28px; margin: 0 0 6px; }
.card-grid + .stage-label { margin-top: 28px; }
.lead { color: var(--fg-dim); margin: 0 0 22px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 820px; }
.results a { display: block; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.results a:hover { border-color: var(--accent); }
.results .r-title { font-weight: 700; }
.results .r-page { font-size: 12.5px; color: var(--fg-faint); }
.results .r-snip { margin-top: 4px; font-size: 14px; color: var(--fg-dim); }
.results mark { background: var(--amber-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.empty { color: var(--fg-dim); padding: 24px 0; }

/* --- the tool page, and the hints that lead to it -------------------------------- */

.tool-page { max-width: 820px; }
.tool-page h2 { font-size: 19px; margin: 28px 0 8px; }
.tool-page ul, .tool-page ol { margin: 0; padding-left: 22px; }
.tool-page li { margin: 7px 0; }
.tool-page .meta { margin-top: 28px; }
.tool-hint { margin: -10px 0 22px; font-size: 14.5px; color: var(--fg-dim); }
.tool-hint a { font-weight: 600; }

/* A full-width band; the text is centred under the content. */
.footer { padding: 22px 24px 36px; font-size: 12.5px; line-height: 1.6; color: var(--fg-faint); background: var(--surface); border-top: 1px solid var(--line); }
.footer p { max-width: 860px; margin: 0 auto 8px; text-align: center; }
.footer p:last-child { margin-bottom: 0; }

/* --- narrow screens ------------------------------------------------------------- */

@media (max-width: 960px) {
  .flow-wrap { grid-template-columns: 1fr; }
  .flow-side { position: static; order: -1; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
  .flow-side h2, .flow-side .meta { display: none; }
  .flow-side .big { font-size: 18px; }
  .flow-side > p:first-of-type { margin: 0; }
  .flow-side .bar, .flow-side .next-up { grid-column: 1 / -1; margin: 0; }
  .topic { grid-template-columns: 1fr; gap: 16px; }
  .local { position: static; max-height: none; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
}
@media (max-width: 860px) {
  /* The search gets a row of its own, so it is never squeezed by the menu. */
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .top-nav { margin-left: auto; }
}
@media (max-width: 680px) {
  /* Name and theme button on the first row, the menu on the second, the search last. */
  .topbar { padding: 10px 16px; gap: 10px; }
  .top-nav { order: 2; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 2px; margin: 0 -8px; }
  #theme-btn { margin-left: auto; }
  main { padding: 20px 16px 40px; }
  .hero h1 { font-size: 26px; }
  .start-cards { grid-template-columns: 1fr; }
  .nodes.choice { grid-template-columns: 1fr; }
  .or { justify-self: center; }
  .stage { grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
  .marker { width: 32px; height: 32px; font-size: 14px; }
  .stage:not(:last-child)::before { left: 15px; top: 36px; }
  .content { padding: 16px; }
  .content li.step { padding-left: 66px; }
  .reader h1 { font-size: 23px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .topic-meta .oracle { margin-left: 0; }
  /* All three areas stay visible instead of scrolling off the edge. */
  .tabs { flex-wrap: wrap; gap: 6px; box-shadow: none; overflow: visible; }
  .tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
  .tabs a.on { border-color: var(--accent); background: var(--accent-soft); }
  .mode { flex-wrap: wrap; }
  .mode .label { flex-basis: 100%; }
  .mode .btn { flex: 1; }
  .pair { grid-template-columns: 1fr; }
  .p-arrow { transform: rotate(90deg); justify-self: start; padding-left: 4px; }
}

@media print {
  .topbar, .local, .mode, .reader-foot, .pager, .path-next, .step-nav, .step-check, .skip { display: none !important; }
  .topic { display: block; }
  .content { border: none; box-shadow: none; padding: 0; }
  .content.stepmode li.step { display: block; }
}

/* --- ask ------------------------------------------------------------------------- */

.ask-form { display: flex; gap: 8px; max-width: 680px; margin: 24px auto 0; }
.ask-input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.ask-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.chat-wrap { max-width: 820px; }
.chat { display: flex; flex-direction: column; gap: 22px; }
.exchange { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 84px; }
.q-bubble {
  align-self: flex-end; max-width: 80%; padding: 10px 14px; font-weight: 500;
  background: var(--accent); color: var(--accent-fg); border-radius: 14px 14px 4px 14px;
}
.a-bubble {
  align-self: stretch; padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; box-shadow: var(--shadow);
}
.a-bubble > p:last-child { margin-bottom: 0; }
.a-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.a-label { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.a-title { font-weight: 700; font-size: 16.5px; color: var(--fg); text-decoration: none; }
.a-title:hover { text-decoration: underline; }
.content.a-body { border: none; box-shadow: none; padding: 0; background: none; }
.a-body mark { background: var(--amber-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.a-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; font-size: 14px; }
.a-more { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.a-more > .meta { margin: 0 0 4px; }
/* Forum threads in an answer: set apart from Oracle's text, in the forum's own colour. */
.a-forum { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.a-forum .a-head { margin-bottom: 8px; }
.a-label.forum { color: var(--blue); }
.a-forum .elsewhere-list { margin: 0 0 10px; }
.a-forum .elsewhere-list li { background: var(--bg); }

.topic-links { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.topic-links a { display: block; padding: 6px 8px; border-radius: 7px; text-decoration: none; color: var(--fg); }
.topic-links a:hover { background: var(--surface-2); }
.topic-links .tl-title { display: block; font-weight: 600; }
.topic-links .meta { display: block; font-size: 12.5px; }

.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.examples > .meta { width: 100%; margin: 0 0 2px; }
.chip-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 7px 13px;
  cursor: pointer; font-size: 14px; text-align: left;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

.ask-dock {
  position: sticky; bottom: 0; z-index: 5; margin-top: 18px; padding: 16px 0 14px;
  background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}
.ask-form.docked { margin: 0; max-width: none; }
.ask-dock .link { margin-top: 8px; }

@media (max-width: 680px) {
  .q-bubble { max-width: 92%; }
  .a-bubble { padding: 14px; }
  .ask-input { font-size: 16px; }
}

/* Text buttons. */
.link { background: none; border: none; padding: 0; color: var(--blue); cursor: pointer; font-size: 14px; }
.link:hover { text-decoration: underline; }

/* Long answers open trimmed. */
.a-body img.shot { max-width: min(100%, 560px); }
.a-body.clamped { max-height: 380px; overflow: hidden; position: relative; }
.a-body.clamped::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
  background: linear-gradient(to bottom, transparent, var(--surface));
}
.a-expand { margin-top: 8px; font-weight: 600; }
