/* ===================================
   CSS Variables & Root Configuration
   =================================== */
:root {
    /* Color Palette - Dark Theme */
    --color-primary: #F97316;
    --color-primary-dark: #EA580C;
    --color-primary-light: #FB923C;
    --color-secondary: #DC2626;
    --color-accent: #FBBF24;
    --color-success: #10B981;

    /* Neutral Colors - Dark Theme */
    --color-bg-primary: #0F172A;
    --color-bg-secondary: #1E293B;
    --color-bg-dark: #020617;
    --color-text-primary: #F1F5F9;
    --color-text-secondary: #94A3B8;
    --color-text-light: #64748B;
    --color-border: #334155;
    --color-shadow: rgba(0, 0, 0, 0.4);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Z-index */
    --z-index-modal: 1000;
    --z-index-overlay: 999;
}

/* ===================================
   CSS Reset & Base Styles
   =================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* ===================================
   Layout Utilities
   =================================== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.main-content {
    flex: 1;
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 50%, #020617 100%);
    border-bottom: 2px solid var(--color-primary);
    color: white;
    padding: var(--spacing-2xl) 0;
    text-align: center;
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.2);
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at top, rgba(249, 115, 22, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
    animation: fadeInUp 0.6s ease-out;
}

.hero-logo {
    max-width: 400px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.hero-subtitle {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 400;
    opacity: 0.95;
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
    margin-bottom: var(--spacing-md);
}

.hero-description {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    font-weight: 300;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease-out 0.4s backwards;
}

/* ===================================
   Products Section
   =================================== */
.products-section {
    padding: var(--spacing-2xl) 0;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-primary);
}

.section-description {
    font-size: clamp(1rem, 2vw, 1.25rem);
    text-align: center;
    color: var(--color-text-secondary);
    max-width: 700px;
    margin: 0 auto var(--spacing-xl);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

/* ===================================
   Product Cards
   =================================== */
.product-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: visible;
    border: 2px solid transparent;
    min-height: 400px;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: scaleX(0);
    transition: transform var(--transition-normal);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.product-card:hover,
.product-card:focus {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(249, 115, 22, 0.3), 0 0 0 1px var(--color-primary);
    border-color: var(--color-primary);
    outline: none;
    background: #1a2332;
}

.product-card:hover::before,
.product-card:focus::before {
    transform: scaleX(1);
}

.product-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

.product-logo {
    width: 120px;
    height: 120px;
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-secondary);
    transition: transform var(--transition-normal);
    padding: var(--spacing-sm);
}

.product-card:hover .product-logo,
.product-card:focus .product-logo {
    transform: scale(1.05);
}

.product-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.product-description {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.product-cta {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--color-primary);
    font-weight: 600;
    transition: gap var(--transition-fast);
}

.product-card:hover .product-cta,
.product-card:focus .product-cta {
    gap: var(--spacing-sm);
}

.cta-icon {
    transition: transform var(--transition-fast);
}

.product-card:hover .cta-icon,
.product-card:focus .cta-icon {
    transform: translateX(4px);
}

/* Product Badges */
.product-badge {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

.product-badge.launched {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
}

.product-badge.in-dev {
    background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Product Features */
.product-features {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    justify-content: center;
    margin-top: auto;
    margin-bottom: var(--spacing-md);
    width: 100%;
}

.feature-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(249, 115, 22, 0.1);
    color: var(--color-primary-light);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(249, 115, 22, 0.3);
    white-space: nowrap;
}

/* Fireworks Fallout - Pantone 186C (#C8102E) accent */
.feature-tag--fallout {
    background: rgba(200, 16, 46, 0.1);
    color: #E8354A;
    border: 1px solid rgba(200, 16, 46, 0.3);
}

.product-cta--fallout {
    color: #C8102E;
}

.product-card--fallout:hover,
.product-card--fallout:focus {
    box-shadow: 0 20px 40px rgba(200, 16, 46, 0.3), 0 0 0 1px #C8102E;
    border-color: #C8102E;
}

.product-card--fallout::before {
    background: linear-gradient(90deg, #C8102E, #E8354A);
}

/* Pyrositeplan - Pantone 151C (#FF8200) accent */
.feature-tag--pyrositeplan {
    background: rgba(255, 130, 0, 0.1);
    color: #FF9A33;
    border: 1px solid rgba(255, 130, 0, 0.3);
}

.product-cta--pyrositeplan {
    color: #FF8200;
}

.product-card--pyrositeplan:hover,
.product-card--pyrositeplan:focus {
    box-shadow: 0 20px 40px rgba(255, 130, 0, 0.3), 0 0 0 1px #FF8200;
    border-color: #FF8200;
}

.product-card--pyrositeplan::before {
    background: linear-gradient(90deg, #FF8200, #FF9A33);
}

/* DSMT Logbook - Pantone 285C (#0072CE) accent */
.feature-tag--dsmt {
    background: rgba(0, 114, 206, 0.1);
    color: #3399E0;
    border: 1px solid rgba(0, 114, 206, 0.3);
}

.product-cta--dsmt {
    color: #0072CE;
}

.product-card--dsmt:hover,
.product-card--dsmt:focus {
    box-shadow: 0 20px 40px rgba(0, 114, 206, 0.3), 0 0 0 1px #0072CE;
    border-color: #0072CE;
}

.product-card--dsmt::before {
    background: linear-gradient(90deg, #0072CE, #3399E0);
}

/* ===================================
   Iframe Modal
   =================================== */
.iframe-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-index-modal);
    padding: var(--spacing-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.iframe-modal.active {
    opacity: 1;
    visibility: visible;
}

.iframe-container {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.iframe-modal.active .iframe-container {
    transform: scale(1);
}

.iframe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.iframe-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.close-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.close-button:hover {
    background: var(--color-border);
    color: var(--color-text-primary);
}

.close-button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.iframe-content {
    flex: 1;
    position: relative;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.iframe-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Iframe Loading State */
.iframe-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    z-index: 5;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.iframe-loading p {
    color: var(--color-text-secondary);
    font-size: 1rem;
}

/* Iframe Error State */
.iframe-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    z-index: 10;
}

.error-content {
    text-align: center;
    max-width: 500px;
}

.error-content svg {
    color: var(--color-text-secondary);
    margin: 0 auto var(--spacing-md);
}

.error-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-sm);
}

.error-content p {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.open-link-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.open-link-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.open-link-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ===================================
   Footer
   =================================== */
.footer {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    padding: var(--spacing-2xl) 0 var(--spacing-lg);
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-section {
    text-align: left;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: var(--spacing-sm);
}

.footer-logo {
    max-width: 180px;
    width: 100%;
    height: auto;
    margin-bottom: var(--spacing-sm);
}

.footer-description {
    font-size: 0.875rem;
    line-height: 1.6;
    max-width: 250px;
}

.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: var(--spacing-sm);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: var(--spacing-xs);
}

.footer-links a {
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: white;
}

.footer-address {
    font-size: 0.875rem;
    line-height: 1.6;
    font-style: normal;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-md);
    text-align: center;
}

.footer-bottom p {
    font-size: 0.875rem;
    margin: 0;
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   Responsive Design - Mobile First
   =================================== */

/* Small devices (phones, less than 640px) */
@media (max-width: 639px) {
    .hero {
        padding: var(--spacing-xl) 0;
    }

    .products-section {
        padding: var(--spacing-xl) 0;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .iframe-modal {
        padding: var(--spacing-sm);
    }

    .iframe-container {
        height: 85vh;
    }

    .iframe-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .iframe-title {
        font-size: 1rem;
    }
}

/* Medium devices (tablets, 640px to 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    .container {
        padding: 0 var(--spacing-lg);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Extra large devices (large desktops, 1536px and up) */
@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
}

/* ===================================
   Accessibility Enhancements
   =================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid var(--color-text-primary);
    }

    .product-card:hover,
    .product-card:focus {
        border-color: var(--color-primary);
    }
}

/* Light mode support (optional override for users who prefer light) */
@media (prefers-color-scheme: light) {
    :root {
        /* Keep dark theme as default - users can override if needed */
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .iframe-modal,
    .footer {
        display: none;
    }

    body {
        background: white;
    }

    .hero {
        background: white;
        color: black;
        border: none;
    }

    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }
}
