/* ──────────────────────────────────────────────────────────────────────
   /finance editorial broadsheet styling.

   Goals:
   - Two-column layout (main article column + sidebar) at desktop widths.
   - Higher information density than the homepage thumbnail grid: the
     article list below the lead is a stack of headline + summary + meta
     with no thumbnail. Closer to MarketWatch / FT than to the rest of AT.
   - All selectors are scoped under .finance-* so this sheet doesn't
     bleed into the existing thumbnail-grid pages.
   - Small section badges (markets/economy/industry, science/health/technology)
     are reused on /section/science-tech for a consistent vocabulary.

   Breakpoints match the rest of the site:
     >= 1000px  → two columns (main + sidebar)
     <  1000px  → stacked (main, then sidebar)
   ────────────────────────────────────────────────────────────────────── */

/* ─── Masthead ─────────────────────────────────────────────────────── */

.finance-masthead {
    border-top: 3px solid #0a2540;
    border-bottom: 1px solid #ddd;
    padding: 1rem 1rem 0.5rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
}

.finance-masthead-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.finance-masthead-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0;
    color: #0a2540;
    letter-spacing: -0.5px;
}

.finance-masthead-tagline {
    font-style: italic;
    color: #555;
    margin: 0;
    font-size: 1rem;
}

.finance-ticker-search {
    margin: 0 0 0.5rem 0 !important;
    padding: 0 !important;
    max-width: 480px;
}

/* ─── Two-column layout ────────────────────────────────────────────── */

.finance-layout {
    max-width: 1280px;
    margin: 1.5rem auto 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1000px) {
    .finance-layout {
        grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
        gap: 2.5rem;
    }
}

.finance-main {
    min-width: 0;
}

.finance-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* ─── Lead story ───────────────────────────────────────────────────── */

/* Lead story — image + text side-by-side on desktop, stacked on
   mobile. The image is constrained to a fixed column width so the
   text column gets predictable space regardless of image aspect. */
.finance-lead {
    border-bottom: 2px solid #0a2540;
    padding-bottom: 1.25rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 600px) {
    .finance-lead {
        grid-template-columns: 280px 1fr;
        gap: 1.25rem;
    }
}

.finance-lead-thumb {
    display: block;
    overflow: hidden;
    border-radius: 2px;
}

.finance-lead-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Text column — badge, title, summary, meta stacked vertically.
   align-items: flex-start keeps the badge as a small pill rather
   than stretching it to the column width. */
.finance-lead-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
}

/* Title-only links: only the headline and image are clickable,
   not the surrounding whitespace / timestamp / summary. Tickers
   and tags are separate <a> elements with their own targets. */
.finance-lead-title a,
.finance-article-title a {
    color: inherit;
    text-decoration: none;
}

.finance-lead-title a:hover,
.finance-article-title a:hover {
    color: #0a2540;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.finance-lead-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.7rem;
    line-height: 1.2;
    margin: 0;
    font-weight: 700;
    color: #1a1a1a;
}

/* Tag links in the meta line */
.finance-tag {
    color: #555;
    text-decoration: none;
    font-size: 0.85rem;
}
.finance-tag:hover {
    color: #0a2540;
    text-decoration: underline;
}

.finance-lead-summary {
    margin: 0;
    color: #444;
    font-size: 0.95rem;
    line-height: 1.45;
}

/* ─── Article list (below the lead) ────────────────────────────────── */

/* Dense, no-thumbnail stack. This is the MarketWatch / FT pattern that
   makes the page read as "a lot of finance news at a glance" rather
   than "a few articles surrounded by white space". */
.finance-article-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid #eee;
}

.finance-article-item {
    border-bottom: 1px solid #eee;
}

.finance-article-item {
    padding: 0.85rem 0;
}

.finance-article-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    line-height: 1.25;
    margin: 0.25rem 0 0.3rem 0;
    font-weight: 600;
    color: #1a1a1a;
}

.finance-article-summary {
    margin: 0 0 0.35rem 0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
    /* Single-line truncation on wide screens; the list lives or dies on
       scannability, and runaway summaries kill that. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Meta line + section badges ───────────────────────────────────── */

.finance-meta {
    margin: 0;
    font-size: 0.78rem;
    color: #888;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.finance-meta-sep {
    color: #bbb;
}

.finance-ticker {
    color: #0a2540;
    font-family: Menlo, Consolas, monospace;
    font-size: 0.75rem;
    text-decoration: none;
}
a.finance-ticker:hover {
    text-decoration: underline;
}

.finance-section-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 2px;
    color: #fff;
    background: #888;
    vertical-align: middle;
    margin-right: 0.35rem;
    white-space: nowrap;
}

/* Per-section colors. Markets is the navy that carries the page;
   economy and industry pick up complementary muted hues so the
   eye can sort them at a glance without becoming a circus. */
.finance-section-badge--markets    { background: #0a2540; }
.finance-section-badge--economy    { background: #5a7a9a; }
.finance-section-badge--industry   { background: #7a5a3a; }
.finance-section-badge--science    { background: #2e7d32; }
.finance-section-badge--health     { background: #c62828; }
.finance-section-badge--technology { background: #1565c0; }

/* ─── Sidebar rails ────────────────────────────────────────────────── */

.finance-rail {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    padding: 0.85rem 0.95rem 0.5rem 0.95rem;
}

.finance-rail-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 700;
    color: #0a2540;
    margin: 0 0 0.6rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #0a2540;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.finance-rail-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.finance-rail-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.45rem 0;
    border-bottom: 1px dotted #e5e5e5;
    font-size: 0.82rem;
}
.finance-rail-item:last-child {
    border-bottom: none;
}

.finance-rail-tag {
    font-family: Menlo, Consolas, monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: #0a2540;
    background: #e8eef5;
    padding: 1px 5px;
    border-radius: 2px;
    white-space: nowrap;
}

.finance-rail-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.1rem;
}

.finance-rail-name {
    color: #1a1a1a;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}
a.finance-rail-name:hover {
    text-decoration: underline;
}

.finance-rail-detail {
    color: #777;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finance-rail-date {
    color: #888;
    font-size: 0.7rem;
    font-family: Menlo, Consolas, monospace;
    white-space: nowrap;
}

/* Whole-row link wrapper for past econ-events (parallel to the existing
   .filings-strip-link pattern). display:contents so the <a> doesn't
   break the grid. */
.finance-rail-link {
    display: contents;
    color: inherit;
    text-decoration: none;
}
.finance-rail-item:has(> .finance-rail-link:hover) {
    background: #f5f9ff;
}
.finance-rail-item:has(> .finance-rail-link:hover) .finance-rail-name {
    text-decoration: underline;
}

/* ─── Tools stub card ──────────────────────────────────────────────── */

.finance-rail--tools .finance-tool-stub {
    grid-template-columns: 1fr auto;
    color: #999;
    font-style: italic;
}

.finance-tool-stub .finance-rail-detail {
    color: #aaa;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Mobile tab strip ────────────────────────────────────────────── */

/* On mobile (< 1000px), a two-tab strip lets users switch between the
   article list and the data widgets (filings + econ events) without
   scrolling past all articles. Hidden on desktop where the two-column
   layout already shows both. */

.finance-mobile-tabs {
    display: flex;
    gap: 0;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
    border-bottom: 2px solid #0a2540;
}

.finance-mobile-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.3px;
    transition: color 0.15s, border-color 0.15s;
}

.finance-mobile-tab:hover {
    color: #0a2540;
}

.finance-mobile-tab.active {
    color: #0a2540;
    border-bottom-color: #0a2540;
}

/* Hide the tab strip on desktop — the two-column layout is sufficient. */
@media (min-width: 1000px) {
    .finance-mobile-tabs {
        display: none;
    }
}

/* On mobile, the inactive panel is hidden. On desktop, both panels are
   always visible regardless of Alpine state (the class is still bound
   but overridden by the media query). */
@media (max-width: 999px) {
    .finance-mobile-hidden {
        display: none !important;
    }
}

/* ─── /section/science-tech subnav ─────────────────────────────────── */

.science-tech-subnav {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.4rem;
}
.science-tech-subnav a {
    color: #0a2540;
    text-decoration: none;
}
.science-tech-subnav a:hover {
    text-decoration: underline;
}
