/* ============================================================
   bada.news — Maritime News Platform
   Aesthetic: Editorial newspaper meets nautical chart
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --newsprint: #f4f0e8;
    --print-black: #1a1a1a;
    --ink-navy: #2a3d50;
    --editorial-red: #c41e3a;
    --chart-blue: #1e5f8a;
    --steel-gray: #6b7d8e;
    --log-paper: #e8e4dc;
    --signal-yellow: #ffd700;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--newsprint);
    color: var(--print-black);
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* --- Breaking News Banner --- */
#breaking-banner {
    background-color: var(--editorial-red);
    color: #ffffff;
    padding: 6px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    overflow: hidden;
    white-space: nowrap;
}

.banner-label {
    background-color: var(--signal-yellow);
    color: var(--print-black);
    padding: 2px 8px;
    font-weight: 500;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.banner-text {
    animation: ticker 30s linear infinite;
    display: inline-block;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* --- Masthead --- */
#masthead {
    padding: 32px 48px 24px;
    text-align: center;
    position: relative;
}

.masthead-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.masthead-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--steel-gray);
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.masthead-rule-top,
.masthead-rule-bottom {
    height: 0;
    border: none;
    border-top: 2px solid var(--print-black);
    margin: 0 auto;
    width: 100%;
}

.masthead-rule-top::after,
.masthead-rule-bottom::before {
    content: '';
    display: block;
    border-top: 1px solid var(--print-black);
    margin-top: 3px;
}

.masthead-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.04em;
    color: var(--print-black);
    margin: 12px 0 4px;
    line-height: 1.1;
}

.masthead-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--steel-gray);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.masthead-tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--steel-gray);
    letter-spacing: 0.08em;
    margin-top: 16px;
}

/* --- Weather Vane --- */
.weather-vane {
    position: absolute;
    top: 28px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.vane-svg {
    display: block;
}

.vane-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: var(--steel-gray);
    letter-spacing: 0.1em;
}

#vane-needle {
    transform-origin: 30px 30px;
    transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Lead Headline --- */
#lead-headline {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 48px 20px;
    border-bottom: 1px solid var(--ink-navy);
}

.lead-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 3vw, 3rem);
    line-height: 1.15;
    color: var(--print-black);
    margin-bottom: 12px;
}

.lead-subhead {
    font-family: 'Source Serif 4', serif;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--ink-navy);
    margin-bottom: 12px;
    font-style: italic;
}

.lead-byline {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    color: var(--steel-gray);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

.byline-separator {
    color: var(--ink-navy);
}

/* --- Content Wrapper --- */
#content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 48px 48px;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
}

/* --- News Grid --- */
#news-grid {
    min-width: 0;
}

/* --- Lead Article with Multi-Column --- */
.article-lead {
    margin-bottom: 24px;
}

.columns-text {
    column-count: 3;
    column-gap: 24px;
    column-rule: 1px solid var(--ink-navy);
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    font-size: 0.95rem;
}

.columns-text p {
    margin-bottom: 0.8em;
    break-inside: avoid;
}

.columns-text p + p {
    text-indent: 1.5em;
}

/* Drop Cap */
.drop-cap::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 4em;
    line-height: 0.8;
    padding-right: 8px;
    padding-top: 4px;
    color: var(--print-black);
}

/* --- Section Rule --- */
.section-rule {
    height: 0;
    border: none;
    border-top: 2px solid var(--print-black);
    margin: 4px 0 24px;
}

.section-rule::after {
    content: '';
    display: block;
    border-top: 1px solid var(--print-black);
    margin-top: 3px;
}

/* --- Articles Grid --- */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: none;
}

.article-medium,
.article-small {
    padding: 16px 20px;
    border-right: 1px solid var(--ink-navy);
    border-bottom: 1px solid rgba(42, 61, 80, 0.3);
}

.article-medium:nth-child(3n),
.article-small:nth-child(3n) {
    border-right: none;
}

.article-headline {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
    line-height: 1.25;
    color: var(--print-black);
    margin-bottom: 6px;
}

.article-headline em {
    font-style: italic;
}

.article-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: var(--steel-gray);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.article-excerpt {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--print-black);
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

/* Medium articles - larger treatment */
.article-medium .article-headline {
    font-size: clamp(1rem, 1.8vw, 1.35rem);
}

.article-medium .article-excerpt {
    font-size: 0.92rem;
}

/* --- Maritime Sidebar --- */
#maritime-sidebar {
    background-color: var(--log-paper);
    padding: 20px 16px;
    position: relative;
    border-left: 2px solid var(--ink-navy);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
}

/* Nautical chart grid background */
#maritime-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(30, 95, 138, 0.05) 39px,
            rgba(30, 95, 138, 0.05) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            rgba(30, 95, 138, 0.05) 39px,
            rgba(30, 95, 138, 0.05) 40px
        );
    pointer-events: none;
}

.sidebar-section {
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-heading {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--chart-blue);
    border-bottom: 1px solid var(--chart-blue);
    padding-bottom: 4px;
    margin-bottom: 12px;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table td {
    padding: 3px 0;
    font-size: 0.72rem;
    color: var(--print-black);
    vertical-align: top;
}

.data-table td:first-child {
    color: var(--steel-gray);
    width: 45%;
    white-space: nowrap;
}

.data-table td:last-child {
    text-align: right;
    font-weight: 500;
}

/* Tide Chart */
.tide-chart {
    margin-bottom: 12px;
}

.tide-svg {
    width: 100%;
    height: auto;
    display: block;
}

.tide-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--steel-gray);
    margin-top: 2px;
}

/* Vessel Table */
.vessel-table .vessel-row td {
    padding: 4px 0;
    border-bottom: 1px dotted rgba(42, 61, 80, 0.2);
}

.vessel-name {
    font-size: 0.68rem;
    color: var(--print-black);
}

.vessel-status {
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-align: right;
}

.vessel-status.arriving {
    color: var(--chart-blue);
}

.vessel-status.departing {
    color: var(--editorial-red);
}

.vessel-status.anchor {
    color: var(--steel-gray);
}

/* Compass Widget */
.compass-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.compass-svg {
    display: block;
}

#compass-needle {
    transform-origin: 50px 50px;
    transition: transform 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.compass-reading {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--print-black);
    letter-spacing: 0.08em;
}

/* Coordinate Display */
.coord-display {
    font-size: 0.72rem;
}

.coord-line {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dotted rgba(42, 61, 80, 0.15);
}

.coord-label {
    color: var(--steel-gray);
    font-weight: 500;
    letter-spacing: 0.1em;
}

/* --- Footer --- */
#site-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 48px 32px;
}

.footer-rule {
    height: 0;
    border: none;
    border-top: 2px solid var(--print-black);
    margin-bottom: 16px;
}

.footer-rule::after {
    content: '';
    display: block;
    border-top: 1px solid var(--print-black);
    margin-top: 3px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-col {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--steel-gray);
}

.footer-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--print-black);
    display: block;
    margin-bottom: 4px;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bullet-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--ink-navy);
    vertical-align: middle;
}

.footer-coord {
    text-align: right;
    letter-spacing: 0.04em;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    #content-wrapper {
        grid-template-columns: 1fr;
        padding: 24px 32px 48px;
    }

    #maritime-sidebar {
        border-left: none;
        border-top: 2px solid var(--ink-navy);
    }

    .columns-text {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    #masthead {
        padding: 24px 20px 20px;
    }

    #lead-headline {
        padding: 20px 20px 16px;
    }

    #content-wrapper {
        padding: 20px 20px 40px;
    }

    .columns-text {
        column-count: 1;
    }

    .articles-grid {
        grid-template-columns: 1fr;
    }

    .article-medium,
    .article-small {
        border-right: none;
        border-bottom: 1px solid var(--ink-navy);
        padding: 16px 0;
    }

    .masthead-meta-top {
        flex-direction: column;
        gap: 4px;
    }

    .weather-vane {
        position: static;
        margin: 16px auto 0;
    }

    .lead-title {
        font-size: 1.5rem;
    }

    .footer-content {
        flex-direction: column;
    }

    .footer-coord {
        text-align: left;
    }

    #site-footer {
        padding: 0 20px 24px;
    }
}

/* --- Animations for Maritime Data --- */
@keyframes dataFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.sidebar-section {
    animation: dataFadeIn 0.6s ease-out both;
}

.sidebar-section:nth-child(2) { animation-delay: 0.1s; }
.sidebar-section:nth-child(3) { animation-delay: 0.2s; }
.sidebar-section:nth-child(4) { animation-delay: 0.3s; }
.sidebar-section:nth-child(5) { animation-delay: 0.4s; }

/* Data value update flash */
.data-flash {
    animation: flashValue 0.6s ease-out;
}

@keyframes flashValue {
    0% { color: var(--chart-blue); }
    100% { color: var(--print-black); }
}

/* Tide line drawing animation */
#tide-line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawTide 2s ease-out 0.5s forwards;
}

@keyframes drawTide {
    to { stroke-dashoffset: 0; }
}
