/* AI News Hub - Anthropic-inspired design */

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

/* === Theme Variables === */
:root, [data-theme="light"] {
    --bg-primary: #e8e6dc;
    --bg-card: #ffffff;
    --bg-header: rgba(232, 230, 220, 0.92);
    --text-primary: #141413;
    --text-secondary: #30302e;
    --text-muted: #6b6a66;
    --accent: #d97757;
    --accent-hover: #c4623f;
    --border: #d4d2c8;
    --shadow: rgba(20, 20, 19, 0.06);
    --shadow-hover: rgba(20, 20, 19, 0.12);
    --badge-bg: #f0ede4;
    --badge-text: #6b6a66;
    --toggle-icon: "☀️";
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-card: #2a2a2a;
    --bg-header: rgba(26, 26, 26, 0.92);
    --text-primary: #e8e6dc;
    --text-secondary: #b0aea6;
    --text-muted: #7a7872;
    --accent: #e8956d;
    --accent-hover: #f0a882;
    --border: #3a3a3a;
    --shadow: rgba(0, 0, 0, 0.2);
    --shadow-hover: rgba(0, 0, 0, 0.35);
    --badge-bg: #333330;
    --badge-text: #b0aea6;
    --toggle-icon: "🌙";
}

/* === Typography === */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    line-height: 1.3;
    font-weight: 600;
}

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

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

/* === Layout === */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 96px 24px 48px;
    min-height: calc(100vh - 180px);
}

/* === Header === */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

nav {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: auto;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--accent);
}

.nav-link--active {
    color: var(--accent);
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text-secondary);
}

#theme-toggle:hover {
    border-color: var(--accent);
    background: var(--bg-card);
}

/* === Footer === */
footer {
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Feed / Cards === */
.feed {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card {
    display: block;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px var(--shadow);
    transition: box-shadow 0.25s, transform 0.25s;
}

.card:hover {
    box-shadow: 0 4px 16px var(--shadow-hover);
    transform: translateY(-2px);
}

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

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

/* YouTube play icon */
.card-image--video .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.card-image--video .play-icon::after {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 22px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 4px;
}

.card:hover .play-icon {
    background: rgba(217, 119, 87, 0.85);
}

.card-body {
    padding: 20px 24px 24px;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.card-badge {
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

/* === Article Page === */
.article-page {
    max-width: 720px;
}

.article-hero {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 32px;
}

.article-video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 32px;
    background: #000;
}

.article-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.article-page h1 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.article-text {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.article-text p {
    margin-bottom: 1em;
}

.btn-original {
    display: inline-block;
    background: var(--accent);
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
}

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

.btn-original:active {
    transform: translateY(0);
}

/* === About Page === */
.about-page {
    max-width: 600px;
    margin: 0 auto;
}

.about-page h1 {
    font-size: 2rem;
    margin-bottom: 24px;
}

.about-page p {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.about-page .about-highlight {
    color: var(--accent);
    font-weight: 500;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-link--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.page-link--active:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

.page-ellipsis {
    border: none;
    background: none;
    color: var(--text-muted);
}

/* === Source Filters === */
.source-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--badge-bg);
    color: var(--badge-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.filter-pill:hover {
    background: var(--border);
    color: var(--text-primary);
}

.filter-pill--active {
    background: var(--accent);
    color: #ffffff;
}

.filter-pill--active:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

/* === Language Toggle === */
.btn-lang {
    display: inline-block;
    background: var(--badge-bg);
    border: 1px solid var(--border);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 16px;
}

.btn-lang:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* === Search === */
.nav-search {
    display: inline-flex;
    align-items: center;
}

.search-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    width: 180px;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
}

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

.search-results-info {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.search-reset {
    color: var(--accent);
    margin-left: 12px;
    font-size: 0.85rem;
}

.search-reset:hover {
    text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 768px) {
    main {
        padding: 80px 16px 32px;
    }

    nav {
        padding: 12px 16px;
        gap: 16px;
    }

    .nav-logo {
        font-size: 1.1rem;
    }

    .nav-link {
        font-size: 0.82rem;
    }

    .card-body {
        padding: 16px 18px 20px;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-desc {
        font-size: 0.9rem;
    }

    .article-page h1 {
        font-size: 1.5rem;
    }

    .article-text {
        font-size: 1rem;
    }

    .about-page h1 {
        font-size: 1.5rem;
    }

    footer {
        padding: 20px 16px;
    }
}

@media (max-width: 768px) {
    .search-input {
        width: 140px;
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .source-filters {
        gap: 6px;
    }

    .filter-pill {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .nav-link {
        font-size: 0.78rem;
    }

    #theme-toggle {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .search-input {
        width: 110px;
        padding: 5px 8px;
    }

    .card-image--video .play-icon {
        width: 48px;
        height: 48px;
    }

    .card-image--video .play-icon::after {
        border-width: 9px 0 9px 16px;
        margin-left: 3px;
    }
}
