/**
 * Helix Research — helpers.css
 */

:root {
    --helix-strand-a: #3ab8c8;
    --helix-strand-b: #38b890;
}
[data-theme='light'] {
    --helix-strand-a: #b86840;
    --helix-strand-b: #905870;
    --wp--preset--color--background: #f6fbfc;
    --wp--preset--color--foreground: #0b1f2a;
    --wp--preset--color--surface: #ffffff;
    --wp--preset--color--card: #f2f7f9;
    --wp--preset--color--muted: #5f7784;
    --wp--preset--color--primary: #008bb0;
    --wp--preset--color--secondary: #00a787;
    --wp--preset--color--accent: #4b74b6;
}

/* Stars stacking context: WordPress block content must sit above the stars layer */
.wp-site-blocks {
    position: relative;
    z-index: 1;
}

/* Smooth theme transitions */
body {
    transition: color 0.3s ease;
}
html {
    background-color: var(--wp--preset--color--background);
}
[data-theme='light'] body {
    background-color: var(--wp--preset--color--background);
}

/* Theme toggle button */
.helix-theme-toggle {
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 999px;
    background: rgba(0, 212, 255, 0.08);
    color: var(--wp--preset--color--foreground);
    font-family: var(--wp--preset--font-family--epilogue);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.helix-theme-toggle:hover {
    transform: translateY(-1px);
    background: rgba(0, 212, 255, 0.14);
    border-color: rgba(0, 212, 255, 0.7);
}

/* DNA mount columns — ensure they have a background-free area for the canvas */
.helix-dna-mount-col,
.helix-dna-mount {
    position: relative;
    overflow: visible;
    min-height: 420px;
}
.helix-dna-canvas {
    display: block;
    z-index: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 3%, #000 97%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 3%, #000 97%, transparent);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
}

/* Keep shortcode wrapper from adding extra spacing inside DNA columns */
.helix-dna-mount-col .wp-block-shortcode {
    margin: 0;
    height: 100%;
}
.helix-dna-mount-col {
    display: flex;
    align-items: stretch;
}
.helix-dna-mount-col .wp-block-shortcode,
.helix-dna-mount-col .wp-block-shortcode > .helix-dna-mount {
    flex: 1;
    display: flex;
}
.helix-dna-mount {
    --helix-bleed: 260px;
    height: 100%;
    min-height: 100%;
    width: 100%;
}

/* Cell + immune animation */
.helix-cell-mount {
    position: relative;
    overflow: visible;
}
.helix-cell-scene {
    --cell-size: min(46vw, 360px);
    --cell-x: 50%;
    --cell-y: 50%;
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.helix-cell {
    position: absolute;
    left: var(--cell-x);
    top: var(--cell-y);
    width: var(--cell-size);
    height: var(--cell-size);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 24px rgba(255, 255, 255, 0.08),
        inset 0 0 18px rgba(255, 255, 255, 0.08);
    animation: helix-cell-drift 18s ease-in-out infinite, helix-cell-shape 12s ease-in-out infinite;
}
.helix-cell::after {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 46% 54% 50% 50%;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    opacity: 0.5;
}
.helix-cell-nucleus {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40%;
    height: 40%;
    transform: translate(-50%, -50%);
    border-radius: 46% 54% 46% 54%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.15);
    animation: helix-nucleus-ruffle 6.5s ease-in-out infinite;
}
.helix-cell-ripple {
    position: absolute;
    inset: -10%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    opacity: 0.4;
    animation: helix-cell-ripple 7.5s ease-in-out infinite;
}

@keyframes helix-cell-drift {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -52%) scale(1.02); }
}
@keyframes helix-cell-shape {
    0%   { border-radius: 52% 48% 50% 50% / 50% 54% 46% 50%; }
    25%  { border-radius: 58% 42% 54% 46% / 44% 60% 40% 56%; }
    50%  { border-radius: 46% 54% 42% 58% / 60% 44% 56% 40%; }
    75%  { border-radius: 60% 40% 56% 44% / 46% 52% 48% 54%; }
    100% { border-radius: 52% 48% 50% 50% / 50% 54% 46% 50%; }
}
@keyframes helix-nucleus-ruffle {
    0%, 100% { transform: translate(-50%, -50%) scale(1); border-radius: 46% 54% 46% 54%; }
    50% { transform: translate(-50%, -50%) scale(1.05); border-radius: 52% 48% 54% 46%; }
}
@keyframes helix-cell-ripple {
    0%, 100% { transform: scale(1); opacity: 0.35; }
    50% { transform: scale(1.05); opacity: 0.18; }
}
/* Immune cell removed */

@media (max-width: 900px) {
    .helix-cell-scene {
        --cell-size: min(72vw, 300px);
    }
}

/* If a section sets a min-height (e.g., hero), make its columns fill it */
.wp-block-group[style*="min-height"] > .wp-block-columns {
    min-height: inherit;
    align-items: stretch;
}
.wp-block-group[style*="min-height"] > .wp-block-columns > .wp-block-column {
    min-height: inherit;
}

/* Hero-specific overflow to allow helix bleed under header */
.helix-hero,
.helix-hero .wp-block-columns,
.helix-hero .helix-dna-mount-col {
    overflow: visible !important;
}
.helix-hero .helix-dna-mount {
    --helix-bleed: 420px;
}

/* Ensure header stays above helix bleed */
.wp-site-blocks > header {
    position: relative;
    z-index: 4;
}
.wp-site-blocks > main {
    position: relative;
    z-index: 1;
}

/* Subtle grid for non-star background sections */
.wp-block-group.has-background,
.wp-block-cover.has-background {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: center;
}
[data-theme='light'] .wp-block-group.has-background,
[data-theme='light'] .wp-block-cover.has-background {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px);
}

/* Hide the spacer used as a pattern placeholder (JS replaces it with a canvas) */
.helix-dna-mount-col .wp-block-spacer,
.helix-dna-mount   .wp-block-spacer {
    display: none;
}

/* Button hover lift */
.wp-block-button__link {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.wp-block-button__link:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.25), 0 6px 18px rgba(0, 212, 255, 0.18);
}

/* Subtle glow on hover for links */
a {
    transition: text-shadow 0.2s ease, color 0.2s ease;
}
a:hover {
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.35);
}

[data-theme='light'] a:hover {
    text-shadow: 0 0 8px rgba(0, 139, 176, 0.28);
}

/* Hide stars in light theme as a CSS-level safety net */
[data-theme='light'] #helix-stars {
    display: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .helix-dna-canvas,
    #helix-stars {
        display: none !important;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile + tablet header and navigation */
@media (max-width: 1024px) {
    /* Hide DNA elements on smaller screens */
    .helix-dna-mount-col,
    .helix-dna-mount,
    .helix-dna-canvas {
        display: none !important;
    }

    /* Header layout: logo left, menu toggle right */
    .wp-site-blocks > header .wp-block-group.alignwide {
        flex-wrap: nowrap;
        align-items: center;
        gap: var(--wp--preset--spacing--x-small);
    }
    .wp-site-blocks > header .wp-block-group.alignwide > .wp-block-group {
        width: auto;
    }
    .wp-site-blocks > header .wp-block-site-logo {
        width: 30vw;
        max-width: 200px;
        min-width: 120px;
        flex: 0 0 auto;
    }
    .wp-site-blocks > header .wp-block-site-logo img {
        width: 100%;
        height: auto;
    }
    .wp-site-blocks > header .wp-block-group.alignwide > .wp-block-group:last-child {
        margin-left: auto;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--wp--preset--spacing--x-small);
    }
    .wp-site-blocks > header .wp-block-navigation {
        width: auto;
        justify-content: flex-end;
    }

    /* Force hamburger menu on tablet/mobile */
    .wp-block-navigation__responsive-container-open {
        display: flex;
    }
    .wp-block-navigation__container {
        display: none;
    }
    .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: none;
    }

    /* Popup menu alignment */
    .wp-block-navigation__responsive-container.is-menu-open {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
        width: min(90vw, 420px);
        padding: var(--wp--preset--spacing--small);
        border-radius: 16px;
        background: var(--wp--preset--color--surface);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--wp--preset--spacing--x-small);
    }
    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
        width: 100%;
        text-align: center;
    }
}

/* Mobile optimisations */
@media (max-width: 900px) {

    /* Stack DNA sections */
    .wp-block-columns {
        flex-wrap: wrap;
    }
    .wp-block-columns .wp-block-column {
        width: 100%;
        flex-basis: 100%;
    }
    .helix-dna-mount-col {
        min-height: 320px;
    }
    .helix-dna-mount {
        --helix-bleed: 80px;
    }

    /* Footer length */
    footer .wp-block-group.alignfull {
        padding-top: var(--wp--preset--spacing--large) !important;
        padding-bottom: var(--wp--preset--spacing--small) !important;
    }
    footer .wp-block-columns {
        flex-direction: column;
    }
    footer .wp-block-list {
        line-height: 2.0;
    }
}
/* Thin section separators */
.wp-site-blocks > main > .wp-block-group + .wp-block-group {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme='light'] .wp-site-blocks > main > .wp-block-group + .wp-block-group {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
