/* Case Studies Page Styles */

.case-studies-page {
    --bg: #0a0a0c;
    --panel: #111114;
    --card: #16161a;
    --text: #ffffff;
    --muted: #dbdbdc;
    --accent: #3066f8;
    --accent-rgb: 48, 102, 248;
    --border: rgba(255, 255, 255, 0.08);
    --theme-border: rgba(255, 255, 255, 0.08);
    --accent-glow: rgba(48, 102, 248, 0.15);
}

.case-studies-page body {
    transition: none;
    background-color: var(--bg);
    color: var(--text);
}

.case-studies-page .logo-adaptive {
    filter: var(--logo-filter);
    transition: none;
}

.case-studies-page .glass-nav {
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--theme-border);
    transition: none;
}

.case-studies-page .custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--theme-border);
    border-radius: 10px;
}

.case-studies-page .bg-grid-pattern {
    background-image: radial-gradient(var(--theme-border) 1px, transparent 1px);
}

/* Case Card Base Styles */
.case-card {
    background: var(--panel);
    border: 1px solid var(--theme-border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.case-card:hover {
    border-color: var(--accent);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(var(--accent-rgb), 0.1);
}

/* Detail View Layouts */
.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.btn-back:hover {
    color: var(--accent);
}

/* -------------------------------------------------------------------------- */
/* NEW DESIGN STYLES (MATCHING REACT VERSION)                                */
/* -------------------------------------------------------------------------- */

/* Back Button (Circular) */
.back-button-circular {
    width: 48px;
    height: 48px;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0 !important;
}

.back-button-circular:hover {
    transform: scale(1.1) translateY(-2px);
}

/* Tags */
.tag-pill {
    padding: 0.2rem 0.7rem;
    background: rgba(var(--accent-rgb), 0.05);
    border: 1px solid rgba(var(--accent-rgb), 0.4);
    color: var(--accent);
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 9999px;
    display: inline-block;
}

/* Timeline Components */
.timeline-container {
    position: relative;
    max-width: 1050px;
    margin: 40px auto;
    padding: 10px 0;
}

.timeline-line {
    position: absolute;
    left: 15px;
    top: 25px;
    bottom: 50px;
    width: 4px;
    background: linear-gradient(180deg, #4285F4, #CD7F32, #C0C0C0, #FFD700);
    border-radius: 3px;
    z-index: 0;
    opacity: 0.8;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 50px;
    z-index: 1;
    opacity: 1; /* Animation removed as requested, so keep it visible */
}

.timeline-dot {
    position: absolute;
    left: 8px;
    top: 30px;
    width: 20px;
    height: 20px;
    border: 3px solid;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.2);
    border-radius: 50%;
}

.timeline-dot-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.timeline-header-outer {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 22px;
    padding-top: 20px;
    padding-left: 5px;
}

.timeline-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.timeline-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

.timeline-content {
    background: rgba(45, 45, 61, 0.4);
    border-radius: 1rem;
    padding: 22px 26px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.timeline-bullets {
    margin: 0;
    padding-left: 20px;
    color: #e0e5f0;
    font-size: 1.05rem;
    line-height: 1.7;
}

.timeline-bullets li {
    margin-bottom: 8px;
    list-style-type: disc;
    padding-left: 5px;
    text-align: left;
}

/* Security Section */
.security-section {
    background: rgba(45, 45, 61, 0.4);
    border-radius: 1rem;
    padding: 24px 30px;
    max-width: 850px;
    margin: 20px auto 0px auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.security-section:hover {
    box-shadow: 0 5px 25px rgba(0,0,0,0.6);
    transform: translateY(-3px);
}

.security-title {
    color: #00cc99;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.security-description {
    color: #e0e5f0;
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Section Card Refinement */
.section-card {
    background: #11111a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.25rem;
    padding: 2.25rem;
    transition: all 0.3s ease;
    height: 100%;
}

.section-card:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.2);
    transform: translateY(-3px);
}

.section-card p {
    margin-top: 0.5rem;
}

.spec-icon-box {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Changed from 1rem to 50% for circular look */
    flex-shrink: 0;
    overflow: hidden;
    /* Removed background-color: transparent !important to allow inline background colors */
    /* border: 1px solid currentColor; */
    backdrop-filter: blur(4px);
}



.spec-icon-box svg {
    position: relative;
    z-index: 1;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Case Card Icon Styling */
.case-card-icon-container {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.case-card-icon-container svg {
    width: 100%;
    height: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timeline-line {
        left: 10px;
    }
    .timeline-dot {
        left: 3px;
    }
    .timeline-item {
        padding-left: 35px;
    }
    .timeline-title {
        font-size: 1.25rem;
    }
}

/* Impact Metrics Grid */
.impact-metrics-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto 3rem auto;
}

/* Impact Metric Card */
.impact-metric-card {
    background: rgba(22, 22, 36, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 2.5rem;
    padding: 2.5rem 2rem;
    text-align: center;
    flex: 0 1 340px; /* Non-flexible width to ensure 3 per row */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 360px;
}

.impact-metric-card:hover {
    transform: translateY(-12px);
    background: rgba(30, 30, 50, 0.6);
    border-color: rgba(var(--accent-rgb), 0.4);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.impact-metric-card .spec-icon-box {
    width: 56px;
    height: 56px;
    margin-bottom: 2rem;
    border-radius: 50%;
}

.impact-metric-card .spec-icon-box span,
.impact-metric-card .spec-icon-box svg {
    width: 28px;
    height: 28px;
    font-size: 28px !important;
    display: block;
    line-height: 1;
}

.impact-metric-card .spec-icon-box span {
    font-family: 'Material Symbols Outlined' !important;
}

.metric-number {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1;
    letter-spacing: -0.02em;
}

.metric-label {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.metric-description {
    color: #c0c5d9;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    padding: 0 0.5rem;
}

/* Highlighted numbers in text */
.highlight-number {
    font-weight: 700;
}

@media (max-width: 640px) {
    .impact-metric-card {
        max-width: 100%;
        text-align: left;
        align-items: flex-start;
    }
    .impact-metric-card .spec-icon-box {
        margin-left: 0 !important;
        margin-right: auto !important;
    }
    .metric-number {
        font-size: 2.5rem;
    }
    .metric-label,
    .metric-description {
        text-align: left;
    }
    .timeline-bullets,
    .security-description {
        text-align: left !important;
        text-align-last: left !important;
        -moz-text-align-last: left;
    }
}

.timeline-bullets,
.security-description {
    text-align: left !important;
}

/* ─── Impact Comparison Table ─────────────────────────────── */
.impact-table-wrapper {
    max-width: 900px;
    margin: 0 auto;
    border-radius: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #11111a;
}

.impact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.impact-table thead {
    background: rgba(48, 102, 248, 0.08);
}

.impact-table th {
    padding: 1.1rem 1.5rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.impact-table th.metric-col {
    color: #ffffff;
}

.impact-table th.before-col {
    color: #f87171;
}

.impact-table th.after-col {
    color: #4ade80;
}

.impact-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.impact-table tbody tr:last-child {
    border-bottom: none;
}

.impact-table tbody tr:hover {
    background: rgba(48, 102, 248, 0.04);
}

.impact-table td {
    padding: 1rem 1.5rem;
    vertical-align: top;
    line-height: 1.6;
}

.impact-table td.metric-col {
    color: #ffffff;
    font-weight: 600;
    white-space: nowrap;
}

.impact-table td.before-col {
    color: #a3a3a3;
    font-style: italic;
}

.impact-table td.after-col {
    color: #4ade80;
    font-weight: 600;
}

/* Mobile responsive for impact table */
@media (max-width: 640px) {
    .impact-table-wrapper {
        border-radius: 1rem;
    }

    .impact-table {
        font-size: 0.85rem;
    }

    .impact-table th,
    .impact-table td {
        padding: 0.75rem 1rem;
    }

    .impact-table td.metric-col {
        white-space: normal;
    }
}
/* Utility classes */
.text-justify {
    text-align: justify;
    text-justify: inter-word;
    text-align-last: left;
    -moz-text-align-last: left;
    hyphens: auto;
    -webkit-hyphens: auto;
    word-spacing: -0.02em;
    line-height: 1.7; /* Better readability */
}

@media (max-width: 768px) {
    .text-justify {
        text-align: left;
        text-align-last: left;
        hyphens: none;
        -webkit-hyphens: none;
        word-spacing: normal;
    }
}

/* ─── Download PDF button ─────────────────────────────────── */
.btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.btn-download-pdf .material-symbols-outlined {
    font-size: 1.1rem;
}

.btn-download-pdf:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* Print-only furniture (PDF letterhead / footer) stays out of the page */
.print-only {
    display: none;
}

/* ─── Print / PDF export ──────────────────────────────────── */
/* The detail view doubles as the downloadable PDF -- "Download PDF" just
   calls window.print(). Everything below re-themes the dark UI to
   ink-on-paper, because browsers strip background graphics by default and
   the site's white-on-near-black would otherwise print as white-on-white. */
@media print {
    @page {
        size: A4;
        margin: 14mm 12mm;
    }

    .case-studies-page {
        --bg: #ffffff;
        --panel: #ffffff;
        --card: #ffffff;
        --text: #101014;
        --muted: #35353d;
        --border: #d4d4d8;
        --theme-border: #d4d4d8;
        --logo-filter: brightness(0);
    }

    html,
    body,
    .case-studies-page body {
        background: #ffffff !important;
        color: #101014 !important;
    }

    /* Entrance animations and hover transforms have no meaning on paper, and a
       half-applied fadeIn keyframe can render the whole page blank. */
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .view-transition,
    #detail-view,
    #case-detail-content {
        opacity: 1 !important;
        transform: none !important;
    }

    /* Site chrome is not part of the document */
    #header-root,
    #mobile-menu,
    #footer-root,
    .pagination-container,
    .back-button-circular,
    .btn-download-pdf,
    .no-print {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    main {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    /* Typography: ink on paper, sized for A4 rather than a viewport */
    h1, h2, h3, h4,
    .text-white,
    .text-theme-text,
    .accent-gradient-text,
    strong {
        color: #101014 !important;
    }

    p,
    .text-theme-muted {
        color: #35353d !important;
    }

    .text-h2 { font-size: 17pt !important; }
    .text-h3 { font-size: 13pt !important; }
    .text-h4 { font-size: 11pt !important; }
    .text-body-lg { font-size: 10.5pt !important; line-height: 1.5 !important; }
    .text-body { font-size: 9.5pt !important; line-height: 1.5 !important; }
    .text-caption { font-size: 9pt !important; }

    .accent-line-gradient {
        background: #3066f8 !important;
    }

    /* Keep related content together across page boundaries */
    .section-card,
    .impact-metric-card,
    .impact-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    h2, h3, h4 {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* Cards: flatten hover/elevation effects into a plain outlined block */
    .section-card {
        background: #ffffff !important;
        border: 1px solid #d4d4d8 !important;
        border-radius: 8px !important;
        padding: 0.8rem 1rem !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .case-studies-page .py-8 {
        padding-top: 0.45rem !important;
        padding-bottom: 0.45rem !important;
    }

    /* Icon chips carry inline dark backgrounds -- override with !important */
    .spec-icon-box {
        width: 32px !important;
        height: 32px !important;
        background: #ffffff !important;
        color: #3066f8 !important;
        border: 1px solid #3066f8 !important;
        backdrop-filter: none !important;
    }

    .spec-icon-box svg {
        width: 17px !important;
        height: 17px !important;
    }

    /* An A4 text column is narrower than the md: breakpoint, so cards would
       otherwise fall back to the stacked mobile layout. Force the icon-left
       row layout -- it reads better as a document and costs fewer pages. */
    .section-card > div {
        flex-direction: row !important;
        align-items: flex-start !important;
        text-align: left !important;
        gap: 0.8rem !important;
    }

    .tag-pill {
        background: #ffffff !important;
        border: 1px solid #3066f8 !important;
        color: #1d4ed8 !important;
    }

    /* The list view has a hardcoded translucent dark fill, which prints as a
       heavy grey block. Flatten it for anyone who prints the index page. */
    .case-card,
    .case-studies-page .case-card {
        background: #ffffff !important;
        border: 1px solid #d4d4d8 !important;
        border-radius: 10px !important;
        padding: 1.1rem 1.3rem !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        transform: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Impact table: no horizontal scroller on paper, header repeats per page */
    .impact-table-wrapper {
        max-width: none !important;
        overflow: visible !important;
        background: #ffffff !important;
        border: 1px solid #d4d4d8 !important;
        border-radius: 8px !important;
    }

    .impact-table {
        font-size: 9pt !important;
    }

    .impact-table thead {
        display: table-header-group;
        background: #ffffff !important;
    }

    .impact-table th {
        padding: 0.6rem 0.8rem !important;
        border-bottom: 1.5px solid #101014 !important;
    }

    .impact-table td {
        padding: 0.55rem 0.8rem !important;
    }

    .impact-table tbody tr {
        border-bottom: 1px solid #e4e4e7 !important;
    }

    .impact-table th.metric-col,
    .impact-table td.metric-col {
        color: #101014 !important;
    }

    .impact-table td.metric-col {
        white-space: normal !important;
    }

    .impact-table th.before-col,
    .impact-table td.before-col {
        color: #b91c1c !important;
    }

    .impact-table th.after-col,
    .impact-table td.after-col {
        color: #15803d !important;
    }

    /* PDF letterhead + footer */
    .case-pdf-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding-bottom: 0.6rem;
        margin-bottom: 1.4rem;
        border-bottom: 1px solid #d4d4d8;
    }

    .case-pdf-header img {
        height: 26px;
        width: auto;
        filter: brightness(0);
    }

    .case-pdf-header span {
        font-size: 7.5pt;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.14em;
        color: #35353d;
    }

    .case-pdf-footer {
        margin-top: 0.5rem;
        padding-top: 0.35rem;
        border-top: 1px solid #d4d4d8;
        font-size: 7.5pt;
        color: #6b6b75;
        text-align: center;
    }
}
