/* Session guide — shared styles across all three directions */
/* colors_and_type.css loaded separately via <link> in each page */

* { box-sizing: border-box; }

/* ── Iconographic accents (inline SVG via mask) ───────────────── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.icon svg { display: block; }

/* ── Type helpers ─────────────────────────────────────────────── */
.eyebrow-sm {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--leland-primary);
  font-weight: var(--fw-medium);
}
.kicker {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
  font-weight: var(--fw-medium);
}

/* ── Tags ─────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.tag-green { background: var(--leland-primary-extra-light); color: var(--leland-dark-green); }
.tag-orange { background: var(--leland-orange-light); color: var(--leland-orange-dark); }
.tag-blue { background: var(--leland-blue-light); color: var(--leland-blue); }
.tag-purple { background: var(--leland-purple-light); color: var(--leland-purple); }
.tag-neutral { background: var(--leland-gray-hover); color: var(--fg-1); }
.tag-outline { background: transparent; border: 1px solid var(--border); color: var(--fg-1); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background var(--duration-fast) var(--ease-standard);
}
.btn-primary { background: var(--leland-primary); color: #fff; }
.btn-primary:hover { background: var(--leland-primary-hover); color: #fff; }
.btn-secondary { background: #fff; color: var(--fg-1); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-ghost { background: transparent; color: var(--fg-1); }
.btn-ghost:hover { background: var(--bg-subtle); }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

/* ── Feedback prompt dialog (renderer.js) ────────────────────────── */
.feedback-prompt-dialog {
  border: none;
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  max-width: 380px;
  width: calc(100% - var(--space-8));
  box-shadow: var(--shadow-modal);
  position: relative;
  background: #fff;
  font-family: var(--font-family);
}
.feedback-prompt-dialog::backdrop { background: var(--overlay); }
.feedback-prompt-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg-2);
  padding: 0;
}
.feedback-prompt-close:hover { color: var(--fg-1); }
/* showModal() auto-focuses the first focusable element (this ×), and
   Chrome applies :focus-visible to it on open — so any outline here shows
   a ring the moment the modal appears. Suppress it entirely; the × is a
   redundant close affordance (Esc and backdrop-click also dismiss). */
.feedback-prompt-close:focus,
.feedback-prompt-close:focus-visible { outline: none; }
.feedback-prompt-body { text-align: center; }
.feedback-prompt-body h3 { margin-bottom: var(--space-6); }

.feedback-sentiments { display: flex; gap: var(--space-2); }
.feedback-sentiment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--fg-1);
  font-size: 13px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.feedback-sentiment:hover { border-color: var(--leland-primary); }
.feedback-sentiment.is-selected { border-color: var(--leland-primary); background: var(--leland-primary-extra-light); }
.feedback-sentiment-emoji { font-size: 1.6rem; line-height: 1; }

.feedback-stars-wrap { margin-top: var(--space-6); }
.feedback-stars-label { color: var(--fg-2); font-size: 14px; margin-bottom: var(--space-3); }
.feedback-stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: var(--space-1); }
.feedback-star {
  background: none;
  border: none;
  color: var(--border);
  cursor: pointer;
  padding: var(--space-1);
}
/* Same real SVG star (via mask) as the /review page uses, instead of a
   Unicode "★" glyph whose rendering quality varies across fonts/OSes —
   background-color: currentColor keeps the color-toggling logic below
   working exactly like the text-based version did. */
.feedback-star::before {
  content: '';
  display: inline-block;
  width: 1.8rem;
  height: 1.8rem;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
/* DOM order is 5,4,3,2,1 (row-reversed visually to read 1→5 left to
   right) specifically so this general-sibling selector lights up every
   star at or above whichever one is selected/hovered — same trick the
   star rating on /review uses. */
.feedback-star.is-selected,
.feedback-star.is-selected ~ .feedback-star,
.feedback-star:hover,
.feedback-star:hover ~ .feedback-star {
  color: var(--leland-yellow);
}
.feedback-thanks { margin-top: var(--space-4); color: var(--leland-dark-green); font-size: 14px; font-weight: var(--fw-medium); }

.feedback-comment-wrap { margin-top: var(--space-6); text-align: left; }
.feedback-comment-label { display: block; color: var(--fg-2); font-size: 14px; margin-bottom: var(--space-3); }
.feedback-comment {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--fg-1);
  resize: vertical;
  min-height: 4.5rem;
}
.feedback-comment:focus { outline: none; border-color: var(--leland-primary); }

/* :not([hidden]) so this display:flex doesn't override the `hidden`
   attribute the JS toggles — the buttons stay gone until the comment
   field is revealed (after a star/dislike pick), never during the
   initial sentiment or star prompts. */
.feedback-actions:not([hidden]) { display: flex; gap: var(--space-3); margin-top: var(--space-6); }
.feedback-skip,
.feedback-submit {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
}
.feedback-skip { border: 1px solid var(--border); background: #fff; color: var(--fg-2); }
.feedback-skip:hover { border-color: var(--leland-primary); color: var(--fg-1); }
.feedback-submit { border: 1px solid var(--leland-primary); background: var(--leland-primary); color: #fff; }
.feedback-submit:hover { opacity: 0.9; }

/* ── Code block ───────────────────────────────────────────────── */
code.inline-code {
  font-family: var(--font-family-mono);
  font-size: 0.85em;
  background: var(--bg-subtle, #f3f2ef);
  padding: 1px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.dirB-step-content { overflow-wrap: anywhere; min-width: 0; }

/* Wrapper is the positioned, non-scrolling anchor for the copy button. The inner
   .code-block scrolls horizontally underneath it, so the button stays pinned. */
.code-wrap { position: relative; }
.code-block {
  margin: 0; /* reset UA <pre> margin (1em) so the box sits flush in .code-wrap and the copy button stays inside the top edge */
  background: #f9f8f4;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  padding-right: 90px; /* room for the copy button so wrapped lines don't sit under it */
  font-family: var(--font-family-mono);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-1);
  white-space: pre-wrap;     /* preserve newlines/indentation but wrap long lines — no horizontal scroll */
  overflow-wrap: anywhere;   /* break very long unbroken tokens (URLs, paths) so nothing overflows */
}
.code-wrap .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.code-wrap .copy-btn:hover { background: var(--bg-subtle); color: var(--fg-1); }

/* Long code/prompt blocks collapse to ~10 lines with a "See more" toggle. */
.code-wrap.code-clamped:not(.code-expanded) .code-block { max-height: 18em; overflow: hidden; }
.code-more-btn {
  width: 100%;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  color: var(--leland-primary);
  padding: 8px 0 0;
  text-align: center;
}
.code-more-btn:hover { text-decoration: underline; }
.code-wrap.code-clamped:not(.code-expanded) .code-more-btn {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 38px 0 10px;
  background: linear-gradient(rgba(249, 248, 244, 0), #f9f8f4 60%);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* AI Builder Process phase tag in build subtitles (e.g. "PLAN &middot; ...") */
.dirB-phase { color: var(--leland-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.82em; }
.dirB-phase-desc { font-style: italic; }

/* ── Checkbox ─────────────────────────────────────────────────── */
.check {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}
.check.is-checked {
  background: var(--leland-primary);
  border-color: var(--leland-primary);
}
.check svg { opacity: 0; transition: opacity var(--duration-fast); }
.check.is-checked svg { opacity: 1; }
.check-lg { width: 28px; height: 28px; border-radius: 8px; }
.check-sm { width: 18px; height: 18px; border-radius: 5px; }

/* ── Progress bar ─────────────────────────────────────────────── */
.progress-track {
  position: relative;
  height: 6px;
  background: var(--leland-gray-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--leland-primary);
  border-radius: var(--radius-full);
  transition: width 360ms var(--ease-standard);
}

/* ── Callout ──────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15px;
  line-height: 1.55;
}
.callout-tip { background: var(--leland-blue-light); color: var(--fg-1); }
.callout-tip .icon { color: var(--leland-blue); }
.callout-trouble { background: var(--leland-primary-extra-light); color: var(--fg-1); }
.callout-trouble .icon { color: var(--leland-primary); }
.callout-go { background: var(--leland-purple-light); color: var(--fg-1); }
.callout-go .icon { color: var(--leland-purple); }

/* ── Prose ────────────────────────────────────────────────────── */
.prose { font-size: 17px; line-height: 1.6; color: var(--fg-1); }
.prose p + p { margin-top: 1em; }
.prose strong { font-weight: var(--fw-semibold); }

/* ── Table ────────────────────────────────────────────────────── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 14.5px;
}
.tbl th, .tbl td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: break-word;   /* break only long unbreakable tokens, never mid-word on normal text */
  hyphens: none;
}
.tbl th {
  background: var(--leland-beige);
  font-weight: var(--fw-medium);
  color: var(--fg-1);
  font-size: 13px;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl td:first-child, .tbl th:first-child { font-weight: var(--fw-medium); }

/* ── Inline glossary term links — auto-linked by /ai-builder/guide/glossary-autolink.js ─ */
a.glossary-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1.5px dashed rgba(21, 176, 120, 0.65);
  transition: color 0.12s ease, border-bottom-color 0.12s ease, background 0.12s ease;
  padding: 0 1px;
  border-radius: 2px;
}
a.glossary-link:hover {
  color: #15b078;
  border-bottom-color: #15b078;
  background: rgba(21, 176, 120, 0.08);
}

/* ── Session prev/next navigation ─────────────────────────────────── */
.sg-session-nav { display: flex; align-items: center; gap: 6px; padding-left: 12px; border-left: 1px solid var(--border); }
.sg-session-btn { position: relative; display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius-full); background: #fff; color: var(--fg-1); text-decoration: none; font-size: 12.5px; font-weight: var(--fw-medium); font-family: inherit; cursor: pointer; transition: border-color var(--duration-fast), background var(--duration-fast); white-space: nowrap; }
.sg-session-btn:hover { border-color: var(--leland-primary); background: var(--leland-primary-extra-light); color: var(--leland-primary-dark, #0e7a52); }
.sg-session-btn.is-disabled { opacity: 0.38; pointer-events: none; cursor: default; }
.sg-btn-title { position: absolute; top: calc(100% + 8px); right: 0; background: var(--fg-1); color: #fff; font-size: 12px; font-weight: var(--fw-medium); padding: 5px 10px; border-radius: var(--radius-md); white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(-4px); transition: opacity 0.15s ease, transform 0.15s ease; z-index: 200; }
.sg-btn-title::before { content: ''; position: absolute; bottom: 100%; right: 14px; border: 5px solid transparent; border-bottom-color: var(--fg-1); }
.sg-session-btn:not(.is-disabled):hover .sg-btn-title { opacity: 1; transform: translateY(0); }
.sg-session-footer { display: flex; justify-content: space-between; align-items: center; padding: 32px 0 0; margin-top: 32px; border-top: 1px solid var(--border); gap: 12px; }
.sg-session-footer-btn { display: flex; flex-direction: column; gap: 3px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); text-decoration: none; background: #fff; transition: border-color var(--duration-fast), background var(--duration-fast); min-width: 140px; }
.sg-session-footer-btn:hover { border-color: var(--leland-primary); background: var(--leland-primary-extra-light); }
.sg-session-footer-btn.is-next { text-align: right; margin-left: auto; }
.sg-session-footer-btn.is-disabled { opacity: 0.38; pointer-events: none; cursor: default; }
.sg-session-footer-label { font-size: 11px; font-weight: var(--fw-medium); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-3); }
.sg-session-footer-title { font-size: 14px; font-weight: var(--fw-medium); color: var(--fg-1); }
.sg-session-footer-btn.is-disabled .sg-session-footer-title { color: var(--fg-3); }

/* ── Collapsible sidebar ───────────────────────────────────────────── */
.dirB-body { transition: grid-template-columns 0.2s ease; }
.dirB-rail { overflow: hidden; transition: padding 0.2s ease, border-width 0.2s ease; }
.dirB-body.rail-collapsed { grid-template-columns: 0 1fr; }
.dirB-body.rail-collapsed .dirB-rail { padding: 0; border-right-width: 0; }
.sg-rail-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; color: var(--fg-2); cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast); flex-shrink: 0; margin-right: 8px; }
.sg-rail-toggle:hover { background: var(--bg-subtle); color: var(--fg-1); }

/* Numbered sub-steps under a build step (the step `sub` array). Without this they
   render as unmarked indented lines — this theme has no default list styling. */
.dirB-substeps { list-style: decimal; padding-left: 22px; margin: 10px 0 0; color: var(--fg-1); }
.dirB-substeps li { font-size: 15px; line-height: 1.5; margin-top: 6px; padding-left: 4px; }
.dirB-substeps li:first-child { margin-top: 0; }

/* ── Rail: a skipped module ────────────────────────────────────────── */
/* renderer.js always emits the "Skipped" chip and reveals it by toggling
   .is-flagged on the row. Without the hide rule the chip showed on every
   section of every guide. Mirrors public/gre/gre-shell.css. */
.dirB-rail-flag { display: none; }
.dirB-rail-item.is-flagged .dirB-rail-flag {
  /* .dirB-rail-meta-col is a column flex container, so an inline-block
     child still stretches the full width of the rail. */
  display: inline-block; align-self: flex-start; width: fit-content; margin-top: 3px;
  font-size: 11px; font-weight: var(--fw-medium); letter-spacing: 0.02em;
  color: #8a7a45; background: #FBF4DE; border-radius: 4px; padding: 1px 6px;
}
.dirB-rail-item.is-flagged .dirB-rail-num { border-style: dashed; border-color: #D8C68A; color: #8a7a45; }
