/* Newspapers South Africa — public stylesheet */

:root {
    --ink: #1b1a17;
    --ink-soft: #55514a;
    --ink-faint: #8a847a;
    --paper: #faf7f1;
    --surface: #ffffff;
    --line: #e4ddd0;
    --brand: #8b1a1a;
    --brand-dark: #6d1414;
    --accent: #1f5673;
    --focus: #1f5673;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(27, 26, 23, .06), 0 6px 20px rgba(27, 26, 23, .06);
    --serif: "Fraunces", Georgia, "Times New Roman", serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Aliases used by admin.css / publish.css */
    --bg: var(--paper);
    --border: var(--line);
    --brand-contrast: #ffffff;
    --accent-solid: var(--brand);
    --text: var(--ink);
    --text-muted: var(--ink-soft);
    --surface-alt: var(--paper);
    --ok-bg: rgba(31, 134, 77, .12);
    --positive: #1f864d;
    --warn-bg: rgba(139, 26, 26, .1);
    --warn-border: var(--brand);
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #ece7dd;
        --ink-soft: #b3ac9f;
        --ink-faint: #8b8579;
        --paper: #171614;
        --surface: #201e1b;
        --line: #34312c;
        --brand: #e07a5f;
        --brand-dark: #c96246;
        --accent: #7bb0c9;
        --focus: #7bb0c9;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.6;
    font-size: 16px;
}

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

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; font-weight: 600; }

.container { width: min(1120px, 92vw); margin-inline: auto; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--brand);
    color: #fff;
    padding: .6rem 1rem;
    z-index: 100;
}
.skip-link:focus { left: 1rem; }

/* ---------- Header ---------- */
.site-header {
    background: var(--surface);
    border-bottom: 3px double var(--ink);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 0;
    flex-wrap: wrap;
}
.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: var(--ink);
}
.site-header__mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    background: var(--brand);
    color: #fff;
    font-family: var(--serif);
    font-weight: 700;
    border-radius: 6px;
    font-size: .95rem;
}
.site-header__name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; }

.site-nav { display: flex; align-items: center; gap: 1.3rem; }
.site-nav a {
    text-decoration: none;
    color: var(--ink-soft);
    font-weight: 500;
    font-size: .95rem;
}
.site-nav a:hover { color: var(--brand); }
.site-nav__cta {
    border: 1px solid var(--line);
    padding: .4rem .8rem;
    border-radius: 999px;
    color: var(--ink) !important;
}

.site-header__toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: 0;
    padding: 8px;
    cursor: pointer;
}
.site-header__toggle span {
    width: 22px;
    height: 2px;
    background: var(--ink);
}

@media (max-width: 820px) {
    .site-header__toggle { display: flex; }
    .site-nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: .2rem;
        padding-top: .6rem;
    }
    .site-nav.is-open { display: flex; }
    .site-nav a { padding: .5rem 0; width: 100%; }
}

/* ---------- Sub bar / search ---------- */
.site-subbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: .6rem 0;
}
.search-form { display: flex; gap: .5rem; }
.search-form__label { position: absolute; left: -9999px; }
.search-form__input {
    flex: 1;
    padding: .55rem .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}
.search-form__submit {
    padding: .55rem 1.1rem;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.search-form__submit:hover { background: var(--brand-dark); }
.search-form--hero { max-width: 560px; margin: 1.4rem auto 0; }
.search-form--hero .search-form__input { padding: .8rem 1rem; }
.search-form--page, .search-form--bar { max-width: 640px; }

/* ---------- Ads ---------- */
.ad-leaderboard { margin: 1rem auto; text-align: center; min-height: 0; }
.ad-slot { margin: 1.5rem 0; text-align: center; }
.art-grid__ad, .side-ad, .story__ad { margin: 1.5rem 0; text-align: center; }

/* ---------- Main / layout ---------- */
.site-main { padding: 2rem 0 3rem; }

/* ---------- Hero ---------- */
.hero {
    text-align: center;
    padding: 2.5rem 0 1rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2rem;
}
.hero__title { font-size: clamp(1.9rem, 4vw, 3rem); margin: 0 0 .6rem; }
.hero__lead { color: var(--ink-soft); font-size: 1.1rem; max-width: 44ch; margin-inline: auto; }
.hero__links { margin-top: 1rem; color: var(--ink-faint); font-size: .95rem; }

/* ---------- Home sections ---------- */
.home-section { margin: 2.5rem 0; }
.home-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2px solid var(--ink);
    padding-bottom: .4rem;
    margin-bottom: 1.2rem;
}
.home-section__head h2 { margin: 0; font-size: 1.35rem; }
.home-section__head a { font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; }

.section-title {
    font-size: 1.2rem;
    margin: 0 0 1rem;
    border-bottom: 2px solid var(--ink);
    padding-bottom: .35rem;
}

/* ---------- Newspaper grid / card ---------- */
.np-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.np-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.np-card__link {
    display: flex;
    gap: .8rem;
    padding: .9rem;
    text-decoration: none;
    color: var(--ink);
    align-items: center;
}
.np-card__link:hover { background: rgba(139, 26, 26, .04); }
.np-card__body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.np-card__name { font-family: var(--serif); font-weight: 600; }
.np-card__tagline { color: var(--ink-soft); font-size: .85rem; }
.np-card__meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .2rem; }
.np-card__place { color: var(--ink-faint); font-size: .8rem; }

.masthead {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--paper);
    border: 1px solid var(--line);
}
.masthead--tile {
    display: grid;
    place-items: center;
    color: #fff;
    font-family: var(--serif);
    font-weight: 700;
    border: 0;
}
.masthead--sm { width: 40px; height: 40px; font-size: .8rem; }
.masthead--lg { width: 84px; height: 84px; font-size: 1.5rem; }

/* ---------- Tags / chips ---------- */
.tag {
    display: inline-block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    color: var(--accent);
    background: rgba(31, 86, 115, .1);
    padding: .15rem .5rem;
    border-radius: 4px;
}
.pill {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--brand);
    color: #fff;
    padding: .1rem .4rem;
    border-radius: 3px;
}
.chip-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    text-decoration: none;
    color: var(--ink);
    font-size: .9rem;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip__count { color: var(--ink-faint); font-size: .8rem; }
.chip-list--tabs { margin-bottom: 1.5rem; }

/* ---------- Article grid / card ---------- */
.art-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.4rem;
}
.art-grid--2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.art-grid--3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.art-card { display: flex; flex-direction: column; }
.art-card__media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: .7rem;
    background: var(--line);
}
.art-card__media img { width: 100%; height: 100%; object-fit: cover; }
.art-card__section {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
    color: var(--brand);
    text-decoration: none;
}
.art-card__title { font-size: 1.1rem; margin: .3rem 0; line-height: 1.3; }
.art-card__title a { color: var(--ink); text-decoration: none; }
.art-card__title a:hover { color: var(--brand); }
.art-card__standfirst { color: var(--ink-soft); font-size: .92rem; margin: .3rem 0; }
.art-card__meta { color: var(--ink-faint); font-size: .82rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.art-card__meta a { color: var(--ink-soft); }

/* ---------- Page head / filters ---------- */
.page-head { border-bottom: 3px double var(--ink); padding-bottom: .6rem; margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.page-head__count { color: var(--ink-faint); font-size: .9rem; margin: .3rem 0 0; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1.5rem;
}
.filter-bar input, .filter-bar select {
    padding: .5rem .7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.filter-bar input { flex: 1; min-width: 180px; }
.filter-bar button {
    padding: .5rem 1.1rem;
    border: 0;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.empty {
    color: var(--ink-soft);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0 0;
    flex-wrap: wrap;
}
.pagination__pages { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 0; }
.pagination__page, .pagination__step {
    display: inline-block;
    padding: .4rem .7rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-decoration: none;
    color: var(--ink);
    font-size: .9rem;
}
.pagination__page.is-current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Newspaper page ---------- */
.paper-head {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    border-bottom: 3px double var(--ink);
    padding-bottom: 1.2rem;
    margin-bottom: 1.2rem;
}
.paper-head__body h1 { margin: 0 0 .3rem; font-size: clamp(1.7rem, 3.5vw, 2.5rem); }
.paper-head__tagline { color: var(--ink-soft); font-style: italic; margin: 0 0 .5rem; }
.paper-head__meta { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; color: var(--ink-faint); font-size: .85rem; }
.paper-head__links { margin: .6rem 0 0; display: flex; gap: 1rem; flex-wrap: wrap; font-size: .9rem; }
.paper-about { color: var(--ink-soft); max-width: 68ch; margin: 0 0 1.5rem; }

.pdf-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin-bottom: 2rem;
}

.paper-layout { display: grid; grid-template-columns: 1fr; gap: 2.5rem; }
@media (min-width: 900px) {
    .paper-layout { grid-template-columns: 1fr 300px; }
}
.edition-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.edition-list li {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--line);
}
.edition-list a { font-weight: 600; text-decoration: none; }
.edition-list span { color: var(--ink-faint); font-size: .8rem; }

/* ---------- Story ---------- */
.crumbs { display: flex; gap: .5rem; font-size: .85rem; color: var(--ink-faint); margin-bottom: 1rem; flex-wrap: wrap; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }

.story { max-width: 44rem; margin-inline: auto; }
.story__head { margin-bottom: 1.5rem; }
.story__head h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); margin: 0 0 .6rem; }
.story__standfirst { font-size: 1.2rem; color: var(--ink-soft); line-height: 1.5; margin: 0 0 1rem; }
.story__byline { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--ink-faint); font-size: .88rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .6rem 0; }
.story__byline a { color: var(--ink-soft); }
.story__hero { margin: 0 0 1.5rem; }
.story__hero img { border-radius: 8px; width: 100%; }
.story__body { font-size: 1.08rem; }

/* ---------- Prose ---------- */
.prose { max-width: 44rem; }
.prose--narrow { max-width: 40rem; margin-inline: auto; }
.prose h2 { margin-top: 2rem; font-size: 1.4rem; }
.prose h3 { margin-top: 1.5rem; }
.prose p, .prose li { color: var(--ink); }
.prose img { border-radius: 8px; margin: 1.2rem 0; }
.prose figure { margin: 1.5rem 0; }
.prose figcaption { color: var(--ink-faint); font-size: .85rem; margin-top: .4rem; }
.table-plain-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
.table-plain { width: 100%; min-width: 40rem; border-collapse: collapse; font-size: .92rem; }
.table-plain th, .table-plain td {
    text-align: left;
    vertical-align: top;
    padding: .6rem .8rem;
    border: 1px solid var(--line);
}
.table-plain th { background: var(--surface); font-weight: 600; }
.prose blockquote {
    border-left: 3px solid var(--brand);
    margin: 1.5rem 0;
    padding: .3rem 0 .3rem 1.2rem;
    color: var(--ink-soft);
    font-style: italic;
}
.prose code { background: var(--surface); border: 1px solid var(--line); padding: .1rem .3rem; border-radius: 4px; font-size: .9em; }
.prose pre { background: var(--surface); border: 1px solid var(--line); padding: 1rem; border-radius: 8px; overflow-x: auto; }
.prose__meta { color: var(--ink-faint); font-size: .85rem; }
.lead { font-size: 1.15rem; color: var(--ink-soft); }

/* ---------- Editions ---------- */
.edition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}
.ed-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ed-card__cover { display: block; aspect-ratio: 3 / 4; background: var(--line); }
.ed-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.ed-card__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #fff;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: .1em;
}
.ed-card__body { padding: .9rem; }
.ed-card__paper { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); text-decoration: none; font-weight: 700; }
.ed-card__body h3 { font-size: 1rem; margin: .3rem 0; }
.ed-card__body h3 a { color: var(--ink); text-decoration: none; }
.ed-card__date { color: var(--ink-faint); font-size: .82rem; margin: .2rem 0 .7rem; }

.edition-view { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2rem; }
@media (min-width: 700px) { .edition-view { grid-template-columns: 220px 1fr; } }
.edition-view__cover { aspect-ratio: 3 / 4; background: var(--line); border-radius: 8px; overflow: hidden; }
.edition-view__cover img { width: 100%; height: 100%; object-fit: cover; }
.edition-view__body h1 { margin: 0 0 .3rem; }
.edition-view__date { color: var(--ink-faint); margin: 0 0 1rem; }
.edition-view__actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; }
.edition-view__embed { width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }

.search-group { margin-bottom: 2.5rem; }
.search-group h2 { border-bottom: 2px solid var(--ink); padding-bottom: .3rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: .92rem;
    cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn--sm { padding: .4rem .8rem; font-size: .85rem; }
.btn span { font-weight: 400; opacity: .85; }

.cta-row { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.5rem 0; }

/* ---------- Field (public forms) ---------- */
.field { margin-bottom: 1.1rem; }
.field__label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
.field__req { color: var(--brand); }
.field__hint { color: var(--ink-faint); font-size: .84rem; margin: 0 0 .3rem; }
.field__control {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.field--error .field__control { border-color: var(--brand); }
.field__error { color: var(--brand); font-size: .85rem; margin: .3rem 0 0; }
.form-hp { position: absolute; left: -9999px; }
.checkbox { display: flex; gap: .5rem; align-items: flex-start; margin: .8rem 0; font-size: .92rem; }
.form__submit {
    padding: .7rem 1.5rem;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.form__submit:hover { background: var(--brand-dark); }

/* ---------- Auth / publisher forms ---------- */
.auth-wrap {
    max-width: 30rem;
    margin: 1rem auto 3rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.8rem;
}
.auth-wrap--wide { max-width: 42rem; }
.auth-wrap h1 { margin-top: 0; }
.auth-alt { margin-top: 1.2rem; font-size: .92rem; color: var(--ink-soft); }
.form__section {
    font-size: 1.05rem;
    margin: 1.6rem 0 .8rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--line);
}
.form__section:first-of-type { margin-top: .5rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }

.callout {
    border: 1px solid var(--line);
    border-left: 4px solid var(--ink-faint);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
}
.callout h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.callout p { margin: .3rem 0; color: var(--ink-soft); }
.callout--warn { border-left-color: var(--brand); }
.callout--info { border-left-color: var(--accent); }
.callout form { margin-top: .8rem; }

.notice { padding: .8rem 1rem; border-radius: 8px; margin: 1rem 0; }
.notice--ok { background: rgba(31, 134, 77, .12); color: #1f864d; }
.notice--warn { background: rgba(139, 26, 26, .1); color: var(--brand); }
.notice--info { background: rgba(31, 86, 115, .1); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--surface);
    border-top: 3px double var(--ink);
    margin-top: 3rem;
    padding: 2rem 0;
    font-size: .9rem;
    color: var(--ink-soft);
}
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .8rem; }
.site-footer__nav a { color: var(--ink-soft); text-decoration: none; }
.site-footer__nav a:hover { color: var(--brand); }

/* ---------- Cookie notice ---------- */
.cookie-notice {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: 480px;
    margin-inline: auto;
    background: var(--ink);
    color: var(--paper);
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    display: flex;
    gap: 1rem;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 50;
}
.cookie-notice p { margin: 0; font-size: .88rem; }
.cookie-notice a { color: var(--paper); }
.cookie-notice button {
    flex-shrink: 0;
    background: var(--paper);
    color: var(--ink);
    border: 0;
    padding: .5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Error page ---------- */
.error-page { text-align: center; padding: 3rem 0; }
.error-page__code { font-family: var(--serif); font-size: 4rem; color: var(--brand); margin: 0; }

[hidden] { display: none !important; }
