/* ==========================================================================
   Horizon Frontier Technologies - Custom CSS
   Version 2.8 - ATLANTIS IMAGE FIX
   Fixes: Images overflowing boxes/cards, huge photos breaking layout
   ========================================================================== */

/* ==========================================================================
   CSS Variables & Theme
   ========================================================================== */
:root {
    --primary-cyan: #00d4ff;
    --primary-orange: #ffa500;
    --bg-dark: #060d1f;
    --bg-dark-alt: #0a1628;
    --bg-gradient: linear-gradient(135deg, #060d1f 0%, #0d2137 100%);
    --text-light: #e8e8e8;
    --text-muted: #a8b2c1;
    --border-glow: rgba(0, 212, 255, 0.6);
    --shadow-glow: rgba(0, 212, 255, 0.3);
}

/* ==========================================================================
   HERO VIDEO SECTION
   ========================================================================== */
.hero-video {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.hero-video video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 13, 31, 0.45);
    z-index: 2;
}

.hero-content {
    text-align: center;
    z-index: 3;
    padding: 2em;
}

.hero-content .logo img {
    max-width: 180px;
    height: auto;
    margin-bottom: 1em;
    opacity: 0.5;
    transition: opacity 0.5s ease;
}

.hero-content h1 {
    font-size: 2.5em;
    letter-spacing: 0.15em;
    margin-bottom: 0.3em;
}

.hero-content .tagline {
    font-size: 1.4em;
    color: var(--primary-cyan) !important;
    margin-bottom: 0.3em;
}

.hero-content .subtitle {
    font-size: 1.1em;
    margin-bottom: 1.5em;
}

@media screen and (max-width: 736px) {
    .hero-video {
        height: 80vh;
        min-height: 400px;
    }
    .hero-content h1 {
        font-size: 1.5em;
        letter-spacing: 0.08em;
    }
    .hero-content .tagline {
        font-size: 1.1em;
    }
    .hero-content .logo img {
        max-width: 120px;
    }
}

/* ==========================================================================
   BASE & BODY - Force dark theme EVERYWHERE
   ========================================================================== */
html, body {
    background: var(--bg-dark) !important;
    background-image: var(--bg-gradient) !important;
    background-attachment: fixed !important;
    color: var(--text-light) !important;
    margin: 0;
    padding: 0;
}

#wrapper, #main, .wrapper, main, article, section, div {
    background-color: transparent !important;
}

#wrapper { background: transparent !important; }
#main { background: var(--bg-dark) !important; color: var(--text-light) !important; }
.main, .main.special, #main > .main { background: transparent !important; color: var(--text-light) !important; }
.wrapper, .wrapper.style1, .wrapper.style2, .wrapper.style3 { background: transparent !important; }

/* Override Stellar defaults */
.spotlight .content, .features-icons, .features-icons li, .posts article {
    background: transparent !important;
    color: var(--text-light) !important;
}

/* Spotlight layout - gap between text and image */
.spotlight {
    gap: 2em !important;
    align-items: center !important;
}

.spotlight .content {
    flex: 1 1 50% !important;
    min-width: 0;
}

/* Spotlight image - constrain to not crush the text */
.spotlight .image {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 45% !important;
    margin-left: 2em !important;
}

.spotlight .image img {
    width: 100% !important;
    max-width: 16em !important;
}

/* Buttons inside spotlight should be left-aligned with content, not centered */
.spotlight .content ul.actions {
    justify-content: flex-start !important;
}

@media screen and (max-width: 980px) {
    .spotlight {
        flex-direction: column-reverse !important;
        text-align: center !important;
    }
    .spotlight .content {
        flex: 1 1 auto !important;
        width: 100% !important;
    }
    .spotlight .image {
        max-width: 60% !important;
        margin-left: 0 !important;
        margin-bottom: 2em !important;
    }
    .spotlight .content ul.actions {
        justify-content: center !important;
    }
}

/* ==========================================================================
   TEXT & HEADINGS - Global centering & visibility
   ========================================================================== */
h1, h2, h3, h4, h5, h6 { color: var(--text-light) !important; }
p, li, span, label, strong, em, b, i { color: var(--text-muted) !important; }
p { text-align: left !important; }

/* Centered text in special / hero / major sections */
.special p, section.special p, .main.special p,
header.major p, .hero-content p, .hero-content h1,
header.major h2, header.major,
#main > section:first-child h1,
#main > section:first-child p {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Constrain width */
.hero-content, header.major, header.major h2, header.major p,
#main > section:first-child h1, #main > section:first-child p {
    max-width: 90%;
    margin: 0 auto;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */
.button {
    background-color: transparent !important;
    border: 2px solid var(--primary-cyan) !important;
    color: var(--primary-cyan) !important;
    padding: 0.8em 2em !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    text-align: center !important;
    display: inline-flex !important; /* Flex for vertical center */
    align-items: center !important; /* Vertical center */
    justify-content: center !important; /* Horizontal center */
    height: auto !important; /* Ensure no fixed height overrides */
    line-height: 1 !important; /* Reset any tall line-height */
}

.button:hover { background-color: var(--primary-cyan) !important; color: var(--bg-dark) !important; box-shadow: 0 0 15px var(--shadow-glow) !important; }
.button:focus, a:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-cyan) !important; outline-offset: 2px !important; }
.button.primary { background-color: var(--primary-cyan) !important; color: var(--bg-dark) !important; border-color: var(--primary-cyan) !important; }
.button.primary:hover { background-color: #fff !important; color: var(--bg-dark) !important; }

ul.actions {
    display: flex !important;
    justify-content: center !important;
    gap: 1em !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 1em 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
}

ul.actions li {
    margin: 0 !important;
    padding: 0 !important;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
#nav {
    background: rgba(6, 13, 31, 0.98) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glow);
    position: sticky;
    top: 0;
    z-index: 1000;
    color: var(--text-light) !important;
}

/* ==========================================================================
   HEADER - Page title centering (Platforms, Solutions, etc.)
   ========================================================================== */
#header {
    text-align: center !important;
}

#header h1,
#header p {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ==========================================================================
   ACCENT BAR (h2:after) - Center everywhere, not just .special sections
   ========================================================================== */
header.major h2:after {
    margin-left: auto !important;
    margin-right: auto !important;
}

#main header.major h2:after {
    margin-left: auto !important;
    margin-right: auto !important;
    background-image: linear-gradient(90deg, #efa8b0, #a89cc8, #8cc9f0) !important;
}

/* ==========================================================================
   IMAGE & PHOTO CONTAINMENT - CRITICAL FIXES
   ========================================================================== */

/* All image containers - prevent overflow */
.main-image,
.platform-image,
.image:not(.spotlight .image),
.video-container {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 12px;
    width: 100% !important;
    max-width: 100% !important;
    margin: 1.5em auto;
    border: 1px solid var(--border-glow);
    box-shadow: 0 5px 20px var(--shadow-glow);
}

/* Spotlight image container - separate styling */
.spotlight .image {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 100%;
    border: 1px solid var(--border-glow);
    box-shadow: 0 5px 20px var(--shadow-glow);
}

/* All images inside containers */
.main-image img,
.platform-image img,
.image:not(.spotlight .image) img,
.video-container img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* Bare img tag fallback */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Image containers - no clipping */
.main-image,
.platform-image,
.image:not(.spotlight .image) {
    max-height: none;
    overflow: visible !important;
}

.main-image img,
.platform-image img,
.image:not(.spotlight .image) img {
    max-height: none !important;
    object-fit: contain !important;
    width: 100% !important;
    height: auto !important;
}

/* ==========================================================================
   FEATURES / CARDS / PLATFORM GRID
   ========================================================================== */
ul.features {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2em !important;
    justify-content: center !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 auto !important;
    max-width: 1400px !important;
}

ul.features li {
    flex: 1 1 300px !important;
    max-width: 400px !important;
    padding: 1.5em;
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    background: rgba(10, 22, 40, 0.95) !important;
    overflow: visible !important;
    /* Pin action buttons to bottom regardless of content height */
    display: flex !important;
    flex-direction: column !important;
}

/* Push action buttons to the bottom of each card */
ul.features li ul.actions.special {
    margin-top: auto !important;
}

/* Remove double-border on action buttons inside feature cards */
ul.features li ul.actions,
ul.features li ul.actions.special {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 1em 0 0 0 !important;
}

ul.features li ul.actions li {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.platform-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 2em !important;
    justify-content: center !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
}

.platform-card {
    background: rgba(10, 22, 40, 0.95) !important;
    border: 1px solid var(--border-glow) !important;
    border-radius: 12px !important;
    padding: 1.5em !important;
    overflow: visible !important;
}

/* Platform card spec tables - FORCE full-width stacked layout */
.platform-card table,
.platform-card .platform-specs table,
.platform-specs table {
    width: 100% !important;
    table-layout: auto !important;
    display: table !important;
}

.platform-card table tr,
.platform-card .platform-specs table tr,
.platform-specs table tr {
    display: block !important;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2) !important;
    padding: 0.5em 0 !important;
}

.platform-card table td,
.platform-card .platform-specs table td,
.platform-specs table td {
    display: block !important;
    width: 100% !important;
    padding: 0.3em 0.75em !important;
    border: none !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    overflow: visible !important;
    max-width: 100% !important;
}

.platform-card table tr td:first-child,
.platform-card .platform-specs table tr td:first-child,
.platform-specs table tr td:first-child {
    font-weight: bold !important;
    color: var(--primary-cyan) !important;
    font-size: 0.85em !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding-bottom: 0 !important;
}

.platform-card table tr td:last-child,
.platform-card .platform-specs table tr td:last-child,
.platform-specs table tr td:last-child {
    color: var(--text-light) !important;
    padding-top: 0.1em !important;
}

/* ==========================================================================
   TABLES - Dark theme + aggressive mobile stacking
   ========================================================================== */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5em 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent !important;
    color: var(--text-light) !important;
    table-layout: fixed;
}

th, td {
    border: 1px solid var(--border-glow) !important;
    padding: 0.9em 1em !important;
    text-align: left !important;
    vertical-align: top !important;
    word-break: break-word !important;
    hyphens: auto !important;
    color: var(--text-light) !important;
}

thead th {
    background: var(--bg-dark-alt) !important;
    font-weight: bold !important;
    text-align: center !important;
}

tbody tr:nth-child(even) {
    background: rgba(10, 22, 40, 0.6) !important;
}

/* === Mobile Stacking (start at 980px for tablets too) === */
@media screen and (max-width: 980px) {
    /* Only stack tables inside .table-wrapper (comparison tables), not card tables */
    .table-wrapper table,
    .table-wrapper thead,
    .table-wrapper tbody,
    .table-wrapper th,
    .table-wrapper td,
    .table-wrapper tr {
        display: block !important;
    }

    .table-wrapper thead tr {
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }

    .table-wrapper tr {
        margin-bottom: 1.8em !important;
        border: 1px solid var(--border-glow) !important;
        border-radius: 8px !important;
        background: rgba(10, 22, 40, 0.95) !important;
        box-shadow: 0 4px 15px var(--shadow-glow);
    }

    .table-wrapper td {
        border: none !important;
        border-bottom: 1px solid var(--border-glow) !important;
        position: relative !important;
        padding-left: 50% !important;
        min-height: 2.8em !important;
        text-align: right !important;
    }

    .table-wrapper td:last-child {
        border-bottom: none !important;
    }

    .table-wrapper td:before {
        content: attr(data-label) !important;
        position: absolute !important;
        left: 1em !important;
        width: calc(45% - 2em) !important;
        padding-right: 1em !important;
        white-space: nowrap !important;
        font-weight: bold !important;
        text-align: left !important;
        color: var(--primary-cyan) !important;
    }

    .table-wrapper td {
        word-break: break-word !important;
        hyphens: auto !important;
    }
}

/* ==========================================================================
   RESPONSIVE - Tighten images on smaller screens
   ========================================================================== */
@media screen and (max-width: 980px) {
    .main-image, .platform-image, .image:not(.spotlight .image) {
        max-height: none;
    }
}

@media screen and (max-width: 736px) {
    #main { padding: 1em !important; }

    .main-image, .platform-image, .image:not(.spotlight .image) {
        max-height: none;
        margin: 1em auto;
    }

    ul.features { flex-direction: column !important; align-items: center !important; }
    ul.features li { width: 90% !important; max-width: 100% !important; margin: 1em 0 !important; }
    .platform-grid { grid-template-columns: 1fr !important; }

    .platform-card { width: 100% !important; margin: 0 0 1.5em 0 !important; }

    /* Force images to respect container */
    .main-image img, .platform-image img, .image:not(.spotlight .image) img {
        height: auto !important;
        max-height: none !important;
    }
}

/* ==========================================================================
   FOOTER FIXES - Copyright centering & layout
   ========================================================================== */
#footer {
    width: 100% !important;
    margin-left: 0 !important;
}

#footer > * {
    width: calc(50% - 2em);
    margin-left: 2em;
}

#footer .copyright {
    width: 100% !important;
    text-align: center !important;
    margin-left: 0 !important;
    padding: 0 !important;
}

@media screen and (max-width: 980px) {
    #footer {
        display: block !important;
        width: 100% !important;
        margin: 0 0 3em 0 !important;
    }
    #footer > * {
        width: 100% !important;
        margin-left: 0 !important;
    }
    #footer .copyright {
        text-align: center !important;
    }
}

/* ==========================================================================
   VIDEO CONTAINER - Platforms page video fix
   ========================================================================== */
.video-container video {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    max-height: 500px;
    object-fit: cover;
}

.video-caption {
    text-align: center !important;
    font-size: 0.9em;
    margin-top: 0.5em;
    color: var(--text-muted) !important;
}

/* ==========================================================================
   EMERGENCY OVERRIDES
   ========================================================================== */
* { box-sizing: border-box !important; }
img { max-width: 100% !important; height: auto !important; }