/* ============================================================
   Tokens
   ============================================================ */
:root {
    --paper:      #EFE7DB;
    --paper-2:    #E4D9C7;
    --paper-3:    #F6F1E7;
    --ink:        #241C1A;
    --ink-soft:   #40332F;
    --wine:       #5B2333;
    --wine-dark:  #3D1622;
    --gold:       #B98B3E;
    --gold-soft:  #D9BC85;
    --muted:      #8C8378;
    --line:       #D8CBB4;

    /* Always-dark chrome (topbar, footer, QOTD box) - stays constant across light/dark mode */
    --chrome: #241C1A;
    /* Text/icons that sit on top of --chrome - always light, regardless of theme */
    --on-chrome: #F6F1E7;
    --on-chrome-muted: #C9BEB2;

    --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
    --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --container: 1180px;
    --sidebar-w: 300px;
    --radius: 3px;
}

/* Dark mode - toggled via data-theme="dark" on <html>, persisted in localStorage */
[data-theme="dark"] {
    --paper:     #17130F;
    --paper-2:   #1F1A15;
    --paper-3:   #241E19;
    --ink:       #EDE6DC;
    --ink-soft:  #C9BEB2;
    --line:      #35291F;
    --muted:     #8A8078;
    --wine:      #E08FA3;
    --wine-dark: #C46E85;
    --gold:      #D9BC85;
    --gold-soft: #E8D3A6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    max-width: 100vw;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--wine);
    outline-offset: 2px;
}

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

.wrap {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

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

/* ============================================================
   Top bar (dark nav strip)
   ============================================================ */
.announcement-bar {
    background: var(--wine);
    color: var(--paper-3);
}
.announcement-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 9px 24px;
    position: relative;
}
.announcement-bar-inner p {
    margin: 0;
    font-size: 0.88rem;
    text-align: center;
}
#announcement-dismiss {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--paper-3);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
}
#announcement-dismiss:hover { opacity: 1; }

.topbar { background: var(--chrome); }

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 0;
}

.main-nav { display: flex; }

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 16px 20px;
    color: var(--on-chrome-muted);
    font-size: 0.92rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
}

.main-nav a:hover { color: var(--on-chrome); }
.main-nav a.active { color: var(--on-chrome); background: rgba(255,255,255,0.06); border-bottom-color: var(--gold); }

.search-form {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
}

.search-form input {
    width: 200px;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--on-chrome);
    padding: 0 16px;
    font-family: var(--sans);
    font-size: 0.9rem;
    border-radius: 999px;
}

.search-form input::placeholder { color: var(--on-chrome-muted); }

.search-form button {
    background: var(--gold);
    color: var(--ink);
    border: none;
    padding: 0 18px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 999px;
}
.search-form button:hover { background: var(--gold-soft); }

.search-form--inline {
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    max-width: 420px;
}
.search-form--inline input {
    background: transparent;
    color: var(--ink);
}
.search-form--inline input::placeholder { color: var(--muted); }

.theme-toggle {
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--on-chrome);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    flex: none;
}
.theme-toggle:hover { background: rgba(255,255,255,0.18); }

.mobile-icon-btn {
    display: none;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--on-chrome);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    flex: none;
    align-items: center;
    justify-content: center;
}
.mobile-icon-btn:hover { background: rgba(255,255,255,0.18); }

.mobile-nav-drawer,
.mobile-search-bar { display: none; }

/* Any pasted ad code shouldn't be able to force the page wider than the viewport */
.ad-slot img, .ad-slot iframe, .ad-slot embed, .ad-slot object { max-width: 100%; height: auto; }

/* ============================================================
   Logo bar
   ============================================================ */
.logo-bar { background: var(--paper-2); border-bottom: 1px solid var(--line); }

.logo-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: 22px;
    padding-bottom: 22px;
}

.logo {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 600;
    font-size: 2rem;
    color: var(--gold);
}

.logo span { color: var(--wine); }

/* ============================================================
   Page body / two-column layout
   ============================================================ */
.page-body { padding-top: 32px; padding-bottom: 56px; }

.page-wide {
    max-width: 760px;
    margin: 0 auto;
}
.page-wide .admin-form { padding: 34px 36px; }
@media (max-width: 640px) {
    .page-wide .admin-form { padding: 26px 20px; }
}

.layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.content { flex: 1; min-width: 0; }

.sidebar {
    flex: none;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .ad-slot--header { min-width: 0; width: 100%; }
}

/* ============================================================
   Sidebar widgets
   ============================================================ */
.side-box {
    background: var(--paper-3);
    border: 1px solid var(--line);
    overflow: hidden;
}

.side-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--paper-3);
}

.side-box-head a { font-size: 0.78rem; background: rgba(255,255,255,0.18); padding: 4px 10px; border-radius: 999px; color: var(--paper-3); }
.side-box-head a:hover { background: rgba(255,255,255,0.3); }

.side-box--accent .side-box-head { background: var(--wine); }
.side-box--ink .side-box-head { background: var(--chrome); color: var(--on-chrome); }
.side-box--ink .side-box-head a { color: var(--on-chrome); }
.side-box--gold .side-box-head { background: var(--gold); color: var(--ink); }
.side-box--gold .side-box-head a { background: rgba(0,0,0,0.1); color: var(--ink); }
.side-box--plain .side-box-head { background: var(--paper-2); color: var(--ink); }

.side-box-body { padding: 18px; }

#refresh-random {
    background: none; border: none; color: inherit; cursor: pointer;
    font-size: 1.1rem; line-height: 1; padding: 2px;
}
#refresh-random.spinning { animation: spin 0.6s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.rq-byline { margin: 0 0 10px; font-size: 0.85rem; }
.rq-byline a { color: var(--wine); font-weight: 600; }
.rq-cat { color: var(--muted) !important; font-weight: 400 !important; margin-left: 6px; }
.rq-cat::before { content: "· "; }
.rq-text { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.02rem; line-height: 1.45; }

.topic-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}
.topic-cols a { font-size: 0.9rem; color: var(--ink-soft); padding: 3px 0; }
.topic-cols a:hover { color: var(--wine); }

.author-search { position: relative; margin-bottom: 14px; }
.author-search input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 0.88rem;
    background: var(--paper);
}
.author-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--paper-3);
    border: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    z-index: 20;
    max-height: 240px;
    overflow-y: auto;
}
.author-search-results a, .asr-empty {
    display: block;
    padding: 9px 12px;
    font-size: 0.88rem;
}
.author-search-results a:hover { background: var(--paper-2); color: var(--wine); }
.asr-empty { color: var(--muted); }

.author-rank { list-style: none; margin: 0; padding: 0; }
.author-rank li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
}
.author-rank li:last-child { border-bottom: none; }
.author-rank a { color: var(--ink-soft); font-weight: 500; }
.author-rank a:hover { color: var(--wine); }
.badge {
    background: var(--gold);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.side-list { list-style: none; margin: 0; padding: 8px 0; }
.side-list li { border-bottom: 1px solid var(--line); }
.side-list li:last-child { border-bottom: none; }
.side-list a { display: block; padding: 10px 18px; font-size: 0.9rem; color: var(--ink-soft); }
.side-list a:hover { color: var(--wine); background: var(--paper-2); }

/* ============================================================
   Ad slots
   ============================================================ */
.ad-slot { display: flex; justify-content: center; overflow: hidden; }
.ad-slot--header { margin-left: auto; justify-content: flex-end; }
@media (min-width: 900px) {
    .ad-slot--header { min-width: 720px; }
}
.ad-slot--sidebar { border: 1px solid var(--line); background: var(--paper-3); padding: 10px; }
.ad-slot--in_feed { margin: 0 0 16px; border: 1px solid var(--line); background: var(--paper-3); padding: 14px; justify-content: center; }

/* ============================================================
   Quote rows (main listing)
   ============================================================ */
.quote-row {
    background: var(--paper-3);
    border: 1px solid var(--line);
    padding: 22px 24px;
    margin-bottom: 16px;
}

.quote-row-head {
    margin-bottom: 8px;
    font-size: 0.92rem;
}
.quote-row-head .author { color: var(--wine); font-weight: 700; }
.lang-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--wine);
    background: var(--paper-2);
    border: 1px solid var(--line);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Arabic quotes get a proper Naskh-style serif and right-to-left flow */
[lang="ar"] {
    font-family: "Amiri", var(--serif);
    direction: rtl;
    text-align: right;
    line-height: 1.9;
}

.quote-row-text {
    margin: 0 0 16px;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--ink);
}
.quote-row-text a { color: inherit; }
.quote-row-text a:hover { color: var(--wine); }

.quote-row-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.quote-row-tags {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
}
.quote-row-tags .category { color: var(--gold); font-weight: 600; }
.quote-row-tags .category:hover { color: var(--wine); }

.quote-row-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: 1px solid var(--line);
    color: var(--ink-soft);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { border-color: var(--wine); color: var(--wine); }
.icon-btn.copied { border-color: var(--gold); color: var(--gold); }
.icon-btn.is-fav { border-color: var(--wine); color: var(--wine); background: rgba(91,35,51,0.08); }

/* ============================================================
   Quote of the Day
   ============================================================ */
.qotd-box {
    background: var(--chrome);
    border: 1px solid var(--line);
    margin-bottom: 28px;
    overflow: hidden;
}
.qotd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--gold);
    color: var(--ink);
    font-weight: 700;
    font-size: 0.9rem;
}
.qotd-date { font-weight: 500; color: var(--wine-dark); }
.qotd-body { padding: 32px 28px; }
.qotd-body blockquote {
    margin: 0 0 22px;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.25rem, 2.2vw, 1.6rem);
    line-height: 1.4;
    color: var(--on-chrome);
}
.qotd-body .quote-meta { border-top-color: rgba(255,255,255,0.12); }
.qotd-body .quote-meta .author { color: var(--gold-soft); }
.qotd-body .quote-meta .category { color: var(--on-chrome-muted); }
.qotd-body .icon-btn { border-color: rgba(255,255,255,0.25); color: var(--on-chrome-muted); }
.qotd-body .icon-btn:hover { border-color: var(--gold); color: var(--gold); }

@media (max-width: 640px) {
    .quote-row { padding: 18px 18px; }
}

/* ============================================================
   Buttons (reused on quote.php / empty states)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-outline { background: transparent; border-color: var(--wine); color: var(--wine); }
.btn-outline:hover { background: var(--wine); color: var(--paper-3); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink-soft); padding: 8px 14px; font-size: 0.85rem; }
.btn-quiet:hover { border-color: var(--wine); color: var(--wine); }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ============================================================
   Single quote page
   ============================================================ */
.quote-solo {
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-top: 4px solid var(--gold);
    padding: 48px;
}

.quote-solo blockquote {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    line-height: 1.45;
    margin: 0 0 28px;
}

.quote-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.95rem;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.quote-meta .author { color: var(--wine); font-weight: 700; }
.quote-meta .category { color: var(--gold); font-weight: 600; }
.quote-actions { display: flex; gap: 10px; }

@media (max-width: 640px) {
    .quote-solo { padding: 30px 22px; }
}

.kbd-hint {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 14px;
}
.kbd-hint kbd {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 7px;
    font-family: var(--sans);
    font-size: 0.8rem;
}

/* ============================================================
   Page headers (category/author/search)
   ============================================================ */
.page-header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}
.page-header h1 { font-family: var(--serif); font-size: 1.9rem; margin: 0 0 8px; }
.page-header p { color: var(--muted); margin: 0; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.muted { color: var(--muted); }

.author-profile {
    display: flex;
    gap: 22px;
    align-items: flex-start;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
}
.author-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
    flex: none;
}
.author-bio {
    color: var(--ink-soft);
    line-height: 1.6;
    max-width: 65ch;
    margin: 0;
}
@media (max-width: 560px) {
    .author-profile { flex-direction: column; align-items: center; text-align: center; }
    .author-bio { max-width: none; }
}

/* ============================================================
   Topics index page
   ============================================================ */
.topics-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.topics-head h1 { font-family: var(--serif); font-size: 1.9rem; margin: 0; }
.topics-head input {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 0.9rem;
    min-width: 240px;
    background: var(--paper-3);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px 20px;
}
.topic-grid a {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.95rem;
}
.topic-grid a:hover { color: var(--wine); }

/* ============================================================
   Authors index page (A-Z)
   ============================================================ */
.az-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 28px;
}
.az-tab {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--paper-3);
    border: 1px solid var(--line);
    color: var(--ink-soft);
}
.az-tab:hover { border-color: var(--wine); color: var(--wine); }
.az-tab.active { background: var(--wine); border-color: var(--wine); color: var(--paper-3); }
.az-tab.disabled { color: var(--muted); opacity: 0.35; }

.author-index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px 20px;
    margin-bottom: 24px;
}
.author-index-grid a {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.95rem;
}
.author-index-grid a:hover { color: var(--wine); }

/* ============================================================
   Static pages (Privacy Policy etc.)
   ============================================================ */
.static-page { line-height: 1.7; }
.static-page h2 { font-family: var(--serif); }

/* ============================================================
   Public forms (e.g. submit.php) - lightweight echo of admin form styles
   ============================================================ */
.admin-form {
    background: var(--paper-3);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    padding: 28px 30px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 0.8rem; margin-top: 5px; }
.field input[type="text"],
.field input[type="password"],
.field textarea,
.field select {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--sans);
    font-size: 0.95rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 180px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}
.alert-success { background: #EAF3E7; border-color: #BFDCB4; color: #2E5A24; }
.alert-error { background: #F6E6E6; border-color: #E0B4B4; color: #7A2727; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}
.page-link {
    border: 1px solid var(--line);
    padding: 8px 13px;
    font-size: 0.88rem;
    border-radius: var(--radius);
    color: var(--ink-soft);
}
.page-link:hover { border-color: var(--wine); color: var(--wine); }
.page-link.active { background: var(--wine); border-color: var(--wine); color: var(--paper-3); }
.page-link.disabled { color: var(--muted); opacity: 0.5; }
.page-gap { padding: 8px 4px; color: var(--muted); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    background: var(--chrome);
    color: var(--on-chrome-muted);
    margin-top: 48px;
    padding: 22px 0;
    font-size: 0.85rem;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-copy { margin: 0; }
.site-footer a { color: var(--gold-soft); }
.footer-pages { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-pages a { color: var(--on-chrome-muted); }
.footer-pages a:hover { color: var(--gold-soft); }

@media (max-width: 560px) {
    .footer-inner { flex-direction: column; align-items: flex-start; }
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--wine);
    color: var(--paper-3);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
    z-index: 50;
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: var(--wine-dark); }

.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--chrome);
    color: var(--on-chrome-muted);
    border-top: 3px solid var(--gold);
    padding: 16px 0;
    z-index: 90;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.cookie-banner-inner p { margin: 0; font-size: 0.88rem; max-width: 640px; }
@media (max-width: 560px) {
    .cookie-banner-inner { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 20px);
    background: var(--chrome);
    color: var(--on-chrome);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    border: 1px solid var(--gold);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}

/* ============================================================
   Mobile topbar: menu icon (left) / search icon (center) / dark mode (right)
   Placed at the end of the file on purpose, so these overrides always
   win the cascade regardless of where the base rules they touch live.
   ============================================================ */
@media (max-width: 700px) {
    .topbar-inner {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        padding: 16px 4px;
    }
    .main-nav,
    .search-form { display: none; }
    .mobile-icon-btn { display: inline-flex; }
    #mobile-menu-btn { justify-self: start; }
    #mobile-search-btn { justify-self: center; }
    #theme-toggle { justify-self: end; }

    .mobile-nav-drawer.open {
        display: flex;
        flex-direction: column;
        background: var(--chrome);
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .mobile-nav-drawer a {
        padding: 14px 24px;
        color: var(--on-chrome-muted);
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .mobile-nav-drawer a.active,
    .mobile-nav-drawer a:hover { color: var(--on-chrome); background: rgba(255,255,255,0.05); }

    .mobile-search-bar.open {
        display: flex;
        gap: 8px;
        padding: 12px 24px;
        background: var(--chrome);
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    .mobile-search-bar input {
        flex: 1;
        background: rgba(255,255,255,0.08);
        border: none;
        color: var(--on-chrome);
        padding: 10px 14px;
        font-family: var(--sans);
        font-size: 0.9rem;
        border-radius: 999px;
    }
    .mobile-search-bar input::placeholder { color: var(--on-chrome-muted); }
    .mobile-search-bar button {
        background: var(--gold);
        color: var(--ink);
        border: none;
        width: 40px;
        border-radius: 999px;
        cursor: pointer;
    }

    /* Logo centered under the icon row, ad stacked below it instead of beside it.
       flex-wrap/align-items/justify-content are repeated explicitly here (not just
       flex-direction) so nothing leaks in from the desktop .logo-bar-inner rule. */
    .logo-bar-inner {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 12px;
        text-align: center;
    }
    .logo-bar-inner .logo { margin: 0 auto; }
    .ad-slot--header {
        min-width: 0;
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }
}
