/* ==========================================================================
   MyFieldNotes (MFN) — CSS Design System
   Serif typography, minimal color, literary aesthetic
   ========================================================================== */

:root {
    --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Lora', Georgia, 'Times New Roman', serif;
    --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --color-bg: #fafafa;
    --color-text: #1a1a1a;
    --color-muted: #666;
    --color-border: #e0e0e0;
    /* --color-surface: cards/panels that sit on --color-bg.
       --color-white: stays true white in both themes (text on red/orange). */
    --color-surface: #fff;
    --color-white: #fff;
    --spot-color: #c0392b;

    --max-width-article: 1100px;
    --max-width-page: 1100px;

    color-scheme: light;
}

html[data-theme="dark"] {
    --color-bg: #141414;
    --color-text: #e8e4dc;
    --color-muted: #a39d92;
    --color-border: #383838;
    --color-surface: #1e1e1e;
    /* brighter red so links/accents keep contrast on dark ground */
    --spot-color: #e2695f;

    color-scheme: dark;
}

/* ---------- Reset & Base ---------- */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

/* ---------- Header ---------- */

.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 2rem;
}

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

.site-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.site-nav {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.site-nav a {
    color: var(--color-muted);
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--color-text);
}

.site-nav a.admin-link {
    color: orange;
    margin-left: auto;
}

.site-nav a.admin-link:hover {
    color: #e69500;
}

.site-nav .nav-logout-form {
    display: inline;
    margin: 0;
}

.site-nav .nav-logout-btn {
    font-family: inherit;
    font-size: inherit;
    color: var(--color-muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s;
}

.site-nav .nav-logout-btn:hover {
    color: var(--color-text);
}

/* ---------- Main Content ---------- */

.main-content {
    flex: 1;
    max-width: calc(var(--max-width-page) + 4rem);
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 0.75rem 2rem;
    margin-top: 3rem;
}

.footer-inner {
    max-width: var(--max-width-page);
    margin: 0 auto;
    text-align: center;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
}

/* ---------- Flash Messages ---------- */

.flash-messages {
    max-width: var(--max-width-page);
    margin: 1rem auto 0;
    padding: 0 2rem;
}

.flash {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    border-left: 3px solid var(--color-border);
}

.flash-success { border-left-color: #27ae60; background: #f0faf4; }
.flash-error   { border-left-color: var(--spot-color); background: #fdf2f2; }
.flash-info    { border-left-color: #2980b9; background: #f0f6fb; }

/* ==========================================================================
   Homepage — Typographic Cover / Table of Contents
   ========================================================================== */

.magazine-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 2px solid var(--color-text);
    margin-bottom: 1rem;
}

.magazine-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.magazine-tagline {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.5rem;
}

/* Featured Article */

.featured-section {
    margin-bottom: 0.5rem;
}

.featured-article {
    display: block;
    padding: 1rem 0;
    text-align: center;
}

.featured-article:hover .featured-title {
    color: var(--spot-color);
}

.featured-title {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1.15;
    margin: 0.5rem 0;
    transition: color 0.2s;
}

.featured-subtitle {
    font-family: var(--font-body);
    font-size: 1.15rem;
    color: var(--color-muted);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.featured-meta {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
}

.featured-lead {
    max-width: var(--max-width-page);
    margin: 0 auto;
    font-size: 1.05rem;
    color: var(--color-muted);
    line-height: 1.7;
}

/* Section Dividers */

.section-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.section-heading {
    display: none;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

/* Article List (TOC style) */

.article-list {
    display: flex;
    flex-direction: column;
}

.article-item {
    display: block;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-border);
    transition: padding-left 0.2s;
}


.article-item:last-child {
    border-bottom: none;
}

.article-item:hover {
    padding-left: 0.5rem;
}

.article-item:hover .article-item-title {
    color: var(--spot-color);
}

.category-label {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--spot-color);
    font-weight: 600;
}

.article-item-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0.25rem 0;
    transition: color 0.2s;
}

.article-item-subtitle {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-muted);
    font-style: italic;
}

.article-item-meta {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

/* Categories */

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.category-link {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--color-border);
    transition: all 0.2s;
}

.category-link:hover,
.category-link.active {
    color: var(--spot-color);
    border-color: var(--spot-color);
}

.category-aside {
    text-transform: none;
    letter-spacing: normal;
    font-style: italic;
    opacity: 0.7;
}

/* Empty State */

.empty-state {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-muted);
    text-align: center;
    padding: 3rem 0;
}

.empty-state a {
    color: var(--spot-color);
    text-decoration: underline;
}

/* ==========================================================================
   Article Page
   ========================================================================== */

.article-page {
    max-width: 100%;
    margin: 0 auto;
}

.article-header {
    text-align: center;
    padding: 2rem 0;
}

.article-header .category-label {
    display: inline-block;
    margin-bottom: 1rem;
}

.article-title {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.article-subtitle {
    font-family: var(--font-body);
    font-size: 1.25rem;
    color: var(--color-muted);
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.article-by {
    font-size: 0.75em;
    text-transform: lowercase;
}

.article-meta {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.article-edit-bar {
    margin-bottom: 0.75rem;
}

.edit-article-btn {
    background: orange;
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    transition: background 0.2s;
}

.edit-article-btn:hover {
    background: #e69500;
}

.article-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.article-lead {
    font-size: 1.15rem;
    line-height: 1.75;
    margin-bottom: 2rem;
    font-weight: 500;
}

.article-body {
    font-size: 1.1rem;
    line-height: 1.8;
    /* A long unbroken URL/token in author copy must wrap, not overflow. */
    overflow-wrap: break-word;
}

.article-body p {
    margin-bottom: 1.5rem;
    /* Blocksatz: justified body copy; auto-hyphenation (per the page's
       lang attribute) keeps word spacing even, especially in German. */
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.article-body h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
}

.article-body h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
}

.article-body .katex-display {
    margin: 1.5rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.article-body pre {
    background: #f5f5f5;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
}

.article-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.88em;
    background: #f5f5f5;
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

.article-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.article-body th,
.article-body td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

.article-body th {
    background: #f5f5f5;
    font-weight: 600;
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.article-body blockquote {
    border-left: 3px solid var(--spot-color);
    margin: 2rem 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    font-style: italic;
    color: var(--color-muted);
    font-size: 1.15rem;
}

.article-body ul,
.article-body ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

/* Font Size Control */

.article-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.font-size-control {
    display: flex;
    gap: 0.25rem;
}

.font-size-btn {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1;
}

.font-size-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text);
}

.font-size-btn[data-action="decrease"] {
    border-radius: 3px 0 0 3px;
}

.font-size-btn[data-action="reset"] {
    border-left: none;
    border-right: none;
}

.font-size-btn[data-action="increase"] {
    border-radius: 0 3px 3px 0;
}

.article-footer {
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.article-footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.epub-download-link {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    padding: 0.4rem 0.9rem;
    transition: color 0.2s, border-color 0.2s;
}

.epub-download-link:hover {
    color: var(--spot-color);
    border-color: var(--spot-color);
}

.back-link {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--spot-color);
}

/* Share Button */

.share-btn {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    border-radius: 3px;
    transition: color 0.2s, border-color 0.2s;
    line-height: 1;
}

.share-btn svg {
    width: 14px;
    height: 14px;
}

.share-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text);
}

.share-btn.shared {
    color: var(--spot-color);
    border-color: var(--spot-color);
}

/* Like Button */

.like-section {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--color-border);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
    transition: color 0.2s, border-color 0.2s;
    border-radius: 2px;
}

.like-btn:hover:not(.liked):not(:disabled) {
    color: var(--spot-color);
    border-color: var(--spot-color);
}

.like-btn:hover:not(.liked):not(:disabled) .like-icon {
    color: var(--spot-color);
}

.like-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.like-btn.liked .like-icon {
    color: var(--spot-color);
}

.like-btn.liked {
    color: var(--spot-color);
    border-color: var(--spot-color);
    cursor: default;
}

.like-count {
    font-weight: 600;
}

/* ---------- Book TOC (public) ---------- */

.book-intro {
    margin-bottom: 2.5rem;
}

.book-toc {
    margin-top: 1rem;
}

.book-toc-heading {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.book-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.book-toc-item {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    transition: padding-left 0.2s;
}

.book-toc-item:hover {
    padding-left: 0.5rem;
}

.book-toc-number {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 1.5rem;
}

.book-toc-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    transition: color 0.2s;
}

.book-toc-item:hover .book-toc-title {
    color: var(--spot-color);
}

/* ---------- Book Chapter (public) ---------- */

.book-breadcrumb {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
    padding-top: 1rem;
}

.book-breadcrumb a {
    transition: color 0.2s;
}

.book-breadcrumb a:hover {
    color: var(--spot-color);
}

.chapter-header {
    text-align: center;
    padding: 1.5rem 0 1rem;
}

.chapter-number {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.chapter-nav a,
.chapter-nav span {
    flex: 1;
}

.chapter-nav-prev {
    text-align: left;
    color: var(--color-muted);
    transition: color 0.2s;
}

.chapter-nav-prev:hover {
    color: var(--spot-color);
}

.chapter-nav-toc {
    text-align: center;
    color: var(--color-muted);
    transition: color 0.2s;
}

.chapter-nav-toc:hover {
    color: var(--spot-color);
}

.chapter-nav-next {
    text-align: right;
    color: var(--color-muted);
    transition: color 0.2s;
}

.chapter-nav-next:hover {
    color: var(--spot-color);
}

/* ==========================================================================
   Category Page
   ========================================================================== */

.category-page {
    max-width: var(--max-width-page);
}

.category-header {
    padding: 2rem 0 0;
}

.category-page-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
}

.category-count {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-page {
    max-width: var(--max-width-page);
    margin: 0 auto;
}

.about-page h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 2rem;
    text-align: center;
}

.about-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.about-lead {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.about-body p {
    margin-bottom: 1.25rem;
}

.about-body h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
}

.about-body ul {
    margin: 1rem 0 1.5rem 1.5rem;
}

.about-body li {
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-page {
    max-width: 380px;
    margin: 4rem auto;
}

.login-page h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-back {
    text-align: center;
    margin-top: 2rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
}

.login-back a:hover {
    color: var(--spot-color);
}

/* ==========================================================================
   Admin Interface
   ========================================================================== */

.admin-layout {
    max-width: var(--max-width-page);
}

.admin-nav {
    display: flex;
    align-items: stretch;
    gap: 0.15rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    /* A single swipeable strip instead of a tall wrapped block on mobile. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Stays reachable on long pages (article list, monitoring, reports). */
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--color-bg);
}
.admin-nav::-webkit-scrollbar { display: none; }

.admin-badge {
    flex-shrink: 0;
    align-self: center;
    background: var(--color-text);
    color: var(--color-bg);
    padding: 0.2rem 0.6rem;
    margin-right: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.admin-nav-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.7rem;
    color: var(--color-muted);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.admin-nav-link:hover {
    color: var(--color-text);
}

.admin-nav-link.active {
    color: var(--color-text);
    font-weight: 600;
    border-bottom-color: var(--spot-color);
}

.admin-nav-viewsite {
    margin-left: auto;
    color: var(--spot-color);
}

.admin-content h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
}

/* Stats Grid */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
}

.stat-number {
    display: block;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
}

.stat-label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    margin-top: 0.5rem;
}

/* Dashboard Actions */

.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Dashboard Cleanup */

.dashboard-cleanup {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.dashboard-cleanup h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.dashboard-cleanup p {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Confirm Modal */

.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: var(--color-surface);
    border-radius: 8px;
    padding: 2rem;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.confirm-modal h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.confirm-modal p {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.confirm-modal h3 {
    color: var(--spot-color);
}

/* Danger Zone */

.form-divider {
    margin: 3rem 0 0;
    border: none;
    border-top: 1px solid var(--color-border);
}

.danger-zone {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px solid #e0c0c0;
    border-radius: 6px;
    background: #fdf6f6;
}

.danger-zone h3 {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--spot-color);
    margin-bottom: 0.35rem;
}

.danger-zone p {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
}

/* Admin Header Row */

.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
    /* Wrap the action buttons under the heading instead of overflowing the
       viewport when the title is long (article/press editors, images). */
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.admin-header-row h1 {
    margin-bottom: 0;
}

/* Admin Table */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    padding: 0.75rem 0.75rem 0.75rem 0;
    border-bottom: 2px solid var(--color-text);
}

.admin-table td {
    padding: 0.75rem 0.75rem 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

/* Admin list — shared row layout for Articles and Press.
   Row = a main edit-link (optional cover thumbnail + body) plus a
   right-aligned actions area. Both admin lists use the same skeleton. */

.admin-list {
    border-top: 2px solid var(--color-text);
}

.admin-list-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.admin-list-row:hover {
    background: #f0f0f0;
}

.admin-list-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: var(--color-text);
}

.admin-list-thumb {
    flex: 0 0 40px;
    width: 40px;
    height: 60px;
    object-fit: cover;
    border: 1px solid var(--color-border);
    background: #eee;
}

.admin-list-thumb-empty {
    display: block;
    background: var(--spot-color);
    opacity: 0.35;
}

.admin-list-body {
    flex: 1;
    min-width: 0;
}

.admin-list-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.admin-list-title {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.admin-list-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.2rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-muted);
}

.admin-list-meta .meta-sep {
    color: var(--color-border);
}

.admin-list-meta .badge {
    margin-left: 0;
}

.admin-list-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* EPUB drag-and-drop upload zone (press form) */

.epub-dropzone {
    border: 2px dashed var(--color-border);
    border-radius: 6px;
    padding: 1.25rem;
    background: var(--color-surface);
    transition: border-color 0.15s, background 0.15s;
}

.epub-dropzone.is-dragover {
    border-color: var(--spot-color);
    background: rgba(192, 57, 43, 0.06);
}

.epub-dropzone.is-invalid {
    border-color: var(--spot-color);
}

.epub-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
}

.epub-dropzone-hint {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.epub-dropzone.is-dragover .epub-dropzone-hint {
    color: var(--spot-color);
}

.epub-dropzone-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.epub-dropzone-filename {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

/* Badges */

.badge {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.5rem;
    vertical-align: middle;
}

.badge-published { background: #e8f5e9; color: #2e7d32; }
.badge-draft     { background: #fff3e0; color: #e65100; }
.badge-featured  { background: #fce4ec; color: #c62828; margin-left: 0.5rem; }

.featured-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--color-border);
    padding: 0.35rem 0.4rem;
    line-height: 1;
    transition: color 0.15s;
}

.featured-toggle:hover {
    color: var(--color-muted);
}

.featured-toggle.is-featured {
    color: var(--spot-color);
}
.badge-book      { background: #e3f2fd; color: #1565c0; margin-left: 0.5rem; }
.badge-admin     { background: #1a1a1a; color: #fafafa; }
.badge-author    { background: #e8f5e9; color: #2e7d32; }
.badge-user      { background: #f0f0f0; color: #666; }
.badge-access    { background: #fff3e0; color: #e65100; margin-left: 0.5rem; }
.badge-open      { background: #e8f5e9; color: #2e7d32; margin-left: 0.5rem; }
.badge-review-pending  { background: #fff8e1; color: #f9a825; margin-left: 0.5rem; }
.badge-review-approved { background: #e8f5e9; color: #2e7d32; margin-left: 0.5rem; }
.badge-review-changes  { background: #fff3e0; color: #e65100; margin-left: 0.5rem; }


/* ---------- Chapter Accordion (admin) ---------- */

.chapter-accordion {
    border: 1px solid var(--color-border);
    margin-bottom: 0.5rem;
}

.chapter-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    padding: 0.5rem 0.75rem;
}

.chapter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
    text-align: left;
}

.chapter-toggle-indicator {
    display: inline-block;
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.chapter-toggle-indicator.open {
    transform: rotate(90deg);
}

.chapter-actions {
    display: flex;
    gap: 0.25rem;
}

.chapter-accordion-body {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="password"],
.form-group textarea {
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    line-height: 1.5;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-text);
}

.form-group input[type="color"] {
    height: 44px;
    width: 64px;
    padding: 2px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.form-group-wide {
    flex: 1;
}

.form-row .form-group {
    flex: 1;
}

.body-type-selector {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-top: 0.25rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    cursor: pointer;
}

.body-editor {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    min-height: 300px;
    resize: vertical;
}

.form-checkboxes {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.4;
}

.btn:hover {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

.btn-primary {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-muted);
}

.btn-secondary:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.btn-danger {
    color: var(--spot-color);
    border-color: #e0c0c0;
}

.btn-danger:hover {
    background: var(--spot-color);
    color: var(--color-white);
    border-color: var(--spot-color);
}

.btn-small {
    font-size: 0.75rem;
    padding: 0.3rem 0.65rem;
}

/* ==========================================================================
   Export / Import
   ========================================================================== */

.export-import-section h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.export-import-section p {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
    max-width: 600px;
}

.export-import-warning {
    color: var(--spot-color) !important;
    font-weight: 500;
}

.file-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

.file-input-label {
    cursor: pointer;
    white-space: nowrap;
}

.file-input-name {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   Delete Confirmation
   ========================================================================== */

.delete-confirmation {
    max-width: 600px;
}

.delete-confirmation h1 {
    color: var(--spot-color);
}

.delete-confirmation > p {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.delete-article-preview {
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.delete-article-preview h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.delete-form {
    display: flex;
    gap: 1rem;
}

/* ==========================================================================
   Account Interface
   ========================================================================== */

.account-layout {
    max-width: var(--max-width-page);
}

.account-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.account-badge {
    background: var(--color-muted);
    color: var(--color-bg);
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.account-nav a {
    color: var(--color-muted);
    transition: color 0.2s;
}

.account-nav a:hover {
    color: var(--color-text);
}

.account-nav a.active {
    color: var(--color-text);
    font-weight: 600;
}

.account-nav-divider {
    color: var(--color-border);
}

.account-content h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
}

/* Profile Card */

.profile-card {
    border: 1px solid var(--color-border);
    padding: 2rem;
    max-width: 480px;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    font-family: var(--font-ui);
    font-size: 0.95rem;
}

.profile-field:last-of-type {
    border-bottom: none;
}

.profile-label {
    color: var(--color-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.profile-value {
    color: var(--color-text);
}

.profile-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* Password Form */

.password-form {
    max-width: 480px;
}

/* ==========================================================================
   Search
   ========================================================================== */

/* Header icon */

.search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    padding: 0.3rem;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
}

.search-toggle:hover {
    color: var(--color-text);
}

/* Full-page overlay */

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.92);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-inner {
    width: 90%;
    max-width: 600px;
    text-align: center;
}

.search-overlay-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.search-overlay-close:hover {
    color: #fff;
}

.search-overlay-form {
    display: flex;
    gap: 0.75rem;
}

.search-overlay-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 1.25rem;
    padding: 0.85rem 1.25rem;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.search-overlay-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-overlay-input:focus {
    border-bottom-color: #fff;
}

.search-overlay-form .btn {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    background: transparent;
}

.search-overlay-form .btn:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.search-overlay-hint {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 1.5rem;
}

/* Search results page */

.search-page {
    max-width: var(--max-width-page);
}

.search-header {
    padding: 2rem 0 1rem;
}

.search-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
}

.search-result-count {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.75rem;
}

/* ---------- Language Toggle ---------- */

.lang-toggle {
    display: flex;
    gap: 0;
}

.lang-toggle-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-toggle-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.lang-toggle-btn:last-child {
    border-radius: 0 3px 3px 0;
    border-left: none;
}

.lang-toggle-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text);
}

.lang-toggle-btn.active {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

.home-lang-toggle {
    margin: 0 0 0 auto;
    width: fit-content;
}

/* ---------- View Toggle (magazine / newspaper) ---------- */

.home-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* when no lang toggle is present, still align right */
.home-controls:only-child {
    margin-left: auto;
}

.view-toggle {
    display: flex;
    gap: 0;
}

.view-toggle-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1;
    padding: 0.2rem 0.55rem;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.view-toggle-btn:last-child {
    border-radius: 0 3px 3px 0;
    border-left: none;
}

.view-toggle-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text);
}

.view-toggle-btn.active {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

/* ---------- Newspaper View ---------- */

/* Dateline: hidden in magazine, shown in newspaper */
.np-dateline {
    display: none;
}

.newspaper-view .np-dateline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-top: 1px solid var(--color-text);
    border-bottom: 1px solid var(--color-text);
    padding: 0.3rem 0;
    margin-top: 0.6rem;
}

.newspaper-view .magazine-tagline {
    display: none;
}

/* Masthead */
.newspaper-view .magazine-header {
    border-bottom: none;
    border-top: 1px solid var(--color-border);
    padding-top: 0.6rem;
    padding-bottom: 0;
    margin-bottom: 1.25rem;
    text-align: center;
}

.newspaper-view .magazine-title {
    font-size: 5rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Lead story */
.newspaper-view .featured-section {
    display: block;
    padding: 0.5rem 0 1.5rem;
    border-bottom: 3px double var(--color-text);
    margin-bottom: 1.5rem;
}

.newspaper-view .featured-article {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
}

.newspaper-view .featured-article .category-label {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
}

.newspaper-view .featured-title {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0.5rem 0 0.6rem;
}

.newspaper-view .featured-subtitle {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--color-muted);
    margin-bottom: 0.6rem;
}

.newspaper-view .featured-meta {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.9rem;
}

.newspaper-view .featured-lead {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    text-align: left;
    max-width: 560px;
    margin: 0 auto;
}

.article-item-lead {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-muted);
    margin-top: 0.5rem;
}

/* Article column flow */
.newspaper-view .article-list {
    display: block;
    column-count: 3;
    column-gap: 2rem;
    column-rule: 1px solid var(--color-border);
}

.newspaper-view .article-item {
    display: block;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    padding: 0.7rem 0 0.85rem;
    border: none;
    border-bottom: 1px solid var(--color-border);
    background: none;
    transition: opacity 0.15s;
}

.newspaper-view .article-item:first-child {
    padding-top: 0;
}

.newspaper-view .article-item:hover {
    padding-left: 0;
    background: none;
    opacity: 0.65;
}

.newspaper-view .article-item .category-label {
    font-size: 0.66rem;
    letter-spacing: 0.14em;
}

.newspaper-view .article-item-title {
    font-size: 1.15rem;
    line-height: 1.2;
    margin: 0.2rem 0 0.3rem;
}

.newspaper-view .article-item-subtitle {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.3rem;
}

.newspaper-view .article-item-meta {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.newspaper-view .section-heading {
    display: none;
}

.np-filter-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.np-filter-btn {
    background: none;
    border: none;
    padding: 0.25rem 0.6rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    cursor: pointer;
    transition: color 0.15s;
}

.np-filter-btn:hover {
    color: var(--color-text);
}

.np-filter-btn.active {
    color: var(--spot-color);
    font-weight: 600;
}

.np-filter-sep {
    color: var(--color-muted);
}

.newspaper-view .section-divider,
.newspaper-view .categories-section {
    display: none;
}

.newspaper-body .site-footer {
    margin-top: 2rem;
}

.newspaper-view .section-divider {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .newspaper-view .article-list {
        column-count: 2;
        column-gap: 1.5rem;
    }
    .newspaper-view .featured-title {
        font-size: 2.4rem;
    }
    .newspaper-view .magazine-title {
        font-size: 3.5rem;
    }
}

@media (max-width: 600px) {
    .newspaper-view .article-list {
        column-count: 1;
        column-rule: none;
    }
    .newspaper-view .featured-title {
        font-size: 1.9rem;
    }
    .newspaper-view .magazine-title {
        font-size: 2.6rem;
    }
}

/* ---------- Site Settings (admin dashboard) ---------- */

.site-settings-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.site-settings-section h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.setting-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
}

.setting-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.setting-label {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
}

.setting-description {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
}

/* ---------- Closed Beta Notice (login page) ---------- */

.closed-beta-notice {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--color-muted);
    text-align: center;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--spot-color);
    background: var(--color-bg, #fafafa);
}

/* ---------- Review Section (admin article form) ---------- */

.review-section {
    border: 1px solid var(--color-border);
    padding: 1.25rem;
    margin: 1.5rem 0;
    background: #fafafa;
}

.review-section h3 {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}

.review-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.review-reviewer {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
}

.review-request-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.review-request-form select {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

/* ---------- Review Actions Bar (account review page) ---------- */

.review-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.review-actions-buttons {
    display: flex;
    gap: 0.75rem;
}

/* ---------- Translation Section (admin) ---------- */

.translation-section {
    border: 1px solid var(--color-border);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    background: #fafafa;
}

/* ==========================================================================
   Reports
   ========================================================================== */

.report-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--color-text);
}

.report-tab {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.6rem 1.25rem;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    border-bottom: none;
    margin-bottom: -2px;
    transition: color 0.2s, background 0.2s;
}

.report-tab:hover {
    color: var(--color-text);
    background: #f5f5f5;
}

.report-tab.active {
    color: var(--color-text);
    background: var(--color-surface);
    border-color: var(--color-text);
    border-bottom: 2px solid var(--color-surface);
}

.report-section {
    margin-bottom: 2.5rem;
}

.report-section h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.report-section h3 {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    overflow: hidden;
    padding: 0.5rem 0;
    box-sizing: border-box;
}

.chart-container-category {
    height: 350px;
}

.distribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.distribution-card {
    border: 1px solid var(--color-border);
    padding: 1.25rem;
}

.distribution-card h3 {
    margin-bottom: 0.75rem;
}

.bar-chart-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.bar-chart-label {
    width: 80px;
    min-width: 80px;
    color: var(--color-muted);
    flex-shrink: 0;
}

.bar-chart-track {
    flex: 1;
    min-width: 0;
    height: 8px;
    background: #eee;
    border-radius: 4px;
}

.bar-chart-bar {
    height: 8px;
    background: var(--color-text);
    border-radius: 4px;
    min-width: 4px;
}

.bar-chart-value {
    font-weight: 600;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.health-section {
    margin-top: 1.5rem;
}

.health-section h3 {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.health-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.health-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.health-item a {
    color: var(--color-text);
    transition: color 0.2s;
}

.health-item a:hover {
    color: var(--spot-color);
}

.health-item-meta {
    color: var(--color-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .site-header {
        padding: 1rem;
    }

    /* Kill iOS focus-zoom on admin inputs that live outside .form-group
       (those get 16px separately). 16px is the threshold Safari won't zoom. */
    .beta-link-create input,
    .beta-link-url,
    .support-url-field input,
    .body-editor {
        font-size: 16px;
    }

    /* Header controls are icon/text buttons, not .btn, so give them a
       proper ~44px tap target on touch. */
    .theme-toggle,
    .search-toggle {
        padding: 0.6rem;
    }
    .lang-toggle-btn {
        padding: 0.5rem 0.7rem;
    }
    .nav-logout-btn {
        padding: 0.4rem 0.2rem;
    }

    .header-inner {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .site-nav {
        justify-content: center;
        margin-left: 0;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .magazine-title {
        font-size: 2.5rem;
    }

    .featured-title {
        font-size: 1.75rem;
    }

    .article-title {
        font-size: 2rem;
    }

    .form-row {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        font-size: 0.8rem;
        min-width: 500px;
    }

    .actions-cell {
        flex-direction: column;
        gap: 0.25rem;
    }

    .chapter-title {
        font-size: 1.65rem;
    }

    .chapter-nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .chapter-nav a,
    .chapter-nav span {
        text-align: center !important;
    }

    .profile-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .chart-container {
        height: 250px;
    }

    .distribution-grid {
        grid-template-columns: 1fr;
    }

    .report-tabs {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .magazine-title {
        font-size: 2rem;
    }

    .featured-title {
        font-size: 1.5rem;
    }

    .article-title {
        font-size: 1.65rem;
    }

    .article-item-title {
        font-size: 1.2rem;
    }

    /* Search overlay */
    .search-overlay {
        padding-top: 15vh;
    }

    .search-overlay-input {
        font-size: 1.1rem;
        padding: 0.75rem;
    }

    .search-overlay-form {
        flex-direction: column;
    }

    .search-overlay-close {
        top: 1rem;
        right: 1rem;
    }

    /* Navigation touch targets */
    .site-nav {
        gap: 0.25rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .site-nav a {
        padding: 0.4rem 0.5rem;
    }

    /* Let the sticky tab strip run edge-to-edge so swiping feels natural. */
    .admin-nav {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .admin-nav-viewsite {
        /* In the scrollable strip on mobile, keep it inline at the end
           rather than pinned, so it's reachable by swiping. */
        margin-left: 0.15rem;
    }

    /* Form inputs — prevent iOS zoom, increase touch target */
    .form-group select,
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="url"],
    .form-group input[type="date"],
    .form-group input[type="password"],
    .form-group textarea {
        font-size: 1rem;
        padding: 0.75rem;
    }

    /* Buttons — minimum touch target */
    .btn {
        padding: 0.75rem 1.25rem;
        min-height: 44px;
    }

    .btn-small {
        padding: 0.5rem 0.75rem;
        min-height: 36px;
    }

    /* Article meta */
    .article-meta {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    /* Stats grid single column */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Login page */
    .login-page {
        max-width: 100%;
        margin: 2rem 0;
    }

    /* Profile / password forms */
    .profile-card {
        max-width: 100%;
        padding: 1.25rem;
    }

    .password-form {
        max-width: 100%;
    }

    /* Delete / confirm pages */
    .delete-confirmation {
        max-width: 100%;
    }

    .chart-container {
        height: 200px;
    }

    .report-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .health-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .health-item-meta {
        margin-left: 0;
    }
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.pagination-link {
    color: var(--color-accent, var(--spot-color));
    text-decoration: none;
    letter-spacing: 0.03em;
}

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

.pagination-info {
    color: var(--color-muted, #888);
}

/* ---------- Refine Mode ---------- */

.refine-toolbar-hint {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-muted);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.refine-toolbar-hint--error {
    color: var(--spot-color);
}

.refine-btn {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--spot-color);
    border: 1px solid var(--spot-color);
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.15s;
}

.refine-btn:hover {
    opacity: 0.85;
}

.refine-btn.active {
    opacity: 0.7;
}

/* Panel */
.refine-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 360px;
    height: 100vh;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
    padding: 1.75rem 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: right 0.25s ease;
    overflow-y: auto;
}

.refine-panel.open {
    right: 0;
}

.refine-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.refine-panel-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
}

.refine-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-muted);
    padding: 0.2rem 0.4rem;
    transition: color 0.15s;
}

.refine-panel-close:hover {
    color: var(--color-text);
}

.refine-field-label {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.refine-textarea {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.75rem;
    resize: vertical;
    width: 100%;
    min-height: 140px;
    transition: border-color 0.15s;
}

.refine-textarea:focus {
    outline: none;
    border-color: var(--spot-color);
}

.refine-panel-actions {
    display: flex;
    gap: 0.75rem;
}

.refine-save-btn,
.refine-cancel-btn {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.45rem 1.1rem;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.refine-save-btn {
    background: var(--spot-color);
    color: #fff;
    border-color: var(--spot-color);
}

.refine-save-btn:hover:not(:disabled) {
    opacity: 0.88;
}

.refine-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.refine-cancel-btn {
    background: none;
    color: var(--color-muted);
    border-color: var(--color-border);
}

.refine-cancel-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text);
}

.refine-status {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    min-height: 1.2em;
}

.refine-status--ok {
    color: #27ae60;
}

.refine-status--error {
    color: var(--spot-color);
}

/* Selection highlight in refine mode */
.article-page--refine [data-field] {
    cursor: text;
}

.article-page--refine [data-field]::selection,
.article-page--refine [data-field] *::selection {
    background: rgba(192, 57, 43, 0.15);
}

/* ==========================================================================
   Distraction-Free Writer
   ========================================================================== */

/* Hide site chrome */
.write-mode .site-header,
.write-mode .site-footer,
.write-mode .flash-messages {
    display: none;
}

.write-mode .main-content {
    padding: 0;
    max-width: none;
}

/* Fixed top chrome bar — fades unless hovered/focused */
.write-chrome {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    opacity: 0.2;
    transition: opacity 0.3s;
}

.write-chrome:hover,
.write-chrome:focus-within {
    opacity: 1;
}

.write-exit-link {
    color: var(--color-muted);
    text-decoration: none;
    white-space: nowrap;
}

.write-exit-link:hover {
    color: var(--color-text);
}

.write-status {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-muted);
}

.write-chrome-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Floating markdown toolbar — fades unless hovered */
.write-toolbar {
    position: fixed;
    top: 3.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 0.2rem 0.4rem;
    z-index: 99;
    opacity: 0.1;
    transition: opacity 0.25s;
}

.write-toolbar:hover,
.write-toolbar:focus-within {
    opacity: 1;
}

.write-toolbar button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    padding: 0.2rem 0.5rem;
    transition: color 0.15s;
    line-height: 1.5;
}

.write-toolbar button:hover {
    color: var(--color-text);
}

.write-toolbar-sep {
    display: inline-block;
    width: 1px;
    background: var(--color-border);
    align-self: stretch;
    margin: 0.15rem 0.4rem;
}

/* Refine button inside write toolbar — overrides the plain button defaults */
.write-toolbar .write-toolbar-refine {
    padding: 0.15rem 0.55rem;
    line-height: 1.4;
    border-radius: 3px;
}

/* Writing canvas */
.write-canvas {
    min-height: 100vh;
    padding: 5.5rem 2rem 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Restore banner */
.write-restore-banner {
    width: 100%;
    max-width: 680px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.write-restore-banner button {
    background: none;
    border: 1px solid currentColor;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    color: var(--color-text);
}

/* Inputs */
.write-title-input,
.write-subtitle-input,
.write-body-editor {
    display: block;
    width: 100%;
    max-width: 680px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--color-text);
    box-sizing: border-box;
}

.write-title-input {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.write-subtitle-input {
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
}

.write-body-editor {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.9;
    resize: none;
    overflow: hidden;
    min-height: 60vh;
}

.write-title-input::placeholder,
.write-subtitle-input::placeholder,
.write-body-editor::placeholder {
    color: var(--color-border);
}

/* Word count */
.write-wordcount {
    position: fixed;
    bottom: 1.5rem;
    right: 2rem;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--color-border);
    pointer-events: none;
    transition: color 0.3s;
}

/* Write entry link in articles list */
.write-entry-link {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--spot-color);
    border: 1px solid currentColor;
    padding: 0.3rem 0.55rem;
    opacity: 0.75;
    transition: opacity 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.write-entry-link:hover {
    opacity: 1;
}

@media (max-width: 700px) {
    .write-canvas {
        /* Extra top padding clears the chrome once it wraps to two rows. */
        padding: 6.75rem 1.25rem 6rem;
    }
    /* The action buttons must never run off-screen: let the bar wrap and
       grow, and drop the centred status onto its own row below them. */
    .write-chrome {
        height: auto;
        min-height: 3rem;
        flex-wrap: wrap;
        padding: 0.4rem 1rem;
        gap: 0.35rem 0.6rem;
        /* On touch there is no hover, so keep the controls fully visible. */
        opacity: 1;
    }
    .write-chrome-actions {
        flex-wrap: wrap;
    }
    .write-status {
        order: 3;
        flex-basis: 100%;
        text-align: left;
    }
    .write-title-input {
        font-size: 1.6rem;
    }
    /* Sits below the (now taller, always-visible) chrome instead of over it. */
    .write-toolbar {
        top: auto;
        bottom: 0.75rem;
        opacity: 1;
    }
}

/* ─── Focus button (article toolbar) ──────────────────────────────────────── */
.focus-edit-btn {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid var(--color-muted);
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-muted);
    transition: border-color 0.15s, color 0.15s;
}

.focus-edit-btn:hover {
    border-color: var(--color-text);
    color: var(--color-text);
}

/* ─── Distraction-free edit overlay ───────────────────────────────────────── */
.dfe-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dfe-overlay.open {
    opacity: 1;
    visibility: visible;
}

.dfe-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 2rem;
    height: 3.25rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.dfe-chrome-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dfe-back-btn {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    padding: 0;
    transition: color 0.15s;
}

.dfe-back-btn:hover {
    color: var(--color-text);
}

.dfe-outline-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    padding: 0.2rem 0.3rem;
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.dfe-outline-toggle:hover {
    color: var(--color-text);
    background: var(--color-border);
}

.dfe-outline-toggle.active {
    color: var(--color-text);
    background: var(--color-border);
}

.dfe-status {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--color-muted);
    flex: 1;
    text-align: center;
}

/* ── Body row (outline + canvas) ── */
.dfe-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ── Outline panel ── */
.dfe-outline-panel {
    width: 0;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    border-right: 1px solid transparent;
    transition: width 0.22s ease, border-color 0.22s ease;
}

.dfe-outline-panel.open {
    border-right-color: var(--color-border);
}

.dfe-outline-panel--resizing {
    transition: none !important;
}

.dfe-outline-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.25rem 1.5rem 1.5rem;
    box-sizing: border-box;
    gap: 0.75rem;
    min-width: 0;
}

.dfe-outline-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
}

.dfe-outline-resizer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: transparent;
    transition: background 0.15s;
}

.dfe-outline-resizer:hover::after,
.dfe-outline-panel--resizing .dfe-outline-resizer::after {
    background: var(--spot-color, var(--color-border));
}

.dfe-outline-header {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.dfe-outline-textarea {
    flex: 1;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    line-height: 1.7;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--color-text);
    overflow-y: auto;
}

.dfe-outline-textarea::placeholder {
    color: var(--color-border);
}

.dfe-canvas {
    flex: 1;
    overflow: hidden;
    padding: 4rem 0 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dfe-editor {
    width: 100%;
    max-width: 680px;
    flex: 1;
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.9;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
    color: var(--color-text);
}

.dfe-editor::placeholder {
    color: var(--color-border);
}

.dfe-wordcount {
    position: fixed;
    bottom: 1.5rem;
    right: 2rem;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    color: var(--color-border);
    pointer-events: none;
    z-index: 501;
}

@media (max-width: 700px) {
    .dfe-chrome {
        padding: 0 1rem;
    }
    .dfe-canvas {
        padding: 2rem 0 6rem;
    }
}

/* ---------- Compose mode (write mode + image drag-and-drop) ---------- */

.compose-hint {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    align-self: center;
}

.compose-dropzone {
    position: relative;
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
}

.compose-drop-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--spot-color);
    background-color: rgba(192, 57, 43, 0.06);
    border-radius: 4px;
    color: var(--spot-color);
    font-family: var(--font-ui);
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease-out;
    z-index: 10;
}

.compose-dropzone.is-dragging .compose-drop-overlay {
    opacity: 1;
}

/* ---------- Images admin overview ---------- */

.admin-meta-line {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0 0 1.5rem;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.image-card {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-card.is-unused {
    border-color: #e65100;
}

.image-card-thumb {
    display: block;
    aspect-ratio: 4 / 3;
    background: #f5f5f5;
    overflow: hidden;
}

.image-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-card-meta {
    padding: 0.6rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
}

.image-card-name {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card-sub {
    display: flex;
    justify-content: space-between;
    color: var(--color-muted);
    font-size: 0.75rem;
}

.image-card-slug {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.image-card-actions {
    margin-top: 0.25rem;
}

/* ---------- Preview modal (shared across editor views) ---------- */

.preview-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 3rem 1rem;
    overflow-y: auto;
}

.preview-modal-overlay.is-open {
    display: flex;
}

.preview-modal {
    background: var(--color-surface);
    width: 100%;
    max-width: 780px;
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 6rem);
}

.preview-modal-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    flex-shrink: 0;
}

.preview-modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--color-muted);
    padding: 0 0.25rem;
    line-height: 1;
}

.preview-modal-close:hover {
    color: var(--color-text);
}

.preview-modal-body {
    padding: 2rem 2.25rem;
    overflow-y: auto;
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--color-text);
}

.preview-modal-body h1,
.preview-modal-body h2,
.preview-modal-body h3 {
    font-family: var(--font-heading);
    margin: 1.5rem 0 0.75rem;
    line-height: 1.25;
}

.preview-modal-body h1 { font-size: 1.8rem; }
.preview-modal-body h2 { font-size: 1.4rem; }
.preview-modal-body h3 { font-size: 1.15rem; }

.preview-modal-body p { margin: 0 0 1rem; }

.preview-modal-body blockquote {
    border-left: 3px solid var(--spot-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--color-muted);
    font-style: italic;
}

.preview-modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

.preview-modal-body hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

.preview-modal-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: #f3f3f3;
    padding: 0.1em 0.3em;
    font-size: 0.9em;
}

.preview-modal-body pre {
    background: #f3f3f3;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.preview-modal-body pre code { background: none; padding: 0; }

.preview-modal-body ul,
.preview-modal-body ol {
    margin: 0 0 1rem 1.5rem;
}

.preview-modal-empty {
    color: var(--color-muted);
    font-style: italic;
}




/* === Groschenpress === */

.press-page {
    max-width: var(--max-width-page);
    margin: 0 auto;
    padding: 0.75rem 1.5rem 4rem;
}

.press-masthead {
    text-align: center;
    margin-bottom: 2rem;
}

/* The h1 exists for document structure; the logo image is the visual title. */
.press-masthead-title {
    margin: 0;
    line-height: 0;
}

.press-logo {
    display: block;
    max-width: 680px;
    width: 100%;
    height: auto;
    margin: 0 auto 0.75rem;
    /* the logo is a flat JPEG; the rounding lives here so it works on any background */
    border-radius: 19px;
}

.press-tagline {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--color-muted);
}

.press-categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.press-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 2rem 1.5rem;
    margin-top: 2rem;
}

.press-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-decoration: none;
    color: var(--color-text);
    transition: transform 0.15s ease;
}

.press-card:hover {
    transform: translateY(-3px);
}

.press-card-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0.4rem;
}

.press-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 2 / 3;
    background: var(--spot-color);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 0.4rem;
    padding: 1rem;
    text-align: center;
}

.press-cover-placeholder span {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--color-white);
}

.press-card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

.press-card-author {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.press-category-section {
    margin-bottom: 3rem;
}

.press-category-heading {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--spot-color);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
    margin: 2rem 0 0;
}

.press-grid-centered {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.press-grid-centered > .press-card-wrap {
    width: 180px;
}

.press-manage-btn {
    align-self: center;
    background: orange;
    color: #fff;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background 0.2s;
}

.press-manage-btn:hover {
    background: #e69500;
    color: #fff;
}

.press-card-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
}

.press-card-wrap[hidden] {
    display: none;
}

.press-card-wrap > .press-card {
    flex: 1;
}

.press-card-edit {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: orange;
    color: #fff;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background 0.2s;
}

.press-card-edit:hover {
    background: #e69500;
}

.press-card-tagline {
    font-size: 0.75rem;
    font-style: italic;
    font-weight: 700;
    color: var(--color-muted);
    line-height: 1.4;
}

.press-breadcrumb {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 2rem;
    font-family: var(--font-ui);
}

.press-breadcrumb a {
    color: var(--color-muted);
    text-decoration: none;
}

.press-breadcrumb a:hover {
    color: var(--color-text);
    text-decoration: underline;
}

.press-breadcrumb-current {
    color: var(--color-text);
    font-weight: 600;
}

.press-detail {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.press-detail-cover {
    flex: 0 0 260px;
    max-width: 260px;
}

.press-detail-info {
    flex: 1;
    min-width: 260px;
}

.press-detail-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    line-height: 1.15;
    margin: 0.35rem 0 0.5rem;
}

.press-detail-author {
    font-style: italic;
    color: var(--color-muted);
    margin-bottom: 1rem;
}

.press-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.press-actions .edit-article-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.press-description p {
    margin-bottom: 0.9rem;
    line-height: 1.7;
}

.press-detail-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-family: var(--font-ui);
    margin-top: 1.5rem;
}

/* Admin press list */
@media (max-width: 600px) {
    .press-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1.5rem 1rem;
    }
    .press-detail-cover {
        flex-basis: 180px;
        max-width: 180px;
        margin: 0 auto;
    }
    .press-detail-title {
        font-size: 1.6rem;
    }
    .press-actions {
        flex-direction: column;
    }
    .press-actions .btn,
    .press-actions .edit-article-btn {
        width: 100%;
        text-align: center;
    }
}

.press-tolino-hint {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-family: var(--font-ui);
    margin-top: 0.75rem;
}

.press-tolino-hint a {
    color: inherit;
    text-decoration: underline;
}

/* === Author applications === */

.apply-page {
    max-width: var(--max-width-page);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.apply-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
}

.apply-intro {
    color: var(--color-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.apply-form .form-group {
    margin-bottom: 1.25rem;
}

.apply-optional {
    font-weight: normal;
    color: var(--color-muted);
    font-size: 0.85em;
}

.apply-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

.application-section-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin: 2rem 0 1rem;
}

.application-card {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.application-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.application-date {
    margin-left: auto;
    color: var(--color-muted);
    font-size: 0.85rem;
    font-family: var(--font-ui);
}

.application-body h3 {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    margin: 0.75rem 0 0.25rem;
}

.application-text {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.95rem;
}

.application-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* === Marketing landing page === */

.landing-page {
    max-width: var(--max-width-page);
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.landing-hero {
    text-align: center;
    padding: 3.5rem 0 3rem;
}

.landing-title {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(2.4rem, 6vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.25rem;
}

.landing-sub {
    max-width: 620px;
    margin: 0 auto 2rem;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--color-muted);
}

.landing-cta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2.5rem;
    padding: 2.5rem 0;
}

.landing-feature h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    margin-bottom: 0.6rem;
}

.landing-feature p {
    line-height: 1.7;
    color: var(--color-muted);
    font-size: 0.98rem;
}

.landing-feature a {
    color: var(--spot-color);
}

.landing-section-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    text-align: center;
    margin: 2.5rem 0 0.5rem;
}

.landing-press-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.landing-press-more {
    text-align: center;
    margin-top: 1.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.landing-press-more a {
    color: var(--spot-color);
    text-decoration: none;
}

.landing-press-more a:hover {
    text-decoration: underline;
}

.landing-closing {
    text-align: center;
    padding: 2.5rem 0 1rem;
}

.landing-closing-line {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

/* === Magazine masthead logo (the 2AM chronicle wordmark) === */

.magazine-logo {
    display: block;
    max-width: 680px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    /* The PNG has a white background; multiply blends it into the page */
    mix-blend-mode: multiply;
}

/* === Header brand links === */

.header-brands {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex-shrink: 1;
}

.brand-link {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
}

.brand-link:hover {
    color: var(--spot-color);
}

.brand-sep {
    color: var(--color-muted);
}

@media (max-width: 600px) {
    .brand-link {
        font-size: 0.85rem;
        white-space: normal;
    }
}

/* === Printed newspaper look (newspaper view) === */

/* The desk the paper lies on */
body.newspaper-body {
    background: #e2ded6;
}

/* The sheet of newsprint */
.home-page.newspaper-view {
    --np-ink: #211e19;
    --np-faded: #57503f;
    --np-rule: #9d947e;
    background-color: #fbf8f0;
    background-image:
        radial-gradient(rgba(90, 75, 45, 0.06) 1px, transparent 1.4px),
        linear-gradient(rgba(255, 255, 255, 0.35), rgba(120, 100, 60, 0.06));
    background-size: 5px 5px, 100% 100%;
    color: var(--np-ink);
    border: 1px solid #c4bdad;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.25),
        0 14px 45px rgba(40, 30, 10, 0.35);
    padding: 1.5rem 2.75rem 2.5rem;
    margin: 0.5rem auto 2rem;
}

/* Chrome buttons blend into the paper */
.newspaper-view .view-toggle-btn,
.newspaper-view .lang-toggle-btn {
    background: transparent;
    border-color: var(--np-rule);
    color: var(--np-faded);
}
.newspaper-view .view-toggle-btn.active,
.newspaper-view .lang-toggle-btn.active {
    background: var(--np-ink);
    color: #fbf8f0;
    border-color: var(--np-ink);
}

/* Top line: volume, edition, price */
.np-topline {
    display: none;
}
.newspaper-view .np-topline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--np-ink);
    border-bottom: 1px solid var(--np-ink);
    padding: 0.25rem 0;
    margin-bottom: 0.75rem;
}
.np-topline-center {
    font-style: normal;
    font-weight: 600;
}

/* Nameplate */
.newspaper-view .magazine-header {
    border-top: none;
    padding-top: 0;
}
.newspaper-view .magazine-logo {
    max-width: 760px;
    margin: 0 auto;
}

/* Dateline under the nameplate: thick-thin rules like a real paper */
.newspaper-view .np-dateline {
    color: var(--np-ink);
    border-top: 2px solid var(--np-ink);
    border-bottom: 1px solid var(--np-ink);
    box-shadow: 0 3px 0 -2px var(--np-ink);
    padding: 0.35rem 0;
}
.newspaper-view .np-filter-btn {
    color: var(--np-faded);
}
.newspaper-view .np-filter-btn:hover {
    color: var(--np-ink);
}
.newspaper-view .np-filter-btn.active {
    color: var(--np-ink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.newspaper-view .np-filter-sep { color: var(--np-rule); }

/* Lead story: justified, hyphenated, with a drop cap */
.newspaper-view .featured-section {
    border-bottom: 4px double var(--np-ink);
}
.newspaper-view .featured-title {
    color: var(--np-ink);
}
.newspaper-view .featured-meta {
    color: var(--np-faded);
}
.newspaper-view .featured-meta::before,
.newspaper-view .featured-meta::after {
    content: " — ";
}
.newspaper-view .featured-lead {
    color: var(--np-ink);
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}
.newspaper-view .featured-lead::first-letter {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 3.1em;
    float: left;
    line-height: 0.82;
    padding: 0.04em 0.12em 0 0;
    color: var(--np-ink);
}

/* Column flow: darker rules, justified body text, ink headlines */
.newspaper-view .article-list {
    column-rule: 1px solid var(--np-rule);
}
.newspaper-view .article-item {
    border-bottom: 1px solid var(--np-rule);
}
.newspaper-view .article-item-title {
    color: var(--np-ink);
}
.newspaper-view .article-item-meta {
    color: var(--np-faded);
}
.newspaper-view .article-item-lead {
    color: #3d3931;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    font-size: 0.9rem;
    line-height: 1.55;
}
/* End-of-item mark, like a wire-service sign-off */
.newspaper-view .article-item-lead:not([style*="none"])::after {
    content: " \25C6";
    font-size: 0.6em;
    color: var(--np-faded);
}

/* Category labels printed in ink, not spot color */
.newspaper-view .category-label {
    color: var(--np-ink);
    font-weight: 700;
}

/* Pagination as a print instruction */
.newspaper-view .pagination {
    border-top: 1px solid var(--np-rule);
    margin-top: 1rem;
}
.newspaper-view .pagination-link {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--np-ink);
    text-transform: none;
    letter-spacing: 0;
}
.newspaper-view .pagination-info {
    color: var(--np-faded);
    font-family: var(--font-body);
    font-style: italic;
}

.newspaper-view .empty-state {
    color: var(--np-faded);
    background: transparent;
}

@media (max-width: 900px) {
    .home-page.newspaper-view {
        padding: 1.25rem 1.5rem 2rem;
    }
}

@media (max-width: 600px) {
    .home-page.newspaper-view {
        padding: 1rem 0.9rem 1.5rem;
        margin: 0 auto 1.25rem;
    }
    .np-topline {
        font-size: 0.6rem;
    }
}

/* === Header language toggle === */

.header-lang-toggle .lang-toggle-btn {
    font-size: 0.7rem;
    padding: 0.18rem 0.45rem;
    background: transparent;
}

.header-lang-toggle .lang-toggle-btn.active {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}

/* === Mobile: tighter margins & paddings === */

@media (max-width: 768px) {
    .site-header {
        padding: 0.6rem 0.75rem;
    }

    .header-inner {
        gap: 0.5rem;
    }

    .site-nav {
        flex-wrap: wrap;
        gap: 0.35rem 0.9rem;
    }

    .main-content {
        padding: 1rem 0.75rem;
    }

    .site-footer {
        padding: 0.75rem 1rem;
        margin-top: 2rem;
    }

    /* Page containers already sit inside the padded .main-content —
       drop their own horizontal padding so text isn't double-inset */
    .press-page,
    .landing-page,
    .apply-page {
        padding-left: 0;
        padding-right: 0;
        padding-top: 0.75rem;
        padding-bottom: 2rem;
    }

    .landing-hero {
        padding: 1.75rem 0 1.5rem;
    }

    .landing-features {
        gap: 1.5rem;
        padding: 1.5rem 0;
    }

    .landing-closing {
        padding: 1.5rem 0 0.5rem;
    }

    .press-masthead {
        margin-bottom: 1.25rem;
    }

    .press-detail {
        gap: 1.25rem;
    }

    .category-header {
        padding: 1rem 0 0;
    }

    .login-page {
        margin: 2rem auto;
    }

    .apply-page {
        padding-top: 1rem;
    }

    .apply-header h1 {
        font-size: 1.8rem;
    }

    .application-card {
        padding: 0.75rem 0.9rem;
    }
}

@media (max-width: 600px) {
    .main-content {
        padding: 0.75rem 0.5rem;
    }

    /* Newspaper sheet: keep the paper look but hug the screen */
    .home-page.newspaper-view {
        padding: 0.75rem 0.65rem 1.25rem;
        margin: 0 auto 1rem;
    }

    .home-controls {
        margin-bottom: 0.5rem;
    }

    .press-grid {
        gap: 1.25rem 0.75rem;
    }

    .press-detail-cover {
        flex-basis: 150px;
        max-width: 150px;
        margin: 0 auto;
    }

    .press-tolino-hint {
        font-size: 0.8rem;
    }

    .featured-article {
        padding: 0 0.25rem;
    }

    .pagination {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
}

/* === Newspaper sheet reaches the bottom of the page === */

body.newspaper-body .main-content {
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

.home-page.newspaper-view {
    flex: 1;
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0;
    /* the sheet runs past the fold — no bottom edge */
    border-bottom: none;
}

body.newspaper-body .site-footer {
    margin-top: 0;
}

@media (max-width: 600px) {
    .home-page.newspaper-view {
        margin-top: 0;
        margin-bottom: 0;
    }
}

/* === Tighter gap between header and the newspaper sheet === */

body.newspaper-body .main-content {
    padding-top: 0.6rem;
}

.home-page.newspaper-view {
    margin-top: 0;
}

/* ==========================================================================
   Dark mode — overrides for rules with fixed light-mode colors.
   The palette itself flips via the variables in html[data-theme="dark"].
   ========================================================================== */

html[data-theme="dark"] .flash-success { background: #17251b; }
html[data-theme="dark"] .flash-error   { background: #2a1917; }
html[data-theme="dark"] .flash-info    { background: #16222c; }

html[data-theme="dark"] .article-body pre,
html[data-theme="dark"] .article-body code,
html[data-theme="dark"] .article-body th,
html[data-theme="dark"] .preview-modal-body pre,
html[data-theme="dark"] .preview-modal-body code { background: #262626; }

html[data-theme="dark"] .btn-primary:hover { background: #cfcabf; }
html[data-theme="dark"] .btn-danger { border-color: #59332f; }

html[data-theme="dark"] .danger-zone {
    border-color: #59332f;
    background: #231715;
}

html[data-theme="dark"] .admin-list-row:hover { background: #242424; }

html[data-theme="dark"] .chapter-accordion-header,
html[data-theme="dark"] .report-tab:hover,
html[data-theme="dark"] .image-card-thumb { background: #262626; }

html[data-theme="dark"] .review-section,
html[data-theme="dark"] .translation-section { background: #1a1a1a; }

html[data-theme="dark"] .bar-chart-track { background: #2e2e2e; }
html[data-theme="dark"] .admin-list-thumb { background: #2a2a2a; }

/* press masthead: two baked variants of the logo, one per theme */
.press-logo-dark { display: none; }
html[data-theme="dark"] .press-logo-light { display: none; }
html[data-theme="dark"] .press-logo-dark { display: block; }

/* badges: muted dark fills with lifted text */
html[data-theme="dark"] .badge-published,
html[data-theme="dark"] .badge-author,
html[data-theme="dark"] .badge-open,
html[data-theme="dark"] .badge-review-approved { background: #1c2f21; color: #85c793; }
html[data-theme="dark"] .badge-draft,
html[data-theme="dark"] .badge-access,
html[data-theme="dark"] .badge-review-changes { background: #33250f; color: #e2a35c; }
html[data-theme="dark"] .badge-featured { background: #331721; color: #e08fa4; }
html[data-theme="dark"] .badge-book { background: #16293a; color: #85b8e6; }
html[data-theme="dark"] .badge-admin { background: #e8e4dc; color: #141414; }
html[data-theme="dark"] .badge-user { background: #2c2c2c; color: #a8a8a8; }
html[data-theme="dark"] .badge-review-pending { background: #322b10; color: #d9b850; }

html[data-theme="dark"] .write-restore-banner {
    background: #2c2610;
    border-color: #57491d;
}

/* newspaper view: night edition — desk and sheet both go black */
html[data-theme="dark"] body.newspaper-body { background: #100f0e; }

html[data-theme="dark"] .home-page.newspaper-view {
    --np-ink: #e8e4dc;
    --np-faded: #a39d92;
    --np-rule: #4a463f;
    background-color: #000;
    background-image: none;
    border-color: #2e2b27;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.6),
        0 14px 45px rgba(0, 0, 0, 0.55);
}
/* The nameplate PNG is black ink on a baked white ground. Light mode
   multiplies the white away; here we invert to white-on-black and
   screen the black away instead. */
html[data-theme="dark"] .newspaper-view .magazine-logo {
    filter: invert(1);
    mix-blend-mode: screen;
}
html[data-theme="dark"] .newspaper-view .view-toggle-btn.active,
html[data-theme="dark"] .newspaper-view .lang-toggle-btn.active {
    color: #141414;
}
html[data-theme="dark"] .newspaper-view .article-item-lead {
    color: #c9c4ba;
}

/* modals sit on the surface color already via variables; deepen the dim */
html[data-theme="dark"] .confirm-modal-overlay,
html[data-theme="dark"] .preview-modal-overlay { background: rgba(0, 0, 0, 0.65); }

/* ---------- header theme toggle ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    padding: 0.25rem;
    line-height: 0;
}
.theme-toggle:hover { color: var(--spot-color); }
.theme-toggle .icon-sun,
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

/* === Closed beta page === */

.closed-beta-page {
    max-width: 640px;
    margin: 2.5rem auto 3rem;
    padding: 0 1rem;
    text-align: center;
}

.closed-beta-logos {
    margin-bottom: 2.5rem;
}

.closed-beta-logo-chronicle {
    display: block;
    max-width: 460px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    /* Black ink on a baked white ground: multiply in light mode,
       invert + screen in dark (same treatment as the newspaper masthead). */
    mix-blend-mode: multiply;
}
html[data-theme="dark"] .closed-beta-logo-chronicle {
    filter: invert(1);
    mix-blend-mode: screen;
}

.closed-beta-logo-sep {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 300px;
    margin: 1.25rem auto;
}
.closed-beta-logo-sep span {
    flex: 1;
    height: 1px;
    background: var(--color-border);
}
.closed-beta-logo-sep em {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.3rem;
    color: var(--color-muted);
}

/* .press-logo-light / .press-logo-dark visibility rules are shared with
   the press masthead and already theme-switch these two images. */
.closed-beta-logo-press {
    display: block;
    max-width: 380px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
}

.closed-beta-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 2.25rem 2rem;
}

.closed-beta-badge {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-white);
    background: var(--spot-color);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.closed-beta-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.closed-beta-text {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}
.closed-beta-text:last-child { margin-bottom: 0; }

.closed-beta-muted {
    font-size: 0.95rem;
    color: var(--color-muted);
}

.closed-beta-footnote {
    margin-top: 2rem;
    font-style: italic;
    color: var(--color-muted);
}

/* === Admin: beta links === */

.beta-mode-status {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}
.beta-mode-status.beta-mode-on {
    border-left-color: var(--spot-color);
    color: var(--color-text);
}

.beta-link-create {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.beta-link-create input[type="text"] {
    flex: 1;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
}

.beta-link-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.beta-link-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    font-family: var(--font-ui);
}
.beta-link-date {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.beta-link-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.beta-link-url {
    flex: 1;
    min-width: 0;
    font-family: monospace;
    font-size: 0.85rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-muted);
}

@media (max-width: 600px) {
    .beta-link-row { flex-wrap: wrap; }
    .beta-link-url { flex-basis: 100%; }
}

/* ---------- Support / Patronage ---------- */

.support-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.support-header {
    text-align: center;
    margin-bottom: 2rem;
}

.support-title {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    margin: 0.5rem 0 1rem;
}

.support-lead {
    font-size: 1.15rem;
    line-height: 1.75;
    font-weight: 500;
    font-style: italic;
}

.support-body p {
    font-size: 1.05rem;
    line-height: 1.75;
    margin-bottom: 1.25rem;
}

.support-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0 1rem;
}

.support-fineprint {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    text-align: center;
    margin-bottom: 2rem;
}

.support-alternatives {
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.support-cta {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
    text-align: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.support-cta a {
    color: var(--spot-color);
}

.press-support-hint {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-family: var(--font-ui);
    margin-top: 0.5rem;
}

.press-support-hint a {
    color: inherit;
    text-decoration: underline;
}

.landing-support-line {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.support-urls-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.support-url-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
    max-width: 420px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
}

.support-url-field input {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
}

/* ---------- Groschenpress Adventures ---------- */

.adventure-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 720px;
    margin: 0 auto;
}

.adventure-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.adventure-card-info {
    flex: 1;
}

.adventure-card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.35rem;
}

.adventure-card-byline {
    font-style: italic;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.adventure-card-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}

.adventure-hint {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    text-align: center;
    margin-top: 1.5rem;
}

@media (max-width: 600px) {
    .adventure-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ---------- Apply page extras ---------- */

.apply-hint {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-top: 0.35rem;
}

.apply-footnote {
    margin-top: 0.9rem;
}

.pitch-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.pitch-starter {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--color-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.pitch-starter:hover {
    color: var(--spot-color);
    border-color: var(--spot-color);
}

/* ---------- Tolino / e-ink edition ---------- */

.tolino-howto {
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--spot-color);
    background: var(--color-surface);
    padding: 0.75rem 1rem;
    margin: 1.5rem auto 2rem;
    max-width: 720px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
}

.tolino-note {
    margin-top: 2.5rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-muted);
    text-align: center;
}

/* ---------- Adventure Player (themed terminal) ---------- */

/* LLM-chat layout: the story flows as the normal document and the page
   scrolls; the input dock floats fixed at the bottom of the viewport.
   Bottom padding on the page keeps the last lines clear of the dock. */
body:has(.adventure-play-page) .site-footer {
    display: none;
}

/* compact chrome: slim header, breadcrumb directly beneath it */
body:has(.adventure-play-page) .site-header {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.main-content:has(.adventure-play-page) {
    padding-top: 0;
}

.adventure-play-page .press-breadcrumb {
    padding-top: 0.4rem;
    margin-bottom: 1.25rem;
}

.adventure-play-page {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem 9rem;
}

.adventure-output {
    padding-top: 0.5rem;
}

.adventure-output .line {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-body);
    font-size: 1.02rem;
    line-height: 1.65;
}

.adventure-output .line.h,
.adventure-output .line.room {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.8em;
}

.adventure-output .line.d,
.adventure-output .line.s {
    color: var(--color-muted);
}

.adventure-output .line.a {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
}

.adventure-output .line.g {
    color: var(--spot-color);
}

.adventure-output .line.r,
.adventure-output .line.w {
    color: var(--spot-color);
    font-style: italic;
}

.adventure-output .line.echo {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-top: 0.8em;
}

.adventure-output .line.reportage {
    color: var(--color-muted);
    font-style: italic;
    border-left: 2px solid var(--spot-color);
    padding-left: 0.75rem;
    margin: 0.4em 0;
}

.adventure-input-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 2rem 1.5rem 1rem;
    /* fade the story out behind the dock, like chat UIs */
    background: linear-gradient(to top, var(--color-bg) 65%, transparent);
    pointer-events: none;
}

.adventure-input-dock > * {
    pointer-events: auto;
}

.adventure-input-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: min(720px, 100%);
    padding: 0.7rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}

.adventure-input-row:focus-within {
    border-color: var(--color-muted);
}

.adventure-prompt {
    color: var(--spot-color);
    font-family: var(--font-ui);
    font-weight: 600;
}

.adventure-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: transparent;
    border: none;
    outline: none;
    padding: 0.2rem 0;
}

.adventure-help {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--color-muted);
    text-align: center;
    margin: 0;
}

@media (max-width: 600px) {
    .adventure-play-page {
        padding-bottom: 8rem;
    }
    .adventure-input-dock {
        padding: 1.5rem 0.75rem 0.75rem;
    }
    .adventure-help {
        display: none;
    }
}
