/*
Analysis Subpage v2 Template Styles
Template: subpage-analysis-v2.php
Visual system mirrors crypto-price-v2.css (hero band + page toc + textual + faq).
*/

/* Match fixed header height (76px) — global .site-main uses 100px and leaves a gap */
@media (min-width: 769px) {
    .site-main.aspv2 {
        padding: 76px 0 0;
    }
}

/* Layout container */
.aspv2-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Shared section heading */
.aspv2-section-title {
    margin: 0 0 24px;
    font-size: clamp(1.25rem, 2.4vw, 1.6rem);
    font-weight: 800;
    line-height: 1.5;
    color: var(--text-body);
}

/* ------------------------------------------------------------------ */
/* Hero — full-bleed band (info on the right, media aside on the left) */
/* ------------------------------------------------------------------ */
.aspv2-hero {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    background: var(--nav-bg);
    border-block-end: 1px solid var(--border-color);
    padding-block: 32px;
}

.aspv2-hero__breadcrumb {
    max-width: 1200px;
    margin: 0 auto 28px;
    padding-inline: 20px;
}

.aspv2-hero__breadcrumb .breadcrumb-container {
    max-width: none;
    margin: 0;
    padding: 0;
}

.aspv2-hero__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding-inline: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
    gap: 40px;
    align-items: stretch;
    direction: rtl;
}

.aspv2-hero__info {
    direction: rtl;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 18px;
    min-width: 0;
}

.aspv2-hero__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.aspv2-hero__title {
    margin: 0;
    font-size: clamp(1.375rem, 3vw, 2rem);
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-body);
    flex: 1 1 280px;
    min-width: 0;
}

.aspv2-hero__date {
    flex-shrink: 0;
    color: var(--text-muted, #6b7280);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    margin-top: 6px;
}

.aspv2-hero__seo-text {
    width: 100%;
    margin: 0;
    font-size: 0.87rem;
    font-weight: 400;
    line-height: 1.95;
    color: var(--text-body);
    text-align: justify;
}

.aspv2-hero__seo-text p {
    margin: 0 0 8px;
}

.aspv2-hero__seo-text p:last-child {
    margin-bottom: 0;
}

.aspv2-hero__seo-text strong {
    font-weight: 700;
    color: var(--text-body);
}

.aspv2-hero__media {
    direction: rtl;
    min-width: 0;
    display: flex;
    align-items: center;
}

/* The media column stretches to the text column height; the screenshot fills the
   card (object-fit: cover) so the image itself grows — not just the box — while a
   cap keeps the height reasonable. */
.aspv2-hero__media-inner {
    width: 100%;
    height: 100%;
    max-height: 250px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    background: var(--card-bg, #fff);
}

.aspv2-hero__media-inner,
.aspv2-hero__media-inner .arzpaya-popup-img-container,
.aspv2-hero__media-inner .arzpaya-popup-img-wrapper,
.aspv2-hero__media-inner picture {
    display: block;
    width: 100%;
    height: 100%;
}

.aspv2-hero__media-inner .arzpaya-popup-img-container,
.aspv2-hero__media-inner .arzpaya-popup-img-wrapper {
    margin: 0;
}

/* Higher specificity than the popup plugin's `height: auto` so the image truly
   fills the card height instead of leaving an empty box. */
.aspv2-hero__media-inner .arzpaya-popup-img-wrapper img,
.aspv2-hero__media-inner .arzpaya-popup-img-wrapper picture img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ------------------------------------------------------------------ */
/* Tools — analysis tools. Main: efficiency table + price chart v2.    */
/* Sidebar: date-profit calculator + exchange. Mirrors crypto-price-v2.*/
/* ------------------------------------------------------------------ */
.aspv2-tools {
    padding-block: 40px 8px;
    scroll-margin-top: 120px;
}

.aspv2-tools__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 32px;
    align-items: start;
    min-width: 0;
}

.aspv2-tools__main,
.aspv2-tools__sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

/* Efficiency + technical — stacked in one main-column grid cell */
.aspv2-tools__secondary {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.aspv2-panel {
    min-width: 0;
}

/* Efficiency table — wrap the bare widget in a soft card to match the panels */
.aspv2-tools__efficiency {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #eceef2);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    padding: 20px;
}

/* Technical summary — panel wrapper below efficiency table */
.aspv2-tools__technical {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #eceef2);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    padding: 20px;
}

/* Price chart v2 already ships its own card; just neutralize the margin */
.aspv2-tools__chart .apc2-container {
    margin: 0;
}

/* Date-profit calculator card (mirrors cpv2 sidebar) */
.aspv2-tools__calculator .arzpaya-date-profit-widget {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #eceef2);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    padding: 18px;
    max-width: none;
    margin: 0;
    overflow: visible;
}

.aspv2-tools__calculator .arzpaya-date-profit-widget .dp-title {
    font-size: 1.05rem;
    color: var(--text-body, #213364);
}

.aspv2-tools__calculator .arzpaya-date-profit-widget .dp-desc {
    font-size: 0.875rem;
}

/* Fear & greed — typography between compact and date-profit */
.aspv2-tools__fear-greed .arzfg-card-title {
    font-size: 1.025rem;
}

.aspv2-tools__fear-greed .arzfg-summary,
.aspv2-tools__fear-greed .arzfg-section-title,
.aspv2-tools__fear-greed .arzfg-stat-label,
.aspv2-tools__fear-greed .arzfg-now-verdict,
.aspv2-tools__fear-greed .arzfg-na {
    font-size: 0.8125rem;
}

.aspv2-tools__fear-greed .arzfg-stat-date,
.aspv2-tools__fear-greed .arzfg-section-hint,
.aspv2-tools__fear-greed .arzfg-pill {
    font-size: 0.6875rem;
}

.aspv2-tools__fear-greed .arzfg-footer {
    font-size: 0.625rem;
}

.aspv2-tools__fear-greed .arzfg-now-score {
    font-size: 1.875rem;
}

/* Fear & greed — sidebar card (matches efficiency / technical / calculator) */
.aspv2-tools__fear-greed {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #eceef2);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    padding: 18px;
}

/* Desktop: efficiency + technical stack (row 1) beside fear-greed; chart (row 2) beside date-profit. */
@media (min-width: 1025px) {
    .aspv2-tools__inner {
        grid-template-rows: auto auto;
        row-gap: 24px;
        column-gap: 32px;
    }

    .aspv2-tools__main,
    .aspv2-tools__sidebar {
        display: contents;
    }

    .aspv2-tools__secondary {
        grid-column: 1;
        grid-row: 1;
        align-self: stretch;
        min-height: 0;
    }

    .aspv2-tools__efficiency {
        flex: 0 0 auto;
    }

    /* Grows so efficiency + gap + technical = fear-greed (reference height). */
    .aspv2-tools__technical {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
        box-sizing: border-box;
    }

    .aspv2-tools__technical.is-height-synced .artzs-card-header {
        flex-shrink: 0;
    }

    .aspv2-tools__technical.is-height-synced .artzs-card-body {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .aspv2-tools__technical.is-height-synced .artzs-gauge-meta {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .aspv2-tools__technical.is-height-synced .artzs-ind-grid {
        flex: 1 1 auto;
        align-content: space-between;
    }

    .aspv2-tools__fear-greed {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
    }

    .aspv2-tools__chart {
        grid-column: 1;
        grid-row: 2;
    }

    .aspv2-tools__calculator {
        grid-column: 2;
        grid-row: 2;
        align-self: stretch;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .aspv2-tools__calculator .arzpaya-date-profit-widget {
        flex: 1 1 auto;
        min-height: 0;
    }
}

[data-theme="dark"] .aspv2-tools__efficiency,
[data-theme="dark"] .aspv2-tools__technical,
[data-theme="dark"] .aspv2-tools__fear-greed,
[data-theme="dark"] .aspv2-tools__calculator .arzpaya-date-profit-widget {
    border-color: var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------------ */
/* Benefits — highlights row (between tools and textual)              */
/* ------------------------------------------------------------------ */
.aspv2-tools-divider {
    display: none;
}

.aspv2-benefits {
    padding-block: 8px 0;
    scroll-margin-top: 120px;
}

.aspv2-benefits .arzpaya-benefits-highlights {
    max-width: 100%;
    margin-bottom: 32px;
}

@media (min-width: 1025px) {
    .aspv2-tools {
        padding-block: 32px 40px;
    }

    .aspv2-tools-divider {
        display: block;
        width: 100vw;
        z-index: 1;
        margin-top: 88px;
        margin-inline: calc(50% - 50vw);
        border-top: 1px solid #eceef2;
    }

    .aspv2-benefits {
        padding-block: 0;
    }

    .aspv2-benefits .arzpaya-benefits-highlights {
        position: relative;
        z-index: 2;
        max-width: 1120px;
        margin: 0 auto 40px;
        transform: translateY(-50%);
    }
}

[data-theme="dark"] .aspv2-tools-divider {
    border-top-color: var(--border-color);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .aspv2-tools-divider {
        border-top-color: var(--border-color);
    }
}

/* ------------------------------------------------------------------ */
/* Textual — expandable SEO prose + listing TOC sidebar               */
/* ------------------------------------------------------------------ */
.aspv2-textual {
    padding-block: 40px;
    scroll-margin-top: 120px;
}

.aspv2-textual__grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    align-items: start;
}

.aspv2-textual__grid.is-height-synced {
    align-items: start;
}

.aspv2-textual__sidebar {
    position: relative;
    min-height: 80px;
}

.aspv2-textual-toc {
    position: relative;
    z-index: 2;
}

.aspv2-textual-toc.is-sticky {
    position: fixed;
    z-index: 40;
}

.aspv2-textual-toc__placeholder {
    visibility: hidden;
    pointer-events: none;
}

.aspv2-textual-toc .arzpaya-toc-widget {
    margin: 0;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
}

.aspv2-seo-content__inner {
    width: 100%;
}

.aspv2-seo-content__viewport {
    position: relative;
    overflow: hidden;
    max-height: var(--aspv2-seo-collapsed-height, 360px);
    transition: max-height 0.6s ease;
}

.aspv2-seo-content.is-expanded .aspv2-seo-content__viewport {
    max-height: none;
    overflow: visible;
}

.aspv2-seo-content__prose {
    text-align: justify;
    color: var(--text-body);
}

.aspv2-seo-content__title {
    margin: 0 0 20px;
    font-size: 1.75rem;
    line-height: 1.65;
    font-weight: 700;
    color: var(--text-body);
    scroll-margin-top: 140px;
}

.aspv2-seo-content__prose p {
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: 1.1em;
}

.aspv2-seo-content__prose h1,
.aspv2-seo-content__prose h2,
.aspv2-seo-content__prose h3,
.aspv2-seo-content__prose h4,
.aspv2-seo-content__prose h5,
.aspv2-seo-content__prose h6 {
    margin: 30px 0 20px;
    color: var(--text-body);
    font-weight: 600;
    scroll-margin-top: 140px;
}

.aspv2-seo-content__prose h2 {
    font-size: 1.6em;
}

.aspv2-seo-content__prose h3 {
    font-size: 1.3em;
}

.aspv2-seo-content__prose ul,
.aspv2-seo-content__prose ol {
    margin: 0 0 20px;
    padding-inline-start: 24px;
    line-height: 1.8;
}

.aspv2-seo-content__prose img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.aspv2-seo-content__prose a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.aspv2-seo-content__prose a:hover {
    text-decoration: underline;
}

.aspv2-seo-content__fade {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 120px;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.85) 55%,
        var(--bg-primary, #fff) 100%
    );
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.aspv2-seo-content.is-expanded .aspv2-seo-content__fade {
    opacity: 0;
}

.aspv2-seo-content__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 16px;
}

.aspv2-seo-content.is-expanded .aspv2-seo-content__actions {
    display: none;
}

.aspv2-seo-content__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary, #6b7280);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.aspv2-seo-content__toggle:hover {
    background: rgba(107, 114, 128, 0.08);
    color: var(--text-body);
}

.aspv2-seo-content__toggle svg {
    flex-shrink: 0;
}

.aspv2-seo-content__collapse-wrap {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.aspv2-seo-content:not(.is-expanded) .aspv2-seo-content__collapse-wrap {
    display: none;
}

/* ------------------------------------------------------------------ */
/* Analysis CTA — full-width conversion band (mirrors cpv2-login)     */
/* ------------------------------------------------------------------ */
.aspv2-login {
    padding-block: 8px 0;
    scroll-margin-top: 120px;
}

/* ------------------------------------------------------------------ */
/* FAQ — match the homepage width on desktop (800px), centered         */
/* ------------------------------------------------------------------ */
.aspv2-faq {
    padding-block: 24px 48px;
    border-block-start: 1px solid var(--border-color);
    scroll-margin-top: 140px;
}

.aspv2-faq .faq-section {
    width: 100%;
    max-width: 800px;
    margin-inline: auto;
    margin-block: 0;
}

.aspv2-faq .faq-title {
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 800;
    color: var(--text-body);
    margin-bottom: 20px;
    text-align: center;
}

/* ------------------------------------------------------------------ */
/* Dark mode                                                          */
/* ------------------------------------------------------------------ */
[data-theme="dark"] .aspv2-hero {
    background: var(--card-bg);
    border-color: var(--border-color);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .aspv2-hero {
        background: var(--card-bg);
    }
}

[data-theme="dark"] .aspv2-textual,
[data-theme="dark"] .aspv2-faq {
    border-color: var(--border-color);
}

[data-theme="dark"] .aspv2-seo-content__fade {
    background: linear-gradient(
        to bottom,
        rgba(15, 20, 25, 0) 0%,
        rgba(15, 20, 25, 0.85) 55%,
        var(--bg-primary, #0f1419) 100%
    );
}

[data-theme="dark"] .aspv2-seo-content__toggle {
    color: var(--text-secondary);
    border-color: var(--border-color, rgba(255, 255, 255, 0.12));
}

[data-theme="dark"] .aspv2-seo-content__toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

[data-theme="dark"] .aspv2-hero__media-inner {
    border-color: var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------------ */
/* Responsive — match crypto-price-v2 breakpoints                     */
/* ------------------------------------------------------------------ */
@media (max-width: 1024px) {
    .aspv2-hero__inner {
        grid-template-columns: 1fr;
        gap: 28px;
        direction: rtl;
        align-items: stretch;
        display: flex;
        flex-direction: column;
    }

    /* Flatten info so head / media / seo-text can be reordered on mobile only. */
    .aspv2-hero__info {
        display: contents;
    }

    .aspv2-hero__head {
        order: 1;
    }

    .aspv2-tools__inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Title + date first, then image, then SEO prose — desktop grid unchanged. */
    .aspv2-hero__media {
        order: 2;
        max-width: 480px;
        display: block;
    }

    .aspv2-hero__seo-text {
        order: 3;
    }

    .aspv2-hero__media-inner {
        max-height: none;
    }

    .aspv2-hero__media-inner,
    .aspv2-hero__media-inner .arzpaya-popup-img-container,
    .aspv2-hero__media-inner .arzpaya-popup-img-wrapper,
    .aspv2-hero__media-inner picture {
        height: auto;
    }

    .aspv2-hero__media-inner .arzpaya-popup-img-wrapper img,
    .aspv2-hero__media-inner .arzpaya-popup-img-wrapper picture img {
        height: auto;
        object-fit: contain;
    }

    .aspv2-textual__grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .aspv2-textual__sidebar {
        display: none;
    }

    /* When audio player is present, keep fade shorter so a few prose lines stay readable */
    .aspv2-seo-content.has-audio-player:not(.is-expanded) .aspv2-seo-content__fade {
        height: 72px;
        background: linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.65) 45%,
            var(--bg-primary, #fff) 100%
        );
    }

    [data-theme="dark"] .aspv2-seo-content.has-audio-player:not(.is-expanded) .aspv2-seo-content__fade {
        background: linear-gradient(
            to bottom,
            rgba(15, 20, 25, 0) 0%,
            rgba(15, 20, 25, 0.65) 45%,
            var(--bg-primary, #0f1419) 100%
        );
    }
}

@media (max-width: 768px) {
    .aspv2-hero__breadcrumb,
    .aspv2-layout {
        padding-inline: 16px;
    }

    .aspv2-hero {
        padding-block: 24px;
    }

    .aspv2-hero__inner {
        padding-inline: 16px;
        gap: 24px;
    }

    .aspv2-hero__title {
        font-size: 1.35rem;
    }

    .aspv2-hero__seo-text {
        font-size: 0.9rem;
    }

    .aspv2-tools {
        padding-block: 30px 0;
    }

    .aspv2-benefits .arzpaya-benefits-highlights {
        margin-bottom: 24px;
    }

    .aspv2-tools__main,
    .aspv2-tools__sidebar {
        gap: 20px;
    }

    .aspv2-textual {
        padding-block: 30px;
    }

    .aspv2-seo-content__title {
        font-size: 1.4rem;
    }

    .aspv2-seo-content__prose p {
        font-size: 1em;
    }

    .aspv2-seo-content__prose h2 {
        font-size: 1.4em;
    }

    .aspv2-seo-content__viewport {
        --aspv2-seo-collapsed-height: 280px;
    }
}

@media (max-width: 480px) {
    .aspv2-hero__breadcrumb,
    .aspv2-layout {
        padding-inline: 12px;
    }

    .aspv2-hero__inner {
        padding-inline: 12px;
    }

    .aspv2-hero__head {
        gap: 10px;
    }

    .aspv2-hero__date {
        margin-top: 0;
    }
}
