/* ================================================================
   DOWNLOADS.CSS — Pure CSS, no PHP.
   Multi-file expandable cells. Two sections: Offer + Takeover.
================================================================ */

/* ----------------------------------------------------------------
   PAGE HERO
---------------------------------------------------------------- */
.dl-hero {
    position: relative;
    background: var(--color-blue);
    padding: 160px 0 120px;
    overflow: hidden;
}
.dl-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
            -58deg, transparent, transparent 72px,
            rgba(255,255,255,0.015) 72px, rgba(255,255,255,0.015) 73px
    );
    pointer-events: none;
}
.dl-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--color-orange);
    margin-bottom: 1.2rem;
}
.dl-hero__eyebrow::before {
    content: '';
    display: block;
    width: 28px;
    height: 2px;
    background: var(--color-orange);
    flex-shrink: 0;
}
.dl-hero__title {
    font-size: clamp(3rem, 7vw, 6rem);
    font-weight: 600;
    line-height: 1.02;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: #fff;
    margin: 0 0 1.5rem;
}
.dl-hero__sub {
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    color: rgba(255,255,255,0.72);
    max-width: 640px;
    line-height: 1.75;
    margin: 0;
}
.dl-hero__sub a {
    color: var(--color-orange);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.dl-hero__slice {
    position: absolute;
    bottom: -2px; left: -2px; right: -2px;
    height: 80px;
    background: #fff;
    clip-path: polygon(0 100%, 100% 30%, 100% 100%);
    pointer-events: none;
}

/* ----------------------------------------------------------------
   BODY
---------------------------------------------------------------- */
.dl-body { padding: 70px 0 100px; }

.dl-section { margin-bottom: 80px; }
.dl-section:last-child { margin-bottom: 0; }

.dl-section__title {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: var(--color-primary);
    margin: 0 0 6px;
    display: inline-block;
}
.dl-section__title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--color-orange);
    margin-top: 8px;
}
.dl-section__title--takeover::after { background: #c0392b; }

.dl-section__sub {
    color: var(--color-muted);
    font-size: 0.92rem;
    margin: 14px 0 28px;
}

/* ----------------------------------------------------------------
   GRID WRAPPER
---------------------------------------------------------------- */
.dl-grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}
.dl-scroll-hint {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    margin-bottom: 10px;
}

/* ----------------------------------------------------------------
   CSS GRID
---------------------------------------------------------------- */
.dl-grid {
    display: grid;
    grid-template-columns:
        minmax(200px, 260px)
        repeat(calc(var(--col-count, 2) - 1), minmax(160px, 1fr));
    min-width: 560px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: visible; /* allow panels to escape */
    box-shadow: 0 2px 24px rgba(4, 47, 101, 0.07);
    position: relative;
}

/* ----------------------------------------------------------------
   BASE CELL
---------------------------------------------------------------- */
.dl-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    opacity: 0;
    transform: translateY(8px);
    animation: dlIn 0.38s ease forwards;
}
.dl-cell.is-last-row { border-bottom: none; }
.dl-cell.is-last-col { border-right: none; }

/* Rounded corners handled by border-radius + overflow on .dl-grid container */

/* ----------------------------------------------------------------
   CORNER
---------------------------------------------------------------- */
.dl-cell--corner {
    background: var(--color-blue);
    border-right-color: rgba(255,255,255,0.12);
    border-bottom-color: rgba(255,255,255,0.15);
    animation-delay: 0s;
    border-radius: 10px 0 0 0;
}
.dl-grid--to .dl-cell--corner { background: #1a1a2e; }

/* ----------------------------------------------------------------
   HEADER CELLS
---------------------------------------------------------------- */
.dl-cell--header {
    flex-direction: column;
    gap: 8px;
    background: var(--color-blue);
    border-right-color: rgba(255,255,255,0.12);
    border-bottom-color: rgba(255,255,255,0.15);
    padding: 18px 14px;
    text-align: center;
    animation-delay: calc(var(--ci, 0) * 0.05s + 0.04s);
}
.dl-grid--to .dl-cell--header { background: #1a1a2e; }

.dl-header__label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.45;
    text-align: center;
}

/* ----------------------------------------------------------------
   COMPANY CELLS
---------------------------------------------------------------- */
.dl-cell--company {
    justify-content: flex-start;
    gap: 10px;
    background: rgba(4, 47, 101, 0.03);
    border-right: 1px solid var(--color-border);
    padding: 16px 18px;
    animation-delay: calc(var(--ri, 0) * 0.06s + 0.1s);
}
.dl-grid--to .dl-cell--company { background: rgba(26,26,46,0.03); }

.dl-company__index {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--color-orange);
    flex-shrink: 0;
}
.dl-grid--to .dl-company__index { color: #c0392b; }

.dl-company__name {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.35;
}

/* ----------------------------------------------------------------
   FILE CELLS
---------------------------------------------------------------- */
.dl-cell--file {
    background: #fff;
    border-right-color: var(--color-border);
    transition: background 0.18s ease;
    animation-delay: calc(var(--di, 0) * 0.025s + 0.12s);
    overflow: visible;
}

/* Alternate row tinting using --ri CSS variable */
.dl-cell--file:has(~ .dl-cell--company:nth-child(odd)) {
    background: rgba(4, 47, 101, 0.013);
}

.dl-cell--file.is-expanded {
    background: rgba(4, 47, 101, 0.04);
    z-index: 10;
}

/* ----------------------------------------------------------------
   SINGLE FILE DOWNLOAD BUTTON
---------------------------------------------------------------- */
.dl-download-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 68px;
    padding: 11px 0 9px;
    border-radius: 7px;
    border: 1.5px solid var(--color-border);
    background: #fff;
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.dl-download-btn:hover {
    border-color: var(--color-blue);
    background: var(--color-blue);
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(4, 47, 101, 0.2);
}
.dl-grid--to .dl-download-btn:hover {
    border-color: #1a1a2e;
    background: #1a1a2e;
}

.dl-download-btn__icon {
    color: var(--color-blue);
    display: flex;
    transition: color 0.2s, transform 0.2s;
}
.dl-grid--to .dl-download-btn__icon { color: #1a1a2e; }
.dl-download-btn:hover .dl-download-btn__icon { color: #fff; transform: translateY(2px); }
/* ----------------------------------------------------------------
   MULTI-FILE STACK — stacked download buttons in one cell
---------------------------------------------------------------- */
.dl-multi {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
    align-items: center;
    padding: 4px 0;
}

/* ----------------------------------------------------------------
   NOT AVAILABLE
---------------------------------------------------------------- */
.dl-na {
    font-size: 1.1rem;
    color: #ddd;
    font-weight: 300;
    user-select: none;
}

/* ----------------------------------------------------------------
   EMPTY STATE
---------------------------------------------------------------- */
.dl-empty {
    padding: 40px;
    background: var(--color-bg-light);
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    color: var(--color-muted);
    font-size: 0.92rem;
    text-align: center;
    margin-bottom: 24px;
}

/* ----------------------------------------------------------------
   ENTRANCE ANIMATION
---------------------------------------------------------------- */
@keyframes dlIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------
   REDUCED MOTION
---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .dl-cell { animation: none; opacity: 1; transform: none; }
    .dl-download-btn,
    .dl-expand-btn,
    .dl-expand-panel { transition: none; animation: none; }
}

/* ----------------------------------------------------------------
   RESPONSIVE
---------------------------------------------------------------- */
@media (max-width: 1279px) {
    .dl-hero { padding: 130px 0 100px; }
}

@media (max-width: 900px) {
    .dl-scroll-hint { display: flex; }
    .dl-grid {
        grid-template-columns:
            minmax(160px, 200px)
            repeat(calc(var(--col-count, 2) - 1), minmax(130px, 1fr));
    }
    .dl-cell { padding: 12px 10px; }
    .dl-company__name { font-size: 0.8rem; }
}

@media (max-width: 768px) {
    .dl-body { padding: 50px 0 80px; }
    .dl-hero { padding: 110px 0 80px; }
    .dl-hero__slice { height: 48px; }
    .dl-section { margin-bottom: 56px; }

    .dl-download-btn,
    .dl-expand-btn { width: 48px; padding: 8px 0; }

    .dl-download-btn__text,
    .dl-expand-btn__text { display: none; }

    .dl-download-btn__icon svg,
    .dl-expand-btn__icon svg { width: 17px; height: 17px; }

    .dl-expand-panel { min-width: 200px; max-width: 280px; }
}