/* ============================================================
   Intercomm Tabbed Forms — Front-end styles
   Magnetic sliding background ("pill") that follows the pointer
   between tab buttons and lands behind the active one when idle.
   Panels slide left/right when switching tabs.
   ============================================================ */

.intercomm-tf {
    --itf-bar-bg: #F2F2F2;
    --itf-tab-color: #111111;
    --itf-tab-color-hover: #ffffff;
    --itf-tab-color-active: #ffffff;
    --itf-tab-bg-active: #111111;
    --itf-radius: 60px;
    --itf-ease: cubic-bezier(.4, 0, .2, 1);
    --itf-slide-dur: .45s;
    --itf-panel-slide-dur: .5s;
    --itf-panel-slide-distance: 60px;
    width: 100%;
    box-sizing: border-box;
}

.intercomm-tf *,
.intercomm-tf *::before,
.intercomm-tf *::after {
    box-sizing: border-box;
}

/* -----------------------------------------------------------
   Tabs bar
   ----------------------------------------------------------- */
.intercomm-tf__bar {
    display: flex;
    justify-content: center;
    width: 100%;
}

.intercomm-tf__bar-inner {
    position: relative;          /* anchor for the absolute slider */
    display: inline-flex;
    align-items: stretch;
    background-color: var(--itf-bar-bg);
    border-radius: var(--itf-radius);
    padding: 6px;
    max-width: 100%;
}

/* -----------------------------------------------------------
   The magnetic slider — a single absolute pill that the JS
   moves between tabs by setting transform/width/height.
   ----------------------------------------------------------- */
.intercomm-tf__slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    background-color: var(--itf-tab-bg-active);
    border-radius: var(--itf-radius);
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition:
        transform   var(--itf-slide-dur) var(--itf-ease),
        width       var(--itf-slide-dur) var(--itf-ease),
        height      var(--itf-slide-dur) var(--itf-ease),
        opacity     .2s ease;
    will-change: transform, width, height;
    z-index: 0;
}

.intercomm-tf__slider.is-ready {
    opacity: 1;
}

/* -----------------------------------------------------------
   Tab button
   ----------------------------------------------------------- */
.intercomm-tf__tab {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--itf-tab-color);
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    border-radius: var(--itf-radius);
    transition: color .35s var(--itf-ease);
    outline: none;
    flex: 0 0 auto;
}

.intercomm-tf__tab.is-hot {
    color: var(--itf-tab-color-hover);
}
.intercomm-tf__tab.is-active.is-hot {
    color: var(--itf-tab-color-active);
}

.intercomm-tf__tab:focus-visible {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--itf-tab-bg-active);
}

/* -----------------------------------------------------------
   No-JS / pre-init fallback
   ----------------------------------------------------------- */
.intercomm-tf:not(.intercomm-tf--js) .intercomm-tf__tab.is-active {
    background-color: var(--itf-tab-bg-active);
    color: var(--itf-tab-color-active);
}

/* -----------------------------------------------------------
   Panels — all panels share the same grid cell so they
   stack on top of each other. Only the .is-active panel
   is visible/interactive; others sit in the same spot
   waiting to slide in.
   ----------------------------------------------------------- */
.intercomm-tf__panels {
    display: grid;
    grid-template-columns: 1fr;
    position: relative;
    overflow: hidden;            /* mask off-screen slide */
}

.intercomm-tf__panel {
    grid-row: 1;
    grid-column: 1;
    padding-top: 40px;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
    transition:
        transform var(--itf-panel-slide-dur) var(--itf-ease),
        opacity   .35s                      var(--itf-ease);
    will-change: transform, opacity;
    min-width: 0;                /* allow content to shrink in grid cell */
}

.intercomm-tf__panel.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;                  /* sit above the leaving panel */
}

.intercomm-tf__heading {
    margin: 0 0 24px 0;
    font-size: 32px;
    line-height: 1.2;
    color: var(--itf-tab-color);
}

.intercomm-tf__empty {
    color: #888;
    font-style: italic;
}

/* -----------------------------------------------------------
   Responsive
   ----------------------------------------------------------- */
@media (max-width: 1024px) {
    .intercomm-tf__tab {
        padding: 12px 22px;
        font-size: 13px;
    }
    .intercomm-tf__heading {
        font-size: 28px;
    }
}

/* Below 768px → stack the three buttons vertically, full width.
   The magnetic slider still works — it slides up/down instead
   of left/right. Panels still slide horizontally. */
@media (max-width: 767px) {
    .intercomm-tf__bar {
        justify-content: stretch;
    }
    .intercomm-tf__bar-inner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        padding: 6px;
        border-radius: 24px;
        gap: 4px;
    }
    .intercomm-tf__tab {
        width: 100%;
        padding: 14px 18px;
        font-size: 13px;
        letter-spacing: 0.04em;
        white-space: normal;
        text-align: center;
    }
    .intercomm-tf__slider {
        border-radius: 18px;
    }
    .intercomm-tf__panel {
        padding-top: 28px;
    }
    .intercomm-tf__heading {
        font-size: 24px;
        margin-bottom: 18px;
    }
}

/* -----------------------------------------------------------
   Reduced-motion users — kill all transitions so panel
   switches happen instantly without sliding.
   ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .intercomm-tf__tab,
    .intercomm-tf__slider,
    .intercomm-tf__panel {
        transition: none !important;
        animation: none !important;
    }
}
