/* ===========================================================================
   Poeten — newspaper-style stylesheet (light + dark)
   =========================================================================== */
:root {
    --bg: #faf8f4;
    --surface: #ffffff;
    --ink: #1a1a1a;
    --ink-soft: #4a4a4a;
    --ink-faint: #7a7572;
    --line: #e3ddd3;
    --line-strong: #c9c1b4;
    --accent: #b03a2e;
    --accent-ink: #8a2c22;
    --gold: #9a7b3f;
    --link: #1c3f6e;
    --tag-bg: #f0ebe1;
    --shadow: 0 1px 3px rgba(40, 30, 20, .08);
    --serif-display: "Playfair Display", Georgia, "Times New Roman", serif;
    --serif-body: "Source Serif 4", Georgia, serif;
    --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --wrap: 1180px;
}
[data-theme="dark"] {
    --bg: #15130f;
    --surface: #1d1a15;
    --ink: #ece7df;
    --ink-soft: #c2bcb2;
    --ink-faint: #8f887d;
    --line: #332e26;
    --line-strong: #4a4338;
    --accent: #e07a5f;
    --accent-ink: #e69a85;
    --gold: #cda85f;
    --link: #8fb4e6;
    --tag-bg: #2a251d;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--serif-body);
    font-size: 18px;
    line-height: 1.6;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---- Topbar ---- */
.topbar { background: var(--ink); color: #f3ede2; font-family: var(--sans); font-size: 12px; }
[data-theme="dark"] .topbar { background: #0c0a07; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar-date { text-transform: capitalize; letter-spacing: .04em; color: #d8cfbf; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.lang-form { display: inline-flex; align-items: center; gap: 6px; }
.lang-btn { background: none; border: 0; color: #b9b0a0; cursor: pointer; font: inherit; padding: 2px; letter-spacing: .05em; }
.lang-btn.active { color: #fff; font-weight: 700; }
.lang-sep { color: #6b6357; }
.theme-toggle { background: none; border: 0; color: #d8cfbf; cursor: pointer; font-size: 16px; line-height: 1; }

/* ---- Masthead ---- */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; gap: 16px; }
.brand { text-align: left; text-decoration: none; }
.brand-name { font-family: var(--serif-display); font-weight: 900; font-size: clamp(34px, 6vw, 58px); line-height: .95; color: var(--ink); letter-spacing: -.01em; display: block; }
.brand-tag { font-family: var(--sans); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.brand:hover { text-decoration: none; }

.user-menu { display: flex; align-items: center; gap: 14px; font-family: var(--sans); font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.user-link { color: var(--ink-soft); }
.user-link.as-button { background: none; border: 0; cursor: pointer; font: inherit; color: var(--ink-soft); padding: 0; }
.logout-form { display: inline; margin: 0; }
.btn-pill { background: var(--accent); color: #fff !important; padding: 7px 16px; border-radius: 999px; font-weight: 600; }
.btn-pill:hover { background: var(--accent-ink); text-decoration: none; }

/* ---- Main nav ---- */
.mainnav { background: var(--surface); border-bottom: 2px solid var(--ink); position: sticky; top: 0; z-index: 40; }
.mainnav-inner { display: flex; align-items: center; }
.navlinks { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; font-family: var(--sans); }
.navlinks > li > a { display: block; padding: 12px 14px; color: var(--ink); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.navlinks > li > a:hover { color: var(--accent); text-decoration: none; }
.nav-search a { color: var(--accent); }
.nav-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink); padding: 10px; }

.page-main { padding: 28px 20px 48px; min-height: 50vh; }

/* ---- Kicker / labels ---- */
.kicker { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--ink); margin: 38px 0 18px; padding-bottom: 6px; }
.section-head h2 { font-family: var(--serif-display); font-weight: 700; font-size: 24px; margin: 0; }
.section-head a { font-family: var(--sans); font-size: 13px; }

/* ---- Front-page grid ---- */
.front-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 34px; }
.lead-col { border-right: 1px solid var(--line); padding-right: 34px; }

.lead .cover { margin-bottom: 14px; border-radius: 2px; overflow: hidden; }
.lead h1 { font-family: var(--serif-display); font-weight: 900; font-size: clamp(30px, 4.4vw, 50px); line-height: 1.04; margin: 8px 0 10px; letter-spacing: -.015em; }
.lead h1 a { color: var(--ink); }
.lead .dek { font-size: 21px; color: var(--ink-soft); line-height: 1.45; margin: 0 0 12px; font-family: var(--serif-body); }
.byline { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.byline a { color: var(--ink-soft); font-weight: 600; }
.dot { color: var(--line-strong); }

.sub-leads { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.sub-leads .card h3 { font-size: 22px; }

.card .cover { margin-bottom: 10px; overflow: hidden; border-radius: 2px; }
.card .cover img { width: 100%; aspect-ratio: 3/2; object-fit: cover; transition: transform .4s ease; }
.card:hover .cover img { transform: scale(1.04); }
.card h3 { font-family: var(--serif-display); font-weight: 700; font-size: 19px; line-height: 1.12; margin: 6px 0 6px; }
.card h3 a { color: var(--ink); }
.card .dek { font-size: 15.5px; color: var(--ink-soft); margin: 0 0 8px; line-height: 1.4; }

/* rail (most read) */
.rail-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.rail-list li { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.rail-list li:first-child { border-top: 0; }
.rail-num { counter-increment: rank; font-family: var(--serif-display); font-weight: 900; font-size: 30px; color: var(--accent); line-height: 1; min-width: 28px; }
.rail-num::before { content: counter(rank); }
/* Big stat number for dashboards — like rail-num but WITHOUT the list counter. */
.stat-num { font-family: var(--serif-display); font-weight: 900; font-size: 30px; color: var(--accent); line-height: 1; }
.rail-list h4 { font-family: var(--serif-body); font-weight: 600; font-size: 16px; line-height: 1.25; margin: 0 0 4px; }
.rail-list h4 a { color: var(--ink); }
.rail-meta { font-family: var(--sans); font-size: 11.5px; color: var(--ink-faint); }

/* poem-of-day box */
.potd { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); padding: 22px; box-shadow: var(--shadow); margin-bottom: 28px; }
.potd .kicker { color: var(--gold); }
.potd h3 { font-family: var(--serif-display); font-size: 26px; font-weight: 700; margin: 6px 0 10px; line-height: 1.1; }
.potd h3 a { color: var(--ink); }
.potd .verse { font-family: var(--serif-body); font-style: italic; color: var(--ink-soft); white-space: pre-line; line-height: 1.6; font-size: 17px; }

/* generic responsive card grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 30px 26px; }
.cards.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cards.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* type chip + tags */
.chip { display: inline-block; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tag { font-family: var(--sans); font-size: 12px; background: var(--tag-bg); color: var(--ink-soft); padding: 4px 11px; border-radius: 999px; }
.tag:hover { text-decoration: none; background: var(--line-strong); }

/* ---- Author cards ---- */
.authors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 26px; }
.author-card { text-align: center; background: var(--surface); border: 1px solid var(--line); padding: 22px; box-shadow: var(--shadow); }
.avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; background: var(--tag-bg); display: flex; align-items: center; justify-content: center; font-family: var(--serif-display); font-size: 32px; color: var(--accent); font-weight: 700; }
.author-card h3 { font-family: var(--serif-display); font-size: 20px; margin: 0 0 6px; }
.author-card p { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 12px; }

/* ---- Article (read) page ---- */
.article { max-width: 720px; margin: 0 auto; }
.article-head { text-align: center; margin-bottom: 26px; }
.article-head .kicker { display: block; margin-bottom: 12px; }
.article h1 { font-family: var(--serif-display); font-weight: 900; font-size: clamp(32px, 5.5vw, 54px); line-height: 1.05; margin: 0 0 14px; letter-spacing: -.015em; }
.article .standfirst { font-size: 22px; color: var(--ink-soft); font-style: italic; line-height: 1.45; margin: 0 0 18px; }
.article-meta { font-family: var(--sans); font-size: 13.5px; color: var(--ink-faint); display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.article-meta a { color: var(--ink-soft); font-weight: 600; }
.article-cover { margin: 28px 0; }
.article-cover figcaption { font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; text-align: center; }
.article-body { font-size: 20px; line-height: 1.72; }
.article-body p { margin: 0 0 1.3rem; }
.article-body.poem p { white-space: pre-line; }
.article-body.dropcap > p:first-of-type::first-letter {
    font-family: var(--serif-display); font-weight: 900; float: left; font-size: 78px; line-height: .72; padding: 6px 12px 0 0; color: var(--accent);
}
.article-body img { margin: 1.5rem auto; border-radius: 2px; }
.article-body blockquote { border-left: 3px solid var(--accent); margin: 1.5rem 0; padding-left: 18px; color: var(--ink-soft); font-style: italic; }
.article-body em { font-style: italic; }

/* engagement bar */
.engage { display: flex; gap: 12px; align-items: center; margin: 30px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex-wrap: wrap; font-family: var(--sans); }
.engage form { margin: 0; }
.ebtn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); padding: 8px 15px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; }
.ebtn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.ebtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ebtn .count { font-weight: 700; }
.share-links { margin-left: auto; display: flex; gap: 8px; }
.share-links a { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--ink-soft); font-size: 14px; }
.share-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* author box */
.author-box { display: flex; gap: 18px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); padding: 22px; margin: 30px 0; }
.author-box .avatar { margin: 0; width: 70px; height: 70px; font-size: 26px; flex: 0 0 auto; }
.author-box h4 { font-family: var(--serif-display); font-size: 21px; margin: 0 0 6px; }
.author-box p { margin: 0; font-size: 15px; color: var(--ink-soft); }

/* comments */
.comments { margin-top: 36px; }
.comment { padding: 16px 0; border-top: 1px solid var(--line); }
.comment-head { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin-bottom: 5px; }
.comment-head strong { color: var(--ink); }
.comment-body { font-size: 16px; }
.comment-form textarea, .field textarea, .field input, .field select {
    width: 100%; font-family: var(--serif-body); font-size: 16px; padding: 11px 13px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 3px;
}

/* ---- Forms / generic ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-family: var(--sans); font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.field .hint { font-family: var(--sans); font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.btn { display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 14px; padding: 10px 20px; border-radius: 3px; border: 1px solid var(--ink); background: var(--ink); color: var(--surface); cursor: pointer; }
.btn:hover { text-decoration: none; opacity: .9; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-danger { background: #a12; border-color: #a12; color: #fff; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.panel { background: var(--surface); border: 1px solid var(--line); padding: 26px; box-shadow: var(--shadow); }
.form-narrow { max-width: 560px; margin: 0 auto; }
.page-title { font-family: var(--serif-display); font-weight: 900; font-size: clamp(30px,5vw,46px); margin: 4px 0 6px; }
.page-intro { color: var(--ink-soft); font-size: 18px; margin: 0 0 22px; max-width: 680px; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.table th { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.badge { font-family: var(--sans); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge.published { background: #e3f1e3; color: #1d6b2a; }
.badge.draft { background: var(--tag-bg); color: var(--ink-soft); }
.badge.pending { background: #fbe7cf; color: #8a5a12; }
.badge.archived { background: #efe2e0; color: #8a2c22; }
[data-theme="dark"] .badge.published { background: #1c3320; color: #8fd49a; }
[data-theme="dark"] .badge.pending { background: #3a2e16; color: #e6c074; }

.alert { padding: 14px 18px; border-radius: 4px; margin-bottom: 20px; font-family: var(--sans); font-size: 14.5px; }
.alert-success { background: #e3f1e3; color: #1d6b2a; border: 1px solid #bfe0bf; }
.alert-info { background: #e6eef7; color: #1c3f6e; border: 1px solid #c5d6ea; }
.alert-warn { background: #fbe7cf; color: #8a5a12; border: 1px solid #ecd3a4; }
.alert:empty, .alert ul:empty { display: none; }
.alert ul { margin: 0; padding-left: 18px; }

/* ---- Sign-in / offline landing ---- */
.auth-page { padding: 26px 0 60px; }
.auth-page .page-title { text-align: center; }
.auth-page .page-intro { text-align: center; margin-left: auto; margin-right: auto; }
.auth-offline { text-align: center; margin-bottom: 26px; }
.auth-offline .page-title::after {
    content: ""; display: block; width: 62px; height: 2px; background: var(--accent);
    margin: 16px auto 0;
}
.auth-page .panel { padding: 30px 32px; }
.field-error { display: block; font-family: var(--sans); font-size: 12.5px; color: #a12; margin-top: 5px; }
.field-check { margin-bottom: 22px; }
.check { display: flex; align-items: center; cursor: pointer; }
/* asp-for on a bool also emits a hidden input, so space the checkbox with a margin
   rather than a flex gap (which the hidden element would otherwise take up). */
.check input[type="checkbox"] { width: auto; margin: 0 8px 0 0; }
.check input[type="hidden"] { display: none; }
.check span { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); }
.btn-block { display: block; width: 100%; text-align: center; padding: 12px 20px; font-size: 15px; }
.auth-links {
    display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
    margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
    font-family: var(--sans); font-size: 14px;
}
.auth-footnote { text-align: center; font-family: var(--sans); font-size: 13px; color: var(--ink-faint); margin-top: 22px; }
.offline-badge {
    font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; padding: 3px 10px; border-radius: 999px;
    background: var(--accent); color: #fff;
}

/* ---- Admin: site access toggle ---- */
.access-panel {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    flex-wrap: wrap; margin-bottom: 24px; border-left: 4px solid var(--line-strong);
}
.access-panel.is-closed { border-left-color: var(--accent); }
.access-panel h2 { font-family: var(--serif-display); font-size: 21px; margin: 0 0 8px; }
.access-panel p { margin: 0; font-size: 15px; color: var(--ink-soft); }
.access-panel .badge { margin-right: 8px; }
.access-text { flex: 1 1 320px; }

/* newsletter */
.newsletter { background: var(--ink); color: #f3ede2; padding: 34px; margin: 44px 0; text-align: center; }
[data-theme="dark"] .newsletter { background: #0c0a07; }
.newsletter h2 { font-family: var(--serif-display); font-size: 28px; margin: 0 0 8px; color: #fff; }
.newsletter p { color: #cfc6b6; margin: 0 0 18px; }
.newsletter form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.newsletter input { flex: 1; padding: 12px 14px; border: 0; border-radius: 3px; font-family: var(--serif-body); }

/* preview pane (editor) */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.preview-pane { background: var(--surface); border: 1px solid var(--line); padding: 24px; position: sticky; top: 70px; align-self: start; max-height: 80vh; overflow: auto; }

/* validation */
.text-danger, .validation-summary-errors { color: var(--accent-ink); font-family: var(--sans); font-size: 13px; }
.field-validation-error { color: var(--accent-ink); }

/* responsive */
@media (max-width: 900px) {
    .front-grid { grid-template-columns: 1fr; }
    .lead-col { border-right: 0; padding-right: 0; }
    .editor-grid { grid-template-columns: 1fr; }
    .preview-pane { position: static; max-height: none; }
    .cards.cols-3, .cards.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    body { font-size: 17px; }
    .nav-toggle { display: block; }
    .navlinks { display: none; flex-direction: column; width: 100%; background: var(--surface); }
    .navlinks.open { display: flex; }
    .navlinks > li > a { border-top: 1px solid var(--line); }
    .sub-leads { grid-template-columns: 1fr; }
    .cards.cols-3, .cards.cols-4 { grid-template-columns: 1fr; }
    .newsletter form { flex-direction: column; }
    .masthead-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .user-menu { justify-content: flex-start; }
}
