/* Acervo (archive) module - modern responsive redesign.
   Scoped under .ac to avoid colliding with Bootstrap 4 / legacy rules.
   Light theme only (print-emulating editorial); tenant brand color drives
   the accent via the inline --ac custom property. */

/* Kill any horizontal overflow on the archive pages (scoped: this stylesheet
   only loads on the acervo module). Keeps sticky top bar working. */
html { overflow-x: hidden; }

.ac {
    /* Interactive accent (buttons, active pills, links): a fixed neutral
       graphite, identical for every publication so the component stays
       brand-agnostic and predictable. The tenant brand shows in the top bar
       and logo, not in the controls. */
    --ac: #2a2f36;
    --ac-ink: #ffffff;          /* text on accent */
    /* Top bar is the only surface driven by the tenant's configured color
       (pref.backgroundTop); its text color is computed for contrast. */
    --topbar-bg: #ffffff;
    --topbar-ink: #1d1d1f;
    --ink: #1d1d1f;
    --ink-soft: #5b5b60;
    --line: #e6e6e9;
    --surface: #ffffff;
    --surface-2: #f6f6f8;
    --bg: #fbfbfc;
    --radius-card: 12px;
    --radius-input: 10px;
    --shadow-1: 0 1px 2px rgba(20, 20, 30, .06), 0 4px 14px rgba(20, 20, 30, .05);
    --shadow-2: 0 6px 16px rgba(20, 20, 30, .10), 0 18px 40px rgba(20, 20, 30, .12);
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ac *,
.ac *::before,
.ac *::after { box-sizing: border-box; }

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

.ac-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px 64px;
}

/* ---------- Top bar ---------- */
.ac-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--topbar-bg);
    color: var(--topbar-ink);
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 1px 6px rgba(20, 20, 30, .06);
}
.ac-topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.ac-brand { display: flex; align-items: center; min-height: 44px; min-width: 0; }
.ac-brand img { height: 40px; width: auto; max-width: 46vw; object-fit: contain; display: block; }
.ac-topbar-spacer { flex: 1 1 auto; }
.ac-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    min-width: 40px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid;
    border-color: var(--topbar-ink);
    color: var(--topbar-ink);
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background .18s ease, transform .06s ease;
}
.ac-iconbtn:hover { background: rgba(128, 128, 128, .16); }
.ac-iconbtn:active { transform: translateY(1px); }
.ac-user-name { color: var(--topbar-ink); font-weight: 600; }

/* ---------- Toolbar (search + nav actions) ---------- */
.ac-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 28px 0 8px;
}
.ac-toolbar .ac-search { flex: 1 1 320px; }
.ac-search {
    display: flex;
    align-items: stretch;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-input);
    padding: 6px;
    box-shadow: var(--shadow-1);
}
.ac-search select,
.ac-search input[type="text"] {
    border: 0;
    background: transparent;
    height: 40px;
    padding: 0 10px;
    font-size: 15px;
    color: var(--ink);
    outline: none;
    min-width: 0;
}
.ac-search input[type="text"] { flex: 1 1 auto; }
.ac-search select {
    border-right: 1px solid var(--line);
    max-width: 130px;
    cursor: pointer;
}
.ac-search input::placeholder { color: #9a9aa2; }

.ac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .06s ease, box-shadow .18s ease, background .18s ease;
    white-space: nowrap;
}
/* Scoped under .ac so these beat the legacy `.ac a { color: inherit }` rule
   (which otherwise wins on specificity and darkens the button text). */
.ac .ac-btn-primary { background: var(--ac); color: var(--ac-ink); }
.ac .ac-btn-primary:hover { box-shadow: var(--shadow-1); }
.ac .ac-btn-primary:active { transform: translateY(1px); }
.ac .ac-btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.ac .ac-btn-ghost:hover { background: var(--surface-2); }
.ac-search-btn {
    height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    border: 0;
    background: var(--ac);
    color: var(--ac-ink);
    cursor: pointer;
}

/* ---------- Section headings ---------- */
.ac-section { padding-top: 40px; }
.ac-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.ac-h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 700; letter-spacing: -.02em; margin: 0; }
.ac-h2 { font-size: clamp(20px, 3vw, 26px); font-weight: 700; letter-spacing: -.01em; margin: 0; }
.ac-sub { color: var(--ink-soft); font-size: 15px; margin: 4px 0 0; }

/* ---------- Hero (featured current edition) ---------- */
.ac-hero {
    display: grid;
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    margin-top: 28px;
    padding: 32px;
    background: var(--surface); /* fallback if color-mix is unsupported */
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--ac) 6%, transparent), transparent 60%),
        var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-1);
}
.ac-hero-cover {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-2);
    background: var(--surface-2);
    line-height: 0;
    /* No forced aspect ratio: newspapers (tall) and magazines differ. */
    transition: transform .25s ease;
}
.ac-hero-cover img { width: 100%; height: auto; display: block; }
.ac-hero-cover:hover { transform: translateY(-3px); }
.ac-hero-meta .ac-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--ac);
    color: var(--ac-ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.ac-hero-title { font-size: clamp(26px, 4.4vw, 40px); font-weight: 800; margin: 14px 0 6px; letter-spacing: -.02em; line-height: 1.05; }
.ac-hero-date { color: var(--ink-soft); font-size: 16px; margin: 0 0 22px; }

/* ---------- Cover grid ---------- */
.ac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 22px;
    align-items: start;
}
.ac-card { display: flex; flex-direction: column; }
.ac-card-cover {
    position: relative;
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--surface-2);
    box-shadow: var(--shadow-1);
    line-height: 0;
    /* No forced aspect ratio: each publication has its own cover proportions
       (magazine vs. German/standard newspaper). Show the full cover, no crop. */
    transition: transform .22s ease, box-shadow .22s ease;
}
.ac-card-cover img { width: 100%; height: auto; display: block; }
.ac-card:hover .ac-card-cover { transform: translateY(-4px); box-shadow: var(--shadow-2); }

/* Subtle highlight for the most recent edition (first card). Not a hero: just
   an accent ring, a little more elevation, and a small badge. */
.ac-card--featured .ac-card-cover { box-shadow: 0 0 0 2px var(--ac), var(--shadow-2); }
.ac-card--featured:hover .ac-card-cover { transform: translateY(-4px); box-shadow: 0 0 0 2px var(--ac), var(--shadow-2); }
.ac-card--featured .ac-card-num { color: var(--ac); }
.ac-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--ac);
    color: var(--ac-ink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1;
}
.ac-card-num { font-size: 14px; font-weight: 700; margin: 12px 0 2px; }
.ac-card-date { font-size: 13px; color: var(--ink-soft); }
.ac-card-name {
    font-size: 13px;
    color: var(--ink-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---------- Browse (navegar) filters ---------- */
.ac-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-1);
    padding: 22px;
    margin-top: 24px;
}
.ac-filter-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 10px;
}
.ac-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.ac-pills::-webkit-scrollbar { height: 6px; }
.ac-pills::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.ac-pill {
    scroll-snap-align: start;
    flex: 0 0 auto;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
    white-space: nowrap;
}
.ac-pill:hover { background: var(--surface-2); }
.ac-pill.is-active { background: var(--ac); color: var(--ac-ink); border-color: var(--ac); }
.ac-filter-block + .ac-filter-block { margin-top: 18px; }

.ac-results { margin-top: 28px; }

/* ---------- States (loading / empty) ---------- */
.ac-skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px; }
.ac-skeleton {
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-card);
    background: linear-gradient(100deg, var(--surface-2) 30%, #eeeef2 50%, var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: ac-shimmer 1.2s linear infinite;
}
@keyframes ac-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ac-empty {
    text-align: center;
    color: var(--ink-soft);
    padding: 48px 16px;
    font-size: 15px;
}
.ac-empty i { font-size: 28px; opacity: .5; display: block; margin-bottom: 10px; }

/* ---------- Search results (pesquisar) ---------- */
.ac-result {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-1);
    padding: 16px;
    margin-bottom: 16px;
}
.ac-result-thumb { border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.ac-result-thumb img { width: 100%; height: auto; display: block; }
.ac-result-body h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.ac-result-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--ink-soft); font-size: 13px; margin-bottom: 10px; }
.ac-result-meta span { display: inline-flex; align-items: center; gap: 6px; }
.ac-result-text { color: var(--ink); font-size: 14px; line-height: 1.6; }
.ac-result-text strong { background: #fff2a8; color: var(--ink); padding: 0 2px; border-radius: 2px; }
.ac .ac-result-link { color: var(--ac); font-weight: 600; }

.ac-pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 20px 0; }
.ac-page {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
}
.ac-page:hover { background: var(--surface-2); }
.ac-page.is-active { background: var(--ac); color: var(--ac-ink); border-color: var(--ac); }

/* ---------- Product switcher (offcanvas) ---------- */
.ac-drawer-title { font-size: 18px; font-weight: 700; }
.ac-drawer-item {
    display: block;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 15px;
    cursor: pointer;
}
.ac-drawer-item:hover { color: var(--ac); }

/* ---------- Footer ---------- */
.ac-footer {
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    margin-top: 56px;
}
.ac-footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.ac-footer-logo { height: 34px; width: auto; max-width: 60vw; object-fit: contain; opacity: .9; }
.ac-footer-powered a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 14px;
}
.ac-footer-powered a:hover { color: var(--ink); }
.ac-footer-powered strong { color: var(--ink); font-weight: 700; }
.ac-footer-powered img { display: block; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .ac-shell { padding: 0 16px 48px; }
    .ac-hero { grid-template-columns: 1fr; gap: 20px; justify-items: center; text-align: center; }
    .ac-hero-cover { max-width: 240px; }
    .ac-hero-meta { text-align: center; }
    .ac-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
    .ac-result { grid-template-columns: 88px 1fr; gap: 12px; }
    .ac-section-head { flex-direction: column; align-items: flex-start; gap: 12px; }
    .ac-search { flex-wrap: wrap; }
    .ac-search select { max-width: none; flex: 1 1 46%; }
    .ac-search input[type="text"] { flex: 1 1 100%; }
    .ac-toolbar .ac-search { flex-basis: 100%; }
    .ac-footer-inner { justify-content: center; text-align: center; }
}

@media (max-width: 380px) {
    .ac-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .ac * { animation: none !important; transition: none !important; }
}
