/* ==========================================================================
   Asociación Vaisnavas de España — Facebook Archive
   Static site stylesheet
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --bg: #f0f2f5;
    --card-bg: #fff;
    --text: #1c1e21;
    --text-secondary: #65676b;
    --accent: #1877f2;
    --accent-hover: #1466d8;
    --border: #dadde1;
    --tag-bg: #e4e6eb;
    --tag-text: #444950;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol";
    --max-width: 680px;
}

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

/* ---------- Base ---------- */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-stack);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

/* ---------- Site Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.site-title:hover {
    text-decoration: none;
    color: var(--accent-hover);
}

.header-search {
    flex: 1;
    max-width: 320px;
    min-width: 160px;
    margin: 0;
}

.header-search input {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.9375rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.header-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

nav a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* ---------- Main Content ---------- */
.content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px 16px 40px;
}

/* ---------- Post Card ---------- */
.post-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

/* ── Post Header ── */
.post-header {
    padding: 12px 16px 0;
}

.post-author-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    flex-shrink: 0;
}

.post-meta {
    display: flex;
    flex-direction: column;
}

.post-author {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

.post-time {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.post-time-link {
    color: var(--text-secondary);
    text-decoration: none;
}

.post-time-link:hover {
    text-decoration: underline;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    display: inline-block;
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.tag:hover {
    background: var(--border);
    text-decoration: none;
}

/* ── Post Body ── */
.post-body {
    padding: 12px 16px;
}

.post-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.post-text {
    font-size: 1rem;
    line-height: 1.75;
    word-wrap: break-word;
    overflow-wrap: break-word;
    letter-spacing: 0.01em;
}

.read-more {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.read-more:hover {
    color: var(--accent);
    text-decoration: none;
}

/* ── Post Media ── */
.post-media {
    margin: 0;
}

.post-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2px;
}

.media-item {
    line-height: 0;
}

.post-image {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.post-video {
    width: 100%;
    height: auto;
    background: #000;
}

.media-caption {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 6px 16px;
    line-height: 1.4;
}

/* ── Post Links ── */
.post-links {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.post-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--tag-bg);
    padding: 10px 14px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 0.875rem;
    transition: background 0.15s ease;
    overflow: hidden;
}

.post-link:hover {
    background: var(--border);
    text-decoration: none;
}

.link-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.link-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

/* ── Post Comments ── */
.post-comments {
    border-top: 1px solid var(--border);
    padding: 12px 16px 16px;
}

.comments-heading {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.comment {
    background: var(--bg);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.comment:last-child {
    margin-bottom: 0;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    word-wrap: break-word;
}

/* ---------- Category Grid ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.category-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    text-decoration: none;
}

.category-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-card .count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ---------- Date Navigation ---------- */
.date-nav {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.date-nav-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.date-nav-years {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.date-nav-years a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--tag-bg);
    color: var(--text);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.date-nav-years a:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.date-nav-years a.active {
    background: var(--accent);
    color: #fff;
}

.date-nav-years .count {
    font-size: 0.75rem;
    opacity: 0.7;
}

.date-nav-months {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.date-nav-months a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.date-nav-months a:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.date-nav-months a.active {
    background: var(--accent);
    color: #fff;
}

.date-nav-months .count {
    font-size: 0.6875rem;
    opacity: 0.7;
}

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

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.pagination a {
    background: var(--card-bg);
    color: var(--accent);
    box-shadow: var(--shadow);
}

.pagination a:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.pagination .disabled {
    color: var(--border);
    cursor: default;
    background: transparent;
}

/* ---------- Statistics ---------- */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 16px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.stats-chart {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 28px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.chart-label {
    flex-shrink: 0;
    width: 90px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    font-weight: 500;
}

.chart-label a {
    color: var(--text-secondary);
}

.chart-label a:hover {
    color: var(--accent);
}

.chart-bar-container {
    flex: 1;
    min-width: 0;
}

.chart-bar {
    background: var(--accent);
    border-radius: 4px;
    min-width: 24px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    transition: width 0.3s ease;
}

.chart-bar-cat {
    background: var(--tag-bg);
    color: var(--text);
}

.chart-value {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.chart-bar-cat .chart-value {
    color: var(--text-secondary);
}

.stats-table {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-collapse: collapse;
    margin-bottom: 28px;
    overflow: hidden;
}

.stats-table th,
.stats-table td {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.875rem;
}

.stats-table th {
    background: var(--tag-bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-table td {
    border-top: 1px solid var(--border);
}

.stats-table tr:hover td {
    background: var(--bg);
}

.stats-table a {
    font-weight: 600;
}

/* ---------- Search ---------- */
.search-box {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 1rem;
    font-family: var(--font-stack);
    background: var(--card-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

.search-box::placeholder {
    color: var(--text-secondary);
}

.search-results {
    margin-top: 20px;
}

.search-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 0;
    font-size: 0.9375rem;
}

/* ---------- Page Headers ---------- */
.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* ---------- Archive ---------- */
.archive-month {
    margin-bottom: 32px;
}

.archive-month h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

/* ---------- Focus & Accessibility ---------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-search {
        order: 3;
        max-width: 100%;
        flex-basis: 100%;
    }

    nav {
        gap: 14px;
    }

    .site-title {
        font-size: 1.125rem;
    }

    .content {
        padding: 12px 8px 32px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .category-card {
        padding: 14px;
    }

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

    .pagination {
        gap: 4px;
    }

    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 0.8125rem;
    }
}

/* ---------- Post bottom navigation ---------- */
.post-nav-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.back-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* Medium breakpoint — tighten spacing */
@media (max-width: 720px) {
    .header-inner {
        padding: 10px 12px;
    }

    .content {
        padding: 16px 12px 36px;
    }
}
