/* =============================================
   MATCHOOM NEWS - Subaquatic Newsroom Styles
   Seapunk Editorial Design / Broken Grid Layout
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --deep-navy: #1A2A4A;
    --ocean-dark: #2A3A4A;
    --ocean-mid: #4A7AA0;
    --teal-accent: #20A8B0;
    --warm-sand: #F4ECD8;
    --coral-pink: #E87080;
    --ocean-light: #E8F0F4;

    --font-display: 'Libre Caslon Display', 'Georgia', serif;
    --font-body: 'Source Serif 4', 'Georgia', serif;

    --grid-gap: 24px;
    --card-radius: 6px;
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--ocean-dark);
    background-color: var(--ocean-light);
    line-height: 1.85;
    overflow-x: hidden;
    position: relative;
}

/* --- Grid Lines Background --- */
.grid-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.05;
    background-image:
        linear-gradient(to right, var(--deep-navy) 1px, transparent 1px),
        linear-gradient(to bottom, var(--deep-navy) 1px, transparent 1px);
    background-size: 80px 80px;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(170deg, var(--ocean-light) 0%, #d4e8f0 40%, #b8d8e8 70%, var(--ocean-mid) 100%);
    overflow: hidden;
    z-index: 1;
}

.hero-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.hero-bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(32, 168, 176, 0.08);
    border: 1px solid rgba(32, 168, 176, 0.15);
    animation: bubbleFloat linear infinite;
}

@keyframes bubbleFloat {
    0% {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-20vh) scale(1);
        opacity: 0;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 20px;
}

.hero-accent-bar {
    width: 120px;
    height: 4px;
    margin: 0 auto;
    border-radius: 2px;
}

.accent-bar-coral {
    background: var(--coral-pink);
    margin-bottom: 24px;
}

.accent-bar-teal {
    background: var(--teal-accent);
    margin-top: 24px;
    margin-bottom: 20px;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--deep-navy);
    letter-spacing: 0.06em;
    line-height: 1.05;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(30px);
    animation: heroTitleAppear 1.2s var(--transition-smooth) 0.3s forwards;
}

@keyframes heroTitleAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
    color: var(--ocean-mid);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0;
    animation: heroTitleAppear 1s var(--transition-smooth) 0.9s forwards;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollBounce 2s ease-in-out infinite;
    opacity: 0;
    animation: scrollBounce 2s ease-in-out infinite, heroTitleAppear 0.5s ease 2s forwards;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

/* --- Category Navigation --- */
.category-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(232, 240, 244, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(26, 42, 74, 0.08);
    padding: 16px 0;
    transition: box-shadow var(--transition-smooth);
}

.category-nav.scrolled {
    box-shadow: 0 4px 24px rgba(26, 42, 74, 0.1);
}

.category-nav-inner {
    display: flex;
    gap: 8px;
    padding: 0 32px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-nav-inner::-webkit-scrollbar {
    display: none;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid rgba(26, 42, 74, 0.15);
    border-radius: 100px;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--ocean-dark);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-smooth);
}

.category-tag:hover {
    border-color: var(--teal-accent);
    color: var(--teal-accent);
    background: rgba(32, 168, 176, 0.06);
}

.category-tag.active {
    background: var(--deep-navy);
    border-color: var(--deep-navy);
    color: var(--ocean-light);
}

.category-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- News Feed - Broken Grid --- */
.news-feed {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 32px 100px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--grid-gap);
}

/* Broken grid positioning */
.news-card:nth-child(1) {
    grid-column: 1 / 9;
    grid-row: 1;
    margin-right: -20px;
}

.news-card:nth-child(2) {
    grid-column: 7 / 13;
    grid-row: 2;
    margin-left: -15px;
    margin-top: -30px;
}

.news-card:nth-child(3) {
    grid-column: 1 / 6;
    grid-row: 3;
    margin-right: -10px;
}

.news-card:nth-child(4) {
    grid-column: 5 / 10;
    grid-row: 3;
    margin-top: 20px;
}

.news-card:nth-child(5) {
    grid-column: 2 / 12;
    grid-row: 4;
    margin-top: -15px;
}

.news-card:nth-child(6) {
    grid-column: 8 / 13;
    grid-row: 5;
    margin-left: -25px;
}

.news-card:nth-child(7) {
    grid-column: 1 / 8;
    grid-row: 6;
    margin-right: -20px;
}

.news-card:nth-child(8) {
    grid-column: 6 / 13;
    grid-row: 7;
    margin-left: -15px;
    margin-top: -20px;
}

.news-card:nth-child(9) {
    grid-column: 1 / 7;
    grid-row: 8;
}

.news-card:nth-child(10) {
    grid-column: 6 / 12;
    grid-row: 8;
    margin-top: 30px;
    margin-left: -10px;
}

/* --- News Card Base --- */
.news-card {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--card-radius);
    padding: 32px;
    border: 1px solid rgba(26, 42, 74, 0.06);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    overflow: hidden;
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(32, 168, 176, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(26, 42, 74, 0.12);
}

.news-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--teal-accent);
    border-radius: 2px 0 0 2px;
    transition: width var(--transition-smooth);
}

.news-card:hover .news-card-accent {
    width: 6px;
}

.news-card-featured .news-card-accent {
    background: linear-gradient(180deg, var(--coral-pink), var(--teal-accent));
}

/* --- News Card Meta --- */
.news-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.news-card-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(32, 168, 176, 0.1);
    color: var(--teal-accent);
}

.badge-tech {
    background: rgba(74, 122, 160, 0.12);
    color: var(--ocean-mid);
}

.badge-science {
    background: rgba(232, 112, 128, 0.1);
    color: var(--coral-pink);
}

.badge-culture {
    background: rgba(26, 42, 74, 0.08);
    color: var(--deep-navy);
}

.badge-ocean {
    background: rgba(32, 168, 176, 0.12);
    color: var(--teal-accent);
}

.badge-opinion {
    background: rgba(244, 236, 216, 0.6);
    color: var(--ocean-dark);
}

.badge-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.news-card-time {
    font-size: 0.8rem;
    color: var(--ocean-mid);
    font-weight: 300;
}

/* --- News Card Title --- */
.news-card-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 1.7rem);
    color: var(--deep-navy);
    line-height: 1.3;
    margin-bottom: 12px;
    transition: color var(--transition-smooth);
}

.news-card-featured .news-card-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.news-card:hover .news-card-title {
    color: var(--teal-accent);
}

/* --- News Card Excerpt --- */
.news-card-excerpt {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--ocean-dark);
    line-height: 1.85;
    margin-bottom: 18px;
}

/* --- News Card Footer --- */
.news-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid rgba(26, 42, 74, 0.06);
}

.news-card-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--deep-navy);
}

.news-card-reading-time {
    font-size: 0.8rem;
    color: var(--ocean-mid);
    font-weight: 300;
}

/* --- Slide Reveal Animations --- */
.slide-reveal {
    opacity: 0;
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.slide-from-left {
    transform: translateX(-60px);
}

.slide-from-right {
    transform: translateX(60px);
}

.slide-reveal.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* --- Personalization Panel --- */
.personalization-panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    background: rgba(26, 42, 74, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px 0 0 12px;
    z-index: 200;
    transition: transform var(--transition-smooth);
    overflow: hidden;
}

.personalization-panel.collapsed {
    transform: translateY(-50%) translateX(240px);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(232, 240, 244, 0.1);
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--ocean-light);
    font-weight: 400;
}

.panel-toggle {
    background: none;
    border: none;
    color: var(--teal-accent);
    cursor: pointer;
    padding: 4px;
    transition: transform var(--transition-smooth);
}

.panel-toggle:hover {
    transform: rotate(45deg);
}

.panel-body {
    padding: 16px 20px 20px;
}

.panel-section {
    margin-bottom: 20px;
}

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

.panel-section-title {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--teal-accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* --- Trending List --- */
.trending-list {
    list-style: none;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(232, 240, 244, 0.06);
    cursor: pointer;
    transition: color var(--transition-smooth);
}

.trending-item:last-child {
    border-bottom: none;
}

.trending-item:hover {
    color: var(--teal-accent);
}

.trending-item:hover .trending-rank {
    color: var(--coral-pink);
}

.trending-rank {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--ocean-mid);
    min-width: 22px;
    transition: color var(--transition-smooth);
}

.trending-text {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ocean-light);
    font-weight: 300;
}

/* --- Feed Preferences --- */
.preference-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pref-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.pref-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 36px;
    height: 20px;
    background: rgba(232, 240, 244, 0.15);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background var(--transition-smooth);
    flex-shrink: 0;
}

.pref-toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--ocean-light);
    border-radius: 50%;
    transition: transform var(--transition-smooth);
}

.pref-toggle input[type="checkbox"]:checked {
    background: var(--teal-accent);
}

.pref-toggle input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

.pref-label {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ocean-light);
    font-weight: 300;
}

/* --- Footer --- */
.site-footer {
    position: relative;
    z-index: 1;
    background: var(--deep-navy);
    color: var(--ocean-light);
    padding: 60px 32px 0;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(232, 240, 244, 0.1);
}

.footer-logo {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--ocean-light);
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 10px;
}

.footer-description {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--ocean-mid);
    line-height: 1.6;
}

.footer-links {
    display: flex;
    gap: 60px;
}

.footer-heading {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal-accent);
    margin-bottom: 16px;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 8px;
}

.footer-column a {
    font-size: 0.9rem;
    color: rgba(232, 240, 244, 0.7);
    text-decoration: none;
    font-weight: 300;
    transition: color var(--transition-smooth);
}

.footer-column a:hover {
    color: var(--teal-accent);
}

/* --- Depth Indicator --- */
.footer-depth-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.depth-bar {
    width: 4px;
    height: 80px;
    background: linear-gradient(180deg, var(--teal-accent), var(--coral-pink), var(--deep-navy));
    border-radius: 2px;
}

.depth-label {
    font-size: 0.75rem;
    color: var(--ocean-mid);
    font-weight: 300;
    letter-spacing: 0.05em;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.8rem;
    color: rgba(232, 240, 244, 0.4);
    font-weight: 300;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .personalization-panel {
        display: none;
    }

    .news-feed {
        grid-template-columns: repeat(8, 1fr);
        padding: 40px 24px 80px;
    }

    .news-card:nth-child(1) {
        grid-column: 1 / 7;
        margin-right: -10px;
    }

    .news-card:nth-child(2) {
        grid-column: 3 / 9;
        margin-left: -10px;
        margin-top: -15px;
    }

    .news-card:nth-child(3) {
        grid-column: 1 / 5;
        margin-right: -5px;
    }

    .news-card:nth-child(4) {
        grid-column: 4 / 9;
        margin-top: 10px;
    }

    .news-card:nth-child(5) {
        grid-column: 1 / 9;
        margin-top: -10px;
    }

    .news-card:nth-child(6) {
        grid-column: 3 / 9;
        margin-left: -10px;
    }

    .news-card:nth-child(7) {
        grid-column: 1 / 7;
        margin-right: -10px;
    }

    .news-card:nth-child(8) {
        grid-column: 3 / 9;
        margin-left: -10px;
        margin-top: -10px;
    }

    .news-card:nth-child(9) {
        grid-column: 1 / 5;
    }

    .news-card:nth-child(10) {
        grid-column: 4 / 9;
        margin-top: 15px;
        margin-left: -5px;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }

    .footer-depth-indicator {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
    }

    .depth-bar {
        width: 80px;
        height: 4px;
        background: linear-gradient(90deg, var(--teal-accent), var(--coral-pink), var(--deep-navy));
    }
}

@media (max-width: 640px) {
    .news-feed {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 30px 16px 60px;
    }

    .news-card {
        margin: 0 !important;
    }

    .news-card:nth-child(odd) {
        transform: translateX(0) rotate(-0.3deg);
    }

    .news-card:nth-child(even) {
        transform: translateX(0) rotate(0.3deg);
    }

    .news-card.revealed:nth-child(odd) {
        transform: translateX(0) rotate(-0.3deg);
    }

    .news-card.revealed:nth-child(even) {
        transform: translateX(0) rotate(0.3deg);
    }

    .news-card:hover {
        transform: translateY(-4px) rotate(0deg) !important;
    }

    .hero-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .category-nav-inner {
        padding: 0 16px;
    }

    .news-card {
        padding: 24px;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-links {
        gap: 30px;
    }
}

/* --- Bioluminescent Glow Animations --- */
@keyframes biolumGlow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(32, 168, 176, 0);
    }
    50% {
        box-shadow: 0 0 20px rgba(32, 168, 176, 0.08);
    }
}

.news-card-featured {
    animation: biolumGlow 4s ease-in-out infinite;
}

/* --- Category filter active state --- */
.news-card.filtered-out {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.news-card.filtered-in {
    opacity: 1;
    transform: scale(1);
}

/* --- Sway animation for cards --- */
@keyframes gentleSway {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3px); }
}

.news-card:nth-child(odd) {
    animation: gentleSway 8s ease-in-out infinite;
}

.news-card:nth-child(even) {
    animation: gentleSway 8s ease-in-out 4s infinite;
}

.news-card:hover {
    animation-play-state: paused;
}
