/* ============================================================
   BLOG PROTOTYPE — SHARED STYLES
   Sections: Tokens · Base · Layout · Cards · Nav · Utilities
   ============================================================ */

/* ─── DESIGN TOKENS ─────────────────────────────────────── */
:root {
    --brand-blue: #0062ff;
    --brand-blue-soft: rgba(0, 98, 255, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --radius-sm: 0.75rem;
    /* 12px */
    --radius-md: 1rem;
    /* 16px */
    --radius-lg: 1.5rem;
    /* 24px */
    --radius-xl: 2rem;
    /* 32px */
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface-muted);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
.page-wrapper {
    background: var(--surface);
    min-height: 100vh;
    padding-bottom: 90px;
    /* space for bottom nav */
}

@media (min-width: 768px) {
    .page-wrapper {
        background: var(--surface-muted);
        padding-bottom: 2rem;
    }
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

.section {
    padding: 1.5rem 0;
}

@media (min-width: 768px) {
    .section {
        padding: 2.5rem 0;
    }
}

/* ─── SECTION HEADER ─────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.5rem;
    }
}

.section-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-blue);
}

.section-link:hover {
    opacity: 0.8;
}

/* ─── CARD BASE ──────────────────────────────────────────── */
/* All cards: soft shadow and 1px border */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card:hover {
    border-color: var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-facebook {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* ─── CARD VARIANT A: Hero Full-Bleed ───────────────────── */
/* Full-width image with gradient text overlay */
.card-hero {
    position: relative;
    width: 100%;
    height: 220px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: none;
    /* image cards have no border */
    display: block;
}

@media (min-width: 768px) {
    .card-hero {
        height: 480px;
    }
}

.card-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.card-hero:hover img {
    transform: scale(1.03);
}

.card-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
}

.card-hero__category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--brand-blue);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    letter-spacing: 0.03em;
}

.card-hero__body {
    position: absolute;
    bottom: 1.25rem;
    left: 1.25rem;
    right: 1.25rem;
    color: #fff;
}

@media (min-width: 768px) {
    .card-hero__body {
        bottom: 2.5rem;
        left: 2.5rem;
        right: 2.5rem;
        max-width: 60%;
    }
}

.card-hero__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.6rem;
}

.card-hero__title {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    .card-hero__title {
        font-size: 2.25rem;
    }
}

/* ─── CARD VARIANT B: Thumbnail List Item ────────────────── */
/* Small square thumb left + text right — used in Recommendation & Newsfeed */
.card-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.card-list-item__thumb {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--border-light);
    position: relative;
}

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

.card-list-item:hover .card-list-item__thumb img {
    transform: scale(1.05);
}

.card-list-item__body {
    flex: 1;
    min-width: 0;
}

.card-list-item__category {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.card-list-item__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.card-list-item__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

.card-list-item__meta-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

/* ─── CARD VARIANT C: Swipe / Grid Card (Image top, text below) */
.card-grid {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
}

.card-grid:hover {
    border-color: var(--border);
}

.card-grid__image {
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--border-light);
    position: relative;
}

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

.card-grid:hover .card-grid__image img {
    transform: scale(1.04);
}

.card-grid__body {
    padding: 0.875rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-grid__category {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.card-grid__title {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-grid__date {
    margin-top: auto;
    padding-top: 0.6rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* ─── CARD VARIANT D: Stat / Metric Card ─────────────────── */
/* Dashboard-style KPI cards, no shadows */
.card-stat {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.card-stat__icon {
    width: 44px;
    height: 44px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-stat__icon svg {
    width: 20px;
    height: 20px;
}

.card-stat__label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.card-stat__value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}

/* ─── CARD VARIANT E: Author Card ────────────────────────── */
.card-author {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.card-author__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--border-light);
}

.card-author__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-author__name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-author__role {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.card-author__count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--brand-blue);
    white-space: nowrap;
}

/* ─── CATEGORY PILL ──────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.875rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}

.pill:hover {
    background: var(--surface-muted);
}

.pill.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--surface);
}

/* ─── HORIZONTAL SCROLL CAROUSEL ────────────────────────── */
.scroll-x {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.875rem;
    padding-bottom: 0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
    display: none;
}

.scroll-x .card-grid {
    scroll-snap-align: start;
    width: 240px;
    min-width: 240px;
}

@media (min-width: 768px) {

    /* On desktop the carousel becomes a standard grid */
    .scroll-x {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        overflow: visible;
        scroll-snap-type: none;
    }

    .scroll-x .card-grid {
        width: auto;
        min-width: 0;
    }
}

@media (min-width: 1024px) {
    .scroll-x {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ─── STAT GRID ──────────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ─── AUTHOR SCROLL ──────────────────────────────────────── */
.author-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.author-scroll::-webkit-scrollbar {
    display: none;
}

.author-scroll .card-author {
    scroll-snap-align: start;
    width: 210px;
    min-width: 210px;
}

@media (min-width: 768px) {
    .author-scroll {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        overflow: visible;
    }

    .author-scroll .card-author {
        width: auto;
        min-width: 0;
    }
}

/* ─── CATEGORY PILL ROW ──────────────────────────────────── */
.pill-row {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.pill-row::-webkit-scrollbar {
    display: none;
}

/* ─── NEWSFEED (main + sidebar layout on desktop) ────────── */
.newsfeed-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .newsfeed-layout {
        grid-template-columns: 2fr 1fr;
    }
}

/* ─── SIDEBAR CARD ───────────────────────────────────────── */
.sidebar-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 1.25rem;
}

.sidebar-card__title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* ─── VERIFY BADGE ───────────────────────────────────────── */
.badge-verified {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: var(--brand-blue);
    border-radius: 50%;
    color: #fff;
    font-size: 8px;
    text-align: center;
    line-height: 14px;
}

/* ─── DESKTOP WRAPPER ────────────────────────────────────── */
@media (min-width: 768px) {
    .desktop-card-wrapper {
        background: var(--surface);
        border: 1px solid var(--border-light);
        border-radius: var(--radius-xl);
        padding: 2.5rem;
    }
}

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .site-header__inner {
        padding: 1rem 1.5rem;
    }
}

.site-header__logo {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.site-header__logo span {
    color: var(--brand-blue);
}

.site-header__icon-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    background: var(--surface);
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.site-header__icon-btn:hover {
    background: var(--surface-muted);
}

.site-header__nav {
    display: none;
    gap: 2rem;
}

@media (min-width: 768px) {
    .site-header__nav {
        display: flex;
    }
}

.site-header__nav a {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.site-header__nav a:hover,
.site-header__nav a.active {
    color: var(--brand-blue);
}

.site-header__actions {
    display: flex;
    gap: 0.5rem;
}

/* ─── BOTTOM NAV (Mobile Only) ───────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 1rem;
    z-index: 100;
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 700;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.bottom-nav__item svg {
    width: 24px;
    height: 24px;
}

.bottom-nav__item.active {
    color: var(--brand-blue);
}

.bottom-nav__item.active .bottom-nav__icon-wrap {
    background: var(--brand-blue-soft);
    border-radius: 999px;
    padding: 0.35rem 1rem;
}

/* ─── NOTIFICATION DOT ───────────────────────────────────── */
.notif-dot {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
}

/* ─── NEWSLETTER INPUT ───────────────────────────────────── */
.input {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s;
}

.input:focus {
    border-color: var(--brand-blue);
}

.input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 0.65rem;
    background: var(--text-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.85;
}

/* ─── TRENDING RANK ──────────────────────────────────────── */
.trending-item {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.trending-item__rank {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--border);
    line-height: 1;
    flex-shrink: 0;
    width: 1.5rem;
}

.trending-item__category {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.trending-item__title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.trending-item__views {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ─── UTILITIES ──────────────────────────────────────────── */
.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .desktop-only {
        display: block;
    }

    .md-hide {
        display: none;
    }
}

/* Hero pagination dots */
.dot-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    .dot-row {
        display: none;
    }
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    transition: width 0.2s;
}

.dot.active {
    width: 18px;
    background: var(--brand-blue);
}

/* Desktop sidebar: hide on mobile */
aside {
    display: none;
}

@media (min-width: 1024px) {
    aside {
        display: flex;
    }
}