﻿/* Weekly earnings calendar */
.calweek-page {
    max-width: 100%;
}

.calweek-head {
    margin-bottom: 16px;
}

    .calweek-head h1 {
        font-size: 24px;
        font-weight: 800;
        color: var(--text);
        margin: 0 0 2px;
    }

.calweek-title .tm {
    font-size: 0.35em;
    vertical-align: super;
    line-height: 0;
}

/* the H2 reads as a continuation of the H1, so it sits quieter */
.calweek-h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 12px;
}

/* the SEO paragraph: plain sentence with a logo chip after each company name.
   Full container width so it lines up with the calendar below it. */
.calweek-intro {
    font-size: 15px;
    line-height: 2.1;
    color: var(--text);
    margin: 0 0 12px;
}

/* inline-flex drops the whitespace text nodes between the chip, the name and the
   ::after separator, so the comma sits tight against the name.
   align-items:center lines the name up with the middle of the chip, and
   vertical-align:middle lines the whole item up with the lead-in sentence text. */
.calweek-item {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

    .calweek-item::after {
        content: attr(data-sep);
    }

.calweek-name {
    font-weight: 600;
    margin-left: .35em;
}

/* small logo + ticker button, same chip used on The Drift */
.ew-tchip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem .2rem .3rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 120ms ease;
}

    .ew-tchip:hover {
        border-color: var(--ew-color);
    }

    .ew-tchip:focus-visible {
        outline: 2px solid var(--ew-color);
        outline-offset: 2px;
    }

.ew-tchip-logo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border);
    object-fit: contain;
    flex: 0 0 auto;
}

.calweek-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.calweek-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.calweek-navbtn {
    display: inline-block;
    border: 1px solid var(--border);
    background: var(--surface, transparent);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 120ms ease;
}

    .calweek-navbtn:hover {
        background: color-mix(in srgb, var(--text) 8%, transparent);
    }

.calweek-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.calweek-loading {
    color: var(--text-muted);
    padding: 40px;
    text-align: center;
}

/* ticker text for screen readers and crawlers; the logos are background images */
.cw-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* the grid, with ONE watermark behind everything */
.calweek-grid {
    position: relative;
    margin-top: 8px;
    overflow-x: auto;
}

    .calweek-grid::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url('/logo.svg');
        background-repeat: no-repeat;
        background-position: center center;
        background-size: 90% auto;
        opacity: .10; /* light mode */
        pointer-events: none;
        z-index: 0;
    }

[data-theme="dark"] .calweek-grid::before {
    opacity: .25;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .calweek-grid::before {
        opacity: .25;
    }
}

.cw-table {
    position: relative;
    z-index: 1;
    min-width: 640px;
    background: transparent;
}

.cw-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

/* day header */
.cw-dayrow .cw-daycol {
    text-align: center;
    padding: 8px 0 4px;
}

.cw-dayname {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.cw-daydate {
    font-size: 12px;
    color: var(--text-muted);
}

/* period sub-headers */
.cw-periodgroup {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.cw-period {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding: 2px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* logo strips */
.cw-logogroup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-left: 1px solid var(--border);
}

    .cw-logogroup:last-child {
        border-right: 1px solid var(--border);
    }

.cw-cell {
    display: block;
    position: relative; /* anchors the .cw-sr text */
    min-height: 120px;
    padding: 0 6px;
    box-sizing: border-box;
    border-right: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
    transition: background-color 160ms ease;
    background: transparent;
    /* logo strip as a centered background image (no right-click "Save image") */
    background-repeat: no-repeat;
    background-position: center top;
    background-size: 96px auto; /* width fixed; the server sets the cell height to fit the strip */
    /* block selection / drag of the whole cell */
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none; /* iOS: no long-press save menu */
}

    .cw-cell.cw-has {
        cursor: pointer;
    }

        .cw-cell.cw-has:hover {
            background-color: color-mix(in srgb, var(--ew-color) 18%, transparent);
        }

/* the mobile card container only shows on mobile */
.cw-mobile {
    display: none;
}

@media (max-width: 700px) {
    /* hide the desktop 5-column strip table; show stacked day-cards */
    .cw-table {
        display: none;
    }

    .cw-mobile {
        display: block;
        position: relative;
        z-index: 1;
    }

    .calweek-head h1 {
        font-size: 21px;
    }

    .calweek-h2 {
        font-size: 15px;
    }

    .calweek-intro {
        font-size: 14px;
        line-height: 2.2;
    }

    .cw-daycard {
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--surface, transparent);
        margin-bottom: 14px;
        overflow: hidden;
    }

    .cw-daycard-head {
        display: flex;
        align-items: baseline;
        gap: 8px;
        padding: 10px 14px;
        background: color-mix(in srgb, var(--ew-color) 10%, transparent);
        border-bottom: 1px solid var(--border);
    }

    .cw-daycard-name {
        font-size: 16px;
        font-weight: 800;
        color: var(--text);
    }

    .cw-daycard-date {
        font-size: 13px;
        color: var(--text-muted);
        font-weight: 600;
    }

    .cw-sect {
        padding: 10px 14px 14px;
    }

        .cw-sect + .cw-sect {
            border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
        }

    .cw-sect-label {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        margin-bottom: 10px;
    }

    /* one clickable composite image per period (from /api/gridLogos, 2x5) */
    .cw-gridimg {
        display: block;
        text-decoration: none;
        -webkit-touch-callout: none;
    }

    .cw-gridimg-png {
        display: block;
        width: 100%;
        height: auto;
        -webkit-user-drag: none;
        user-select: none;
    }

        /* no src yet (hydrating) or a failed load: don't show a broken-image glyph */
        .cw-gridimg-png:not([src]) {
            min-height: 90px;
        }

    .cw-sect-empty {
        color: var(--text-muted);
        font-size: 14px;
    }

    /* home-only: link to the full week (home mobile shows just today + next 2 days) */
    .cw-fullweek {
        display: block;
        text-align: center;
        margin: 4px 0 8px;
        padding: 10px;
        font-size: 14px;
        font-weight: 700;
        color: var(--ew-color);
        text-decoration: none;
        border: 1px solid var(--border);
        border-radius: 12px;
    }

        .cw-fullweek:hover {
            background: color-mix(in srgb, var(--ew-color) 10%, transparent);
        }
}

/* Home page weekly calendar */
.home-cal {
    margin: 0 0 24px;
}

.home-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.home-cal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

    .home-cal-title .tm {
        font-size: 0.35em;
        vertical-align: super;
        line-height: 0;
    }
