/* =========================================================================
   Base Styles & Reset - Steve Keen Brand Theme
   ========================================================================= */
:root {
    /* Steve Keen Light Theme Constraints */
    --bg-color: #f8fafc;
    /* Very light slate/grey for contrast against white cards */
    --card-bg: #ffffff;
    --card-hover: #f1f5f9;

    /* Typography */
    --text-primary: #0f172a;
    /* Slate 900 for high contrast readability */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-meta: #64748b;
    /* Slate 500 */

    /* Strict Accent Color (Steve Keen brand accent usually a bold color, often dark red/blue, we'll use a deep authoritative blue) */
    --primary-btn: #0f172a;
    /* Slate 900 / Black */
    --primary-btn-hover: #000000;
    /* Pure Black */
    --secondary-btn: #1f2937;
    /* Gray 800 */
    --secondary-btn-hover: #111827;

    /* Clean Sans-Serif Fonts matching stevekeen.com */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Allow scrolling for the disclaimer, but container handles Above-the-fold sizing */
html,
body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
}

body {
    background: linear-gradient(to bottom, #ffffff 0%, #64748b 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================================================
   Layout & Container (100vh locked)
   ========================================================================= */
.router-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.5rem;
    min-height: 100dvh;
    /* Allow expanding past viewport if content needs vertically */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Space out header, grid, and footer perfectly */
}

/* Header - Extremely Compact with Verbatim Branding */
.router-header {
    text-align: center;
    padding: 0.25rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.logo-image {
    height: 70px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.1rem;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 800;
}

.credibility-footer {
    width: 100%;
    text-align: center;
    padding: 0;
    margin-top: 0;
}

.credibility-banner {
    width: 100%;
    max-width: 900px;
    height: auto;
    max-height: 55px;
    object-fit: contain;
    opacity: 0.85;
    margin: 0 auto;
}

/* Grid Layout - Fluid Remaining Space */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    flex-grow: 1;
    /* Take up all remaining vertical space */
    min-height: 0;
    /* Important for grid items to shrink properly */
    padding-bottom: 0.5rem;
}

/* Desktop Grid */
@media (min-width: 768px) {
    .router-container {
        padding: 0.5rem 2rem;
    }

    .router-header {
        padding: 0.5rem 0;
        gap: 0.5rem;
    }

    .logo-image {
        height: 90px;
    }

    .subtitle {
        font-size: 2.25rem;
    }

    .credibility-banner {
        max-width: 1000px;
        max-height: 90px;
    }

    .grid-layout {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto auto;
        /* Fix: Force grid to stretch to its content to stop buttons clipping */
        gap: 1.25rem;
    }

    /* Top card spans both columns */
    .card:first-child {
        grid-column: span 2;
    }
}

/* =========================================================================
   Card Styles - Light Theme & Compact
   ========================================================================= */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    /* Horizontal layout for mobile by default */
    align-items: center;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.08);
    min-height: 0;
    /* Allow shrinking */
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px -6px rgba(0, 0, 0, 0.15), 0 6px 10px -3px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Mobile image area: small square on the left */
.card-image {
    width: 30%;
    height: 100%;
    min-height: 120px;
    background-color: #e2e8f0;
    position: relative;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

/* Desktop image area: top banner */
@media (min-width: 768px) {
    .card {
        flex-direction: column;
        /* Stack vertically inside the card on desktop */
        align-items: stretch;
    }

    .card-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 5;
        /* Shrink to a more horizontal sliver instead of full 16:9 box */
        min-height: auto;
        max-height: 200px;
        /* Hard clamp so it never overtakes the screen */
    }
}

/* Very subtle light-mode gradients for placeholder images */
.bg-books {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.bg-rebel {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.bg-enterprise {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.card-overlay {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
}

.badge {
    background: var(--primary-btn);
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
}

/* Content Area - Highly Condensed */
.card-content {
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    overflow: visible;
    /* Fix container clipping */
}

/* Title and Icon Area Styles */
.title-wrapper {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
    /* Ensure generous spacing between headline and bullets per user request */
}

.title-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-btn);
    color: white;
    width: 3.5rem;
    /* 56px */
    height: 3.5rem;
    /* 56px */
    border-radius: 14px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.title-icon svg {
    width: 1.75rem;
    /* 28px */
    height: 1.75rem;
    /* 28px */
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    line-height: 1.25;
    font-weight: 700;
    margin: 0;
    /* Wrapping handles spacing now */
    color: var(--text-primary);
    white-space: normal;
    /* Fix truncation */
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    line-height: 1.2;
}

.card-benefits li span {
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.15rem;
}

/* Desktop expansions */
@media (min-width: 768px) {
    .card-content {
        padding: 1.25rem 1.5rem;
        justify-content: space-between;
    }

    /* Larger title for Top Card */
    .card:first-child .card-title {
        font-size: 1.85rem;
        margin: 0;
    }

    .card-title {
        font-size: 1.55rem;
        /* Significantly bump alternative card sizes closer to top card */
        margin: 0;
        white-space: normal;
    }

    .card-desc {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    .card-benefits {
        font-size: 1.1rem;
        gap: 0.35rem;
        margin-bottom: 0.75rem;
    }

    .card-benefits li span {
        font-size: 1.3rem;
    }
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.05rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-btn);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-btn-hover);
}

.btn-secondary {
    background-color: var(--secondary-btn);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-btn-hover);
}

/* Theme specific buttons and icons */

/* Book Bundle - Subtle Green Gradient (darker green top, deep green bottom) */
.theme-green .title-icon {
    background: linear-gradient(to bottom, #0d9e5a 0%, #065f46 100%);
}

.theme-green .btn {
    background: linear-gradient(to bottom, #0d9e5a 0%, #065f46 100%);
    color: white;
}

.theme-green .btn:hover {
    background: linear-gradient(to bottom, #0a8a4e 0%, #054d3b 100%);
}

/* Rebel Challenge - Orange-top to Crimson-bottom Gradient */
.theme-rebel .title-icon {
    background: linear-gradient(to bottom, #c2410c 0%, #7f1d1d 100%);
    /* Orange 700 to Red 900 */
}

.theme-rebel .btn {
    background: linear-gradient(to bottom, #c2410c 0%, #7f1d1d 100%);
    color: white;
}

.theme-rebel .btn:hover {
    background: linear-gradient(to bottom, #9a3412 0%, #5c1414 100%);
}

/* Enterprise - Subtle Purple Gradient (medium purple top, deep purple bottom) */
.theme-enterprise .title-icon {
    background: linear-gradient(to bottom, #7c3aed 0%, #4c1d95 100%);
    /* Violet 600 to Violet 900 */
}

.theme-enterprise .btn {
    background: linear-gradient(to bottom, #7c3aed 0%, #4c1d95 100%);
    color: white;
}

.theme-enterprise .btn:hover {
    background: linear-gradient(to bottom, #6d28d9 0%, #3b0764 100%);
}

/* Desktop button tweak */
@media (min-width: 768px) {
    .btn {
        padding: 1.35rem;
        font-size: 1.25rem;
        border-radius: 8px;
    }
}

.arrow {
    transition: transform 0.2s ease;
}

.card:hover .arrow {
    transform: translateX(3px);
}

/* =========================================================================
   Footer (Disclaimer text)
   ========================================================================= */
.router-footer {
    text-align: center;
    padding: 2rem 1rem 4rem 1rem;
    color: var(--text-meta);
    font-size: 0.75rem;
    flex-shrink: 0;
    max-width: 1000px;
    margin: 0 auto;
}

/* =========================================================================
   Modal Styles
   ========================================================================= */
.modal-overlay {
    opacity: 0;
    visibility: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.modal-content {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(0.95) translateY(10px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    cursor: pointer;
    font-size: 1.75rem;
    line-height: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
}

.modal-title {
    font-size: 1.35rem;
    font-family: var(--font-heading);
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    color: white;
    text-align: center;
    font-weight: 700;
    font-size: 1.15rem;
    /* Larger text */
    transition: var(--transition);
}

.modal-btn svg {
    flex-shrink: 0;
}

.modal-btn-consulting {
    background-color: #1e3a8a;
    /* Deep Navy Blue */
}

.modal-btn-consulting:hover {
    background-color: #1e3a8a;
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-btn-media {
    background-color: #334155;
    /* Slate 700 */
}

.modal-btn-media:hover {
    background-color: #1e293b;
    /* Slate 800 */
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-btn:last-child {
    margin-bottom: 0;
}

.modal-text-link {
    display: block;
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.modal-text-link:hover {
    color: var(--text-primary);
}