/* ============================================
   Research Page — Unique layouts per section
   No two sections share the same visual structure
   ============================================ */

/* Nav active state now in index-lab.css */

/* Dark-section eyebrows — mint for >=4.5:1 on the dark surface
   (index-lab default --accent-light is ~3.2:1 on var(--inverse)) */
.pl-section--dark .pl-eyebrow { color: var(--mint); }


/* ============================================
   1. HERO — Split grid (mirrors index-lab / harness)
   ============================================ */
.pl-r-hero {
    display: grid;
    grid-template-columns: 1fr 2fr;
    border-top: 1px solid var(--border);
}
.pl-r-hero .pl-heading em {
    padding-left: 6px;
    margin-left: -6px;
}
.pl-r-hero-text {
    padding: clamp(40px, 6vw, 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.pl-r-hero-text .pl-subtitle {
    font: 500 14px/1.55 var(--sans);
    max-width: 440px;
    margin-bottom: 24px;
}
/* Single CTA — force primary style */
.pl-r-hero .pl-hero-cta { justify-content: flex-start; }
.pl-r-hero .pl-hero-cta a:only-child {
    background: var(--inverse);
    color: var(--bg1);
    border: none;
}
.pl-r-hero .pl-hero-cta a:only-child:hover {
    background: var(--accent);
}

/* ---- Hero visual — JSON preview in container ---- */
.pl-r-hero-preview {
    position: relative;
    min-height: clamp(300px, 50vh, 500px);
    background: var(--bg1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    min-width: 0;
}
.pl-r-hero-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.25;
    pointer-events: none;
    z-index: 1;
}

/* ---- Metrics bar ---- */
.pl-r-metrics {
    margin: 0 56px 32px;
    border-radius: 4px;
}

/* JSON episode preview card */
.pl-r-json {
    background: #101a14;
    border-radius: 8px;
    max-height: 420px;
    overflow-y: auto;
    position: relative;
    z-index: 2;
    width: 100%;
    box-shadow:
        0 24px 80px rgba(0,0,0,0.25),
        0 8px 24px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.06);
}
/* Scrollbar — thin, muted, blends with the dark code viewer */
.pl-r-json::-webkit-scrollbar { width: 4px; }
.pl-r-json::-webkit-scrollbar-track { background: transparent; }
.pl-r-json::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.22);
    border-radius: 2px;
}
.pl-r-json::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.38); }
/* Firefox */
.pl-r-json { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.22) transparent; }

.pl-r-json-fade {
    position: sticky;
    bottom: 0;
    height: 60px;
    margin-top: -60px;
    background: linear-gradient(transparent, #101a14);
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease;
}
.pl-r-json-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 16px;
    background: rgba(0,0,0,0.35);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pl-r-json-bar > span:nth-child(-n+3) {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
}
.pl-r-json-filename {
    margin-left: auto;
    font: 500 10px/1 var(--mono);
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.02em;
}
.pl-r-json pre {
    margin: 0;
    padding: 16px 20px;
}
.pl-r-json code {
    font: 400 13px/1.7 var(--mono);
    color: rgba(255,255,255,0.60);   /* 6.97:1 on the #101a14 code ground */
    white-space: pre-wrap;
    word-break: break-word;
}
/* Syntax highlighting */
.pl-j-key { color: #8fb3a0; }
.pl-j-str { color: #b5896a; }
.pl-j-num { color: #a3be98; }
.pl-j-bool { color: #8adcae; }
/* Highlighted fields — draw the eye to what matters */
.pl-j-hi { color: rgba(255,255,255,0.85); }
.pl-j-hi-str { color: #dda873; }
.pl-j-hi-num { color: #c8e6a0; font-weight: 500; }
.pl-j-hi-key { color: var(--mint); }

/* Caption under the JSON episode card */
.pl-r-json-caption {
    position: relative;
    z-index: 2;
    margin: 16px 0 0; /* clear gap from the code window edge */
    padding: 0 12px;
    font: 500 11px/1.5 var(--mono);
    letter-spacing: 0.03em;
    color: var(--text-3);
    text-align: center;
}


/* Terminal card */
.pl-r-terminal {
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--inverse);
    background: var(--inverse);
}
.pl-r-terminal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.2);
}
.pl-r-terminal-bar > span:nth-child(-n+3) {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}
.pl-r-terminal-body {
    padding: 20px 24px;
}
.pl-r-terminal-body code {
    display: block;
    font: 500 14px/1.6 var(--mono);
    color: var(--mint);
    margin-bottom: 12px;
}
.pl-r-terminal-features {
    font: 500 11px/1.6 var(--sans);
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.02em;
}


/* ============================================
   3. ENVIRONMENT — Code-first two-column layout
   ============================================ */
.pl-r-env-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 48px;
    align-items: start;
}
/* Grid items default to min-width:auto, which lets the code block's
   intrinsic width blow out the layout on narrow screens instead of
   letting pre { overflow-x } scroll. */
.pl-r-env-grid > * { min-width: 0; }

/* Code card */
.pl-r-env-code .pl-r-terminal {
    margin-top: 0;
    border-radius: 8px;
    background: #1c2a22;
    border-color: rgba(255,255,255,0.06);
}
.pl-r-env-code .pl-r-terminal-body {
    padding: 0;
}
.pl-r-env-code pre {
    margin: 0;
    padding: 20px 24px;
}
.pl-r-env-code code {
    font: 400 13px/1.7 var(--mono);
    color: rgba(255,255,255,0.72);
    white-space: pre;
}
.pl-j-comment {
    color: rgba(255,255,255,0.58);
    font-style: italic;
}
.pl-j-hi-label {
    color: var(--mint);
    font-style: normal;
    font-weight: 500;
}

/* Text column */
.pl-r-env-text {
    padding-top: 16px;
}
.pl-r-env-text .pl-heading {
    margin-bottom: 32px;
}
.pl-r-env-mode {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pl-r-env-mode:last-of-type { border-bottom: none; }
.pl-r-env-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}
.pl-r-env-icon canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.pl-r-env-mode h4 {
    margin: 0 0 8px;
}
.pl-r-env-mode h4 code {
    font: 500 13px/1 var(--mono);
    color: var(--mint);
    background: rgba(27,107,76,0.1);
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid rgba(27,107,76,0.15);
    display: inline-block;
}
.pl-r-env-mode p {
    font: 300 15px/1.55 var(--sans);
    color: rgba(255,255,255,0.6);
    margin: 0;
    letter-spacing: 0.015em;
}

/* Caption under the SDK code card */
.pl-r-code-caption {
    margin: 12px 4px 0;
    font: 500 11px/1.5 var(--mono);
    letter-spacing: 0.03em;
    color: rgba(255,255,255,0.35);
}

/* Harness cross-link note */
.pl-r-env-note {
    margin: 24px 0 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font: 300 14px/1.6 var(--sans);
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.015em;
}
.pl-r-env-note a {
    color: var(--mint);
    transition: opacity 0.2s ease;
}
.pl-r-env-note a:hover { opacity: 0.7; }
/* ============================================
   4. CUSTOM TRAJECTORIES — Mesh gradient card
   ============================================ */
.pl-r-custom {
    padding: 48px 56px;
}
.pl-r-custom-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    padding: 36px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    background:
        radial-gradient(ellipse at 50% 130%, rgba(42,143,101,0.35), transparent 50%),
        #16302a;
    box-shadow:
        0 8px 32px rgba(27,107,76,0.2),
        0 2px 8px rgba(0,0,0,0.15);
}
.pl-r-custom-card > * {
    position: relative;
    z-index: 1;
}
/* Animated mesh orbs */
.pl-r-custom-card::before,
.pl-r-custom-card::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}
.pl-r-custom-card::before {
    width: 55%;
    height: 160%;
    background: radial-gradient(circle, rgba(27,107,76,0.7), transparent 70%);
    top: -50%;
    left: -5%;
    animation: orbA 10s ease-in-out infinite alternate;
}
.pl-r-custom-card::after {
    width: 45%;
    height: 140%;
    background: radial-gradient(circle, rgba(85,210,154,0.2), transparent 70%);
    bottom: -40%;
    right: -5%;
    animation: orbB 8s ease-in-out infinite alternate;
}
@keyframes orbA {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(8%, 10%) scale(1.1); }
}
@keyframes orbB {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-10%, -8%) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
    .pl-r-custom-card::before,
    .pl-r-custom-card::after { animation: none; }
}
.pl-r-custom-card h3 {
    font: 700 26px/1.3 'Bitter', serif;
    font-style: italic;
    color: rgba(255,255,255,0.95);
    margin: 0 0 12px;
}
.pl-r-custom-card p {
    font: 300 16px/1.6 var(--sans);
    color: rgba(255,255,255,0.7);
    margin: 0 0 20px;
    max-width: 70ch;
    letter-spacing: 0.015em;
}
.pl-r-custom-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pl-r-custom-tags span {
    font: 500 11px/1 var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 4px;
    color: rgba(255,255,255,0.8); /* legible over the orb glow */
}
/* Mint-outline button — holds >=4.5:1 against the banner glow */
.pl-r-custom-cta {
    font: 500 12px/1 var(--sans);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 28px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(85,210,154,0.6);
    border-radius: 4px;
    color: #fff;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.pl-r-custom-cta:hover {
    background: rgba(85,210,154,0.15);
    border-color: var(--mint);
}


/* ============================================
   7. CTA — Atmospheric single-focus conversion
   ============================================ */
.pl-r-cta {
    padding: 120px 56px 100px;
    overflow: hidden;
}

/* Atmospheric glow — focal point behind button area */
.pl-r-cta-glow {
    position: absolute;
    width: 800px;
    height: 600px;
    left: 50%;
    top: 55%;
    transform: translate(-50%, -40%);
    background:
        radial-gradient(ellipse, rgba(27,107,76,0.25) 0%, transparent 55%),
        radial-gradient(ellipse at 45% 65%, rgba(85,210,154,0.08) 0%, transparent 45%);
    filter: blur(30px);
    pointer-events: none;
    z-index: 0;
    animation: ctaBreath 10s ease-in-out infinite alternate;
}
@keyframes ctaBreath {
    0%   { opacity: 0.7; transform: translate(-50%, -40%) scale(1); }
    100% { opacity: 1;   transform: translate(-50%, -40%) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
    .pl-r-cta-glow { animation: none; opacity: 0.8; }
}

/* Credibility metric */
.pl-r-cta-metric {
    display: block;
    font: 500 10px/1 var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mint); /* full mint — ~7:1 on var(--inverse) */
    margin-bottom: 24px;
}

/* Heading override — push it larger, full-contrast white */
.pl-r-cta h2 {
    font-size: clamp(40px, 5.5vw, 64px);
    margin-bottom: 20px;
    color: #fff;
}

/* Animated border angle — @property enables smooth gradient rotation */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* Credibility metric — tighten gap to heading */
.pl-r-cta-metric {
    margin-bottom: 18px;
}

/* Button shell */
.pl-r-cta-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 24px 64px;
    border-radius: 8px;
    text-decoration: none;
    margin-bottom: 28px;
    border: none;
    cursor: pointer;
    background: transparent;
    box-shadow:
        0 0 0 1px rgba(85,210,154,0.1),
        0 0 40px rgba(27,107,76,0.1),
        0 0 80px rgba(27,107,76,0.04),
        0 4px 20px rgba(0,0,0,0.4);
    transition: box-shadow 0.4s ease, transform 0.3s ease;
    animation: btnGlow 4s ease-in-out infinite alternate;
}
@keyframes btnGlow {
    0%   { box-shadow: 0 0 0 1px rgba(85,210,154,0.08), 0 0 40px rgba(27,107,76,0.08), 0 0 80px rgba(27,107,76,0.03), 0 4px 20px rgba(0,0,0,0.4); }
    100% { box-shadow: 0 0 0 1px rgba(85,210,154,0.13), 0 0 50px rgba(27,107,76,0.18), 0 0 100px rgba(27,107,76,0.06), 0 4px 20px rgba(0,0,0,0.4); }
}
.pl-r-cta-btn:hover {
    transform: translateY(-2px);
    animation: none;
    box-shadow:
        0 0 0 1px rgba(85,210,154,0.2),
        0 0 60px rgba(27,107,76,0.3),
        0 0 120px rgba(27,107,76,0.1),
        0 8px 28px rgba(0,0,0,0.35);
}

/* Rotating conic gradient — masked to border only */
.pl-r-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(
        from var(--border-angle),
        transparent 0%,
        #55d29a 10%,
        rgba(85,210,154,0.2) 22%,
        transparent 30%,
        transparent 45%,
        #1b6b4c 52%,
        rgba(27,107,76,0.15) 62%,
        transparent 70%,
        transparent 82%,
        rgba(85,210,154,0.25) 90%,
        transparent 100%
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    z-index: 0;
    animation: borderRotate 7s linear infinite;
}
@keyframes borderRotate {
    to { --border-angle: 360deg; }
}
.pl-r-cta-btn:hover::before {
    animation-duration: 4s;
    background: conic-gradient(
        from var(--border-angle),
        transparent 0%,
        #55d29a 10%,
        rgba(85,210,154,0.35) 22%,
        transparent 30%,
        transparent 45%,
        #2a8f65 52%,
        rgba(27,107,76,0.25) 62%,
        transparent 70%,
        transparent 82%,
        rgba(85,210,154,0.4) 90%,
        transparent 100%
    );
}

/* Inner fill — lighter than section bg for contrast, top-lit gradient */
.pl-r-cta-btn-fill {
    position: absolute;
    inset: 2px;
    border-radius: 6px; /* nested: outer 8px − 2px inset */
    background:
        radial-gradient(ellipse at 50% 0%, rgba(85,210,154,0.06) 0%, transparent 50%),
        linear-gradient(180deg, #1a352c, #0f2620);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
    z-index: 1;
    transition: background 0.3s ease;
}
.pl-r-cta-btn:hover .pl-r-cta-btn-fill {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(85,210,154,0.1) 0%, transparent 50%),
        linear-gradient(180deg, #1e3d33, #132b24);
}

/* Button text */
.pl-r-cta-btn-label {
    position: relative;
    z-index: 3;
    font: 500 14px/1 var(--sans);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 0 24px rgba(85,210,154,0.1);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pl-r-cta-btn, .pl-r-cta-btn::before { animation: none; }
    .pl-r-cta-btn::before {
        background: conic-gradient(
            from 45deg,
            rgba(85,210,154,0.4),
            transparent 30%,
            rgba(27,107,76,0.3) 50%,
            transparent 80%,
            rgba(85,210,154,0.2)
        );
    }
}

/* Academic note — quiet footnote (override .pl-cta > p) */
.pl-cta p.pl-r-cta-note {
    font: 300 13px/1.5 var(--sans);
    color: rgba(255,255,255,0.45);
    margin: 0 auto;
    max-width: none;
    letter-spacing: 0.03em;
}


/* ============================================
   6. FAQ — Asymmetric: heading left, list right
   ============================================ */
.pl-r-faq-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 56px;
    align-items: start;
}
.pl-r-faq-left .pl-heading {
    margin-bottom: 0;
}
.pl-r-faq-note {
    margin: 20px 0 0;
    font: 500 13px/1.6 var(--sans);
    color: var(--text-2);
    letter-spacing: 0.01em;
}
.pl-r-faq-note a {
    color: var(--accent);
    transition: opacity 0.2s ease;
}
.pl-r-faq-note a:hover { opacity: 0.7; }

/* FAQ styles now in index-lab.css */


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .pl-r-hero {
        grid-template-columns: 1fr;
    }
    .pl-r-hero-text {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .pl-r-metrics { margin: 0 40px; }
    .pl-r-json code { font-size: 11.5px; }

    .pl-r-env-grid { grid-template-columns: 1fr; gap: 32px; }
    .pl-r-env-code code { font-size: 12px; white-space: pre-wrap; }

    .pl-r-faq-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .pl-r-cta { padding: 100px 40px 80px; }
    .pl-r-cta-glow { width: 500px; height: 400px; }

    .pl-r-custom { padding: 40px; }
    .pl-r-custom-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 28px 32px;
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .pl-r-hero-text { padding: 32px 24px; }
    .pl-r-hero-preview { padding: 24px; min-height: auto; }
    .pl-r-metrics { margin: 24px; }
    .pl-r-cta { padding: 80px 24px 64px; }
    .pl-r-cta-glow { width: 350px; height: 300px; }
    .pl-r-json { max-height: 240px; overflow-y: auto; }
    .pl-r-json code { font-size: 11px; }
    .pl-r-custom { padding: 32px 24px; }
    .pl-r-custom-card { padding: 24px; }

    /* Code block — horizontal scroll */
    .pl-r-env-code code { white-space: pre; overflow-x: auto; }
    .pl-r-env-code pre { overflow-x: auto; }

    /* CTA button — reduce padding */
    .pl-r-cta-btn { padding: 20px 36px; }
}
