/* ══════════════════════════════════════════════════
   Vladindex — Non-critical styles
   ══════════════════════════════════════════════════ */

/* Chart story sections (below each chart) */
.chart-story {
    border-top: 1px solid var(--border);
    margin-top: 1.25rem;
    padding-top: 1.25rem;
}

.chart-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.chart-story p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.chart-story p:last-child {
    margin-bottom: 0;
}

/* Key insight callout box */
.chart-insight {
    background: var(--bg-card);
    border-left: 3px solid var(--accent-net);
    border-radius: 0 8px 8px 0;
    padding: 0.85rem 1.2rem;
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
}

.chart-insight p {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0;
}

.chart-insight strong {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Chart controls */
.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-controls .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 0.4rem;
}

.btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

.btn.active {
    background: var(--accent-gross);
    color: #0f0f13;
    border-color: var(--accent-gross);
    font-weight: 600;
}

/* Info section */
.info-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.info-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.info-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.info-section .note {
    border-left: 3px solid var(--accent-gross);
    padding-left: 1rem;
    margin-top: 1.25rem;
}

.info-section .note p {
    font-size: 0.85rem;
}

/* Sources section */
.sources-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
}

.sources-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.sources-list {
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.sources-list li {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.sources-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    min-width: 6px;
    border-radius: 50%;
    background: var(--accent-gross);
    margin-top: 0.45em;
}

.sources-list a {
    color: var(--accent-gross);
    text-decoration: none;
}

.sources-list a:hover {
    text-decoration: underline;
}

.sources-notes {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.sources-notes p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.sources-notes p:last-child {
    margin-bottom: 0;
}

.sources-list .source-tag {
    display: inline-block;
    background: rgba(129, 140, 248, 0.1);
    color: var(--accent-gross);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* FAQ section */
.faq-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.faq-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.faq-list {
    display: grid;
    gap: 0.5rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.faq-item[open] {
    border-color: var(--accent-gross);
}

.faq-item summary {
    padding: 0.85rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.faq-item summary::before {
    content: '+';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.1);
    color: var(--accent-gross);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.faq-item[open] summary::before {
    content: '\2212';
    background: var(--accent-gross);
    color: #0f0f13;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item p {
    padding: 0 1.2rem 1rem 3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* Milestone legend */
.milestone-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    justify-content: center;
    padding-top: 0.85rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.milestone-legend .ml-item {
    display: inline-flex;
    align-items: center;
}

.milestone-legend .ml-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #c8c5d6;
    color: #0f0f13;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 50%;
    margin-right: 0.3rem;
    flex-shrink: 0;
}

/* Chart legend */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    justify-content: center;
    padding-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-legend .cl-item {
    display: inline-flex;
    align-items: center;
}

.chart-legend .cl-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.35rem;
    flex-shrink: 0;
}

/* Header install button */
.header-install {
    display: none;
    position: absolute;
    top: 1rem;
    right: 0;
    z-index: 2;
    align-items: center;
    gap: 0.35rem;
    background: rgba(129, 140, 248, 0.08);
    border: 1px solid rgba(129, 140, 248, 0.25);
    color: var(--accent-gross);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.header-install.visible {
    display: inline-flex;
}

.header-install:hover {
    background: rgba(129, 140, 248, 0.18);
    border-color: var(--accent-gross);
}

.header-install svg {
    flex-shrink: 0;
}

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding: 3.5rem 0 2.5rem;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Footer 3-column grid */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: space-evenly;
    gap: 3rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-col-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.footer-col a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--accent-gross);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.footer-logo img {
    width: 28px;
    height: auto;
    opacity: 0.6;
}

.footer-logo span {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #847f98;
}

.footer-tagline {
    font-size: 0.78rem;
    color: #847f98;
    line-height: 1.5;
}

.footer-install-btn {
    display: none;
    align-items: center;
    gap: 0.35rem;
    background: rgba(129, 140, 248, 0.08);
    border: 1px solid rgba(129, 140, 248, 0.25);
    color: var(--accent-gross);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
    margin-top: 0.25rem;
}

.footer-install-btn.visible {
    display: inline-flex;
}

.footer-install-btn:hover {
    background: rgba(129, 140, 248, 0.18);
    border-color: var(--accent-gross);
}

.footer-install-btn svg {
    flex-shrink: 0;
}

.footer-email {
    color: var(--accent-gross) !important;
    font-weight: 600;
}

/* Social icons */
.footer-social {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all 0.2s;
}

.social-link:hover {
    color: var(--text) !important;
    border-color: var(--text-muted);
    background: var(--bg-card-hover);
}

/* Footer bottom */
.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: #847f98;
    font-size: 0.75rem;
}

.pwa-install-btn {
    background: linear-gradient(135deg, var(--accent-net), var(--accent-gross));
    color: var(--bg);
    font-weight: 700;
    font-size: 0.8rem;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.pwa-install-btn:hover {
    opacity: 0.85;
}

/* PWA Modal */
.pwa-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.pwa-modal.visible {
    display: flex;
}

.pwa-modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 380px;
    width: 90%;
    position: relative;
    text-align: center;
}

.pwa-hero {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.pwa-hero svg {
    width: 120px;
    height: auto;
}

.pwa-modal-box > strong {
    font-size: 1.05rem;
    color: var(--text);
    display: block;
    margin-bottom: 0.3rem;
}

.pwa-subtitle {
    font-size: 0.78rem;
    color: #847f98;
    margin-bottom: 1.25rem;
}

.pwa-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.pwa-modal-close:hover {
    color: var(--text);
}

.pwa-steps {
    text-align: left;
}

.pwa-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.pwa-step:last-child {
    margin-bottom: 0;
}

.pwa-step-icon {
    min-width: 32px;
    height: 32px;
    background: rgba(129, 140, 248, 0.1);
    border: 1px solid rgba(129, 140, 248, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.05rem;
    color: var(--accent-gross);
}

.pwa-step:last-child .pwa-step-icon {
    background: rgba(110, 231, 183, 0.1);
    border-color: rgba(110, 231, 183, 0.2);
    color: var(--accent-net);
}

.pwa-step p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    padding-top: 0.15rem;
}

.pwa-step p strong {
    color: var(--text);
}

/* Scroll-hint overlay (desktop) */
.chart-scroll-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 15, 19, 0.85);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 10;
    white-space: nowrap;
}

.chart-scroll-hint.visible {
    opacity: 1;
}

/* ══════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   Content-visibility: skip rendering of off-screen sections
   ══════════════════════════════════════════════════ */

.chart-wrapper:nth-of-type(n+2) {
    content-visibility: auto;
    contain-intrinsic-size: auto 900px;
}

.chart-wrapper:first-of-type .chart-story {
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
}

.faq-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 440px;
}

.sources-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 320px;
}

.site-footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 250px;
}

/* ══════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .chart-container { height: 440px; }
    .chart-wrapper { padding: 1.4rem; margin-bottom: 2rem; }
    .chart-controls { margin-bottom: 0.6rem; }
    .milestone-legend { font-size: 0.65rem; gap: 0.3rem 0.6rem; }
    .milestone-legend .ml-dot { width: 14px; height: 14px; font-size: 0.55rem; }
    .chart-legend { font-size: 0.68rem; gap: 0.3rem 0.8rem; }
    .chart-legend .cl-color { width: 8px; height: 8px; }
    .chart-controls .label { font-size: 0.7rem; }
    .chart-title { font-size: 0.95rem; }
    .chart-story { margin-top: 1rem; padding-top: 1rem; }
    .chart-story p { font-size: 0.8rem; }
    .chart-insight p { font-size: 0.85rem; }
    .faq-section { padding: 1.5rem; }
    .faq-item summary { font-size: 0.85rem; padding: 0.75rem 1rem; }
    .faq-item p { font-size: 0.8rem; padding: 0 1rem 0.85rem 2.75rem; }
    .footer-grid { gap: 2rem; }
    .chart-wrapper:nth-of-type(n+2) { contain-intrinsic-size: auto 780px; }
}

@media (max-width: 640px) {
    .container { padding: 1rem 0.75rem 3rem; }
    .chart-container { height: 218px; }
    .chart-wrapper { padding: 1rem; margin-bottom: 1.75rem; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .stat-card { padding: 0.75rem 1rem; border-radius: 10px; }
    .stat-card .stat-label { font-size: 0.65rem; margin-bottom: 0.2rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
    .stat-card .stat-sub { font-size: 0.7rem; }
    .chart-controls { margin-bottom: 0.5rem; }
    .chart-controls .label { font-size: 0.65rem; }
    .btn { padding: 0.3rem 0.6rem; font-size: 0.7rem; }
    .chart-title { font-size: 0.88rem; margin-bottom: 0.5rem; }
    .chart-story { margin-top: 0.85rem; padding-top: 0.85rem; }
    .chart-story p { font-size: 0.78rem; margin-bottom: 0.6rem; }
    .chart-insight { padding: 0.65rem 0.9rem; }
    .chart-insight p { font-size: 0.8rem; }
    .info-section, .sources-section, .faq-section { padding: 1.25rem; }
    .faq-item summary { font-size: 0.82rem; padding: 0.7rem 0.85rem; }
    .faq-item p { font-size: 0.78rem; padding: 0 0.85rem 0.75rem 2.5rem; }
    .milestone-legend { display: none; }
    .chart-legend { font-size: 0.62rem; gap: 0.25rem 0.6rem; }
    .header-install { top: 0.5rem; font-size: 0.7rem; padding: 0.35rem 0.65rem; }
    .header-install svg { width: 12px; height: 12px; }
    .site-footer { margin-top: 2.5rem; padding: 2.5rem 0 1.5rem; }
    .footer-content { gap: 2rem; }
    .footer-grid { grid-template-columns: 1fr; justify-content: center; gap: 1.5rem; text-align: center; }
    .footer-col { align-items: center; }
    .footer-install-btn { margin: 0.25rem auto 0; }
    .footer-bottom { font-size: 0.7rem; }
    .chart-wrapper:nth-of-type(n+2) { contain-intrinsic-size: auto 520px; }
    .chart-wrapper:first-of-type .chart-story { contain-intrinsic-size: auto 180px; }
    .faq-section { contain-intrinsic-size: auto 380px; }
    .sources-section { contain-intrinsic-size: auto 280px; }
    .site-footer { contain-intrinsic-size: auto 350px; }
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

.ptr-indicator svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent-gross);
    transition: transform 0.1s ease;
}

.ptr-indicator.ready svg { stroke: var(--accent-net); }

.ptr-indicator.refreshing svg {
    animation: ptr-spin 0.6s linear infinite;
    stroke: var(--accent-net);
}

@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* Prevent native pull-to-refresh in PWA standalone mode */
@media (display-mode: standalone) {
    body { overscroll-behavior-y: contain; }
}

@media (max-width: 380px) {
    .stats { grid-template-columns: 1fr; gap: 0.5rem; }
    .stat-card { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.6rem; padding: 0.7rem 1rem; }
    .stat-card .stat-label { width: 100%; margin-bottom: 0.1rem; }
    .stat-card .stat-value { font-size: 1.2rem; }
    .stat-card .stat-sub { font-size: 0.68rem; margin-top: 0; }
}
