/*
 * Template of the feature guides in info/. Builds on the homepage tokens and blocks
 * of style.css (fonts, --hub-* colors, .header, .eyebrow, .cta, .hub__foot), so the
 * guides follow the theme that main.js sets on <html data-theme>.
 */

:root {
  --guide-width: 960px;
  --guide-gutter: 24px;
  --guide-radius: 14px;
  --guide-radius-sm: 10px;
  /* Accent for text and small marks: --hub-accent-strong stays under 4.5:1 on light surfaces */
  --guide-accent-text: oklch(0.47 0.11 165);
  --guide-ok: oklch(0.5 0.13 150);
  --guide-ok-soft: oklch(0.955 0.04 150);
  --guide-warn: oklch(0.52 0.12 65);
  --guide-warn-soft: oklch(0.96 0.05 85);
  --guide-danger: oklch(0.53 0.19 25);
  --guide-danger-soft: oklch(0.96 0.03 25);
}

[data-theme="dark"] {
  --guide-accent-text: var(--hub-accent);
  --guide-ok: oklch(0.8 0.15 150);
  --guide-ok-soft: oklch(0.3 0.06 150);
  --guide-warn: oklch(0.84 0.13 80);
  --guide-warn-soft: oklch(0.31 0.06 75);
  --guide-danger: oklch(0.76 0.14 25);
  --guide-danger-soft: oklch(0.3 0.07 25);
}

/* Layout */

.guide .header {
  max-width: calc(var(--guide-width) + 2 * var(--guide-gutter));
  padding-inline: var(--guide-gutter);
}

.guide-home__back {
  color: var(--hub-faint);
  transition: color 0.15s ease, transform 0.15s ease;
}

.guide-home:hover .guide-home__back {
  color: var(--hub-text);
  transform: translateX(-2px);
}

.guide-page {
  max-width: calc(var(--guide-width) + 2 * var(--guide-gutter));
  margin: 0 auto;
  padding: 0 var(--guide-gutter);
  font-family: var(--hub-font-body);
  color: var(--hub-text);
}

.guide-intro {
  padding-top: 28px;
}

.guide-title {
  margin-top: 14px;
  font-size: 44px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.guide-lede {
  margin-top: 18px;
  max-width: 62ch;
  font-size: 17px;
  line-height: 1.6;
  color: var(--hub-muted);
  text-wrap: pretty;
}

.guide-intro .cta {
  margin-top: 26px;
}

.guide-intro .cta .guide-icon {
  width: 18px;
  height: 18px;
}

.guide-section {
  margin-top: 64px;
}

.guide-section > h2 {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.guide-section > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hub-border);
}

.guide-section h3 {
  font-size: 15px;
  font-weight: 600;
}

.guide-section > * + * {
  margin-top: 16px;
}

.guide-section > h2 + * {
  margin-top: 20px;
}

.guide-section > h3 {
  margin-top: 28px;
}

.guide-section > h3 + * {
  margin-top: 10px;
}

.guide-text {
  max-width: 68ch;
  font-size: 15px;
  line-height: 1.65;
}

.guide-caption {
  font-size: 13px;
  color: var(--hub-muted);
}

.guide-section > .guide-caption {
  margin-top: 10px;
}

.guide-main a:not([class]) {
  color: var(--guide-accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklch, currentColor 40%, transparent);
  text-underline-offset: 3px;
}

.guide-main a:not([class]):hover {
  text-decoration-color: currentColor;
}

.guide-page :is(a, button):focus-visible {
  outline: 2px solid var(--hub-accent);
  outline-offset: 2px;
}

.guide-footer {
  margin-top: 80px;
  padding-bottom: 32px;
}

/* Icons: Lucide symbols of assets/icons/sprite.svg */

.guide-icon {
  flex: none;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
}

/* Lists */

.guide-steps {
  list-style: none;
  counter-reset: guide-step;
  display: grid;
  gap: 14px;
}

.guide-steps > li {
  counter-increment: guide-step;
  position: relative;
  min-height: 28px;
  padding-left: 42px;
  font-size: 15px;
  line-height: 1.65;
}

.guide-steps > li::before {
  content: counter(guide-step);
  position: absolute;
  top: -1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hub-accent-soft);
  color: var(--guide-accent-text);
  font: 600 13px/1 var(--hub-font-mono);
}

.guide-list {
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 15px;
  line-height: 1.6;
}

.guide-list > li {
  position: relative;
  padding-left: 20px;
}

.guide-list > li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hub-accent);
}

.guide-defs {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  font-size: 14px;
  line-height: 1.55;
}

.guide-defs > div {
  display: contents;
}

.guide-defs dt,
.guide-defs dd {
  padding: 10px 0;
  border-top: 1px solid var(--hub-border);
}

.guide-defs dt {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 24px;
  font-weight: 600;
}

.guide-defs dd {
  color: var(--hub-muted);
}

.guide-defs--code dt {
  font-family: var(--hub-font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--guide-accent-text);
}

.guide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.guide-tags > li {
  padding: 5px 12px;
  border: 1px solid var(--hub-border);
  border-radius: 999px;
  background: var(--hub-surface);
  font-size: 13.5px;
}

/* Cards */

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.guide-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}

.guide-card {
  padding: 18px 20px;
  border: 1px solid var(--hub-border);
  border-radius: var(--guide-radius);
  background: var(--hub-surface);
}

.guide-card > h3 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.guide-card > h3 .guide-icon {
  color: var(--guide-accent-text);
}

.guide-card > p {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--hub-muted);
}

.guide-samples {
  list-style: none;
}

.guide-card > h3 + .guide-samples {
  margin-top: 8px;
}

.guide-sample {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--hub-border);
}

.guide-sample:first-child {
  border-top: 0;
}

.guide-sample:last-child {
  padding-bottom: 0;
}

.guide-sample > p {
  flex: 1;
  min-width: 0;
  padding-top: 3px;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

/* Controls */

.guide-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--hub-border);
  border-radius: 999px;
  background: var(--hub-surface);
  color: var(--hub-muted);
  font: 500 13px/1 var(--hub-font-body);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.guide-chip:hover {
  border-color: var(--hub-border-2);
  color: var(--hub-text);
}

.guide-chip[aria-pressed="true"] {
  border-color: color-mix(in oklch, var(--hub-accent) 35%, transparent);
  background: var(--hub-accent-soft);
  color: var(--guide-accent-text);
}

.guide-copy {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--hub-faint);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.guide-copy:hover {
  background: var(--hub-surface-2);
  color: var(--hub-text);
}

.guide-copy.is-copied {
  color: var(--guide-accent-text);
}

/* Sample copy buttons stay out of the way until the row is hovered; touch screens always show them */
@media (hover: hover) {
  .guide-sample > .guide-copy:not(:focus-visible, .is-copied) {
    opacity: 0;
  }

  .guide-sample:hover > .guide-copy {
    opacity: 1;
  }
}

/* Code */

.guide-page code {
  font-family: var(--hub-font-mono);
  font-size: 0.875em;
}

.guide-page :not(pre) > code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--hub-border);
  border-radius: 5px;
  background: var(--hub-surface-2);
  overflow-wrap: anywhere;
}

.guide-code {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hub-border);
  border-radius: var(--guide-radius-sm);
  background: var(--hub-surface-2);
}

.guide-code > figcaption {
  padding: 9px 48px 9px 14px;
  border-bottom: 1px solid var(--hub-border);
  font-size: 12.5px;
  color: var(--hub-muted);
}

.guide-code > pre {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  font: 13px/1.6 var(--hub-font-mono);
  white-space: pre;
  tab-size: 4;
}

.guide-code > pre > code {
  font-size: inherit;
}

.guide-code > .guide-copy {
  position: absolute;
  top: 4px;
  right: 6px;
}

/* Example conversation, laid out like BravoGen Chat */

.guide-chat {
  display: grid;
  /* minmax(0, ...) lets long code lines scroll inside their block instead of widening the page */
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--hub-border);
  border-radius: var(--guide-radius);
  background: var(--hub-surface);
}

.guide-chat__user {
  justify-self: end;
  max-width: min(85%, 600px);
  padding: 10px 16px;
  border-radius: 18px;
  background: var(--hub-surface-2);
  font-size: 14.5px;
  line-height: 1.55;
}

.guide-chat__user > pre {
  margin-top: 8px;
  overflow-x: auto;
  font: 13px/1.6 var(--hub-font-mono);
}

.guide-chat__answer {
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.65;
}

.guide-chat__answer > * + * {
  margin-top: 10px;
}

.guide-chat__answer :is(ul, ol) {
  padding-left: 22px;
}

.guide-chat__answer li + li {
  margin-top: 4px;
}

.guide-cite {
  margin-left: 3px;
  padding: 1px 5px;
  border: 1px solid var(--hub-border);
  border-radius: 999px;
  background: var(--hub-surface-2);
  color: var(--hub-muted);
  font: 600 10px/1 var(--hub-font-body);
  vertical-align: 2px;
  white-space: nowrap;
}

/* A word joiner keeps the marker on the line of the text it cites */
.guide-cite::before {
  content: "\2060";
}

.guide-sources {
  padding-top: 14px;
  border-top: 1px solid var(--hub-border);
  font-size: 13.5px;
  color: var(--hub-muted);
}

.guide-sources > ol {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 0;
  list-style: none;
}

.guide-sources li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.guide-sources .guide-cite {
  flex: none;
  margin: 0;
  vertical-align: 0;
}

/* Callouts and status */

.guide-note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--hub-border);
  border-radius: var(--guide-radius-sm);
  background: var(--hub-surface-2);
  font-size: 14.5px;
  line-height: 1.6;
}

.guide-note > .guide-icon {
  margin-top: 3px;
  color: var(--hub-muted);
}

.guide-note--warn > .guide-icon {
  color: var(--guide-warn);
}

.guide-note .guide-list {
  margin-top: 6px;
  font-size: inherit;
}

.guide-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.guide-badge--ok {
  background: var(--guide-ok-soft);
  color: var(--guide-ok);
}

.guide-badge--warn {
  background: var(--guide-warn-soft);
  color: var(--guide-warn);
}

.guide-badge--danger {
  background: var(--guide-danger-soft);
  color: var(--guide-danger);
}

/* Media */

.guide-video {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--hub-border);
  border-radius: var(--guide-radius);
  background: var(--hub-surface-2);
}

.guide-video > iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 720px) {
  .guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 580px) {
  :root {
    --guide-gutter: 20px;
  }

  .guide-intro {
    padding-top: 12px;
  }

  .guide-title {
    font-size: 34px;
  }

  .guide-lede {
    font-size: 16px;
  }

  .guide-section {
    margin-top: 48px;
  }

  .guide-card,
  .guide-chat {
    padding: 16px;
  }

  .guide-defs dt {
    padding-right: 16px;
  }
}
