/* ---------- Design tokens ---------- */
:root {
    --bg:        #f7f4ec;
    --bg-2:      #efeae0;
    --surface:   #ffffff;
    --ink:       #0b0b0c;
    --ink-2:     #1c1c1f;
    --muted:     #6b6b71;
    --line:      rgba(11, 11, 12, 0.10);
    --line-2:    rgba(11, 11, 12, 0.06);

    --accent:    #0f5132;
    --accent-2:  #14b886;
    --accent-3:  #d97706;

    --cat-tech:    #1d4ed8;
    --cat-finance: #047857;
    --cat-world:   #b91c1c;
    --cat-sports:  #c2410c;
    --cat-general: #4b5563;
    --cat-health:  #be185d;
    --cat-science: #6d28d9;

    --radius:    14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(11,11,12,0.04);
    --shadow:    0 12px 40px -16px rgba(11,11,12,0.18), 0 2px 6px rgba(11,11,12,0.04);
    --shadow-lg: 0 30px 80px -24px rgba(11,11,12,0.30);

    --serif: "Fraunces", "Playfair Display", Georgia, serif;
    --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --script: "Pacifico", cursive;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    background:
        radial-gradient(900px 500px at 90% -10%, rgba(20,184,134,0.10), transparent 60%),
        radial-gradient(800px 400px at -10% 10%, rgba(217,119,6,0.08), transparent 60%),
        var(--bg);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Navigation ---------- */
nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 48px;
    background: rgba(247, 244, 236, 0.78);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--line-2);
}

.logo {
    font-family: var(--serif);
    font-weight: 900;
    font-style: italic;
    color: var(--ink);
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.logo::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    display: inline-block;
    transform: translateY(1px);
    box-shadow: 0 0 0 4px rgba(15,81,50,0.12);
}

.logo .tag {
    font-family: var(--sans);
    font-style: normal;
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a.muted {
    font-size: 0.9rem;
    color: var(--muted);
    transition: color 0.18s ease;
}

.nav-links a.muted:hover { color: var(--ink); }

.nav-links a.muted.active {
    outline: 3px solid rgba(59,130,246,0.18);
    border-radius: 6px;
    padding: 6px 8px;
    color: var(--ink);
}

.join-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: #fff;
    padding: 0.65rem 1.15rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    box-shadow: var(--shadow-sm);
}

.join-btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.join-btn::after {
    content: "→";
    transition: transform 0.18s ease;
}

.join-btn:hover::after { transform: translate(3px, 0); }

/* ---------- Masthead ---------- */
.header {
    text-align: center;
    padding: 64px 24px 24px;
    max-width: 980px;
    margin: 0 auto;
}

.header .eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,0.6);
}

.header h1 {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 18px 0 12px;
}

.header h1 em {
    font-style: italic;
    color: var(--accent);
}

.header .meta {
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 6px;
}

/* ---------- Layout ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 32px 80px;
}

/* ---------- Featured hero ---------- */
.featured {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 0;
    background: linear-gradient(135deg, #0b3b27 0%, #0f5132 55%, #14b886 110%);
    color: #fff;
    border-radius: var(--radius-lg);
    margin: 32px 0 56px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    isolation: isolate;
}

.featured::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 300px at 100% 0%, rgba(255,255,255,0.18), transparent 60%),
        radial-gradient(500px 240px at 0% 100%, rgba(20,184,134,0.30), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.featured > .featured-copy { position: relative; z-index: 1; padding: 36px 44px 32px; }

.featured .featured-image {
    position: relative;
    background-size: cover;
    background-position: center;
    background-color: #0f5132;
    min-height: 240px;
}

.featured .featured-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(15,81,50,0.55) 0%, rgba(15,81,50,0) 35%, rgba(0,0,0,0.0) 100%);
    pointer-events: none;
}

.featured .badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.16);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.featured .badge::before {
    content: "";
    width: 7px;
    height: 7px;
    background: #fde68a;
    border-radius: 50%;
    box-shadow: 0 0 12px #fde68a;
}

.featured h2 {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin: 12px 0 10px;
    max-width: 26ch;
}

.featured .meta {
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.78;
    margin-bottom: 10px;
}

.featured p {
    font-size: 0.98rem;
    line-height: 1.6;
    max-width: 60ch;
    color: rgba(255,255,255,0.92);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured a.read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    color: #fff;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.30);
    transition: background 0.2s ease, transform 0.2s ease;
}

.featured a.read-more:hover {
    background: #fff;
    color: var(--accent);
    transform: translateY(-1px);
}

.featured a.read-more::after {
    content: "→";
    transition: transform 0.2s ease;
}

.featured a.read-more:hover::after { transform: translate(3px, 0); }

/* ---------- Section heading above grid ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 4px 22px;
}

.section-head h3 {
    font-family: var(--serif);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin: 0;
}

.section-head .count {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- News grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 26px;
}

.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    overflow: hidden;
    isolation: isolate;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: transparent;
}

.card:hover .thumb img { transform: scale(1.04); }

.card .thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--cat-color, var(--cat-general)) 88%, #000 8%) 0%,
            color-mix(in srgb, var(--cat-color, var(--cat-general)) 55%, #000 0%) 100%);
    overflow: hidden;
    flex-shrink: 0;
}

.card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.card .thumb.is-logo {
    background:
        radial-gradient(60% 60% at 50% 40%, rgba(255,255,255,0.55), transparent 75%),
        linear-gradient(135deg,
            color-mix(in srgb, var(--cat-color, var(--cat-general)) 28%, #ffffff 0%) 0%,
            color-mix(in srgb, var(--cat-color, var(--cat-general)) 18%, #ffffff 0%) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card .thumb.is-logo img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    image-rendering: auto;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.14));
    transition: transform 0.4s ease;
}

.card:hover .thumb.is-logo img { transform: scale(1.06); }
.card .thumb.is-logo::after { display: none; }

.card .thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.18) 100%);
    pointer-events: none;
}

.card .pill {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--cat-color, var(--cat-general));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.10);
}

.card .body {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.card .meta {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.card h3 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.18rem;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.005em;
    color: var(--ink);
}

.card p {
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--ink-2);
    margin: 0;
    flex-grow: 1;
    opacity: 0.82;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card a.read-more {
    margin-top: 6px;
    align-self: flex-start;
    color: var(--accent);
    font-size: 0.86rem;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.card a.read-more:hover { border-bottom-color: var(--accent); }
.card a.read-more::after { content: " →"; }

/* ---------- Skeleton loading ---------- */
.skeleton {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line-2);
    overflow: hidden;
    position: relative;
}

.skeleton .thumb {
    aspect-ratio: 16 / 10;
    background: linear-gradient(90deg, var(--bg-2) 0%, #fff 50%, var(--bg-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
}

.skeleton .body { padding: 20px 22px 22px; }

.skeleton .bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--bg-2) 0%, #fff 50%, var(--bg-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
    margin-bottom: 10px;
}

.skeleton .bar.short { width: 30%; }
.skeleton .bar.title { height: 18px; width: 80%; }
.skeleton .bar.long  { width: 95%; }
.skeleton .bar.med   { width: 70%; }

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ---------- Empty / error states ---------- */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    font-style: italic;
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

/* ---------- Footer ---------- */
footer {
    text-align: center;
    padding: 40px 20px 32px;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--line-2);
    margin-top: 40px;
}

footer .footer-logo {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 900;
    color: var(--ink);
    letter-spacing: -0.01em;
    font-size: 1.05rem;
}

/* ---------- Reveal animation ---------- */
.card, .featured {
    animation: fadeUp 0.5s ease both;
}

.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.10s; }
.card:nth-child(4) { animation-delay: 0.14s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(6) { animation-delay: 0.22s; }
.card:nth-child(n+7) { animation-delay: 0.26s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
    nav { padding: 14px 20px; }
    .nav-links { gap: 14px; }
    .nav-links a.muted { display: none; }
    .header { padding: 40px 18px 12px; }
    .container { padding: 8px 16px 60px; }
    .featured {
        grid-template-columns: 1fr;
        margin: 24px 0 40px;
        border-radius: 18px;
    }
    .featured > .featured-copy { padding: 32px 26px 30px; }
    .featured .featured-image { aspect-ratio: 16 / 10; min-height: 0; order: -1; }
    .grid { gap: 18px; }
}

/* ---------- Categories panel ---------- */
.categories-panel {
    position: sticky;
    top: 88px;
    width: 260px;
    max-height: calc(100vh - 120px);
    overflow: auto;
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    padding: 14px;
    margin-right: 26px;
    box-shadow: var(--shadow-sm);
}

.categories-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
}

.categories-head .muted {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 0.9rem;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    cursor: pointer;
    font-weight: 600;
}

.cat-chip input { display: none; }

.cat-chip.selected {
    box-shadow: var(--shadow-sm);
    border-color: rgba(11,11,12,0.08);
}

/* categories panel as a dropdown anchored to the nav link */
.categories-panel {
    display: none; /* toggled by JS */
    position: absolute;
    top: calc(100% + 8px);
    right: 120px;
    width: 320px;
    max-height: 360px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 18px 40px -12px rgba(11,11,12,0.25);
    z-index: 120;
}

/* small screens: full width dropdown below nav */
@media (max-width: 979px) {
    .categories-panel {
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 280px;
    }
}
