:root {
    --bg: #F6F4F0;
    --surface: #FFFFFF;
    --text: #1A1A1A;
    --text-muted: #6B6560;
    --text-light: #9B9590;
    --accent: #C84B31;
    --accent-hover: #A83D28;
    --tag-bg: #EDEAE6;
    --tag-text: #5A5550;
    --border: #E5E0DA;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-hover: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06);
    --radius: 10px;
    --radius-sm: 6px;
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --max-width: 1200px;
    --external-accent: #2D6A9F;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ─── NAV ─── */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(246,244,240,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.nav-logo span { color: var(--accent); }
.nav-logo small { font-family: var(--font-body); font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

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

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-top: 48px;
}
.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

/* ─── FEATURED ─── */
.featured-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}
.featured-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    display: block;
}
.featured-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.featured-card .card-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}
.featured-card .card-body { padding: 24px; }
.featured-card .card-body h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1.25;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}
.featured-card:first-child .card-body h3 { font-size: 1.75rem; }
.featured-card .card-excerpt {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card-date {
    font-size: 0.78rem;
    color: var(--text-light);
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}
.tag-chip {
    display: inline-block;
    padding: 3px 10px;
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.72rem;
    font-weight: 500;
    border-radius: 20px;
    text-decoration: none;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}
.tag-chip:hover { background: #DDD8D2; color: var(--text); }
.featured-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--accent);
    color: white;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    pointer-events: none;
}
.featured-card:hover .video-badge { background: var(--accent); transform: translate(-50%, -50%) scale(1.08); }
.card:hover .video-badge { background: var(--accent); transform: translate(-50%, -50%) scale(1.08); }
.video-badge svg { fill: white; margin-left: 3px; }
.card-img-wrap { position: relative; overflow: hidden; }
.card-img-wrap .card-img { transition: transform 0.4s ease; }
.featured-card:hover .card-img-wrap .card-img { transform: scale(1.03); }
.card-img-placeholder {
    background: linear-gradient(135deg, var(--tag-bg) 0%, var(--border) 100%);
}

/* ─── CARD TYPE BADGE ─── */
.card-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.card-type-badge.internal { background: #E8F0E8; color: #3A6B3A; }
.card-type-badge.external { background: #E4EDF5; color: var(--external-accent); }
.card-type-badge svg { width: 10px; height: 10px; }

/* ─── CARDS GRID ─── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card:hover .card-img-wrap .card-img { transform: scale(1.03); }
.card .card-img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.card .card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.card .card-body h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}
.card .card-excerpt {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ─── NO-IMAGE CARD VARIANT ─── */
.card--no-image .card-excerpt {
    -webkit-line-clamp: unset;
    overflow: visible;
}
.featured-card.card--no-image .card-excerpt {
    -webkit-line-clamp: unset;
    overflow: visible;
}

/* ─── CTA BUTTONS ─── */
.cta-read {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    transition: gap 0.2s;
}
.card:hover .cta-read { gap: 10px; }
.cta-read svg { transition: transform 0.2s; }
.cta-external {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--external-accent);
    text-decoration: none;
}

/* ─── EXTERNAL CTA BUTTON ─── */
.external-cta-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: var(--external-accent);
    color: white;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(45,106,159,0.3);
}
.external-cta-button:hover {
    transform: translateY(-2px);
    background: #245B8A;
}

/* ─── ARTICLE PAGE ─── */
.article-page { max-width: 720px; margin: 0 auto; padding: 48px 24px 80px; }
.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 32px;
    transition: color 0.2s;
}
.article-back:hover { color: var(--text); }
.article-header { margin-bottom: 36px; }
.article-header h1 {
    font-family: var(--font-display);
    font-size: 2.75rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}
.article-header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.article-header-meta .card-date { font-size: 0.85rem; }
.article-hero {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 36px;
}
.article-hero img { width: 100%; display: block; }
.article-hero video {
    width: 100%;
    display: block;
    border-radius: var(--radius);
    background: #000;
}
.video-embed {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}
.article-body {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #2A2A2A;
}
.article-body p { margin-bottom: 1.4em; }
.article-body h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin: 2em 0 0.6em;
}
.article-body h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin: 1.5em 0 0.5em;
}
.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 20px;
    margin: 1.5em 0;
    color: var(--text-muted);
    font-style: italic;
}
.article-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--tag-bg);
    padding: 2px 6px;
    border-radius: 4px;
}
.article-body pre {
    background: #1A1A1A;
    color: #E5E0DA;
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5em 0;
}
.article-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}
.article-body ul, .article-body ol {
    margin: 1em 0;
    padding-left: 1.5em;
}
.article-body li { margin-bottom: 0.5em; }
.article-body img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 1.5em 0;
}
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}
.article-body th, .article-body td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}
.article-body th {
    background: var(--tag-bg);
    font-weight: 600;
}
.article-tags {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── TAG PAGE ─── */
.tag-page-header {
    padding: 48px 0 24px;
    text-align: center;
}
.tag-page-header h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 400;
}
.tag-page-header h1 span { color: var(--accent); }
.tag-page-header p { color: var(--text-muted); font-size: 0.9rem; margin-top: 8px; }

/* ─── FOOTER ─── */
footer {
    margin-top: 80px;
    padding: 32px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
footer p { font-size: 0.82rem; color: var(--text-light); }

/* ─── PAGINATION ─── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    padding-bottom: 16px;
}
.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.pagination-btn:hover { border-color: var(--text-muted); color: var(--text); }
.pagination-btn.active { background: var(--text); color: white; border-color: var(--text); }

/* ─── FILTER TAGS ─── */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-top: 8px;
}
.filter-tag {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
    text-decoration: none;
}
.filter-tag:hover { border-color: var(--text-muted); color: var(--text); }
.filter-tag.active { background: var(--text); color: white; border-color: var(--text); }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeUp 0.5s ease forwards;
    opacity: 0;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .featured-grid { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr; }
    .article-header h1 { font-size: 2rem; }
    .nav-links { gap: 16px; }
    .nav-links a { font-size: 0.78rem; }
}

/* ═══════════════════════════════════════
   ADMIN STYLES
   ═══════════════════════════════════════ */

.admin-body { background: #F8F8F8; }
.admin-nav { background: rgba(248,248,248,0.9); }
.admin-main { padding: 32px 0 80px; }
.admin-container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-header-row h1 {
    font-family: var(--font-display);
    font-size: 2rem;
}

.admin-container h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 24px;
}
.admin-container h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 16px;
}

/* Admin Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-mono);
}
.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-section { margin-bottom: 32px; }
.admin-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.admin-table th, .admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: #FAFAF8;
}
.admin-table td { font-size: 0.9rem; }
.admin-table td a { color: var(--accent); text-decoration: none; }
.admin-table td a:hover { text-decoration: underline; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-internal { background: #E8F0E8; color: #3A6B3A; }
.badge-external { background: #E4EDF5; color: var(--external-accent); }
.badge-draft { background: #FFF3E0; color: #E65100; }
.badge-published { background: #E8F5E9; color: #2E7D32; }
.badge-archived { background: #F5F5F5; color: #757575; }

/* Forms */
.admin-form {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}
.form-group textarea { resize: vertical; font-family: var(--font-mono); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error {
    background: #FFEBEE;
    color: #C62828;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}
.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.inline-form input { flex: 1; }
.tag-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: var(--surface);
    color: var(--text);
}
.btn:hover { border-color: var(--text-muted); }
.btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
}
.btn-danger {
    background: white;
    color: #C62828;
    border-color: #EF9A9A;
}
.btn-danger:hover { background: #FFEBEE; border-color: #C62828; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* Admin Login */
.admin-login {
    max-width: 400px;
    margin: 120px auto;
    text-align: center;
}
.admin-login .admin-form { text-align: left; }

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.analytics-chart {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 8px;
}
.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}
.chart-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 90px;
    text-align: right;
}
.chart-bar-container {
    flex: 1;
    height: 18px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}
.chart-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    min-width: 2px;
    transition: width 0.3s;
}
.chart-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text);
    min-width: 80px;
    font-weight: 500;
}
.chart-legend {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: right;
    padding-top: 4px;
}
.truncate-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.text-muted { color: var(--text-muted); }
.badge-status-200 { background: #E8F5E9; color: #2E7D32; }
.badge-status-301, .badge-status-302, .badge-status-304 { background: #E3F2FD; color: #1565C0; }
.badge-status-404 { background: #FFF3E0; color: #E65100; }
.badge-status-500 { background: #FFEBEE; color: #C62828; }

@media (max-width: 768px) {
    .analytics-grid { grid-template-columns: 1fr; }
}
