/* === Solar Panels for Homes in Ireland — interactive guide === */

.solar-guide h1 {
    margin-bottom: var(--space-sm);
    font-size: clamp(2rem, 4.5vw, 3rem);
    line-height: 1.15;
}

/* ── Hero band ─────────────────────────────────────────────────── */
.sg-hero {
    background: linear-gradient(160deg, var(--kw-blue-tint) 0%, var(--white) 70%);
    padding: var(--space-xl) 0 var(--space-lg);
}
.sg-hero-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: var(--space-xl);
    align-items: center;
}
.sg-hero-media img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: block;
}
@media (max-width: 820px) {
    .sg-hero-inner {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    .sg-hero-media {
        order: -1;
        max-width: 30rem;
        margin: 0 auto;
    }
}

/* ── Intro (hero text) ─────────────────────────── */
.sg-intro {
    font-size: 1.06rem;
    line-height: 1.65;
    color: var(--grey-text);
    margin-bottom: var(--space-sm);
    max-width: 62ch;
}

/* ── Stat band ─────────────────────────────────────────────────── */
.sg-stat-band {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}
.sg-stat {
    background: var(--white);
    border: 1px solid var(--grey-border);
    border-top: 4px solid var(--kw-blue);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
    box-shadow: var(--shadow-md);
}
.sg-stat-num {
    display: block;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: var(--kw-blue-darkened);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.sg-stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--grey-text);
    margin-top: var(--space-xs);
}
@media (max-width: 640px) {
    .sg-stat-band {
        grid-template-columns: 1fr;
    }
}

/* ── Two-column split sections ─────────────────────────────────── */
.sg-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: center;
}
.sg-split--rev .sg-split-text { order: 2; }
.sg-split--rev .sg-split-visual { order: 1; }
.sg-split-visual { margin: 0; }
.sg-split > * { min-width: 0; }
.sg-split-visual img,
.sg-split-visual svg {
    width: 100%;
    height: auto;
    display: block;
}
.sg-split-visual figcaption { margin-top: var(--space-sm); }
@media (max-width: 820px) {
    .sg-split {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    .sg-split--rev .sg-split-text { order: 1; }
    .sg-split--rev .sg-split-visual { order: 2; }
    .solar-guide .kw-btn {
        white-space: normal;
        text-align: center;
    }
}

/* ── BER illustration window (§9) ───────────────────────────────── */
/* The window chrome is the shared .kw-preview-window component
   (css/global/30-components.css); here we just constrain and centre
   it within the split column. */
#ber .kw-preview-window {
    max-width: 22rem;
    margin: 0 auto;
}
#ber .kw-preview-window + figcaption {
    text-align: center;
}

/* ── Full-bleed dark band ──────────────────────────────────────── */
.sg-band {
    margin-top: var(--section-gap);
    padding: var(--space-xl) 0;
}
.sg-band--dark {
    background: var(--dark-bg);
    color: var(--white);
}
.sg-band--dark h2,
.sg-band--dark strong { color: var(--white); }
.sg-band--dark p { color: #cbd5e1; }
.sg-band--dark a { color: var(--kw-yellow); }
.sg-band--dark a:hover,
.sg-band--dark a:focus-visible { color: var(--kw-yellow-darkened); }
.sg-band--dark figcaption { color: #94a3b8; }
.sg-band--dark .sg-split-visual img {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
}
#blackout.sg-band--dark {
    background: #000;
    padding: 0;
}
#blackout .sg-blackout-visual {
    margin: 0;
    overflow: hidden;
}
#blackout .sg-blackout-visual img {
    width: 100%;
    height: auto;
    display: block;
}
@media (min-width: 821px) {
    #blackout.sg-band--dark {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    #blackout.sg-band--dark .kw-container {
        padding: calc(var(--space-xl) * 1.5) var(--space-lg);
    }
    #blackout .sg-blackout-visual {
        position: relative;
    }
    #blackout .sg-blackout-visual img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* ── Panels illustration (bill widget) ─────────────────────────── */
.sg-panels-visual {
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}
.sg-panels-svg {
    flex: 0 1 22rem;
    width: 22rem;
    max-width: 100%;
    min-width: 0;
    display: block;
}
.sg-bill-breakdown {
    /* Override the global `table { width: 100% }` rule — a full-width table
       fills the flex line and pushes itself onto a new row. */
    flex: 0 0 auto;
    width: auto;
    min-width: 13rem;
    margin: 0;
    background: var(--white);
    border: 1px solid var(--grey-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}
.sg-bill-breakdown td {
    padding: 0.55rem 1rem;
    border: none;
    border-bottom: 1px solid var(--grey-border);
}
.sg-bill-breakdown td:first-child {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--grey-text);
    padding-right: var(--space-lg);
}
.sg-bill-breakdown td:last-child {
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* "Net" row — the summary line */
.sg-bill-breakdown tr:last-child td {
    background: var(--grey-light);
    border-bottom: none;
}
.sg-bill-breakdown tr:last-child td:first-child {
    color: var(--near-black);
    border-bottom-left-radius: var(--radius-md);
}
.sg-bill-breakdown tr:last-child td:last-child {
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom-right-radius: var(--radius-md);
}
/* Neutralise the global `tbody tr:hover` tint — this table isn't interactive. */
.sg-bill-breakdown tbody tr:hover {
    background: transparent;
}
.sg-bill-breakdown--green {
    color: var(--kw-green);
}
.sg-bill-breakdown--red {
    color: var(--kw-red);
}

/* ── Anchor chips ───────────────────────────────────────────────── */
.sg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: var(--space-lg) 0;
}
.sg-chips a {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--grey-border);
    border-radius: 999px;
    color: var(--grey-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: border-color var(--ease-fast), color var(--ease-fast);
}
.sg-chips a:hover,
.sg-chips a:focus-visible {
    border-color: var(--kw-blue);
    color: var(--kw-blue-darkened);
}

/* ── Sections ───────────────────────────────────────────────────── */
.sg-section {
    margin-top: var(--section-gap);
}
.sg-section h2 {
    margin-bottom: var(--space-md);
}

/* Sub-headings within a section (incentives, roof orientation) */
.solar-guide .sg-h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: var(--space-lg) 0 var(--space-sm);
}

/* ── Incentive cards (three-up, giant emoji) ────────────────── */
.sg-inc-grid {
    margin-top: var(--space-md);
}
.sg-inc-card {
    text-align: center;
}
.sg-inc-emoji {
    font-size: clamp(3rem, 6vw, 4.2rem);
    line-height: 1.1;
    margin-bottom: var(--space-xs);
}
.sg-inc-card .sg-h3 {
    margin: 0 0 var(--space-sm);
}
.sg-inc-card p:not(.sg-inc-emoji) {
    text-align: left;
    font-size: 0.95rem;
    color: var(--grey-text);
}
@media (max-width: 768px) {
    /* kw-grid--3 goes two-up here; let the third card span the row */
    .sg-inc-grid > .sg-inc-card:last-child {
        grid-column: 1 / -1;
    }
}
/* ── Common extras (row-based list, §5) ─────────────────────── */
.sg-extras {
    list-style: none;
    padding: 0;
    margin: var(--space-sm) 0 var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.sg-extra {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--grey-light);
    border: 1px solid var(--grey-border);
    border-radius: var(--radius-md);
}
.sg-extra-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}
.sg-extra-name {
    font-weight: 700;
    white-space: nowrap;
}
.sg-extra-desc {
    color: var(--grey-text);
    font-size: 0.95rem;
    flex: 1;
    min-width: 0;
}
.sg-extra-price {
    font-weight: 700;
    white-space: nowrap;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) {
    .sg-extra {
        flex-wrap: wrap;
    }
    .sg-extra-desc {
        flex-basis: 100%;
        order: 4;
        margin-top: 0.15rem;
    }
}

#roof details {
    background: var(--grey-light);
    border: 1px solid var(--grey-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

/* ── Grant process steps (§6b) ────────────────────────────────────
   Numbered timeline: the left border is the spine, the counter chip
   sits centred on it, so the last step's spine is hidden to avoid a
   stub hanging below the final item. */
.solar-guide .sg-steps {
    list-style: none;
    counter-reset: sg-step;
    padding: 0;
    margin: var(--space-lg) 0;
}
.solar-guide .sg-steps > li {
    counter-increment: sg-step;
    position: relative;
    margin-left: 1.15rem;
    padding: 0 0 var(--space-md) 3.25rem;
    border-left: 2px solid var(--grey-border);
}
.solar-guide .sg-steps > li::before {
    content: counter(sg-step);
    position: absolute;
    left: -1.15rem;
    top: 0;
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--kw-blue);
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.solar-guide .sg-steps > li:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}
.solar-guide .sg-steps .sg-h3 {
    margin: 0.2rem 0 var(--space-xs);
    font-size: 1.08rem;
}
.solar-guide .sg-steps p {
    margin: 0;
    font-size: 0.97rem;
    color: var(--grey-text);
}
.solar-guide .sg-steps p strong {
    color: var(--near-black);
}
@media (max-width: 480px) {
    .solar-guide .sg-steps > li {
        margin-left: 1.15rem;
        padding-left: 2.4rem;
    }
    .solar-guide .sg-steps > li::before {
        width: 2rem;
        height: 2rem;
        left: -1rem;
        font-size: 0.85rem;
    }
}

/* ── Bill simulator ─────────────────────────────────────────────── */
.sg-bill-controls {
    display: grid;
    gap: var(--space-lg);
}


.sg-bill-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin: var(--space-lg) 0 var(--space-sm);
}
.sg-bill-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}
.sg-bill-export-note {
    margin: var(--space-sm) 0 0;
    min-height: 1.4em;
    visibility: hidden;
}
.sg-bill-export-note.is-visible {
    visibility: visible;
}

/* ── Best-tariff widget (full engine, lazy-loaded) ───────────────── */
.sg-best-tariff {
    /* Flex child of .sg-panels-visual, same slot the old breakdown
       table occupied; sizes to content so it sits beside the SVG. */
    flex: 0 1 auto;
    min-width: 15rem;
    max-width: 22rem;
    text-align: center;
}
.sg-best-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--grey-text);
    margin: 0 0 var(--space-sm);
}
.sg-best-rates {
    margin: 0 auto;
}
/* Reserve the amount column's width for the widest realistic figure
   ("-€1,057.99") so the table doesn't resize — and the card reflow —
   when the export sum flips between 3 and 4 figures. The column is
   tabular-nums, so ch units are exact. */
.sg-best-rates td:last-child {
    min-width: 10ch;
}
/* Reserve the height of an 8-row table at all times (measured 373px) so
   the card doesn't jump while loading or when a shorter table renders.
   The spinner overlays this area instead of replacing the table. */
.sg-best-tablewrap {
    position: relative;
    min-height: 23.3rem;
}
.sg-best-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
}
.sg-best-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}
.sg-best-negative {
    color: var(--kw-green-darkened);
    font-weight: 700;
}
/* The breakdown table uppercases first-column labels; keep the inline
   unit rate in normal case and smaller type, and the tooltip text
   ("supplier pays the household") in normal case too. */
.sg-best-rate {
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.85em;
    font-weight: 400;
    color: var(--grey-text);
    white-space: nowrap;
}
.sg-best-rates td:first-child .kw-tooltip__text {
    text-transform: none;
    letter-spacing: normal;
}
.sg-best-link {
    margin: var(--space-sm) 0 0;
    font-size: 0.9rem;
}
.sg-best-empty {
    font-size: 0.9rem;
    color: var(--grey-text);
}
.sg-bill-figure {
    background: var(--grey-light);
    border: 1px solid var(--grey-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    text-align: center;
}
.sg-bill-figure--solar {
    background: var(--kw-green-tint);
    border-color: var(--kw-green);
}
.sg-bill-label {
    display: block;
    font-size: 0.9rem;
    color: var(--grey-text);
    margin-bottom: var(--space-xs);
}
.sg-bill-amount {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
}
.sg-bill-figure--solar .sg-bill-amount {
    color: var(--kw-green-darkened);
}
@media (max-width: 560px) {
    .sg-bill-results {
        grid-template-columns: 1fr;
    }
    .sg-bill-amount {
        font-size: 1.8rem;
    }
}
@media (min-width: 561px) and (max-width: 768px) {
    .sg-bill-results {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Tables ─────────────────────────────────────────────────────── */
.sg-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0;
    background: var(--white);
}
.sg-table th,
.sg-table td {
    border: 1px solid var(--grey-border);
    padding: 0.6rem 0.9rem;
    text-align: left;
}
.sg-table th {
    background: var(--grey-light);
}
.sg-table caption {
    caption-side: top;
    text-align: left;
    font-weight: 600;
    color: var(--grey-text);
    padding-bottom: var(--space-xs);
}

/* ── Orientation compass rose (§7) ──────────────────────────────── */
.sg-compass-figure {
    margin: var(--space-lg) 0;
    text-align: center;
}
.sg-compass {
    display: block;
    width: 100%;
    max-width: 30rem;
    height: auto;
    margin: 0 auto var(--space-sm);
}
.sg-compass-shaft {
    stroke: var(--kw-blue);
    stroke-width: 8;
    stroke-linecap: round;
}
.sg-compass-head { fill: var(--kw-blue); }
.sg-compass-spoke--best .sg-compass-shaft,
.sg-compass-spoke--best .sg-compass-head {
    stroke: var(--kw-green);
    fill: var(--kw-green);
}
.sg-compass-spoke--best .sg-compass-shaft { fill: none; }
.sg-compass-dir {
    font-size: 24px;
    font-weight: 700;
    fill: var(--near-black);
}
.sg-compass-pct {
    font-size: 22px;
    font-weight: 600;
    fill: var(--grey-text);
}
.sg-compass-figure figcaption {
    max-width: 34rem;
    margin: 0 auto;
}
@media (max-width: 560px) {
    .sg-compass-dir { font-size: 28px; }
    .sg-compass-pct { font-size: 26px; }
}

/* ── Bar chart (SEAI grant-aided installs) ──────────────────────── */
.sg-chart-title {
    font-weight: 600;
    margin-bottom: var(--space-md);
}
.sg-barchart {
    display: flex;
    height: 220px;
    gap: var(--space-sm);
}
.sg-yaxis {
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    padding-right: var(--space-xs);
    font-size: 0.65rem;
    color: var(--grey-text);
    text-align: right;
    min-width: 2.5rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.sg-bars-area {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
    min-width: 0;
}
.sg-gridline {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--grey-border);
    pointer-events: none;
}
.sg-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}
.sg-bar-track {
    flex: 1;
    display: flex;
    align-items: flex-end;
    width: 100%;
    max-width: 3.2rem;
    min-height: 0;
}
.sg-bar {
    position: relative;
    width: 100%;
    background: var(--kw-blue);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 2px;
    cursor: pointer;
}
.sg-bar::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--near-black);
    color: var(--white);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ease-fast);
    margin-bottom: 4px;
    z-index: 1;
}
.sg-bar:hover::after,
.sg-bar.is-active::after {
    opacity: 1;
}
.sg-bar-year {
    font-size: 0.78rem;
    color: var(--grey-text);
    margin-top: var(--space-xs);
}
@media (max-width: 560px) {
    .sg-barchart {
        height: 170px;
    }
    .sg-yaxis {
        font-size: 0.55rem;
        min-width: 2rem;
    }
    .sg-bar-year {
        font-size: 0.65rem;
    }
}

/* ── ROI chart (investment section) ─────────────────────────────── */
.sg-roi-figure {
    margin: var(--space-lg) 0;
    text-align: center;
}
.sg-roi-chart {
    display: block;
    width: 100%;
    max-width: 30rem;
    height: auto;
    margin: 0 auto var(--space-sm);
}
.sg-roi-tick {
    font-size: 13px;
    fill: var(--grey-text);
}
.sg-roi-axis-label {
    font-size: 14px;
    font-weight: 600;
    fill: var(--near-black);
}
.sg-roi-figure figcaption {
    max-width: 34rem;
    margin: 0 auto;
}

/* ── FAQ ────────────────────────────────────────────────────────── */
.sg-faq-item {
    border: 1px solid var(--grey-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}
.sg-faq-item summary {
    cursor: pointer;
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
}
.sg-faq-item .sg-faq-answer {
    padding: 0 var(--space-md) var(--space-md);
    margin: 0;
    color: var(--grey-text);
}

/* ── Tariff preview (browser-chrome frame, mirrors home hero) ───── */
.sg-tariff-preview {
    display: block;
    position: relative;
    padding-top: 28px;
    background: #e5e7eb;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform var(--ease-default), box-shadow var(--ease-default);
    max-width: 390px;
}
.sg-tariff-preview::before {
    content: "● ● ●";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 28px;
    padding: 0 12px;
    line-height: 28px;
    color: #cbd5e1;
    font-size: 10px;
    letter-spacing: 4px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--grey-border);
}
.sg-tariff-preview::after {
    content: "➜";
    position: absolute;
    top: calc(28px + var(--space-sm));
    right: var(--space-sm);
    width: 44px;
    height: 44px;
    background: var(--white);
    color: var(--kw-blue);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    transition: transform var(--ease-default);
}
.sg-tariff-preview:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.sg-tariff-preview:hover::after {
    transform: scale(1.1);
}
.sg-tariff-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Methodology appendix (closed <details>, page bottom) */
.sg-method {
    margin-top: var(--section-gap);
    border: 1px solid var(--grey-border);
    border-radius: var(--radius-md);
    background: var(--grey-light);
    padding: var(--space-md);
    font-size: 0.95rem;
}
.sg-method summary {
    cursor: pointer;
    font-weight: 600;
}
.sg-method-body {
    margin-top: var(--space-sm);
    color: var(--grey-text);
}
.sg-method-body ul {
    padding-left: 1.2em;
}
.sg-method-body li {
    margin-bottom: var(--space-xs);
}

/* ── Closing CTA ────────────────────────────────────────────────── */
.sg-cta {
    background: var(--kw-blue-tint);
    border-radius: var(--radius-lg);
    padding: var(--card-padding);
    text-align: center;
}
.sg-cta p {
    max-width: 38rem;
    margin-left: auto;
    margin-right: auto;
}
