/*
   CUSTOM FONTS:
   Commented out to prevent loading delays.
   On Tilda, these fonts will theoretically load from the main site.
   If hosting standalone, uncomment dependent on file availability.
*/
/*
@font-face {
    font-family: 'IvyPresto';
    src: url('assets/fonts/IvyPresto Display Thin.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HelveticaNeue';
    src: url('assets/fonts/HelveticaNeue.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
*/

/* Global Reset for Iframe */
html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Prevent internal scrollbar */
    width: 100%;
    height: auto;
}

:root {
    /* Architecture of Meanings - Minimalist Palette */
    --bat-bg-color: #fffbf6;
    /* Off-white background */
    --bat-text-primary: #1A1A1A;
    /* Near black */
    --bat-text-secondary: #666666;
    --bat-line-color: #8C8C8C;
    /* Thin connection lines */

    /* Typography */
    --font-display: "IvyPresto", "Georgia", serif;
    --font-body: "HelveticaNeue", "Helvetica Neue", "Arial", sans-serif;

    /* Spacing */
    --bat-spacing-sm: 10px;
    --bat-spacing-md: 20px;
    --bat-spacing-lg: 50px;

    /* Layout */
    --bat-max-width: 900px;
}

.bat-container {
    /* Reset & Isolation */
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: var(--bat-bg-color);
    color: var(--bat-text-primary);
    width: 100%;
    min-height: 100vh;
    /* Centered layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    /* Reduced vertical padding */
    box-sizing: border-box;
}

.bat-container * {
    box-sizing: border-box;
}

/* Header Sections */
.bat-header-top {
    width: 100%;
    max-width: var(--bat-max-width);
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--bat-text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: var(--bat-spacing-lg);
}

.bat-title-section {
    width: 100%;
    max-width: var(--bat-max-width);
    margin-bottom: 60px;
}

.bat-main-title {
    font-family: var(--font-display);
    /* Serif for title as per image */
    font-size: 3rem;
    line-height: 1;
    font-weight: 400;
}

.bat-main-title span {
    display: block;
}

/* Scales Grid */
.bat-scales-wrapper {
    width: 100%;
    max-width: var(--bat-max-width);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.bat-step-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    /* Center vertical */
    justify-content: center;
    width: 100%;
    min-height: 250px;
    /* Reduced from 400px */
}

/* Larger scale for single step view */
.bat-scale-row.large-scale {
    transform: scale(1.2);
    /* Slightly larger interaction area */
}

@media (max-width: 768px) {
    .bat-main-title {
        font-size: 2rem;
    }

    /* Staggered Layout: Left Label -> Track -> Right Label */
    .bat-scale-row {
        transform: scale(1) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 20px 0 !important;
        height: auto !important;
    }

    /* Reset Positioning */
    .bat-scale-label {
        position: static;
        width: auto;
        padding: 0;
        font-size: 0.85rem;
    }

    .bat-scale-label.left {
        text-align: left !important;
        align-self: flex-start;
        margin-left: 5px;
    }

    .bat-scale-label.right {
        text-align: right !important;
        align-self: flex-end;
        margin-right: 5px;
    }

    .bat-scale-track {
        width: 90% !important;
        /* Leave space from sides */
        margin: 10px auto !important;
        /* Center and add vertical space */
    }

    .bat-point {
        width: 28px;
        height: 28px;
    }
}

/* Scale Component */
.bat-scale-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.bat-scale-label {
    width: 150px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.bat-scale-label.left {
    text-align: right;
    padding-right: 20px;
}

.bat-scale-label.right {
    text-align: left;
    padding-left: 20px;
}

.bat-scale-track {
    flex-grow: 1;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Connection Line */
.bat-track-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--bat-text-primary);
    transform: translateY(-50%);
    z-index: 0;
}

/* Circle Points */
.bat-point {
    width: 32px;
    /* Larger circles */
    height: 32px;
    border-radius: 50%;
    background: var(--bat-bg-color);
    /* Match bg to hide line behind */
    border: 1px solid var(--bat-text-primary);
    cursor: pointer;
    z-index: 1;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.bat-point:hover {
    border-color: #FF4500;
}

.bat-point.active {
    background: #FF4500;
    /* Solid Orange-Red */
    border-color: #FF4500;
    box-shadow: none;
    transform: scale(1.1);
}

/* Submit Button */
.bat-btn {
    margin-top: 60px;
    background: transparent;
    border: 1px solid var(--bat-text-primary);
    color: var(--bat-text-primary);
    padding: 15px 40px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s;
}

.bat-btn:hover {
    background: var(--bat-text-primary);
    color: var(--bat-bg-color);
}

.bat-btn:disabled {
    border-color: #ccc;
    color: #ccc;
    cursor: not-allowed;
    background: transparent;
}

/* Footer */
.bat-footer {
    width: 100%;
    max-width: var(--bat-max-width);
    margin-top: 80px;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--bat-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Result View */
.bat-result-view {
    width: 100%;
    max-width: var(--bat-max-width);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.bat-narrative {
    margin-top: 40px;
    padding: 30px;
    border: 1px solid var(--bat-text-primary);
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Result View Components */
.bat-section {
    margin-bottom: 30px;
    text-align: left;
    width: 100%;
}

.bat-section-title {
    font-family: 'HelveticaNeue', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bat-text-secondary);
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.bat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bat-tag {
    background: #fff;
    border: 1px solid var(--bat-line-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.bat-insight-box {
    background: #fff;
    border-left: 4px solid #FF4500;
    padding: 20px;
    margin: 30px 0;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Loader - Scaling Orange Circle */
.bat-loader {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FF4500;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: pulseScale 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.bat-loader::after {
    display: none;
}

@keyframes pulseScale {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ===== REFERENCE-MATCHING UI DESIGN ===== */

/* Result Card Container */
.bat-result-card {
    width: 100%;
    max-width: var(--bat-max-width);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    padding: 30px 40px 50px;
    margin-bottom: 40px;
}

/* Result Header - Breadcrumb Style */
.bat-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 0;
}

.bat-breadcrumb {
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bat-text-secondary);
}

.bat-breadcrumb-arrow {
    margin-left: 5px;
    color: #999;
}

.bat-result-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bat-refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--bat-text-secondary);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bat-refresh-btn:hover {
    color: var(--bat-text-primary);
}

.bat-result-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--bat-text-primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
}

/* Result Image - Clean Wide Layout */
.bat-result-image {
    width: 100%;
    margin-bottom: 35px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bat-result-image::before {
    display: none;
}

.bat-result-image img {
    width: 100%;
    height: auto;
    display: block;
}

.bat-result-image:hover img {
    transform: none;
}

/* Result Title & Summary */
.bat-result-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--bat-text-primary);
    margin: 0 0 15px 0;
}

.bat-result-summary {
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--bat-text-secondary);
    margin: 0 0 40px 0;
}

/* Clean Section Styling - Minimal */
.bat-section {
    margin-bottom: 30px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border-left: none;
    transition: none;
}

.bat-section:hover {
    transform: none;
    box-shadow: none;
}

.bat-section-title {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--bat-text-secondary);
    margin-bottom: 12px;
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 500;
}

.bat-section p {
    font-family: 'Georgia', serif;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--bat-text-primary);
    margin: 0;
}

/* Insight Box - Subtle */
.bat-insight-box {
    background: #fafafa;
    border-left: 3px solid var(--bat-text-primary);
    padding: 20px 25px;
    margin: 40px 0;
    border-radius: 0;
    box-shadow: none;
    font-family: 'Georgia', serif;
    font-size: 1rem;
    line-height: 1.6;
    font-style: normal;
}

.bat-insight-box strong {
    display: inline;
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bat-text-secondary);
    margin-right: 10px;
}

/* Scales Summary Section */
.bat-scales-summary {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

/* Result Footer */
.bat-result-footer {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    color: var(--bat-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bat-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
}

.bat-category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 100px;
}

.bat-category-btn:hover {
    border-color: var(--bat-text-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.bat-category-btn.active {
    border-color: var(--bat-text-primary);
    background: var(--bat-text-primary);
    color: #fff;
}

.bat-category-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.bat-category-name {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .bat-result-card {
        padding: 20px;
        border-radius: 0;
        box-shadow: none;
    }

    .bat-result-title {
        font-size: 1.6rem;
    }

    .bat-section {
        margin-bottom: 25px;
    }

    .bat-insight-box {
        padding: 15px 20px;
        margin: 30px 0;
    }

    .bat-result-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .bat-result-label {
        font-size: 0.65rem;
        padding: 6px 12px;
    }

    /* Category grid on mobile - 2 columns */
    .bat-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .bat-category-btn {
        padding: 15px 8px;
        min-height: 80px;
    }

    .bat-category-icon {
        font-size: 1.5rem;
    }

    .bat-category-name {
        font-size: 0.65rem;
    }
}

/* ===== STAGGERED RESULTS FLOW ===== */

/* Hero Image Section */
.bat-result-hero {
    width: 100%;
    max-width: 700px;
    margin: 0 auto 40px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.bat-result-hero img {
    width: 100%;
    height: auto;
    display: block;
}

/* Archetype Title Section */
.bat-archetype-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 60px;
}

.bat-archetype-title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--bat-text-primary);
    margin: 0 0 15px;
}

.bat-archetype-tagline {
    font-family: 'Georgia', serif;
    font-size: 1.15rem;
    color: var(--bat-text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Staggered Flow Container */
.bat-results-flow {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 0;
}

/* Dashed line removed - using SVG zigzag instead */
.bat-results-flow::before {
    display: none;
}

/* Staggered Flow - no connecting line */

/* Flow Card Base */
.bat-flow-card {
    position: relative;
    width: 45%;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 50px;
    transition: all 0.3s ease;
}

/* Card Positions with rotation - pivot around orange circle */
.bat-flow-card--left {
    margin-left: 5%;
    margin-right: auto;
    transform: rotate(-3deg);
    transform-origin: top right;
}

.bat-flow-card--right {
    margin-left: auto;
    margin-right: 5%;
    transform: rotate(3deg);
    transform-origin: top left;
}

/* Hover - straighten and lift */
.bat-flow-card:hover {
    transform: rotate(0deg) translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Card Color Variants */
.bat-flow-card--coral {
    background: #FFF0E8;
}

.bat-flow-card--blue {
    background: #E8F4FA;
}

.bat-flow-card--lavender {
    background: #F3EEFF;
}

/* Orange Circle - at top corner (same size as bipolar dots: 32px) */
.bat-flow-pin {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FF4500;
    top: -16px;
    z-index: 10;
}

/* Pin position - top-right for left cards */
.bat-flow-card--left .bat-flow-pin {
    right: -16px;
}

/* Pin position - top-left for right cards */
.bat-flow-card--right .bat-flow-pin {
    left: -16px;
}

/* Hide numbers inside cards */
.bat-flow-number {
    display: none;
}

/* Card Heading */
.bat-flow-heading {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bat-text-primary);
    margin: 0 0 12px;
}

/* Card Content */
.bat-flow-content {
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--bat-text-secondary);
    margin: 0;
}

/* Scales Summary in Flow Layout */
.bat-flow-scales {
    width: 100%;
    max-width: 700px;
    margin: 60px auto 0;
    padding-top: 40px;
    border-top: 1px solid #eee;
}

.bat-flow-scales-title {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--bat-text-secondary);
    margin-bottom: 30px;
    text-align: center;
}

/* Reset Button in Flow */
.bat-flow-footer {
    display: flex;
    justify-content: center;
    margin-top: 50px;
}

/* ===== MOBILE RESPONSIVE - STAGGERED FLOW ===== */
@media (max-width: 768px) {
    .bat-result-hero {
        border-radius: 12px;
        margin-bottom: 30px;
    }

    .bat-archetype-header {
        margin-bottom: 40px;
        padding: 0 15px;
    }

    .bat-archetype-title {
        font-size: 1.8rem;
    }

    .bat-archetype-tagline {
        font-size: 1rem;
    }

    /* Hide dashed line on mobile */
    .bat-results-flow::before {
        display: none;
    }

    .bat-results-flow {
        padding: 20px 15px;
    }

    /* Stack cards vertically, full width */
    .bat-flow-card {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 20px;
        transform: none !important;
        padding: 20px;
    }

    .bat-flow-card:hover {
        transform: none;
    }

    /* Pin on top-right for all cards on mobile */
    .bat-flow-pin {
        right: 20px !important;
        left: auto !important;
    }

    .bat-flow-heading {
        font-size: 0.9rem;
    }

    .bat-flow-content {
        font-size: 0.9rem;
    }

    .bat-flow-scales {
        margin-top: 40px;
        padding: 20px 0 0;
    }
}

/* Palette Grid */
.bat-palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.bat-swatch-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
    padding: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.bat-swatch-color {
    width: 100%;
    height: 60px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.bat-swatch-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bat-swatch-hex {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--bat-text-primary);
    text-transform: uppercase;
}

.bat-swatch-role {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--bat-text-secondary);
    line-height: 1.2;
}

/* Ensure narrative cards can handle custom content */
.bat-flow-card .bat-palette-grid {
    margin-bottom: 0;
}