/* ======================================================================
   TMI ERP - HOME PAGE  (tmi-index.css)
   Consolidated v2.2 - 25 Sep 2026 (one-view fit)

   This file replaces the old stack of "FINAL / FINAL FIX / CONSOLIDATED"
   override layers. Each component is now defined once.

   Sections
     0. Tokens + page
     1. Shared header (layout navbar) overrides
     2. Hero carousel  (image-driven height, never cropped)
     3. Carousel extras injected by tmi-index.js (arrows, clock, progress)
     4. Useful Links grid
     5. Footer
     6. JS enhancements (scroll bar, pins, dock, toasts, palette, ripple)
     7. Accessibility + reduced motion
     8. One-view fit (whole page visible without scrolling)
   ====================================================================== */


/* ==========================================================
   0. TOKENS + PAGE
   ========================================================== */

:root {
    --navy: #0b3d63;
    --navy-dark: #062b47;
    --navy-deep: #041d31;
    --blue: #1f6f8b;
    --gold: #d9a441;
    --gold-light: #f2c35a;
    --text: #1f2937;
    --muted: #64748b;
    --line: #dde6ed;
    --surface: #ffffff;
    --page-bg: #edf3f7;
    --ease: cubic-bezier(.22, .8, .24, 1);
    /* legacy names still used by tmi-index.js injected markup */
    --tmi-surface: #ffffff;
    --tmi-text: #1f2937;
    --tmi-muted: #64748b;
    --tmi-line: #dde6ed;
    --tmi-hover: #eef5f9;
    --tmi-accent: #0b4f73;
    --tmi-ease: cubic-bezier(.22, .8, .24, 1);
    /* carousel frame */
    --frame-gap: clamp(6px, .9vw, 14px);
    --frame-width: 3px;
    --frame-radius: 14px;
}

/* Shared ERP footer is hidden on the home page only */
body .main-footer {
    display: none !important;
}

body {
    margin: 0 !important;
    background: var(--page-bg) !important;
}

html {
    scroll-padding-top: calc(var(--tmi-header-offset, 0px) + 10px);
}

.tmi-react-home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 4% 3%, rgba(31,111,139,.10), transparent 22%), radial-gradient(circle at 94% 6%, rgba(217,164,65,.06), transparent 18%), linear-gradient(180deg, #edf4f8 0%, #f6f9fb 48%, #edf3f7 100%);
    overflow-x: hidden;
}

    .tmi-react-home *,
    .tmi-react-home *::before,
    .tmi-react-home *::after {
        box-sizing: border-box;
    }

    .tmi-react-home a {
        text-decoration: none !important;
    }

.tmi-container {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: clamp(10px, 1.4vw, 26px) !important;
    padding-right: clamp(10px, 1.4vw, 26px) !important;
}


/* ==========================================================
   1. SHARED HEADER (layout navbar) OVERRIDES
   ========================================================== */

header,
#header,
.tmi-navbar {
    background: linear-gradient(118deg, #041d31 0%, #073b5b 50%, #0b5478 100%) !important;
    box-shadow: 0 10px 30px rgba(3,28,47,.18);
}

    header .container.d-flex.align-items-center,
    #header .container.d-flex.align-items-center {
        width: 100% !important;
        max-width: none !important;
        min-height: 68px !important;
        padding-top: 7px !important;
        padding-bottom: 7px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0 !important;
    }

        header .container.d-flex.align-items-center > a.logo.me-auto,
        #header .container.d-flex.align-items-center > a.logo.me-auto {
            flex: 0 0 auto !important;
            margin: 0 12px 0 0 !important;
            padding: 0 !important;
            display: flex !important;
            align-items: center !important;
        }

        header .container.d-flex.align-items-center > h6.logo.me-auto,
        #header .container.d-flex.align-items-center > h6.logo.me-auto {
            flex: 0 0 auto !important;
            margin: 0 auto 0 0 !important;
            padding: 0 !important;
            display: flex !important;
            align-items: center !important;
            line-height: 1 !important;
            text-align: left !important;
        }

        header .container.d-flex.align-items-center > nav,
        #header .container.d-flex.align-items-center > nav {
            margin-left: auto !important;
            flex: 0 0 auto !important;
        }

/* Brand text: always white */
html body header h6.logo > a,
html body #header h6.logo > a,
html body header .logo > a,
html body #header .logo > a,
html body .tmi-header-brand,
html body .tmi-brand-title,
html body header h6.logo > a:link,
html body header h6.logo > a:visited,
html body header h6.logo > a:hover,
html body header h6.logo > a:focus,
html body header h6.logo > a:active,
html body #header h6.logo > a:link,
html body #header h6.logo > a:visited,
html body #header h6.logo > a:hover,
html body #header h6.logo > a:focus,
html body #header h6.logo > a:active {
    margin: 0 !important;
    padding: 0 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 800 !important;
    white-space: nowrap;
    opacity: 1 !important;
    text-decoration: none !important;
}

@media (max-width: 576px) {
    header .container.d-flex.align-items-center > a.logo.me-auto,
    #header .container.d-flex.align-items-center > a.logo.me-auto {
        margin-right: 8px !important;
    }

    html body header h6.logo > a,
    html body #header h6.logo > a {
        font-size: 15px !important;
    }
}


/* ==========================================================
   2. HERO CAROUSEL
   ----------------------------------------------------------
   Artwork is 3:1 at every size (wide 2172x724, mid 1440x480,
   phone 960x320). The ACTIVE slide stays in normal flow and its
   <img> uses width:100% + height:auto, so the image itself sets
   the carousel height. No fixed height, no object-fit:cover,
   therefore the logo and the Attitude / Skill / Knowledge row
   are never cut off on any screen.
   ========================================================== */

.tmi-hero,
.tmi-hero-container,
.tmi-hero-inner {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: visible !important;
}

.tmi-hero-inner {
    display: block !important;
}

/* The frame: one clean gold border, one radius, one shadow */
.tmi-hero .hero-visual-column {
    position: relative !important;
    display: block !important;
    width: calc(100% - (var(--frame-gap) * 2)) !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: var(--frame-gap) auto 0 !important;
    padding: 0 !important;
    border: var(--frame-width) solid var(--gold) !important;
    border-radius: var(--frame-radius) !important;
    background: var(--navy-dark) !important;
    box-shadow: 0 10px 26px rgba(4, 34, 55, .20), 0 2px 6px rgba(4, 34, 55, .14), inset 0 0 0 1px rgba(255, 255, 255, .35) !important;
    overflow: hidden !important;
    isolation: isolate;
    touch-action: pan-y;
    flex: none !important;
}

    .tmi-hero .hero-visual-column:focus-visible {
        outline: 3px solid rgba(242, 195, 90, .72);
        outline-offset: 2px;
    }

/* Slide stack - RELATIVE so the active slide gives the height */
.tmi-hero .hero-backgrounds {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    /* reserves the exact 3:1 space before the first image loads */
    aspect-ratio: 3 / 1;
}

/* Inactive slides sit on top of the active one, invisible */
.tmi-hero .hero-background {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    visibility: hidden;
    z-index: 1;
    transform: none !important;
    transition: opacity .8s ease, visibility .8s ease;
}

    .tmi-hero .hero-background.active {
        position: relative !important;
        inset: auto !important;
        height: auto !important;
        opacity: 1;
        visibility: visible;
        z-index: 2;
    }

    .tmi-hero .hero-background picture {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
    }

    .tmi-hero .hero-background.active picture {
        height: auto !important;
    }

    /* The image: natural 3:1 shape, full width, nothing trimmed */
    .tmi-hero .hero-background img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        object-fit: contain !important;
        object-position: center !important;
        transform: none !important;
        filter: none !important;
        box-shadow: none !important;
    }

    /* inactive slides fill the same 3:1 box while fading */
    .tmi-hero .hero-background:not(.active) img {
        height: 100% !important;
    }

.tmi-hero .hero-overlay {
    position: absolute !important;
    inset: 0 !important;
    z-index: 3 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
}

.hero-pattern,
.hero-orb {
    display: none !important;
}

/* Dots: centred in the navy band at the bottom of every slide */
.tmi-hero .hero-dots {
    position: absolute;
    left: 50%;
    bottom: clamp(6px, 1.4vw, 16px);
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(3,26,43,.30);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform: translateX(-50%);
}

.tmi-hero .hero-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.65);
    border-radius: 20px;
    background: rgba(255,255,255,.60);
    cursor: pointer;
    transition: width .22s ease, background .22s ease, border-color .22s ease;
}

    .tmi-hero .hero-dot.active {
        width: 27px;
        border-color: var(--gold-light);
        background: var(--gold-light);
    }

/* Large displays: slightly heavier frame */
@media (min-width: 1600px) {
    :root {
        --frame-width: 4px;
        --frame-radius: 18px;
    }
}

/* Phones: lighter frame, smaller dots */
@media (max-width: 576px) {
    :root {
        --frame-gap: 6px;
        --frame-width: 2px;
        --frame-radius: 10px;
    }

    .tmi-hero .hero-dots {
        gap: 5px;
        padding: 3px 6px;
    }

    .tmi-hero .hero-dot {
        width: 6px;
        height: 6px;
    }

        .tmi-hero .hero-dot.active {
            width: 18px;
        }
}


/* ==========================================================
   3. CAROUSEL EXTRAS (injected by tmi-index.js)
   ========================================================== */

/* Clock chip: top-left corner, desktop only */
.tmi-clock {
    position: absolute;
    top: 12px;
    left: 14px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    color: #fff;
    background: rgba(3,26,43,.42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 10.5px;
    line-height: 1;
    pointer-events: none;
}

    .tmi-clock i {
        color: var(--gold-light);
    }

    .tmi-clock b {
        font-weight: 700;
    }

    .tmi-clock span {
        color: rgba(255,255,255,.78);
        font-weight: 500;
    }

/* Prev / next arrows: vertically centred, shown on hover */
.tmi-hero-arrow {
    position: absolute;
    top: 50%;
    z-index: 6;
    width: 38px;
    height: 38px;
    margin-top: -19px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 50%;
    color: #fff;
    background: rgba(3,26,43,.40);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity .2s ease, background .2s ease, transform .2s var(--ease);
}

.tmi-hero-prev {
    left: 14px;
}

.tmi-hero-next {
    right: 14px;
}

.hero-visual-column:hover .tmi-hero-arrow,
.hero-visual-column:focus-within .tmi-hero-arrow {
    opacity: 1;
}

.tmi-hero-arrow:hover {
    color: var(--navy-dark);
    background: rgba(242,195,90,.92);
    transform: scale(1.06);
}

/* Auto-play progress line along the bottom edge */
.tmi-hero-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    height: 3px;
    overflow: hidden;
    pointer-events: none;
    background: rgba(255,255,255,.12);
}

    .tmi-hero-progress span {
        display: block;
        height: 100%;
        transform-origin: 0 50%;
        transform: scaleX(0);
        background: linear-gradient(90deg, var(--gold-light), #fff3d0);
    }

    .tmi-hero-progress.run span {
        animation: tmiProgress 6s linear forwards;
    }

@keyframes tmiProgress {
    to {
        transform: scaleX(1);
    }
}

@media (hover: none), (max-width: 992px) {
    .tmi-hero-arrow,
    .tmi-clock {
        display: none !important;
    }
}


/* ==========================================================
   4. USEFUL LINKS
   ========================================================== */

.portal-section {
    margin: 10px var(--frame-gap) 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(11,61,99,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.95);
    box-shadow: 0 8px 24px rgba(7,45,73,.07);
    overflow: hidden;
}

    .portal-section > .tmi-container {
        padding: 0 !important;
    }

.section-header {
    margin: 0 !important;
    padding: 8px 14px !important;
    text-align: center;
    border-bottom: 2px solid var(--gold);
    background: linear-gradient(110deg, rgba(4,29,49,.985), rgba(8,65,95,.97));
}

.section-title {
    margin: 0 !important;
    color: #ffffff !important;
    font-family: 'Poppins', sans-serif;
    font-size: 15px !important;
    line-height: 1.2 !important;
    font-weight: 700;
    letter-spacing: .2px;
}

.section-overline,
.section-description {
    display: none !important;
}

.quick-access-rail {
    padding: 12px !important;
    background: #ffffff;
}

.quick-access-viewport {
    width: 100%;
    overflow: visible;
    padding: 2px;
}

/* Responsive grid: every link visible, no horizontal scrolling */
.portal-grid {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.portal-card {
    position: relative;
    isolation: isolate;
    min-width: 0;
    min-height: 108px;
    padding: 14px 9px 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e8ee;
    border-radius: 11px;
    color: var(--text);
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: 0 4px 12px rgba(15,45,70,.055);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

    .portal-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 2;
        height: 3px;
        background: var(--portal-color);
    }

    .portal-card::after {
        content: "";
        position: absolute;
        z-index: -1;
        width: 90px;
        height: 90px;
        right: -50px;
        bottom: -55px;
        border-radius: 50%;
        background: color-mix(in srgb, var(--portal-color) 8%, transparent);
    }

    .portal-card:hover {
        transform: translateY(-3px);
        border-color: color-mix(in srgb, var(--portal-color) 25%, #cbd8e0);
        box-shadow: 0 10px 22px rgba(15,45,70,.10);
    }

.portal-icon {
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    background: var(--portal-color);
    box-shadow: 0 5px 12px rgba(15,45,70,.12);
    font-size: 15px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.portal-card:hover .portal-icon {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 8px 18px rgba(15,45,70,.18);
}

.portal-name {
    position: relative;
    z-index: 1;
    color: var(--text);
    font-size: 10.5px;
    line-height: 1.2;
    font-weight: 800;
    text-align: center;
}

.portal-caption {
    position: relative;
    z-index: 1;
    margin-top: 3px;
    color: var(--muted);
    font-size: 8.5px;
    line-height: 1.25;
    text-align: center;
}

.portal-external {
    position: absolute;
    top: 9px;
    right: 9px;
    color: #a8b7c1;
    font-size: 7.5px;
    transition: transform .18s ease, color .18s ease;
}

.portal-card:hover .portal-external {
    color: var(--portal-color);
    transform: translate(2px, -2px);
}

/* cursor-follow glow injected by JS */
.portal-card .tmi-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    background: radial-gradient(110px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--portal-color) 16%, transparent), transparent 72%);
}

.portal-card:hover .tmi-glow {
    opacity: 1;
}

/* filter / search / pin visibility (must win over everything) */
#quickLinks .portal-grid > .portal-card.portal-card-hidden,
#quickLinks .portal-grid > .portal-card.tmi-not-pinned {
    display: none !important;
}

.portal-card.is-pinned {
    order: -1;
}

/* old row-view controls are no longer rendered */
.quick-access-scroll-button,
#quickLinks .tmi-view-toggle,
#quickLinks .portal-filters .tmi-badge {
    display: none !important;
}

@media (max-width: 576px) {
    .quick-access-rail {
        padding: 8px !important;
    }

    .portal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .portal-card {
        min-height: 100px;
    }
}


/* ==========================================================
   5. FOOTER  (pinned to the bottom on short pages)
   ========================================================== */

.tmi-home-footer {
    position: relative;
    width: 100%;
    margin: auto 0 0 !important;
    padding: 0 !important;
    border-top: 3px solid var(--gold);
    color: rgba(255,255,255,.92);
    background: linear-gradient(118deg, #041d31 0%, #073653 48%, #0b4d70 100%);
    box-shadow: 0 -4px 14px rgba(4,29,49,.15);
}

/* keeps a gap between the links panel and the footer */
.tmi-react-home > .portal-section {
    margin-bottom: 12px !important;
}

.tmi-home-footer .tmi-container {
    padding-left: clamp(14px, 2.1vw, 34px) !important;
    padding-right: clamp(14px, 2.1vw, 34px) !important;
}

.tmi-home-footer-inner {
    min-height: 52px;
    padding: 9px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.tmi-footer-copyright {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.88);
    font-size: clamp(10px, .75vw, 12px);
    line-height: 1.45;
}

    .tmi-footer-copyright i {
        flex: 0 0 auto;
        color: var(--gold-light);
        font-size: clamp(12px, .9vw, 15px);
    }

    .tmi-footer-copyright strong {
        color: #ffffff;
        font-weight: 700;
    }

.tmi-footer-version {
    min-height: 30px;
    padding: 5px 11px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 9px;
    color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.08);
    font-size: clamp(9px, .68vw, 10.5px);
    white-space: nowrap;
}

    .tmi-footer-version i,
    .tmi-footer-version strong {
        color: var(--gold-light);
    }

@media (max-width: 576px) {
    .tmi-home-footer {
        border-top-width: 2px;
    }

    .tmi-home-footer-inner {
        padding: 11px 0 10px;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
        text-align: center;
    }

    .tmi-footer-copyright {
        justify-content: center;
        align-items: flex-start;
        font-size: 9.5px;
    }

        .tmi-footer-copyright i {
            margin-top: 2px;
            font-size: 11px;
        }

    .tmi-footer-version {
        min-height: 26px;
        padding: 4px 9px;
        font-size: 9px;
    }
}


/* ==========================================================
   6. JS ENHANCEMENTS (markup injected by tmi-index.js)
   ========================================================== */

/* ---- scroll progress bar ---- */
.tmi-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    height: 3px;
    pointer-events: none;
}

    .tmi-scroll-progress span {
        display: block;
        height: 100%;
        transform-origin: 0 50%;
        transform: scaleX(0);
        background: linear-gradient(90deg, #f2c35a, #d9a441, #3a93ae);
    }

/* ---- pin button on cards ---- */
.tmi-pin {
    position: absolute;
    top: 5px;
    left: 6px;
    z-index: 3;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #a8b7c1;
    font-size: 8.5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .16s ease, color .16s ease, transform .16s ease, background .16s ease;
}

    .portal-card:hover .tmi-pin,
    .tmi-pin:focus-visible,
    .portal-card.is-pinned .tmi-pin {
        opacity: 1;
    }

    .tmi-pin:hover {
        color: var(--gold);
        background: rgba(217,164,65,.14);
        transform: scale(1.12);
    }

.portal-card.is-pinned .tmi-pin {
    color: var(--gold);
}

.tmi-count {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 8.5px;
    font-weight: 600;
    white-space: nowrap;
}

.tmi-kbd {
    flex: 0 0 auto;
    padding: 3px 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: #547c94;
    background: #f3f7fa;
    font: 700 8.5px/1 'Inter', sans-serif;
}

/* ---- floating dock ---- */
.tmi-dock {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .tmi-dock button {
        position: relative;
        width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 13px;
        color: var(--tmi-accent);
        background: var(--surface);
        box-shadow: 0 8px 22px rgba(5,39,64,.18);
        cursor: pointer;
        font-size: 14px;
        transition: transform .18s var(--ease), background .18s ease, color .18s ease, opacity .18s ease;
    }

        .tmi-dock button:hover {
            color: #fff;
            background: linear-gradient(135deg, #073a5d, #146e91);
        }

        .tmi-dock button::after {
            content: attr(data-tip);
            position: absolute;
            right: calc(100% + 10px);
            top: 50%;
            padding: 6px 10px;
            border-radius: 8px;
            color: #fff;
            background: var(--navy-dark);
            font: 600 10.5px/1 'Inter', sans-serif;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transform: translateY(-50%) translateX(4px);
            transition: opacity .16s ease, transform .16s ease;
        }

        .tmi-dock button:hover::after,
        .tmi-dock button:focus-visible::after {
            opacity: 1;
            transform: translateY(-50%);
        }

    .tmi-dock .tmi-top {
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px);
    }

        .tmi-dock .tmi-top.show {
            opacity: 1;
            pointer-events: auto;
            transform: none;
        }

@media (max-width: 576px) {
    .tmi-dock {
        right: 10px;
        bottom: 10px;
    }

        .tmi-dock button {
            width: 38px;
            height: 38px;
        }

            .tmi-dock button::after {
                display: none;
            }
}

/* ---- toasts ---- */
.tmi-toasts {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 2500;
    max-width: min(360px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.tmi-toast {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--blue);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(5,39,64,.20);
    font: 600 11px/1.35 'Inter', sans-serif;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .22s ease, transform .22s var(--ease);
}

    .tmi-toast.in {
        opacity: 1;
        transform: none;
    }

    .tmi-toast i {
        color: var(--blue);
    }

.tmi-toast-success {
    border-left-color: #16a34a;
}

    .tmi-toast-success i {
        color: #16a34a;
    }

.tmi-toast-warn {
    border-left-color: var(--gold);
}

    .tmi-toast-warn i {
        color: var(--gold);
    }

/* ---- command palette (Ctrl/Cmd + K) ---- */
html.tmi-lock,
html.tmi-lock body {
    overflow: hidden;
}

.tmi-palette {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 14px 0;
    background: rgba(4,29,49,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: tmiFade .16s ease;
}

    .tmi-palette[hidden] {
        display: none;
    }

@keyframes tmiFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes tmiPop {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.985);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.tmi-palette-panel {
    width: min(640px, 100%);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 30px 80px rgba(2,24,41,.38);
    animation: tmiPop .2s var(--ease);
}

.tmi-palette-input {
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

    .tmi-palette-input i {
        color: var(--muted);
    }

    .tmi-palette-input input {
        flex: 1 1 auto;
        height: 54px;
        border: 0;
        outline: 0;
        color: var(--text);
        background: transparent;
        font: 500 14px 'Inter', sans-serif;
    }

        .tmi-palette-input input::placeholder {
            color: var(--muted);
        }

.tmi-palette-list {
    max-height: min(52vh, 420px);
    padding: 6px;
    overflow-y: auto;
}

.tmi-palette-item {
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 10px;
    cursor: pointer;
}

    .tmi-palette-item.is-active {
        background: var(--tmi-hover);
        box-shadow: inset 3px 0 0 var(--pc, #1f6f8b);
    }

.tmi-palette-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #fff;
    background: var(--pc, #1f6f8b);
    font-size: 13px;
}

.tmi-palette-text {
    min-width: 0;
    flex: 1 1 auto;
}

.tmi-palette-name {
    overflow: hidden;
    font: 700 12.5px/1.25 'Inter', sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tmi-palette-caption {
    overflow: hidden;
    color: var(--muted);
    font: 500 10.5px/1.3 'Inter', sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tmi-palette-tag {
    flex: 0 0 auto;
    color: var(--muted);
    font: 600 10px 'Inter', sans-serif;
}

.tmi-palette-empty {
    padding: 30px 16px;
    color: var(--muted);
    font: 500 12px 'Inter', sans-serif;
    text-align: center;
}

.tmi-palette-foot {
    padding: 9px 14px;
    display: flex;
    gap: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font: 500 10px 'Inter', sans-serif;
}

    .tmi-palette-foot kbd {
        margin-right: 3px;
        padding: 2px 5px;
        border: 1px solid var(--line);
        border-radius: 4px;
        color: inherit;
        background: transparent;
        font: 700 9px 'Inter', sans-serif;
    }

/* ---- click ripple ---- */
.tmi-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.34);
    transform: scale(0);
    animation: tmiRipple .6s ease-out forwards;
    pointer-events: none;
}

@keyframes tmiRipple {
    to {
        transform: scale(1);
        opacity: 0;
    }
}


/* ==========================================================
   7. ACCESSIBILITY + REDUCED MOTION
   ========================================================== */

.tmi-react-home a:focus-visible,
.tmi-react-home button:focus-visible {
    outline: 3px solid rgba(242,195,90,.72) !important;
    outline-offset: 2px;
}

.tmi-react-home button,
.tmi-react-home a {
    -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .tmi-react-home *,
    .tmi-react-home *::before,
    .tmi-react-home *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .tmi-hero-progress.run span {
        animation: none;
        transform: scaleX(1);
    }

    .tmi-ripple {
        display: none;
    }
}


/* ==========================================================
   8. ONE-VIEW FIT
   ----------------------------------------------------------
   Goal: carousel + Useful Links + footer all visible in one
   screen on laptops and desktops, carousel always full width,
   slide artwork never cropped or stretched.

   How it works
   - The carousel is always full width and never cropped.
   - Useful Links and the footer compact on shorter screens so
     the whole page fits in one view on common laptops.

   Only tune --tmi-header-h if your shared navbar is taller
   or shorter than 68px.
   ========================================================== */

:root {
    --tmi-header-h: 68px;
}

/* page = one screen below the navbar (footer still sits at the bottom) */
.tmi-react-home {
    min-height: calc(100vh - var(--tmi-header-h)) !important;
    min-height: calc(100svh - var(--tmi-header-h)) !important;
}

/* Carousel is NEVER cropped: it is always full width and the image's own
   3:1 shape sets its height (see section 2). The logo and the
   Attitude / Skill / Knowledge row are therefore always fully visible.
   To keep the page in one screen, Useful Links and the footer get more
   compact on shorter screens (rules below). */
@media (min-width: 993px) {

    .tmi-react-home > .portal-section {
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }

    .tmi-home-footer {
        margin-top: auto !important;
    }
}

/* Short laptop screens: tighter Useful Links so the banner stays large */
@media (min-width: 993px) and (max-height: 820px) {

    .section-header {
        padding: 6px 14px !important;
    }

    .section-title {
        font-size: 14px !important;
    }

    .quick-access-rail {
        padding: 8px 12px !important;
    }

    .portal-card {
        min-height: 86px;
        padding: 10px 8px 8px;
    }

    .portal-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 6px;
        font-size: 13px;
    }

    .tmi-home-footer-inner {
        min-height: 44px;
        padding: 6px 0;
    }
}

/* Phones: 4 compact links per row so the page fits in one screen */
@media (max-width: 576px) {

    .portal-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .portal-card {
        min-height: 74px;
        padding: 9px 4px 7px;
        border-radius: 9px;
    }

    .portal-icon {
        width: 30px;
        height: 30px;
        margin-bottom: 5px;
        border-radius: 8px;
        font-size: 12px;
    }

    .portal-name {
        font-size: 8.8px;
        line-height: 1.15;
    }

    .portal-caption,
    .portal-external {
        display: none;
    }
}

/* Very short laptop windows (e.g. 1280x720 screen): extra-compact links + footer */
@media (min-width: 993px) and (max-height: 660px) {

    .section-header {
        padding: 4px 14px !important;
    }

    .section-title {
        font-size: 13px !important;
    }

    .quick-access-rail {
        padding: 6px 10px !important;
    }

    .portal-card {
        min-height: 64px;
        padding: 7px 6px 6px;
    }

    .portal-icon {
        width: 28px;
        height: 28px;
        margin-bottom: 4px;
        border-radius: 8px;
        font-size: 11px;
    }

    .portal-caption {
        display: none;
    }

    .tmi-react-home > .portal-section {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
    }

    .tmi-home-footer-inner {
        min-height: 36px;
        padding: 4px 0;
    }

    .tmi-footer-version {
        min-height: 24px;
        padding: 2px 9px;
    }
}

/* Short laptop screens: Useful Links becomes one slim row
   (title on the left, links as compact pills) so the full,
   uncropped carousel + links + footer fit in one view. */
@media (min-width: 993px) and (max-height: 820px) {

    :root {
        --frame-gap: 8px;
    }

    .portal-section > .tmi-container {
        display: flex !important;
        align-items: stretch;
    }

    .section-header {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 16px !important;
        border-bottom: 0 !important;
        border-right: 2px solid var(--gold);
    }

    .section-title {
        font-size: 13px !important;
        white-space: nowrap;
    }

    .quick-access-rail {
        flex: 1 1 auto;
        min-width: 0;
        padding: 6px 8px !important;
    }

    .portal-grid {
        grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)) !important;
        gap: 6px !important;
    }

    .portal-card {
        min-height: 40px;
        padding: 6px 8px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 7px;
        border-radius: 9px;
    }

        .portal-card::before {
            top: 0;
            bottom: 0;
            right: auto;
            width: 3px;
            height: auto;
        }

        .portal-card::after {
            display: none;
        }

    .portal-icon {
        flex: 0 0 26px;
        width: 26px;
        height: 26px;
        margin: 0;
        border-radius: 7px;
        font-size: 11px;
    }

    .portal-name {
        text-align: left;
        font-size: 10px;
        line-height: 1.15;
    }

    .portal-caption,
    .portal-external {
        display: none;
    }

    .tmi-react-home > .portal-section {
        margin-top: 8px !important;
        margin-bottom: 8px !important;
    }

    .tmi-home-footer-inner {
        min-height: 32px;
        padding: 3px 0;
    }

    .tmi-footer-version {
        min-height: 22px;
        padding: 1px 8px;
    }
}

/* Very short windows (e.g. 1280x720 screen with browser bars) */
@media (min-width: 993px) and (max-height: 640px) {

    :root {
        --frame-gap: 5px;
    }

    .tmi-react-home > .portal-section {
        margin-top: 5px !important;
        margin-bottom: 5px !important;
    }

    .quick-access-rail {
        padding: 4px 6px !important;
    }

    .portal-card {
        min-height: 36px;
        padding: 4px 8px;
    }

    .tmi-home-footer-inner {
        min-height: 28px;
        padding: 2px 0;
    }

    .tmi-footer-copyright {
        font-size: 10px;
    }
}


/* ==========================================================
   9. FOOTER ALWAYS AT THE BOTTOM (all screen sizes)
   ----------------------------------------------------------
   - Short pages: .tmi-react-home is at least one screen tall
     (screen height minus the real navbar height, measured by
     the small script in Index.cshtml) and the footer is pushed
     down with margin-top:auto.
   - Long pages (e.g. phones in landscape): the footer is
     sticky, so it stays on the bottom edge of the screen.
   ========================================================== */

.tmi-react-home {
    min-height: calc(100vh - var(--tmi-header-h)) !important;
    min-height: calc(100dvh - var(--tmi-header-h)) !important;
}

.tmi-react-home {
    /* clip (not hidden) so the page is not a scroll box - lets the footer stick */
    overflow: visible !important;
    overflow-x: clip !important;
}

    .tmi-react-home > .tmi-home-footer {
        position: sticky !important;
        bottom: 0;
        z-index: 50;
        margin-top: auto !important;
        flex: 0 0 auto;
    }

/* floating dock sits above the footer instead of on top of it */
.tmi-dock {
    bottom: calc(var(--tmi-footer-h, 52px) + 12px);
}

@media (max-width: 576px) {
    .tmi-dock {
        bottom: calc(var(--tmi-footer-h, 70px) + 8px);
    }
}


/* ==========================================================
   10. ONE VIEW - NO SCROLLBAR (every screen size)
   ----------------------------------------------------------
   The page below the navbar is exactly one screen tall:
     carousel  -> takes the space that is left
     links     -> natural height (compacts on short screens)
     footer    -> natural height, always on the bottom edge
   The carousel is sized to the LARGEST uncropped 3:1 box that
   fits the space left: full width whenever there is room,
   otherwise it narrows (centred) instead of cropping, so the
   logo and Attitude / Skill / Knowledge are always complete.
   This section overrides the earlier size rules.
   ========================================================== */

html,
body {
    overflow: hidden !important;
    overscroll-behavior: none;
}

    html body .tmi-react-home {
        height: calc(100vh - var(--tmi-header-h, 68px)) !important;
        height: calc(100dvh - var(--tmi-header-h, 68px)) !important;
        min-height: 0 !important;
        max-height: none !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

        /* carousel area: flexible, measured by container units */
        html body .tmi-react-home > #home.tmi-hero {
            flex: 1 1 0 !important;
            min-height: 0 !important;
            height: auto !important;
            /* never taller than a full-width slide, so on tall screens the links
           stay right under the carousel and the spare space goes above the footer */
            max-height: calc((100vw - (var(--frame-gap) * 2) - (var(--frame-width) * 2)) / 3 + (var(--frame-width) * 2) + var(--frame-gap) + 2px) !important;
            overflow: hidden !important;
            container-type: size;
        }

    html body #home .tmi-hero-container,
    html body #home .tmi-hero-inner {
        height: 100% !important;
    }

    html body #home .hero-visual-column {
        width: min( calc(100cqw - (var(--frame-gap) * 2)), calc((100cqh - var(--frame-gap) - (var(--frame-width) * 2)) * 3 + (var(--frame-width) * 2)) ) !important;
        max-width: calc(100cqw - (var(--frame-gap) * 2)) !important;
        height: auto !important;
        margin: var(--frame-gap) auto 0 !important;
    }

    /* image: natural 3:1, never cropped (re-assert over any older rule) */
    html body #home .hero-backgrounds {
        height: auto !important;
        aspect-ratio: 3 / 1 !important;
    }

    html body #home .hero-background {
        position: absolute !important;
        inset: 0 !important;
        height: 100% !important;
    }

        html body #home .hero-background.active {
            position: relative !important;
            inset: auto !important;
            height: auto !important;
        }

        html body #home .hero-background img {
            width: 100% !important;
            height: auto !important;
            object-fit: contain !important;
        }

        html body #home .hero-background:not(.active) img {
            height: 100% !important;
        }

    html body .tmi-react-home > .portal-section {
        flex: 0 0 auto !important;
        margin-top: 8px !important;
        margin-bottom: 8px !important;
    }

    html body .tmi-react-home > .tmi-home-footer {
        position: relative !important;
        flex: 0 0 auto !important;
        margin-top: auto !important;
    }

/* Browsers without container units (very old): conservative viewport cap */
@supports not (width: 1cqh) {
    html body #home .hero-visual-column {
        width: min(calc(100% - (var(--frame-gap) * 2)), calc((100vh - var(--tmi-header-h, 68px) - 220px) * 3)) !important;
    }
}

/* ---- Tablets / landscape phones with short height: slim links row ---- */
@media (min-width: 577px) and (max-width: 992px) and (max-height: 820px) {

    :root {
        --frame-gap: 6px;
    }

    .portal-section > .tmi-container {
        display: flex !important;
        align-items: stretch;
    }

    .section-header {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 12px !important;
        border-bottom: 0 !important;
        border-right: 2px solid var(--gold);
    }

    .section-title {
        font-size: 12px !important;
        white-space: nowrap;
    }

    .quick-access-rail {
        flex: 1 1 auto;
        min-width: 0;
        padding: 5px 6px !important;
    }

    .portal-grid {
        grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)) !important;
        gap: 5px !important;
    }

    .portal-card {
        min-height: 34px;
        padding: 4px 7px;
        flex-direction: row;
        justify-content: flex-start;
        gap: 6px;
        border-radius: 8px;
    }

        .portal-card::before {
            top: 0;
            bottom: 0;
            right: auto;
            width: 3px;
            height: auto;
        }

        .portal-card::after {
            display: none;
        }

    .portal-icon {
        flex: 0 0 24px;
        width: 24px;
        height: 24px;
        margin: 0;
        border-radius: 6px;
        font-size: 10px;
    }

    .portal-name {
        text-align: left;
        font-size: 9.5px;
        line-height: 1.15;
    }

    .portal-caption,
    .portal-external {
        display: none;
    }

    html body .tmi-react-home > .portal-section {
        margin-top: 6px !important;
        margin-bottom: 6px !important;
    }

    .tmi-home-footer-inner {
        min-height: 30px;
        padding: 3px 0;
    }

    .tmi-footer-version {
        min-height: 22px;
        padding: 1px 8px;
    }
}

/* ---- Phones: one-line footer and tight spacing ---- */
@media (max-width: 576px) {

    html body .tmi-react-home > .portal-section {
        margin: 6px 6px 6px !important;
    }

    .section-header {
        padding: 5px 10px !important;
    }

    .section-title {
        font-size: 13px !important;
    }

    .tmi-home-footer-inner {
        min-height: 32px !important;
        padding: 5px 0 !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: 8px !important;
        text-align: left !important;
    }

    .tmi-footer-copyright {
        justify-content: flex-start !important;
        align-items: center !important;
        font-size: 8.5px !important;
        line-height: 1.3 !important;
    }

        .tmi-footer-copyright i {
            margin-top: 0 !important;
        }

    .tmi-footer-version {
        min-height: 22px !important;
        margin: 0 !important;
        padding: 1px 7px !important;
        font-size: 8.5px !important;
    }
}

/* ---- Very short phones (landscape / small devices) ---- */
@media (max-width: 576px) and (max-height: 600px) {

    .portal-card {
        min-height: 58px;
        padding: 6px 3px 5px;
    }

    .portal-icon {
        width: 24px;
        height: 24px;
        margin-bottom: 3px;
        font-size: 10px;
    }
}

/* dock follows the footer height */
.tmi-dock {
    bottom: calc(var(--tmi-footer-h, 52px) + 10px) !important;
}
