/* ==========================================================================
   INK ORBIT FEATURES BENTO & SPLIT-FLAP BOARD (BOECK SYSTEMS)
   Obsidian Dark Palette (#050505, #08090d, #0c0d12) + Accent Cyan (#1ad1ce)
   Strict Typography Match: Rajdhani & Cormorant Garamond
   Zero-dependency Vanilla CSS & 3D Split-Flap Animations
   ========================================================================== */

.ib-section {
    padding: clamp(60px, 8vw, 110px) 0;
    background: #050505;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.ib-root {
    --ib-page: #050505;
    --ib-paper: #08090d;
    --ib-card: #0c0d12;
    --ib-raise: #111319;
    --ib-ink: #ffffff;
    --ib-soft: rgba(255, 255, 255, 0.88);
    --ib-muted: rgba(255, 255, 255, 0.72);
    --ib-faint: rgba(255, 255, 255, 0.35);
    --ib-line: rgba(255, 255, 255, 0.08);
    --ib-line-strong: rgba(255, 255, 255, 0.16);
    --ib-bracket: rgba(26, 209, 206, 0.45);
    --ib-bracket-hover: #1ad1ce;
    --ib-cyan: #1ad1ce;
    --ib-cyan-glow: rgba(26, 209, 206, 0.35);
    --ib-inv: #0e1017;
    --ib-inv-ink: #ffffff;
    --ib-inv-border: rgba(26, 209, 206, 0.45);
    --ib-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 50px rgba(26, 209, 206, 0.04);

    /* Typography perfectly unified with boeck systems core style */
    --ib-sans: 'Rajdhani', sans-serif;
    --ib-serif: 'Cormorant Garamond', Georgia, serif;
    --ib-mono: 'Rajdhani', monospace;

    /* Scaled Split-Flap dimensions: 9 slots comfortably fit on 360px mobile screens */
    --sf-tile-w: clamp(26px, 8.4vw, 48px);
    --sf-tile-h: clamp(38px, 11.5vw, 68px);
    --sf-tile-font: clamp(1.45rem, 5vw, 3.2rem);
    --sf-tile-gap: clamp(2.5px, 0.8vw, 8px);

    position: relative;
    width: 100%;
    box-sizing: border-box;
    color: var(--ib-ink);
    font-family: var(--ib-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.ib-root * {
    box-sizing: border-box;
}

.ib-shell {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 480px) {
    .ib-shell {
        padding: 0 12px;
    }
}

/* ==========================================================================
   SPLIT-FLAP RAILWAY CLOCK (SOLARI BOARD) HEADLINE
   Fixed 9-slot board that never resizes or shifts between words.
   ========================================================================== */

.sf-headline-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    margin-bottom: clamp(36px, 5.5vw, 64px);
}

.sf-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ib-cyan);
    background: rgba(26, 209, 206, 0.08);
    border: 1px solid rgba(26, 209, 206, 0.3);
    border-radius: 999px;
    font-family: var(--ib-sans);
}

.sf-lead-text {
    font-family: var(--ib-sans);
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #ffffff;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.15;
}

/* The Mechanical Solari Board - completely fixed container */
.sf-board-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sf-tile-gap);
    padding: clamp(8px, 1.4vw, 16px) clamp(10px, 2vw, 24px);
    background: #08090d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(26, 209, 206, 0.08);
    perspective: 900px;
    max-width: 100%;
}

.sf-tile {
    position: relative;
    width: var(--sf-tile-w);
    height: var(--sf-tile-h);
    font-family: var(--ib-sans);
    font-size: var(--sf-tile-font);
    font-weight: 700;
    perspective: 450px;
    user-select: none;
    transform-style: preserve-3d;
    flex-shrink: 0;
}

/* Mechanical Side Hinges */
.sf-tile::before, .sf-tile::after {
    content: '';
    position: absolute;
    top: calc(50% - 3px);
    width: 3px;
    height: 6px;
    background: #050505;
    z-index: 20;
    border-radius: 1.5px;
}
.sf-tile::before { left: -1.5px; }
.sf-tile::after { right: -1.5px; }

/* Half Cards */
.sf-card {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: #111319;
    color: var(--ib-cyan);
    border: 1px solid rgba(26, 209, 206, 0.35);
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.7);
    backface-visibility: hidden;
    box-sizing: border-box;
}

.sf-card-top {
    top: 0;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid #000;
    transform-origin: bottom center;
}
.sf-card-top .sf-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--sf-tile-h);
    line-height: var(--sf-tile-h);
    text-align: center;
}

.sf-card-bottom {
    top: 50%;
    border-radius: 0 0 6px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transform-origin: top center;
}
.sf-card-bottom .sf-text {
    position: absolute;
    top: calc(-0.5 * var(--sf-tile-h));
    left: 0;
    width: 100%;
    height: var(--sf-tile-h);
    line-height: var(--sf-tile-h);
    text-align: center;
}

/* Base static cards behind the flaps */
.sf-bg-top {
    z-index: 1;
}
.sf-bg-bottom {
    z-index: 1;
}

/* Moving flaps */
.sf-flap-top {
    z-index: 4;
    transform-origin: bottom center;
}
.sf-flap-bottom {
    z-index: 3;
    transform-origin: top center;
    transform: rotateX(90deg);
}

/* Mechanical Seam */
.sf-seam {
    position: absolute;
    top: calc(50% - 1px);
    left: 0;
    width: 100%;
    height: 2px;
    background: #000;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 15;
    pointer-events: none;
}

/* Authentic downward Solari Flip Animation with Rapid Rattle */
.sf-tile.sf-flipping .sf-flap-top {
    animation: sf-fold-top 0.06s ease-in forwards;
}
.sf-tile.sf-flipping .sf-flap-bottom {
    animation: sf-unfold-bottom 0.06s cubic-bezier(0.2, 0.8, 0.3, 1) 0.04s forwards;
}

/* Firm Settle Flap onto final character */
.sf-tile.sf-settling .sf-flap-top {
    animation: sf-fold-top 0.16s ease-in forwards;
}
.sf-tile.sf-settling .sf-flap-bottom {
    animation: sf-unfold-bottom 0.18s cubic-bezier(0.2, 0.8, 0.3, 1) 0.14s forwards;
}

@keyframes sf-fold-top {
    0% { transform: rotateX(0deg); filter: brightness(1); }
    100% { transform: rotateX(-90deg); filter: brightness(0.2); }
}

@keyframes sf-unfold-bottom {
    0% { transform: rotateX(90deg); filter: brightness(0.2); }
    100% { transform: rotateX(0deg); filter: brightness(1); }
}

/* Subline Explaining Benefit */
.sf-subline {
    font-family: var(--ib-sans);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 600;
    color: var(--ib-cyan);
    max-width: 760px;
    margin: 12px auto 0;
    line-height: 1.45;
    transition: opacity 0.22s ease, transform 0.22s ease;
    min-height: 1.8em;
}

/* Intro statement about tailored process */
.sf-intro-desc {
    display: none;
}

/* ==========================================================================
   BENTO GRID LAYOUT & FRAMES
   ========================================================================== */

.ib-bento {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 820px) {
    .ib-bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
    .ib-wide {
        grid-column: 1 / -1;
    }
}

/* Sleek Bento Frame Container */
.ib-frame {
    position: relative;
    padding: 0;
    border-radius: 12px;
    background: transparent;
}

/* Outer Reticle Brackets (Hidden for cleaner modern aesthetic) */
.ib-c {
    display: none;
}

/* Obsidian Card Content */
.ib-card {
    background: #080a10;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: clamp(18px, 2.5vw, 28px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 290px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
    position: relative;
    overflow: hidden;
}

.ib-card:hover {
    border-color: rgba(26, 209, 206, 0.4);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 35px rgba(26, 209, 206, 0.1);
    transform: translateY(-2px);
}

.ib-card h3 {
    font-family: var(--ib-sans);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffffff;
    margin: 0 0 8px;
    line-height: 1.25;
}

.ib-card p {
    font-family: var(--ib-sans);
    font-size: 1.12rem;
    line-height: 1.6;
    font-weight: 500;
    color: var(--ib-muted);
    margin: 0;
}

.ib-crosslink {
    color: var(--ib-cyan);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 700;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.ib-crosslink:hover {
    color: #ffffff;
    text-shadow: 0 0 10px var(--ib-cyan-glow);
}

.ib-diagram {
    width: 100%;
    height: auto;
    overflow: visible;
    display: block;
}

.ib-diagram-desktop {
    display: block;
}

.ib-diagram-mobile {
    display: none;
}

@media (max-width: 640px) {
    .ib-diagram-desktop {
        display: none !important;
    }
    .ib-diagram-mobile {
        display: block !important;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        height: auto;
    }
}

/* Wide Card Flow & Copy */
.ib-wide .ib-card {
    padding: 0;
}

.ib-wide-diagram-wrap {
    padding: 14px 10px 4px;
    position: relative;
    background: radial-gradient(circle at 50% 65%, rgba(26, 209, 206, 0.05) 0%, transparent 60%);
    overflow: visible;
}

.ib-wide-copy {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 22px 28px 26px;
    border-top: 1px solid var(--ib-line);
    background: #08090d;
}

@media (min-width: 640px) {
    .ib-wide-copy {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 639px) {
    .ib-wide-copy {
        gap: 12px;
        padding: 14px 16px 18px;
    }
    .ib-wide-copy h3 {
        font-size: 1.02rem;
        margin-bottom: 4px;
    }
    .ib-wide-copy p {
        font-size: 0.82rem;
        line-height: 1.45;
    }
}

/* Flows & Pulses */
.ib-flow {
    stroke: var(--ib-line-strong);
    fill: none;
    stroke-width: 1.3;
    transition: stroke 0.3s ease;
}

.ib-flow-on {
    stroke: var(--ib-cyan);
}

.ib-dash {
    stroke-dasharray: 3 4;
    animation: ib-dash-move 1.2s linear infinite;
}

.ib-pkt {
    fill: var(--ib-cyan);
    filter: drop-shadow(0 0 6px var(--ib-cyan));
}

.ib-node {
    fill: #0c0d12;
    stroke: var(--ib-line-strong);
    transition: stroke 0.3s ease, transform 0.3s ease;
}

/* Avatars & Inbound Nodes */
.ib-av {
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-box: fill-box;
    transform-origin: center;
}

.ib-av:hover, .ib-av:focus-visible {
    transform: scale(1.18);
}

/* Dedicated Tooltip Layer (Rendered on top of EVERYTHING) */
.ib-av-tip {
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

/* CSS :has() instant triggers */
.ib-diagram:has(#ib-av-0:hover) #ib-tip-0,
.ib-diagram:has(#ib-av-0:focus-visible) #ib-tip-0,
.ib-diagram:has(#ib-av-1:hover) #ib-tip-1,
.ib-diagram:has(#ib-av-1:focus-visible) #ib-tip-1,
.ib-diagram:has(#ib-av-2:hover) #ib-tip-2,
.ib-diagram:has(#ib-av-2:focus-visible) #ib-tip-2,
.ib-diagram:has(#ib-av-3:hover) #ib-tip-3,
.ib-diagram:has(#ib-av-3:focus-visible) #ib-tip-3,
.ib-diagram:has(#ib-av-4:hover) #ib-tip-4,
.ib-diagram:has(#ib-av-4:focus-visible) #ib-tip-4 {
    opacity: 1;
}

.ib-presence {
    animation: ib-pulse-glow 2.2s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

/* Sheets Stack in Report */
.ib-sheet {
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.7s;
}

.ib-sheet-new {
    animation: ib-sheet-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Tools in Integration Card */
.ib-tool {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-box: fill-box;
    transform-origin: center;
}

.ib-tool:hover, .ib-tool-on {
    transform: translateY(-2px);
}

.ib-tool rect {
    transition: stroke 0.3s ease;
}

.ib-tool-on rect.ib-node {
    stroke: var(--ib-cyan);
    filter: drop-shadow(0 0 8px var(--ib-cyan-glow));
}

/* Chart in Insights Card */
.ib-chart {
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
}

.ib-line-draw {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.8s cubic-bezier(0.4, 0.1, 0.2, 1);
}

[data-in="true"] .ib-line-draw,
.ib-root .ib-line-draw {
    stroke-dashoffset: 0;
}

.ib-glow {
    animation: ib-pulse-glow 2s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

/* Keyframes */
@keyframes ib-dash-move {
    to {
        stroke-dashoffset: -14;
    }
}

@keyframes ib-pulse-glow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.45;
        transform: scale(1.35);
    }
}

@keyframes ib-sheet-in {
    from {
        opacity: 0;
        transform: translate(14px, -10px) rotate(4deg);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .ib-dash, .ib-presence, .ib-glow, .ib-sheet-new {
        animation: none;
    }
    .ib-line-draw {
        stroke-dashoffset: 0;
        transition: none;
    }
}
