/* Shared layout for long-form buyer guides (build vs buy, RAG vs agents vs
   fine-tuning, ...). Everything is prefixed guide- so it can't leak into the
   site-wide components these pages also use (.why-card, .compliance-strip...). */
.guide-prose { max-width: 52rem; margin: 0 auto; text-align: left; }
.guide-section { margin: 4rem auto 0; }
.guide-section h2 {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 1rem;
    color: var(--text-primary);
    scroll-margin-top: 110px;
}
.guide-section h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 1.75rem 0 0.75rem;
    color: var(--text-primary);
}
.guide-section p { color: var(--text-secondary); line-height: 1.8; margin-bottom: 1rem; }
.guide-section a:not(.btn) { color: var(--primary-gold); }
.guide-list { padding-left: 1.25rem; margin: 0 0 1.25rem; }
.guide-list li { color: var(--text-secondary); line-height: 1.75; margin-bottom: 0.45rem; }
.guide-list li strong { color: var(--text-primary); }

/* styles.css has a bare `nav { display:flex; justify-content:space-between }`
   rule meant for the site header. This TOC is also a <nav>, so reset the
   layout it would otherwise inherit (the breadcrumb does the same). */
.guide-toc {
    display: block;
    max-width: none;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--dark-card);
    padding: 1.25rem 1.5rem;
    margin: 2.5rem 0 0;
}
.guide-toc p { margin: 0 0 0.6rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.guide-toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
.guide-toc li { margin-bottom: 0.35rem; break-inside: avoid; }
/* Keep the site-wide underline (styles.css: links are underlined except
   header chrome and buttons) - muted colour, gold on hover like the breadcrumb. */
.guide-toc a { color: var(--text-secondary); }
.guide-toc a:hover, .guide-toc a:focus-visible { color: var(--primary-gold); }

.guide-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.guide-tags li {
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.guide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.guide-cards .why-card { text-align: left; padding: 1.75rem; }
.guide-cards .why-card h3 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.guide-cards .why-card p { margin-bottom: 0.5rem; }
.guide-cards .why-card ul, .guide-cards .why-card ol { padding-left: 1.1rem; margin: 0; }
.guide-cards .why-card li { color: var(--text-secondary); line-height: 1.65; margin-bottom: 0.35rem; }
.guide-option-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary-gold);
    margin-bottom: 0.5rem;
}

.guide-table-wrap { overflow-x: auto; margin: 1.5rem 0 0.75rem; }
.guide-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.guide-table caption { text-align: left; font-size: 0.9rem; color: var(--text-muted); padding-bottom: 0.75rem; }
.guide-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.guide-table tbody th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
}
.guide-table td { padding: 0.75rem 1rem; color: var(--text-secondary); }
.guide-table tbody tr { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.guide-note { font-size: 0.9rem; color: var(--text-muted); }

.guide-formula {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-left: 4px solid var(--primary-gold);
    border-radius: 10px;
    background: rgba(212, 175, 55, 0.05);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    color: var(--text-primary);
    line-height: 1.9;
    overflow-x: auto;
}
.guide-formula span { display: block; }
.guide-formula .guide-formula-term { padding-left: 1.5rem; color: var(--text-secondary); }

.guide-steps { list-style: none; padding: 0; margin: 1.5rem 0; counter-reset: guide-step; }
.guide-steps li {
    counter-increment: guide-step;
    position: relative;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--dark-card);
    padding: 0.9rem 1.2rem 0.9rem 3.4rem;
    color: var(--text-primary);
    font-weight: 600;
}
.guide-steps li::before {
    content: counter(guide-step);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--primary-gold);
    color: #000;
    font-size: 0.85rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.guide-steps li:not(:last-child) { margin-bottom: 1.6rem; }
.guide-steps li:not(:last-child)::after {
    content: "\2193";
    position: absolute;
    left: 50%;
    bottom: -1.45rem;
    transform: translateX(-50%);
    color: var(--primary-gold);
    font-size: 1rem;
}

.guide-cta {
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 20px;
    background: rgba(212, 175, 55, 0.06);
    padding: 2rem;
    margin-top: 2rem;
    text-align: center;
}
.guide-cta h3 { margin-top: 0; font-size: 1.45rem; }
.guide-cta p { max-width: 38rem; margin: 0 auto 1.25rem; }

@media (max-width: 640px) {
    .guide-section { margin-top: 3rem; }
    .guide-section h2 { font-size: 1.5rem; }
    .guide-toc ol { columns: 1; }
    .guide-cta { padding: 1.5rem 1.1rem; }
}

/* ---- Unnumbered flow: a vertical sequence of boxes joined by arrows.
   Same visual language as .guide-steps, without the step counter. */
.guide-steps.guide-steps--plain li { padding-left: 1.2rem; font-weight: 500; }
.guide-steps.guide-steps--plain li::before { content: none; }
.guide-steps.guide-steps--plain { max-width: 26rem; }

/* ---- Architecture stack: components joined by "+" (e.g. AI agent + RAG).
   Markup: <ul class="guide-stack"><li><span>AI agent</span></li>...</ul> */
.guide-stack { display: flex; flex-wrap: wrap; align-items: center; row-gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.guide-stack li { display: inline-flex; align-items: center; }
.guide-stack li + li::before { content: "+"; color: var(--primary-gold); font-weight: 800; margin: 0 0.55rem; }
.guide-stack span {
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(212, 175, 55, 0.08);
}

/* Inside cards, `.guide-cards .why-card ul/li` (list indent, spacing) would
   otherwise win on specificity over the chip layout. */
.guide-cards .why-card .guide-stack { padding-left: 0; margin-top: 0.4rem; }
.guide-cards .why-card .guide-stack li { margin-bottom: 0; line-height: 1.4; }

/* ---- Label chips inside cards (Requirement / Myth / Reality ...). */
.guide-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0.4rem 0 0.25rem;
}
.guide-label--gold { color: var(--primary-gold); }

/* ---- Decision cards: a question, then where it points. */
.guide-decisions { display: grid; gap: 1rem; margin: 1.5rem 0; }
.guide-decision {
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary-gold);
    border-radius: 14px;
    background: var(--dark-card);
    padding: 1.1rem 1.35rem;
}
.guide-decision p { margin: 0; }
.guide-decision .guide-decision-q { color: var(--text-primary); font-weight: 600; line-height: 1.6; }
.guide-decision .guide-decision-a { color: var(--primary-gold); font-weight: 700; margin-top: 0.4rem; }

/* ---- Modifiers */
/* Short row labels ("Fine-tuning") that shouldn't break mid-word. */
.guide-table--nowrap-rowhead tbody th { white-space: nowrap; }
/* Two-up cards for even-numbered sets (4 examples read better as 2x2 than 3+1). */
.guide-cards--pairs { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---- Architecture diagram: real text in a CSS grid, so it stays readable
   and reflows on small screens instead of shrinking like an SVG would. */
.guide-diagram { margin: 1.75rem 0; }
.guide-diagram figcaption { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.9rem; text-align: center; }
.guide-diagram-box {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: var(--dark-card);
    padding: 0.8rem 1rem;
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
}
.guide-diagram-box--top, .guide-diagram-box--bottom {
    max-width: 22rem;
    margin: 0 auto;
    border-color: rgba(212, 175, 55, 0.45);
    background: rgba(212, 175, 55, 0.08);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.9rem;
}
.guide-diagram-branches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin: 0; }
.guide-diagram-branch { display: flex; flex-direction: column; align-items: stretch; }
.guide-diagram-branch .guide-diagram-box { font-size: 1rem; }
.guide-diagram-branch .guide-diagram-box span {
    display: block;
    margin-top: 0.3rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--primary-gold);
}
/* Fan-out / fan-in lines: a horizontal bar joining the centres of the three
   branch columns, a full-height stem in the middle, and half-height drops at
   the outer columns. Column-centre maths: with gap g, the centre of the first
   column sits at (100% - 2g) / 6 from the left edge. */
.guide-diagram-fan { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 0.9rem; height: 1.6rem; }
.guide-diagram-fan span { justify-self: center; width: 0; border-left: 2px solid rgba(212, 175, 55, 0.7); height: 100%; }
.guide-diagram-fan::before {
    content: "";
    position: absolute;
    top: calc(50% - 1px);
    left: calc((100% - 1.8rem) / 6);
    right: calc((100% - 1.8rem) / 6);
    border-top: 2px solid rgba(212, 175, 55, 0.7);
}
.guide-diagram-fan--out span:first-child, .guide-diagram-fan--out span:last-child { height: 50%; align-self: end; }
.guide-diagram-fan--in span:first-child, .guide-diagram-fan--in span:last-child { height: 50%; align-self: start; }
.guide-diagram-connector { text-align: center; color: var(--primary-gold); line-height: 1; padding: 0.45rem 0; font-size: 1.1rem; }
.guide-diagram-box--narrow { max-width: 22rem; margin: 0 auto; }
.guide-stack--center { justify-content: center; }

@media (max-width: 640px) {
    .guide-diagram-branches { gap: 0.5rem; }
    .guide-diagram-fan { column-gap: 0.5rem; }
    .guide-diagram-fan::before { left: calc((100% - 1rem) / 6); right: calc((100% - 1rem) / 6); }
    .guide-diagram-branch .guide-diagram-box { padding: 0.7rem 0.4rem; font-size: 0.9rem; }
    .guide-diagram-branch .guide-diagram-box span { font-size: 0.78rem; }
    .guide-stack li + li::before { margin: 0 0.4rem; }
}

/* ---- Glossary (definition list). */
.guide-glossary { margin: 1.25rem 0; }
.guide-glossary dt { color: var(--text-primary); font-weight: 700; margin-top: 1rem; }
.guide-glossary dt:first-child { margin-top: 0; }
.guide-glossary dd { margin: 0.25rem 0 0; color: var(--text-secondary); line-height: 1.7; }

/* ---- AI automation ROI calculator (ai-automation-roi page). */
.roi-calc {
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: var(--dark-card);
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.roi-calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.roi-calc fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.roi-calc legend {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary-gold);
    margin-bottom: 0.9rem;
}
.roi-calc .form-group { margin-bottom: 0.9rem; }
.roi-calc .form-group label { font-size: 0.88rem; line-height: 1.35; }
.roi-calc .form-group input, .roi-calc .form-group select { padding: 0.6rem 0.8rem; font-size: 0.95rem; border-radius: 10px; }
.roi-calc .roi-currency { max-width: 14rem; margin-bottom: 1.25rem; }
.roi-calc-hint { display: block; font-size: 0.8rem; line-height: 1.4; color: var(--text-muted); margin-top: 0.35rem; }
.roi-calc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.roi-results { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--glass-border); }
.guide-section .roi-results h3 { margin-top: 0; }
.roi-results dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; margin: 0; }
.roi-result { border: 1px solid var(--glass-border); border-radius: 12px; padding: 0.8rem 1rem; background: rgba(255, 255, 255, 0.02); }
.roi-result dt { font-size: 0.82rem; color: var(--text-muted); }
.roi-result dd { margin: 0.25rem 0 0; font-size: 1.15rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.roi-result--key { border-color: rgba(212, 175, 55, 0.45); background: rgba(212, 175, 55, 0.06); }
.roi-result--negative dd { color: #f28b82; }
.guide-section p.roi-breakdown { font-size: 0.9rem; color: var(--text-secondary); margin: 1rem 0 0; }
.guide-section p.roi-disclaimer { font-size: 0.85rem; color: var(--text-muted); margin: 0.75rem 0 0; }
.roi-copy-status { font-size: 0.9rem; color: var(--primary-gold); }

/* ---- Key-principle callout. */
.guide-section p.guide-callout {
    border-left: 4px solid var(--primary-gold);
    background: rgba(212, 175, 55, 0.06);
    border-radius: 0 10px 10px 0;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
}

/* ---- Stack variant for a sequence (A -> B -> C) rather than a combination. */
.guide-stack.guide-stack--flow li + li::before { content: "\2192"; }
.guide-cards .why-card .guide-stack.guide-stack--flow { margin-bottom: 0.9rem; }

/* ---- Linked tag pills (use-case navigator). */
.guide-tags.guide-tags--links li { padding: 0; }
.guide-section .guide-tags--links a { display: block; padding: 0.3rem 0.85rem; border-radius: 999px; color: var(--text-primary); text-decoration: none; }
.guide-section .guide-tags--links a:hover,
.guide-section .guide-tags--links a:focus-visible { color: var(--primary-gold); background: rgba(212, 175, 55, 0.08); }

/* ---- 2x2 prioritization matrix (value vs complexity). */
.guide-matrix { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 0.5rem; max-width: 36rem; margin: 1.5rem 0; }
.guide-matrix-axis { font-size: 0.85rem; color: var(--text-muted); }
.guide-matrix-axis--y { grid-column: 1; grid-row: 1; writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; }
.guide-matrix-axis--x { grid-column: 2; grid-row: 2; text-align: center; }
.guide-matrix-grid { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.guide-matrix-cell {
    display: flex; flex-direction: column; justify-content: center; gap: 0.3rem;
    min-height: 6rem; padding: 1rem; text-align: center;
    border: 1px solid var(--glass-border); border-radius: 12px; background: var(--dark-card);
}
.guide-matrix-cell strong { color: var(--text-primary); }
.guide-matrix-cell span { font-size: 0.85rem; color: var(--text-muted); }
.guide-matrix-cell--key { border-color: rgba(212, 175, 55, 0.45); background: rgba(212, 175, 55, 0.08); }

/* ---- Cards used inside an architecture diagram: compact. */
.guide-diagram .guide-cards { margin: 0.25rem 0; gap: 0.9rem; }
.guide-diagram .guide-cards .why-card { padding: 0.9rem 1.1rem; min-height: 0; }
