/* ============================================
   BASE STYLES — myndfocal News
   Resets, typography, layout, header, footer
   ============================================ */

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--paper);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ── Body ── */
body {
    font-family: var(--font-body);
    background: linear-gradient(180deg, var(--paper-warm) 0%, var(--paper) 12rem);
    background-attachment: fixed;
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    line-height: 1.3;
}

.main-content h1,
.main-content h2,
.main-content h3,
.main-content .section-title {
    font-family: var(--font-heading);
}

/* ── Site Header (Glassmorphism) ── */
.site-header {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 clamp(12px, 4vw, 24px);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(10px, 2vw, 14px) 0;
    flex-wrap: wrap;
    gap: 12px 16px;
}

/* ── Logo ── */
.logo-wrap {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--ink);
    transition: opacity var(--duration-fast) ease;
}

.logo-wrap:hover {
    opacity: 0.85;
}

.logo-img {
    height: clamp(48px, 12vw, 64px);
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

/* ── Header Actions ── */
.header-actions {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 16px);
    margin-left: auto;
    flex-wrap: wrap;
    min-width: 0;
}

.header-datetime {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 500;
    font-family: var(--font-ui);
}

.header-datetime .date-part {
    color: var(--ink);
    font-weight: 600;
}

/* ── Dark mode toggle ── */
.theme-toggle {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 7px 10px;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, transform var(--duration-fast) ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    transform: scale(1.08);
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: inline;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: inline;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* ── Header nav links ── */
.header-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
}

.header-link:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.header-link--accent {
    color: var(--accent);
}

/* ── Search form ── */
.search-form {
    display: flex;
    max-width: 280px;
    min-width: 0;
    flex: 1 1 200px;
}

.search-form input {
    flex: 1;
    min-width: 0;
    padding: clamp(8px, 2vw, 10px) clamp(10px, 2.5vw, 14px);
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: clamp(0.875rem, 2vw, 0.95rem);
    font-family: inherit;
    outline: none;
    background: var(--paper-elevated);
    color: var(--ink);
    transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.search-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-form input::placeholder {
    color: var(--ink-faint);
}

.search-form button {
    padding: clamp(8px, 2vw, 10px) clamp(14px, 3vw, 18px);
    background: var(--ink);
    color: var(--paper-elevated);
    border: 1px solid var(--ink);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-family: inherit;
    transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
    min-height: 44px;
}

.search-form button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* ── Main layout ── */
.main-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: clamp(16px, 4vw, 32px) clamp(12px, 4vw, 24px) clamp(32px, 6vw, 48px);
    display: flex;
    gap: clamp(20px, 4vw, 32px);
    align-items: flex-start;
    box-sizing: border-box;
}

.main-content {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
}

/* ── Ads sidebar ── */
.ads-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 16px);
    align-self: flex-start;
    max-height: calc(100vh - var(--header-height) - 32px);
    overflow-y: auto;
}

.ad-block {
    background: var(--paper-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.ad-block h3 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    font-family: var(--font-ui);
}

.private-ad-item {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background var(--duration-fast);
    border-radius: var(--radius-sm);
}

.private-ad-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.private-ad-item:hover {
    background: var(--accent-softer);
}

.private-ad-item img {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.private-ad-item .ad-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.google-ads-section {
    min-height: 100px;
}

.google-ads-section iframe,
.google-ads-section ins {
    max-width: 100%;
}

/* ── Source tag ── */
.source-tag {
    display: inline-block;
    background: var(--source-bg);
    color: var(--source-text);
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: var(--font-ui);
}

/* ── Breaking news ribbon ── */
.breaking-ribbon {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #fff;
    overflow: hidden;
    position: relative;
    z-index: 99;
    box-shadow: 0 2px 12px var(--accent-glow);
    min-height: 44px;
    contain: layout style paint;
    flex-shrink: 0;
}

.breaking-ribbon-inner {
    display: flex;
    align-items: center;
    width: max-content;
    padding: 10px 0;
    animation: breaking-scroll 60s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.breaking-ribbon:hover .breaking-ribbon-inner {
    animation-play-state: paused;
}

.breaking-label {
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
}

.breaking-label::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: breaking-blink 1s ease-in-out infinite;
}

.breaking-ticker {
    display: flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
}

.breaking-item {
    display: inline-flex;
    align-items: center;
    padding-right: 48px;
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.95;
    transition: opacity var(--duration-fast);
}

.breaking-item:hover {
    opacity: 1;
    text-decoration: underline;
}

.breaking-item .source {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
    margin-right: 12px;
    flex-shrink: 0;
}

.breaking-item .headline {
    max-width: min(420px, 70vw);
    overflow: hidden;
    text-overflow: ellipsis;
}

.breaking-sep {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 24px;
}

/* ── Footer ── */
.site-footer {
    margin-top: clamp(32px, 6vw, 56px);
    padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 24px);
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

[data-theme="dark"] .site-footer {
    background: linear-gradient(180deg, #020617 0%, #000000 100%);
    border-top: 1px solid var(--border-muted);
}

.site-footer a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--duration-fast);
}

.site-footer a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(24px, 5vw, 40px) clamp(32px, 6vw, 48px);
    margin-bottom: clamp(24px, 4vw, 36px);
    text-align: left;
}

.footer-about h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.footer-about p {
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.75);
    max-width: 42ch;
}

.footer-bottom {
    padding-top: clamp(16px, 3vw, 24px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85rem;
}

.footer-bottom a {
    color: rgba(255, 255, 255, 0.9);
}

/* ── Section titles ── */
.section-title {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    margin-bottom: clamp(16px, 3vw, 22px);
    padding-bottom: 12px;
    padding-left: 14px;
    border-left: 4px solid var(--accent);
    border-bottom: 1px solid var(--border);
    color: var(--ink);
    letter-spacing: -0.01em;
}

.section-title span {
    font-weight: 400;
    color: var(--ink-muted);
    font-size: 0.95rem;
}

.latest-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
    font-family: var(--font-ui);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .main-wrap {
        flex-direction: column;
    }

    .ads-sidebar {
        position: static;
        max-height: none;
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .breaking-ribbon {
        min-height: 40px;
    }

    .breaking-label {
        padding: 4px 10px;
        font-size: 0.65rem;
        margin-right: 12px;
    }

    .breaking-item {
        font-size: 0.8rem;
        padding-right: 24px;
    }

    .breaking-item .source {
        font-size: 0.65rem;
        margin-right: 8px;
    }

    .breaking-sep {
        margin-right: 12px;
    }
}

@media (max-width: 640px) {
    .header-top {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        max-width: none;
        flex: 1 1 auto;
    }

    .header-datetime {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo-img {
        height: 44px;
    }

    .breaking-item .headline {
        max-width: 50vw;
    }
}