:root {
    color-scheme: dark;
    font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
    line-height: 1.7;
    --bg: #070b14;
    --text: #f3f4f6;
    --muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-strong: #a78bfa;
    --card: #111827;
    --card-hover: #172033;
    --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(circle at top, #111827 0%, var(--bg) 55%);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px;
}

.site-header {
    background: rgba(7, 11, 20, 0.95);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    padding-bottom: 16px;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.logo span {
    color: var(--primary-strong);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.main-nav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 180ms ease;
}

.main-nav a:hover {
    color: #fff;
}

.main-nav a.nav-cta {
    color: var(--primary-strong);
    background: rgba(139, 92, 246, 0.14);
    padding: 6px 14px;
    border-radius: 999px;
}

.main-nav a.nav-cta:hover {
    background: rgba(139, 92, 246, 0.24);
    color: #fff;
}

.hero {
    background: #3f51b5;
    color: #fff;
    padding: 82px 0;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.3);
}

.compact-hero {
    padding: 0;
}

.hero h1 {
    font-size: 1.2rem;
    margin: 8px 0;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 32px 0;
}

.post-card {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(145deg, var(--card), #0f172a);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.35);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.45);
    border-color: rgba(167, 139, 250, 0.4);
}

.post-card img {
    width: 280px;
    height: 220px;
    object-fit: cover;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
}

.post-content {
    padding: 24px;
    flex: 1;
}

.post-content h2 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

.post-content h2 a {
    color: var(--text);
    text-decoration: none;
}

.post-content h2 a:hover {
    color: var(--primary-strong);
}

.post-content p {
    color: var(--muted);
    margin-bottom: 0;
}

.read-more {
    display: inline-block;
    margin-top: 12px;
    color: var(--primary-strong);
    font-weight: 700;
    text-decoration: none;
    transition: color 180ms ease;
}

.read-more:hover {
    color: #ffffff;
}

.empty-state {
    background: linear-gradient(145deg, var(--card), #0f172a);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 24px 0 40px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    text-decoration: none;
    color: var(--primary-strong);
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.14);
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.pagination a:hover {
    background: rgba(139, 92, 246, 0.24);
    transform: translateY(-1px);
}

.pagination .active {
    background: var(--primary);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.4;
}

.alert {
    margin: 24px 0;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.alert-error {
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.3);
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

.detail-page {
    padding-top: 32px;
}

.detail-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.detail-main {
    min-width: 0;
}

.detail-image {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 24px;
    box-shadow: 0 18px 45px rgba(2, 6, 23, 0.35);
}

.detail-meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 18px;
}

.detail-content {
    margin-top: 16px;
    background: linear-gradient(145deg, var(--card), #0f172a);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.detail-sidebar {
    background: linear-gradient(145deg, var(--card), #0f172a);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.24);
}

.detail-sidebar h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 1.05rem;
}

.detail-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.detail-sidebar li {
    position: relative;
    padding-left: 24px;
}

.detail-sidebar li::before {
    content: '→';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-strong);
    font-size: 0.95rem;
}

.detail-sidebar a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.detail-sidebar a:hover {
    color: var(--primary-strong);
}

.post-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.post-nav-card {
    padding: 18px 20px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 16px;
}

.post-nav-card.next {
    text-align: right;
}

.post-nav-label {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.post-nav-card a {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.post-nav-card a:hover {
    color: var(--primary-strong);
}

@media (max-width: 640px) {
    .hero h1 {
        font-size: 1.2rem;
    }

    .container {
        padding: 16px;
    }

    .nav-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 12px;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .post-card {
        flex-direction: column;
        align-items: stretch;
    }

    .post-card img {
        width: 100%;
        height: 200px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .post-nav-grid {
        grid-template-columns: 1fr;
    }

    .post-nav-card.next {
        text-align: left;
    }
}

/* ===================================================================
   way2news-style swipe feed (home page)
   =================================================================== */
body.feed-body {
    overflow: hidden;
}

body.feed-body .site-header {
    display: none;
}

main.container.feed-main {
    max-width: none;
    margin: 0;
    padding: 0;
}

.feed {
    height: calc(100vh - 56px);
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.feed::-webkit-scrollbar {
    display: none;
}

.feed-card {
    height: calc(100vh - 56px);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.feed-image {
    position: relative;
    height: 40%;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-color: #0f172a;
}

.feed-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(7, 11, 20, 0.15) 0%, rgba(7, 11, 20, 0.55) 100%);
}

.feed-brand {
    position: absolute;
    top: 12px;
    left: 14px;
    z-index: 1;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.feed-brand span {
    color: var(--primary-strong);
}

.feed-scroll {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 8px;
    overflow: hidden;
}

.feed-title {
    margin: 0 0 12px;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.feed-text {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.75;
    white-space: pre-line;
}

.feed-text::-webkit-scrollbar {
    display: none;
}

/* Page-turn reading (single-post view): text moves one page per swipe,
   driven by JS, so it is not freely scrollable. */
.feed-paged {
    overflow: hidden;
    scroll-behavior: smooth;
    touch-action: pan-x;
}

.feed-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.feed-more {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.feed-more .feed-scroll {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.feed-more-btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    padding: 12px 22px;
    border-radius: 999px;
}

/* Fixed bottom tab bar */
.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    background: rgba(7, 11, 20, 0.97);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
    z-index: 60;
}

.bottom-tabs .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
}

.bottom-tabs .tab-icon {
    font-size: 1.15rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.bottom-tabs .tab.active {
    color: #fff;
}

.bottom-tabs .tab.wa {
    color: #25d366;
}

/* Center the phone-style feed on wider screens */
@media (min-width: 700px) {
    .feed,
    .bottom-tabs {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
    }
}
