/* ============================================================
   DATA-DRIVEN ANALYSIS PAGE
   Design: hero + 6 alternating story sections.
   Each section pairs a narrative (Finding / Value / Why)
   with an ASCII-art "data readout" visual.

   Color palette (brand):
     Primary   #2f1f4f   deep purple
     Secondary #4949e7   electric blue
     Accent    #d35b74   rose
     Light     #dedede
   ============================================================ */

/* ── Body baseline ─────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--theme-bg-primary, #ffffff);
    color: var(--theme-text-secondary, #1d1d1f);
    overflow-x: hidden;
}

/* ============================================================
   HERO
   ============================================================ */
.dda-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 140px 24px 100px;
    background: linear-gradient(
        180deg,
        var(--theme-bg-primary, #ffffff) 0%,
        var(--theme-bg-secondary, #f5f5f7) 100%
    );
    position: relative;
    overflow: hidden;
}

.dda-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 22% 28%, rgba(73, 73, 231, 0.07) 0%, transparent 58%),
        radial-gradient(circle at 78% 72%, rgba(211, 91, 116, 0.05) 0%, transparent 52%);
    pointer-events: none;
}

.dda-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 820px;
}

.dda-hero-title {
    font-size: clamp(2.4rem, 5.5vw, 4.2rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.1;
    color: var(--theme-text-primary, #2f1f4f);
    margin-bottom: 1.5rem;
    animation: ddaHeroFadeUp 0.9s ease 0.1s both;
}

.dda-hero-desc {
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    color: var(--theme-text-light, #6e6e73);
    line-height: 1.65;
    max-width: 660px;
    margin: 0 auto;
    animation: ddaHeroFadeUp 0.9s ease 0.28s both;
}

@keyframes ddaHeroFadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   FEATURE SECTIONS
   ============================================================ */
.dda-section {
    min-height: 100vh;
    background: var(--theme-bg-primary, #ffffff);
    display: flex;
    align-items: center;
    overflow-x: hidden;
}

.dda-section--alt {
    background: var(--theme-bg-secondary, #f5f5f7);
}

/* Two-column inner grid — visual is wider to accommodate ASCII */
.dda-section-inner {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 80px 6%;
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    align-items: center;
    gap: 4rem;
}

.dda-section-inner--reverse {
    grid-template-columns: 1.3fr 1fr;
}

/* ── Content side ──────────────────────────────────────────── */
.dda-content {
    max-width: 520px;
}

.dda-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--theme-accent-secondary, #4949e7);
    margin-bottom: 1rem;
}

.dda-tag i {
    font-size: 1rem;
}

.dda-title {
    font-size: clamp(1.7rem, 2.7vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.18;
    color: var(--theme-text-primary, #2f1f4f);
    margin-bottom: 1.5rem;
}

.dda-block {
    margin-bottom: 1.25rem;
}

.dda-block-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--theme-accent-primary, #d35b74);
    margin: 0 0 0.35rem;
}

.dda-block p {
    font-size: 0.98rem;
    color: var(--theme-text-secondary, #1d1d1f);
    line-height: 1.6;
    margin: 0;
}

.dda-block strong {
    color: var(--theme-text-primary, #2f1f4f);
    font-weight: 600;
}

body.theme-dark .dda-block strong {
    color: var(--theme-accent-primary, #d35b74);
}

.dda-ref {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--theme-accent-secondary, #4949e7);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.dda-ref:hover {
    color: var(--theme-accent-primary, #d35b74);
    border-bottom-color: var(--theme-accent-primary, #d35b74);
}

.dda-ref i {
    font-size: 1.05rem;
}

/* ── Visual side: ASCII frame ──────────────────────────────── */
.dda-visual {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dda-ascii-frame {
    position: relative;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 1 / 1;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dda-ascii {
    margin: 0;
    padding: 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-weight: 500;
    /* Tiny font so the 420-char-wide block fits the visual square. */
    font-size: 2px;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--theme-text-primary, #2f1f4f);
    white-space: pre;
    overflow: hidden;
    user-select: none;
    text-align: left;
}

/* Caption hidden — frame is now bare, no chrome */
.dda-ascii-caption {
    display: none;
}

/* ============================================================
   SECTION REVEAL ANIMATION
   ============================================================ */
.dda-section .dda-content,
.dda-section .dda-visual {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.dda-section.is-visible .dda-content {
    opacity: 1;
    transform: translateY(0);
}

.dda-section.is-visible .dda-visual {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

/* ============================================================
   CTA SECTION
   ============================================================ */
.dda-cta {
    background: linear-gradient(
        135deg,
        var(--theme-bg-secondary, #f5f5f7) 0%,
        var(--theme-bg-primary, #ffffff) 100%
    );
    padding: 120px 10%;
    text-align: center;
}

.dda-cta-inner {
    max-width: 640px;
    margin: 0 auto;
}

.dda-cta-title {
    font-size: clamp(1.8rem, 3.6vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--theme-text-primary, #2f1f4f);
    margin-bottom: 1rem;
}

.dda-cta-desc {
    font-size: 1.15rem;
    color: var(--theme-text-light, #6e6e73);
    margin-bottom: 2.5rem;
    line-height: 1.65;
}

.dda-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--theme-accent-secondary, #4949e7);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid var(--theme-accent-secondary, #4949e7);
    padding: 0.85rem 2rem;
    border-radius: 8px;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.dda-cta-btn:hover {
    background: var(--theme-accent-secondary, #4949e7);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(73, 73, 231, 0.3);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer-minimal {
    background: var(--theme-bg-secondary, #f5f5f7);
    padding: 3rem 10%;
    text-align: center;
    border-top: 1px solid var(--theme-border, rgba(0, 0, 0, 0.05));
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--theme-text-light, #6e6e73);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--theme-accent-secondary, #4949e7);
}

.footer-copy {
    color: var(--theme-text-light, #86868b);
    font-size: 0.8125rem;
    margin: 0;
}

@media (max-width: 768px) {
    .footer-minimal {
        padding: 2rem 5%;
    }
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet / small desktop: stack to single column,
   content first then visual on every section. */
@media (max-width: 1024px) {
    .dda-section-inner,
    .dda-section-inner--reverse {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding: 80px 5%;
    }

    .dda-section-inner--reverse .dda-visual { order: 1; }
    .dda-section-inner--reverse .dda-content { order: -1; }

    .dda-content {
        max-width: 100%;
    }

    .dda-ascii-frame {
        max-width: 560px;
        margin: 0 auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .dda-hero {
        padding: 120px 20px 80px;
    }

    .dda-section-inner,
    .dda-section-inner--reverse {
        padding: 64px 6%;
        gap: 2.5rem;
    }

    .dda-title {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    .dda-ascii-frame {
        max-width: 100%;
        border-radius: 12px;
    }

    /* ASCII is 420 chars wide. On mobile the frame is ~88vw, and a
       monospace char is ~0.6 × font-size wide, so the largest font
       that still fits is ~ 88vw / (420 × 0.6) ≈ 0.35vw.
       clamp() keeps it readable on tiny screens and caps it at the
       2px desktop value once the viewport is wide enough. */
    .dda-ascii {
        font-size: clamp(1.1px, 0.345vw, 2px);
        line-height: 1.5;
    }

    .dda-ascii-caption {
        font-size: 0.62rem;
        padding: 0.15rem 0.5rem;
    }

    .dda-cta {
        padding: 80px 6%;
    }
}
