/* ============================================================
   BUYER GUIDES  (src/robotic-pool-cleaners/guide.njk)
   Loaded only on guide pages (base.njk, `guide`).

   The pages are built from the pillar-page parts in style.css
   (.pillar-hero, .pillar-decision, .pillar-pick, .pillar-article,
   .quiz-faq, .pillar-authority, .pillar-related, .quiz-compare-table).
   This file only adds what those parts do not have: the ranked,
   full-width pick card, the "what matters" cards, the notice, the
   side-by-side table's row headers and the verdict's product card.
   Colors and radii are the site tokens from style.css :root.
============================================================ */

.guide-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Section headings: the pillar pages' centered header, with room for a full sentence. */
.guide-head { max-width: 820px; margin-left: auto; margin-right: auto; }
.guide-head .cx-section-title { line-height: 1.15; text-wrap: balance; }
.guide-head .cx-section-sub { line-height: 1.6; }
.guide-head .cx-section-sub a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---- Hero ---- */
.guide-hero .pillar-hero-title { text-wrap: balance; }
.guide-hero .pillar-hero-sub a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

/* ---- The quick answer ---- */
.guide-answer .pillar-decision-answer p { font-size: 17px; color: var(--ink); }
.guide-answer .pillar-decision-answer a,
.guide-notice a {
    color: var(--accent-deep);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.guide-notice {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid #f1dcb4;
    border-left: 4px solid var(--amber);
    border-radius: 12px;
    background: var(--amber-tint);
}
.guide-notice strong {
    display: block;
    margin-bottom: 4px;
    color: #8a3f06;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.guide-notice p { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.6; }

/* The picks at a glance: one small card per pick, linked to its full card below. */
.guide-glance { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.guide-glance-card {
    display: block;
    text-decoration: none;
    transition: border-color var(--transition-standard), box-shadow var(--transition-standard);
}
.guide-glance-card:hover { border-color: var(--accent); box-shadow: 0 8px 20px rgba(20, 24, 40, 0.07); }
.guide-glance-rank {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--ink-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.guide-glance-card:first-child .guide-glance-rank { color: var(--accent-deep); }
.guide-glance-card h3 { margin: 0 0 4px; font-size: 16px; }
.guide-glance-card p { margin: 0; color: var(--ink-secondary); font-size: 13px; line-height: 1.45; }
.guide-answer .pillar-decision-next a { white-space: nowrap; }

/* ---- Introduction ---- */
.guide-intro { padding: 40px 0 0; }
.guide-intro .pillar-article-inner p:last-child { margin-bottom: 0; }

/* ---- The picks: the pillar pick card, laid out as a ranked row ---- */
.guide-picks-list {
    display: grid;
    gap: 22px;
    max-width: 1040px;
    margin: 28px auto 0;
}
.guide-pick {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    scroll-margin-top: 120px;
}
.guide-pick:hover { transform: none; box-shadow: 0 14px 34px rgba(20, 24, 40, 0.10); }
.guide-pick--top { border-color: var(--accent-tint-border); box-shadow: 0 0 0 1px var(--accent-tint-border); }
.guide-pick--top:hover { box-shadow: 0 0 0 1px var(--accent-tint-border), 0 14px 34px rgba(20, 24, 40, 0.10); }
.guide-pick-rank { background: var(--ink); }
.guide-pick-side {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}
/* The image optimizer wraps the photo in a <picture> at build time; the photo is sized to the frame itself. */
.guide-pick .pillar-pick-img { position: relative; aspect-ratio: 1 / 1; padding: 0; }
.guide-pick .pillar-pick-img picture { display: contents; }
.guide-pick .pillar-pick-img img {
    position: absolute;
    inset: 22px;
    width: calc(100% - 44px);
    height: calc(100% - 44px);
    object-fit: contain;
}
.guide-pick-buy {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px 20px;
}
.guide-pick-buy .cp-product-pricing { margin: 0; }
.guide-pick-buy .cp-product-price { font-size: 24px; }
/* Under a price: which version it is for (a robot sold with and without an option), or "sold out". */
.guide-offer-note { margin: 0; color: var(--ink-secondary); font-size: 12.5px; line-height: 1.45; }
.guide-table .guide-offer-note { margin-top: 2px; font-weight: 400; }
.guide-pick .cp-product-actions { margin-top: 0; }
.guide-pick .pillar-pick-body { padding: 24px 28px 26px; gap: 10px; }
.guide-pick .pillar-pick-title { font-size: 24px; letter-spacing: -0.01em; }
.guide-pick-award { margin: 0; color: var(--accent-deep); font-size: 14px; font-weight: 700; line-height: 1.4; }
.guide-pick-why { margin: 0; color: var(--ink-body); font-size: 15.5px; line-height: 1.65; }
.guide-pick-why a,
.guide-pick-fit a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.guide-pick-fit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 6px 0 0;
}
.guide-pick-fit > div { padding: 12px 14px; border-radius: 12px; background: var(--surface-alt); }
.guide-pick-fit dt {
    margin-bottom: 4px;
    color: var(--ink-secondary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.guide-pick-fit dd { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.5; }

/* A note under the picks (only when a guide carries one). */
.guide-note {
    max-width: 1040px;
    margin: 22px auto 0;
    padding: 22px 26px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-alt);
}
.guide-note h3 { margin: 0 0 8px; font-size: 18px; }
.guide-note p { margin: 0 0 10px; color: var(--ink-body); font-size: 15px; line-height: 1.65; }
.guide-note p:last-child { margin-bottom: 0; }
.guide-note a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ---- What matters ---- */
.guide-factors { padding: 56px 0 8px; }
.guide-factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-width: 1040px;
    margin: 28px auto 0;
    padding: 0;
    list-style: none;
}
/* Even rows whatever the count: 2 x 2 for four, 3 + 2 for five. */
.guide-factors-grid--2,
.guide-factors-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guide-factors-grid--5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.guide-factors-grid--5 > li { grid-column: span 2; }
.guide-factors-grid--5 > li:nth-child(n+4) { grid-column: span 3; }
.guide-factor {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(145deg, #fff 0%, var(--surface-alt) 100%);
}
.guide-factor-n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--accent-deep);
    font-size: 13px;
    font-weight: 800;
}
.guide-factor h3 { margin: 0 0 6px; color: var(--ink); font-size: 17px; line-height: 1.3; }
.guide-factor p { margin: 0; color: var(--ink-body); font-size: 14.5px; line-height: 1.6; }
.guide-factor a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ---- Side by side (the quiz page's comparison table, with row headers) ---- */
.guide-compare { padding: 56px 0 8px; }
.guide-table-wrap { max-width: 1040px; margin: 28px auto 0; background: #fff; }
.guide-table-wrap:focus-visible,
.guide-table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-table { table-layout: fixed; }
.guide-table thead th { white-space: normal; vertical-align: bottom; }
.guide-table thead th:first-child { width: 150px; }
.guide-table tbody th {
    padding: 12px 16px;
    border-bottom: 1px solid #ececf0;
    background: var(--surface-alt);
    color: var(--ink);
    font-weight: 600;
    text-align: left;
    vertical-align: top;
    white-space: normal;
}
.guide-table td { line-height: 1.45; vertical-align: top; }
.guide-table tbody tr:last-child th,
.guide-table tbody tr:last-child td { border-bottom: none; }
.guide-table-price td { color: var(--ink); }
.guide-table-price .cp-product-price { font-size: 17px; }
.guide-table td a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
/* The spec names stay in view while the robots scroll sideways on a phone. */
.guide-table th:first-child { position: sticky; left: 0; z-index: 1; }

.guide-photo { padding-top: 48px; }

/* ---- The longer read ---- */
.guide-table-scroll { margin: 8px 0 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.guide-article .guide-table-scroll table { display: table; min-width: 520px; margin: 0; }
.guide-article .guide-table-scroll tbody th { background: var(--surface-near); font-weight: 600; vertical-align: top; }

/* ---- FAQ ---- */
.guide-faq .quiz-faq-item p { color: var(--ink-body); line-height: 1.7; }
.guide-faq .quiz-faq-item a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }

/* ---- The verdict (the pillar pages' dark band) with the top pick beside it ---- */
.guide-verdict .pillar-authority-inner { grid-template-columns: 1.3fr 0.7fr; }
.guide-verdict .pillar-authority-copy p { color: #d6d6db; font-size: 16px; }
.guide-verdict .pillar-authority-copy p + p { margin-top: 12px; }
.guide-verdict .pillar-authority-copy a { color: var(--accent-on-dark); text-decoration: underline; text-underline-offset: 2px; }
.guide-verdict .pillar-authority-copy strong { color: #fff; }
.guide-verdict-pick {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
}
.guide-verdict-label {
    color: var(--accent-deep);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.guide-verdict-img {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    background: var(--surface-alt);
}
.guide-verdict-img picture { display: contents; }
.guide-verdict-img img {
    position: absolute;
    inset: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    object-fit: contain;
}
.guide-verdict-pick h3 { margin: 4px 0 0; font-size: 19px; line-height: 1.3; }
.guide-verdict-pick h3 a { color: var(--ink); text-decoration: none; }
.guide-verdict-pick h3 a:hover { color: var(--accent); }
.guide-verdict-award { margin: 0; color: var(--ink-secondary); font-size: 13.5px; line-height: 1.45; }
.guide-verdict-pick .cp-product-pricing { margin: 2px 0 0; }
.guide-verdict-pick .cp-product-actions { margin-top: 6px; }

.guide-related { padding-top: 32px; }

@media (max-width: 900px) {
    .guide-verdict .pillar-authority-inner { grid-template-columns: 1fr; }
    .guide-verdict-pick { max-width: 420px; }
}

@media (max-width: 768px) {
    .guide-head .cx-section-title { font-size: 26px; }
    .guide-head .cx-section-sub { font-size: 15px; }
    .guide-answer .pillar-decision-answer p { font-size: 16px; }
    .guide-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .guide-glance-card { padding: 14px; }
    .guide-glance-card h3 { font-size: 15px; }

    /* The pick card stacks: photo, the reasons, then the price and buttons. */
    .guide-pick { display: flex; flex-direction: column; }
    .guide-pick-side { display: contents; }
    .guide-pick .pillar-pick-img { order: 1; aspect-ratio: 4 / 3; }
    .guide-pick .pillar-pick-img img { inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); }
    .guide-pick .pillar-pick-body { order: 2; padding: 18px 18px 6px; }
    .guide-pick-buy { order: 3; padding: 12px 18px 20px; }
    .guide-pick .pillar-pick-title { font-size: 21px; }
    .guide-pick-fit { grid-template-columns: 1fr; }

    .guide-factors,
    .guide-compare { padding-top: 40px; }
    .guide-factors-grid,
    .guide-factors-grid--2,
    .guide-factors-grid--4,
    .guide-factors-grid--5 { grid-template-columns: 1fr; }
    .guide-factors-grid--5 > li,
    .guide-factors-grid--5 > li:nth-child(n+4) { grid-column: auto; }
    .guide-table thead th:first-child { width: 112px; }
    .guide-table thead th,
    .guide-table tbody th,
    .guide-table td { padding: 10px 12px; font-size: 13px; }
    .guide-note { padding: 18px; }
    .guide-photo { padding-top: 32px; }
    .guide-verdict-pick { max-width: none; }
}
