/*
 * Grow Money Guides — single template styles
 *
 * Loaded IN ADDITION to guide-single.css (see functions.php enqueue).
 * Only contains grow-specific features that don't exist in the shared
 * guide-* system:
 *   - Tool page full-width layout (hide_sidebar=true)
 *   - Risk warning banner (regulatory)
 *   - Sidebar comparison tools widget
 *   - Glossary (search, category nav, three-steps, term list)
 *   - Learn / Saving / Investing section grids
 *   - Term page layout
 *
 * Breadcrumbs, share modal, mobile header, mobile summary, hero,
 * layout grid, main column, sidebar, related guides, cross-links,
 * byline, TOC, and share buttons all come from guide-single.css.
 */

/* ====================================================================
   TOOL PAGE — full-width layout (hide_sidebar=true)
   ==================================================================== */

/* Full-width tool pages (savings rates, comparisons, etc.)
   Override the guide-container card style to fill the site width. */
.guide-container.grow-full-width {
    max-width: 1400px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 16px;
    margin-top: 0;
}
@media (min-width: 901px) {
    .guide-container.grow-full-width {
        margin-top: -60px;
        padding: 16px 0;
    }

    /* Widen hero inner on grow pages to match wider content */
    .guide-hero-inner {
        max-width: 1400px;
    }
}

/* ====================================================================
   TOOL PAGE HERO — step indicator, CTA, notice
   ==================================================================== */

.grow-tool-steps {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    margin-top: 18px;
}

.grow-step strong {
    color: #fff;
}

.grow-step-arrow {
    color: rgba(255,255,255,0.4);
}

.grow-tool-cta {
    margin-top: 18px;
}

.grow-tool-cta-btn {
    display: inline-block;
    background: #fff;
    color: #2C5282;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(44,82,130,0.3);
    transition: all 0.15s;
}

.grow-tool-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(44,82,130,0.4);
}

.grow-tool-notice {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    margin: 16px 0 0 0;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.grow-tool-notice strong {
    color: rgba(255,255,255,0.9);
}

@media (max-width: 768px) {
    .grow-tool-steps {
        flex-wrap: wrap;
        justify-content: center;
        font-size: 13px;
        gap: 6px 10px;
        padding: 8px 12px;
    }

    .grow-tool-cta-btn {
        font-size: 14px;
        padding: 10px 22px;
    }
}

/* Tool page card — wraps both main content AND sidebar */
.guide-layout.grow-tool-layout {
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.guide-main.grow-tool-main {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Remove top gap on first element inside tool content */
.grow-tool-content > *:first-child {
    margin-top: 0;
}

/* Hide the in-content h2 title on mobile — the plugin's sticky header covers it */
@media (max-width: 900px) {
    .grow-tool-content > h2:first-child {
        display: none;
    }
}

/* Tool pages use .grow-tool-content (not .guide-content) so shortcode
   plugins keep their own table/link styling without guide-single.css
   interfering. No overrides needed here. */

/* Scrollable sticky sidebar for tool pages */
.grow-tool-layout .guide-toc-sidebar {
    position: sticky;
    top: 20px;
    width: 300px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(44, 82, 130, 0.2) transparent;
}

/* Webkit custom scrollbar */
.grow-tool-layout .guide-toc-sidebar::-webkit-scrollbar {
    width: 5px;
}
.grow-tool-layout .guide-toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}
.grow-tool-layout .guide-toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(44, 82, 130, 0.15);
    border-radius: 10px;
}
.grow-tool-layout .guide-toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 82, 130, 0.35);
}

@media (max-width: 900px) {
    /* On mobile: fully edge-to-edge, matching cashback tool pattern */
    .guide-container.grow-full-width {
        padding: 0;
        margin-top: 0;
    }

    /* Hide the hero on mobile for tool pages — plugin sticky headers handle it */
    .grow-full-width-page .guide-hero,
    .grow-full-width-page .guide-mobile-summary {
        display: none;
    }

    .guide-layout.grow-tool-layout {
        border-radius: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        background: #fff;
    }

    /* Show sidebar ABOVE main as a horizontal tools strip on mobile */
    .grow-tool-layout .guide-toc-sidebar {
        display: block !important;
        width: 100% !important;
        order: -1;
        max-height: none;
        overflow: visible;
        position: static;
        padding: 8px 12px;
    }

    /* Hide desktop TOC on mobile (tools widget + related still show) */
    .grow-tool-layout .guide-toc-sidebar .guide-toc {
        display: none;
    }

    /* Tools widget: horizontal scrollable strip on mobile */
    .grow-tool-layout .grow-sidebar-tools {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 12px;
        border-radius: 0;
        border: none;
        background: #f8fafc;
        border-bottom: 1px solid #e7e5e4;
        margin: 0 -12px;
        scrollbar-width: none;
    }
    .grow-tool-layout .grow-sidebar-tools::-webkit-scrollbar {
        display: none;
    }
    .grow-tool-layout .grow-sidebar-tools .guide-toc-header {
        display: none;
    }
    .grow-tool-layout .grow-tool-card {
        flex-shrink: 0;
        margin-bottom: 0;
        white-space: nowrap;
        border-radius: 999px;
        padding: 6px 12px;
        font-size: 12px;
        background: #fff;
    }
    .grow-tool-layout .grow-tool-icon {
        width: 16px;
        height: 16px;
    }
    .grow-tool-layout .grow-tool-icon svg {
        width: 14px;
        height: 14px;
        color: #2C5282;
    }
    .grow-tool-layout .grow-tool-card.active .grow-tool-icon svg,
    .grow-tool-layout .grow-tool-card:hover .grow-tool-icon svg {
        color: currentColor;
    }

    /* Hide related guides on mobile tool pages (save space) */
    .grow-tool-layout .guide-toc-related {
        display: none;
    }

    /* Tool content: zero padding so shortcode tables go edge-to-edge */
    /* No padding on the content wrapper — shortcodes need edge-to-edge.
       Text padding is handled by the shortcode plugins' own spacing
       and by WordPress block markup. For hand-written HTML sections
       (h2, p, content-section, faq-item etc), add the .tool-text-block
       class in the editor, or use the catch-all below. */
    .grow-tool-main .grow-tool-content {
        padding: 0;
    }

    /* Pad all direct children that aren't shortcode containers */
    .grow-tool-content > *:not(.bank-container):not(.fscs-checker-wrap):not(.invest-container):not(.gptmc-container):not(script):not(style) {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Nested elements inside sections also need padding */
    .grow-tool-content > section,
    .grow-tool-content > .content-section,
    .grow-tool-content > .platform-intro {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* But don't double-pad children of already-padded sections */
    .grow-tool-content > section > *,
    .grow-tool-content > .content-section > *,
    .grow-tool-content > .platform-intro > * {
        padding-left: 0;
        padding-right: 0;
    }

    /* Tool pages: plugins handle their own mobile nav (sticky header + pills),
       so no template-level mobile TOC is rendered. */
}

/* ====================================================================
   CAPITAL-AT-RISK WARNING BANNER
   ==================================================================== */

.grow-risk-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: #92400e;
    margin: 0 0 24px 0;
}

.grow-risk-warning strong {
    color: #78350f;
}

/* ====================================================================
   SIDEBAR — Comparison Tools widget
   ==================================================================== */

.grow-sidebar-tools {
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.grow-tool-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    text-decoration: none;
    color: #1E293B;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: all 0.15s ease;
}

.grow-tool-card:last-child { margin-bottom: 0; }

.grow-tool-card:hover {
    border-color: #2C5282;
    background: rgba(44, 82, 130, 0.04);
    color: #2C5282;
    transform: translateX(2px);
}

.grow-tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #2C5282;
}
.grow-tool-icon svg {
    width: 18px;
    height: 18px;
}

.grow-tool-name {
    flex: 1;
}

/* ====================================================================
   GLOSSARY — intro + three steps concept
   ==================================================================== */

.glossary-section {
    margin: 0;
}

.glossary-intro {
    background: #f8fafc;
    border-left: 4px solid #2C5282;
    padding: 18px 22px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 28px;
    font-size: 15px;
    color: #374151;
    line-height: 1.6;
}

.glossary-intro p { margin: 0 0 10px 0; }
.glossary-intro p:last-of-type { margin-bottom: 0; }
.glossary-intro .glossary-pitch {
    color: #1F6A95;
    font-weight: 600;
    font-style: italic;
    margin-top: 10px;
}

.glossary-intro-more {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.glossary-intro.expanded .glossary-intro-more {
    max-height: 800px;
    margin-top: 10px;
}

.glossary-intro-toggle {
    background: none;
    border: none;
    color: #2C5282;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0 0 0;
    text-decoration: underline;
}
.glossary-intro-toggle:hover { color: #1F6A95; }

.glossary-steps {
    margin: 28px 0;
}
.steps-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 18px 0;
    text-align: center;
}
.steps-grid {
    overflow: hidden;
    border-radius: 12px;
}
.steps-track {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    transition: transform 0.3s ease;
}
.step-card {
    background: #fff;
    border: 2px solid #e7e5e4;
    border-radius: 12px;
    padding: 22px 18px;
    text-align: center;
    position: relative;
}
.step-card[data-step="1"] { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.04); }
.step-card[data-step="2"] { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.04); }
.step-card[data-step="3"] { border-color: rgba(31,106,149,0.4); background: rgba(31,106,149,0.04); }
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2C5282;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 10px;
}
.step-title {
    font-size: 17px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 6px 0;
}
.step-horizon {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #64748B;
    margin-top: 2px;
}
.step-desc {
    font-size: 13px;
    color: #374151;
    margin: 6px 0 0 0;
    line-height: 1.4;
}
.steps-indicators {
    display: none;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #E7E5E4;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}
.step-dot.active { background: #2C5282; }
.steps-tagline {
    text-align: center;
    margin: 14px 0 0 0;
    font-size: 13px;
    color: #64748B;
    font-style: italic;
}

.glossary-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e7e5e4, transparent);
    margin: 28px 0;
}

/* ====================================================================
   GLOSSARY — search + category nav + terms list
   ==================================================================== */

.glossary-terms-header {
    text-align: center;
    margin-bottom: 18px;
}
.glossary-terms-title {
    font-size: 22px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 6px 0;
}
.glossary-terms-subtitle {
    font-size: 13px;
    color: #64748B;
    margin: 0;
}
.click-hint {
    color: #2C5282;
    font-weight: 500;
}

.glossary-search-wrap {
    position: relative;
    max-width: 500px;
    margin: 0 auto 12px auto;
}
.glossary-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #94A3B8;
}
.glossary-search {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid #e7e5e4;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.glossary-search:focus {
    border-color: #2C5282;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.glossary-start-hint {
    text-align: center;
    font-size: 12px;
    color: #64748B;
    margin: 0 0 14px 0;
}
.glossary-start-hint a {
    color: #2C5282;
    text-decoration: none;
    font-weight: 600;
}
.glossary-start-hint a:hover { text-decoration: underline; }

.glossary-category-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e7e5e4;
}
.category-nav-item {
    padding: 6px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e7e5e4;
    color: #374151;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.category-nav-item:hover,
.category-nav-item.active {
    background: #2C5282;
    color: #fff;
    border-color: #2C5282;
}

.glossary-mobile-nav.is-sticky {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 50;
    padding: 12px 16px;
    margin: 0 -16px 16px -16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.glossary-terms-by-category {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.glossary-category-group {
    scroll-margin-top: 100px;
}

.glossary-category-heading {
    font-size: 16px;
    font-weight: 700;
    color: #1E293B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #2C5282;
}

.glossary-category-terms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}

.glossary-term-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
}
.glossary-term-row:hover {
    border-color: #2C5282;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transform: translateY(-1px);
}

.term-title {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
}
.term-excerpt {
    font-size: 12px;
    color: #64748B;
    line-height: 1.4;
}

.glossary-no-results {
    text-align: center;
    padding: 30px;
    color: #94A3B8;
    font-size: 14px;
}

/* ====================================================================
   LEARN PAGE — CTA + sections
   ==================================================================== */

.learn-page-content {
    margin-bottom: 24px;
}

.learn-guide-cta {
    background: linear-gradient(135deg, #2C5282 0%, #1F6A95 100%);
    color: #fff;
    padding: 26px 28px;
    border-radius: 14px;
    margin: 28px 0;
    text-align: center;
}
.learn-guide-cta-content h2 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 8px 0;
}
.learn-guide-cta-content p {
    color: rgba(255,255,255,0.9);
    margin: 0 0 16px 0;
    font-size: 14px;
}
.learn-guide-btn {
    display: inline-block;
    background: #fff;
    color: #2C5282;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.15s;
}
.learn-guide-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.learn-section-block {
    margin: 28px 0;
}
.learn-section-heading {
    font-size: 22px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 6px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #2C5282;
    display: inline-block;
}
.learn-section-desc {
    color: #64748B;
    font-size: 14px;
    margin: 0 0 14px 0;
}

.learn-articles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.learn-article-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
}
.learn-article-row:hover {
    border-color: #2C5282;
    background: #fff;
    transform: translateX(3px);
}
.learn-article-title {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
}
.learn-article-excerpt {
    font-size: 12px;
    color: #64748B;
    line-height: 1.4;
}
.learn-see-all {
    display: inline-block;
    margin-top: 12px;
    color: #2C5282;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}
.learn-see-all:hover { text-decoration: underline; }

/* ====================================================================
   SAVING / INVESTING — child card grid
   ==================================================================== */

.section-guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.section-guide-card {
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
}
.section-guide-card:hover {
    border-color: #2C5282;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.section-guide-thumb a {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f8fafc;
}
.section-guide-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.section-guide-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8fafc;
    font-size: 48px;
}

.section-guide-content {
    padding: 16px 18px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.section-guide-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.3;
}
.section-guide-title a {
    color: #1E293B;
    text-decoration: none;
}
.section-guide-title a:hover { color: #2C5282; }

.section-guide-excerpt {
    font-size: 13px;
    color: #64748B;
    line-height: 1.5;
    margin-bottom: 12px;
    flex: 1;
}

.section-guide-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #94A3B8;
    margin-bottom: 12px;
}

.section-guide-btn {
    display: inline-block;
    color: #2C5282;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    margin-top: auto;
}
.section-guide-btn:hover { text-decoration: underline; }

/* ====================================================================
   GLOSSARY TERM PAGE — back link + clean content
   ==================================================================== */

.term-guide-link {
    margin-bottom: 18px;
}
.term-guide-link a {
    color: #2C5282;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}
.term-guide-link a:hover { text-decoration: underline; }

.glossary-term-content {
    font-size: 16px;
    line-height: 1.7;
    color: #374151;
}
.glossary-term-content p {
    margin: 0 0 18px 0;
}
.glossary-term-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1E293B;
    margin: 28px 0 10px 0;
}
.glossary-term-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1E293B;
    margin: 22px 0 8px 0;
}

/* ====================================================================
   MOBILE
   ==================================================================== */

@media (max-width: 768px) {
    .steps-track {
        grid-template-columns: 1fr;
        gap: 0;
        grid-auto-flow: column;
        grid-auto-columns: 100%;
    }
    .steps-indicators {
        display: flex;
    }
    .step-card {
        padding: 18px 16px;
    }

    .glossary-category-nav {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    .category-nav-item {
        flex-shrink: 0;
    }

    .glossary-category-terms {
        grid-template-columns: 1fr;
    }

    .section-guides-grid {
        grid-template-columns: 1fr;
    }

    .learn-guide-cta {
        padding: 20px 18px;
    }
    .learn-guide-cta-content h2 {
        font-size: 18px;
    }
}
