@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Modern Light Theme */
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #ef4444;
    --accent-hover: #dc2626;
    --accent-2: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    
    --ink-panel: #111827;
    --on-ink: #f9fafb;

    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    --container: 1280px;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

:root[data-theme="dark"] {
    /* Premium Midnight Glass Dark Theme */
    --bg: #0b0d10;
    --surface: #14171c;
    --surface-2: #1e2229;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: #2a2f3a;
    --accent: #ef4444;
    --accent-hover: #f87171;
    --accent-2: #60a5fa;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);

    --glass-bg: rgba(20, 23, 28, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);

    --ink-panel: #1e2229;
    --on-ink: #f3f4f6;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 200ms ease, color 200ms ease;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

/* Glass Header */
.site-header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}
.header-inner {
    padding: 16px 0;
    display: grid;
    grid-template-columns: 1fr minmax(280px, 480px) auto;
    gap: 24px;
    align-items: center;
}

.brand {
    display: flex;
    flex-direction: column;
    outline: none;
}
.brand-mark {
    font-weight: 900;
    letter-spacing: -0.03em;
    font-size: 24px;
    background: linear-gradient(135deg, var(--text), var(--muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
.brand-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.search {
    position: relative;
    display: flex;
}
.search input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 99px;
    border: 1px solid var(--border);
    outline: none;
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    transition: all 200ms ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
    background: var(--surface);
}
.search .btn {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    padding: 0 20px;
    border-radius: 99px;
}

.header-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.pill-group {
    display: inline-flex;
    padding: 4px;
    border-radius: 99px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.pill {
    border: 0;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 99px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    transition: all 150ms ease;
}
.pill.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.updated {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    gap: 6px;
    align-items: center;
    font-weight: 500;
}
.updated-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 99px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 150ms ease;
}
.theme-toggle:hover { background: var(--surface-2); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0); }

/* Category Nav */
.category-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.category-inner {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    overflow: auto;
    scrollbar-width: none;
}
.category-inner::-webkit-scrollbar { display: none; }

.cat {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 99px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: all 200ms ease;
}
.cat:hover { color: var(--text); background: var(--surface-2); }
.cat.is-active {
    background: var(--text);
    color: var(--bg);
}

/* Layout */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    padding: 32px 0 80px;
}
.main { min-width: 0; display: flex; flex-direction: column; gap: 32px; }
.side { position: relative; }

/* Hero Section */
.hero {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    transition: transform 300ms ease, box-shadow 300ms ease;
    cursor: pointer;
}
.hero:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.hero:hover .hero-img {
    transform: scale(1.03);
}

.hero-img-wrapper {
    overflow: hidden;
    height: 440px;
    position: relative;
}
.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--surface-2);
    transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero-body {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 32px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
    color: white;
}
.hero-body .meta {
    color: rgba(255,255,255,0.8);
    margin-bottom: 12px;
}
.hero-body .source { color: #fca5a5; }
.hero-title {
    margin: 0 0 12px 0;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.hero-title a { color: inherit; text-decoration: none; }
.hero-title a:hover { text-decoration: underline; }
.hero-desc {
    margin: 0;
    color: rgba(255,255,255,0.9);
    font-size: 16px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

/* Section Head */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* Grid Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 320px;
    transition: all 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.card-img-wrapper {
    overflow: hidden;
    height: 180px;
}
.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--surface-2);
    transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card:hover .card-img {
    transform: scale(1.05);
}
.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.card .meta {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}
.card .source {
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.card-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.01em;
}
.card-title a { color: inherit; text-decoration: none; }
.card-desc {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Sidebar Elements */
.side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}
.side-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.side-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.quick {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.quick li {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}
.quick li:last-child { border-bottom: none; padding-bottom: 0; }
.quick a {
    color: var(--text);
    text-decoration: none;
    transition: color 150ms ease;
}
.quick a:hover { color: var(--accent); }
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* Buttons */
.btn {
    border: 1px solid transparent;
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    border-radius: 99px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
    transition: all 200ms ease;
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.subtle {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}
.btn.subtle:hover { background: var(--border); }

/* Transparent subtle btn for hero over dark bg */
.hero-actions .btn.subtle {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    backdrop-filter: blur(4px);
}
.hero-actions .btn.subtle:hover { background: rgba(255,255,255,0.25); }


.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 99px;
    border: none;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms ease;
}
.icon-btn:hover { background: var(--border); }

/* Skeletons */
.skeleton { display: grid; gap: 32px; }
.sk {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 400% 100%;
    border-radius: var(--radius);
    animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-hero { height: 440px; }
.sk-line { height: 24px; border-radius: 4px; }
.sk-line.short { width: 40%; }
.sk-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.sk-card { height: 320px; }

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 100;
}
.modal.is-open { display: grid; grid-template-columns: 1fr; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-card {
    position: relative;
    margin: auto;
    width: min(600px, calc(100% - 32px));
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlideIn 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 18px; }
.modal-body { padding: 24px; display: grid; gap: 16px; }
.modal-story { color: var(--accent); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.modal-text { font-size: 16px; line-height: 1.6; color: var(--text); }

/* Iframe Modal */
.iframe-card {
    width: min(1100px, calc(100% - 32px));
    height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}
.iframe-card .modal-body { padding: 0; flex: 1; }
.iframe-card iframe { width: 100%; height: 100%; border: none; }

/* AI Bot */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4);
    z-index: 90;
    transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab:hover { transform: scale(1.1); }

.bot {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: min(400px, calc(100% - 48px));
    height: 580px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 90;
    display: grid;
    grid-template-rows: auto 1fr auto;
    animation: botSlideUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes botSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); transform-origin: bottom right; }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.bot-head {
    padding: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.bot-title { font-weight: 800; font-size: 16px; }
.bot-sub { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.bot-actions { display: flex; gap: 8px; align-items: center; }

.bot-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
.msg {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
}
.msg.ai {
    background: var(--surface);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.msg.user {
    background: var(--accent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.bot-input {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.bot-input input {
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 12px 16px;
    outline: none;
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    transition: all 200ms ease;
}
.bot-input input:focus {
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Footer Styles */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 40px 0;
    margin-top: 60px;
    color: var(--muted);
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.footer-col p { margin: 8px 0 0; font-size: 14px; }
.footer-col .brand-mark { font-size: 20px; }

.footer-links {
    display: flex;
    gap: 20px;
    align-items: center;
}
.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 200ms ease, transform 200ms ease;
}
.footer-links a:hover {
    color: var(--accent);
    transform: translateY(-1px);
}
.dev-credit {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: color 200ms ease;
}
.dev-credit:hover {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 1024px) {
    .layout { grid-template-columns: 1fr; gap: 40px; }
    .side { order: -1; }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .header-inner { grid-template-columns: 1fr; gap: 16px; }
    .header-meta { align-items: flex-start; }
    .grid { grid-template-columns: 1fr; }
    .sk-grid { grid-template-columns: 1fr; }
    .hero-img-wrapper { height: 300px; }
    .hero-body { padding: 20px; }
    .hero-title { font-size: 24px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .footer-col[style*="text-align: right"] { text-align: left !important; }
}