/* ===== Wat — White House × Luxembourg typography ===== */

:root {
    /* Luxembourg flag — constant across themes */
    --lux-red: #ED2939;
    --lux-blue: #00A1DE;
    --lux-white: #FFFFFF;

    /* Typography */
    --serif: "Source Serif 4", "Source Serif Pro", "Iowan Old Style", "Georgia", "Times New Roman", serif;
    --sans:  "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono:  "JetBrains Mono", "Fira Code", "Cascadia Code", "Consolas", "SF Mono", "Menlo", monospace;
    --display: "Source Serif 4", "Playfair Display", "Source Serif Pro", "Georgia", serif;

    /* Layout */
    --measure: 68ch;
    --radius: 4px;
}

/* ===== Color modes ===== */

/* Default: Dark */
html, html[data-theme="dark"] {
    --ink: #f0eee6;
    --ink-soft: #d8d6cf;
    --muted: #9a978c;
    --muted-2: #6a685e;
    --rule: #2a2825;
    --rule-strong: #3c3a35;
    --bg: #131311;
    --bg-card: #1c1b18;
    --bg-soft: #211f1c;
    --bar-bg: rgba(19,19,17,.85);
    --link: #ff6573;
    --link-hover: #ff8b96;
    --code-bg: #1f1d1a;
    --code-border: #312f2a;
    --code-fg: #d8d6cf;
    --kbd-bg: #2a2825;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

html[data-theme="light"] {
    --ink: #1a1a1a;
    --ink-soft: #2a2a2a;
    --muted: #5a5a5a;
    --muted-2: #8a8a8a;
    --rule: #e5e5e5;
    --rule-strong: #cfcfcf;
    --bg: #fafaf7;
    --bg-card: #ffffff;
    --bg-soft: #f4f3ee;
    --bar-bg: rgba(255,255,255,.92);
    --link: #b6202f;
    --link-hover: #8a1822;
    --code-bg: #f7f7f4;
    --code-border: #ececec;
    --code-fg: #24292e;
    --kbd-bg: #f3f3ef;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
}

html[data-theme="blueish"] {
    --ink: #e6ecf5;
    --ink-soft: #cfd8e8;
    --muted: #8b97ac;
    --muted-2: #5b6577;
    --rule: #1f2735;
    --rule-strong: #2c3548;
    --bg: #0c1018;
    --bg-card: #131a26;
    --bg-soft: #182030;
    --bar-bg: rgba(12,16,24,.85);
    --link: #6cb7ff;
    --link-hover: #92caff;
    --code-bg: #131a26;
    --code-border: #232c3e;
    --code-fg: #cfd8e8;
    --kbd-bg: #1d2738;
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.35);
}

html[data-theme="cream"] {
    --ink: #2c2418;
    --ink-soft: #4a3e2c;
    --muted: #7a6c54;
    --muted-2: #a39477;
    --rule: #e8dcc4;
    --rule-strong: #d4c5a4;
    --bg: #f5ecd8;
    --bg-card: #fbf3df;
    --bg-soft: #efe3c8;
    --bar-bg: rgba(245,236,216,.92);
    --link: #a3401e;
    --link-hover: #7a2e15;
    --code-bg: #efe3c8;
    --code-border: #ddd0b0;
    --code-fg: #3a2e1f;
    --kbd-bg: #ebdfc0;
    --shadow: 0 1px 2px rgba(80,60,30,.06), 0 4px 12px rgba(80,60,30,.06);
}

* { box-sizing: border-box; }

/* ===== Scrollbars (theme-aware) ===== */

/* Firefox + modern browsers */
html { scrollbar-color: var(--rule-strong) transparent; scrollbar-width: thin; }

/* WebKit / Chromium */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--rule-strong);
    border: 3px solid var(--bg);
    border-radius: 999px;
    min-height: 40px;
    transition: background .15s;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::-webkit-scrollbar-thumb:active { background: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }

/* When the surface under the scrollbar is the card / soft tone, match the border */
.editor-aside::-webkit-scrollbar-thumb,
.reader-sidebar::-webkit-scrollbar-thumb,
.reading-sidebar::-webkit-scrollbar-thumb,
.notif-panel::-webkit-scrollbar-thumb {
    border-color: var(--bg-soft);
}
.editor-preview::-webkit-scrollbar-thumb,
.reader-main::-webkit-scrollbar-thumb,
.reader-article::-webkit-scrollbar-thumb,
.gallery-preview::-webkit-scrollbar-thumb {
    border-color: var(--bg-card);
}

/* Terminal frame uses its own palette */
.terminal-frame { scrollbar-color: var(--term-dim) transparent; }
.terminal-frame ::-webkit-scrollbar-thumb {
    background: var(--term-dim);
    border-color: var(--term-bg);
}
.terminal-frame ::-webkit-scrollbar-thumb:hover { background: var(--term-fg-bright); }

/* Lucide icons: vertical-align with text, never grow on click, inherit text color */
.lc-icon {
    display: inline-flex !important;
    vertical-align: -0.18em;
    line-height: 0;
    color: inherit;
}
.lc-icon svg { display: block; flex: 0 0 auto; }
.btn .lc-icon { vertical-align: -0.16em; margin-right: 1px; }
.btn .lc-icon + span, .btn .lc-icon + svg { margin-left: 2px; }
.tag .lc-icon, .feed-actions .lc-icon { vertical-align: -0.14em; margin-right: 4px; }
.brand .lc-icon { vertical-align: middle; }
.nav-primary a .lc-icon { vertical-align: -0.18em; margin-right: 2px; }
.cookie-notice-inner .lc-icon { vertical-align: -0.16em; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--link);
    text-decoration-thickness: 0.06em;
    text-underline-offset: 0.18em;
    transition: color .12s;
}
a:hover { color: var(--link-hover); }

/* ===== Site chrome ===== */

.site-bar {
    border-top: 4px solid var(--lux-red);
    background: var(--bar-bg);
    border-bottom: 1px solid var(--rule);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.site-bar-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    gap: 16px;
}
.brand {
    font-family: "Garamond", "Didot", "Bodoni MT", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
    font-size: 1.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ink);
    text-decoration: none;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
}
.brand .brand-bang {
    color: var(--lux-red);
    margin-left: -0.15rem;
}

/* ===== Top nav ===== */

.nav-primary {
    display: flex; align-items: center;
    gap: 26px;
    flex: 1;
    justify-content: space-between;
}
.nav-links {
    display: flex; gap: 24px; align-items: center;
}
.nav-links a {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
    font-size: .92rem;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: color .14s, border-color .14s;
}
.nav-links a:hover { color: var(--lux-red); border-bottom-color: var(--lux-red); }

.nav-cluster {
    display: flex; align-items: center;
    gap: 8px;
}
.nav-link-quiet {
    color: var(--ink-soft); text-decoration: none;
    font-weight: 500; font-size: .92rem;
    padding: 6px 10px;
}
.nav-link-quiet:hover { color: var(--lux-red); }

.nav-cta {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    background: var(--lux-red); color: white;
    border: 1px solid var(--lux-red);
    border-radius: 999px;
    font-weight: 600; font-size: .88rem;
    text-decoration: none;
    transition: background .14s, color .14s, border-color .14s, transform .04s;
}
.nav-cta:hover { background: #c81f2f; color: white; }
.nav-cta:active { transform: translateY(1px); }

.nav-cta-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule-strong);
}
.nav-cta-secondary:hover {
    background: var(--bg-soft);
    color: var(--ink);
    border-color: var(--ink);
}
.nav-cta.nav-cta-icon {
    width: 36px; padding: 7px 0;
    justify-content: center;
}

.icon-btn {
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    color: var(--ink-soft);
    transition: background .14s, color .14s;
    padding: 0;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }

/* Light/Dark toggle button */
.theme-toggle { position: relative; }
.theme-toggle .theme-toggle-dark,
.theme-toggle .theme-toggle-light { display: inline-flex; }
/* In dark themes, show the sun (offering to switch to light) */
html[data-theme="dark"] .theme-toggle .theme-toggle-dark,
html[data-theme="blueish"] .theme-toggle .theme-toggle-dark { display: none; }
/* In light themes, show the moon (offering to switch to dark) */
html[data-theme="light"] .theme-toggle .theme-toggle-light,
html[data-theme="cream"] .theme-toggle .theme-toggle-light { display: none; }

/* Notification bell */
.notif-bell { position: relative; }
.notif-trigger { position: relative; }
.notif-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: var(--lux-red); color: white;
    font-family: var(--sans);
    font-size: .65rem; font-weight: 700;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bar-bg);
}
.notif-panel {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    width: 360px; max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 110;
    animation: wat-fade-in .15s ease both;
}
.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--rule);
    font-size: .9rem;
}
.notif-head .link {
    background: none; border: none;
    color: var(--lux-red); font-size: .82rem;
    cursor: pointer; padding: 4px 6px; border-radius: 4px;
}
.notif-head .link:hover { background: rgba(237,41,57,.08); }
.notif-empty { padding: 28px 14px; color: var(--muted); text-align: center; font-size: .9rem; }
.notif-list { list-style: none; padding: 6px; margin: 0; }
.notif-item { border-radius: 4px; }
.notif-item:hover { background: var(--bg-soft); }
.notif-item a {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 10px;
    text-decoration: none;
    color: var(--ink-soft);
}
.notif-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: transparent; flex: 0 0 auto; margin-top: 6px;
}
.notif-item.unread .notif-dot { background: var(--lux-red); }
.notif-body { flex: 1; min-width: 0; }
.notif-text {
    font-size: .9rem; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-when { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.notif-item.unread .notif-text { font-weight: 600; }

@media (max-width: 700px) {
    .notif-panel { width: calc(100vw - 28px); right: -8px; }
}

/* User chip + dropdown */
.user-menu { position: relative; }
.user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; border: 1px solid transparent;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--sans);
    font-size: .9rem;
    color: var(--ink-soft);
    transition: background .14s, border-color .14s;
}
.user-chip:hover { background: var(--bg-soft); border-color: var(--rule); color: var(--ink); }
.avatar-dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lux-red), var(--lux-blue));
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--display); font-weight: 700; font-size: .82rem;
    flex: 0 0 auto;
}
.user-name { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px); right: 0;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 6px;
    min-width: 200px;
    box-shadow: var(--shadow);
    z-index: 100;
    flex-direction: column;
    gap: 2px;
}
.user-menu.open .user-dropdown { display: flex; }
.user-dropdown a, .user-dropdown-signout {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: transparent; border: none; border-radius: 4px;
    cursor: pointer;
    font-family: var(--sans); font-size: .9rem;
    color: var(--ink-soft); text-align: left;
    text-decoration: none;
    width: 100%;
}
.user-dropdown a:hover, .user-dropdown-signout:hover { background: var(--bg-soft); color: var(--ink); }
.user-dropdown-signout { color: var(--lux-red); }
.user-dropdown-signout:hover { color: var(--lux-red); background: rgba(237,41,57,.08); }
.user-dropdown-sep {
    height: 1px; background: var(--rule);
    margin: 4px 4px;
}

.site-foot {
    margin-top: 80px;
    border-top: 1px solid var(--rule);
    padding: 30px 24px 60px;
    color: var(--muted);
    font-size: .9rem;
}
.foot-row {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.foot-row strong { color: var(--ink-soft); }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--lux-red); }

@media (max-width: 700px) {
    .foot-row { justify-content: center; text-align: center; }
}

.cookie-notice {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    max-width: calc(100vw - 24px);
    pointer-events: none;
}
.cookie-notice-inner {
    pointer-events: auto;
    display: inline-flex; align-items: center;
    gap: 10px;
    background: var(--ink); color: var(--bg);
    padding: 8px 8px 8px 16px;
    border-radius: 999px;
    font-size: .82rem;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    animation: wat-fade-in .35s .3s ease both;
    white-space: nowrap;
}
.cookie-notice-inner > span { flex: 0 1 auto; }
.cookie-notice-inner a { color: var(--bg); text-decoration: underline; text-underline-offset: 2px; }
.cookie-notice-inner .cookie-dismiss {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    background: rgba(255,255,255,.08); color: var(--bg);
    border: none; border-radius: 50%;
    cursor: pointer; flex: 0 0 auto;
    transition: background .14s;
}
.cookie-notice-inner .cookie-dismiss:hover { background: rgba(255,255,255,.18); }

@media (max-width: 720px) {
    .cookie-notice { bottom: 12px; }
    .cookie-notice-inner {
        font-size: .78rem; padding: 8px 8px 8px 14px;
        white-space: normal; max-width: calc(100vw - 24px);
    }
}
.site-foot .lux-flag {
    display:inline-flex; vertical-align: middle; width: 24px; height: 14px; margin: 0 6px;
    flex-direction: column; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.05);
}
.site-foot .lux-flag span { flex:1; }
.site-foot .lux-flag .l-r { background: var(--lux-red); }
.site-foot .lux-flag .l-w { background: var(--lux-white); }
.site-foot .lux-flag .l-b { background: var(--lux-blue); }

/* ===== Main column ===== */

main.page { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

.container-narrow { max-width: 760px; margin: 0 auto; padding: 32px 24px; }
.container-prose  { max-width: var(--measure); margin: 0 auto; padding: 32px 24px; }

/* ===== Article typography (White House style) ===== */

.prose { font-family: var(--serif); color: var(--ink); font-size: 19px; line-height: 1.75; }
.prose > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.prose > figure, .prose > pre, .prose > .table-wrap { max-width: 90ch; }

.prose h1, .article-title {
    font-family: "Garamond", "Didot", "Bodoni MT", "Times New Roman", serif;
    font-weight: 700;
    font-size: clamp(2.25rem, 4.5vw, 3.6rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0 auto .35em;
    color: var(--ink);
    text-wrap: balance;
}
.prose h2 {
    font-family: var(--display); font-weight: 700;
    font-size: 1.85rem; line-height: 1.2; letter-spacing: -0.01em;
    margin-top: 2em; margin-bottom: .55em; color: var(--ink);
    border-bottom: 1px solid var(--rule); padding-bottom: .3em;
}
.prose h3 {
    font-family: var(--display); font-weight: 700;
    font-size: 1.4rem; line-height: 1.25;
    margin-top: 1.75em; margin-bottom: .4em;
}
.prose h4 { font-family: var(--display); font-size: 1.15rem; margin-top: 1.4em; }

.prose p { margin: 0 auto 1.05em; }
.prose p + p { text-indent: 0; }

.prose blockquote {
    margin: 1.5em auto;
    padding: 0.4em 1.5em;
    border-left: 3px solid var(--lux-red);
    color: var(--ink-soft);
    font-style: italic;
    background: var(--bg-soft);
}
.prose blockquote p { margin-bottom: .5em; }

.prose hr {
    border: none; height: 1px; background: var(--rule);
    margin: 2.4em auto; max-width: 6em;
}

.prose ul, .prose ol { padding-left: 1.4em; margin: .5em auto 1.1em; }
.prose li { margin: .2em 0; }
.prose li > p { margin-bottom: .5em; }

.prose a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: rgba(237,41,57,.35);
    text-decoration-thickness: 0.07em;
    text-underline-offset: 0.18em;
}
.prose a:hover { color: var(--link-hover); text-decoration-color: var(--link-hover); }

.prose strong { color: var(--ink); }
.prose em { font-style: italic; }

.prose img, .prose video {
    display: block; max-width: 100%; height: auto;
    margin: 1.4em auto; border-radius: var(--radius);
}
.prose figure { margin: 1.6em auto; }
.prose figure figcaption {
    font-family: var(--sans);
    font-size: .85rem;
    color: var(--muted);
    text-align: center;
    margin-top: .5em;
    font-style: italic;
}

/* Drop cap for first paragraph */
.prose.drop-cap > p:first-of-type::first-letter {
    font-family: var(--display); font-weight: 800;
    float: left; font-size: 4.4em; line-height: .85;
    padding: .08em .12em 0 0; color: var(--lux-red);
}

/* Article header block */
.article-header {
    max-width: var(--measure); margin: 0 auto 2em;
    padding-bottom: 1.2em; border-bottom: 1px solid var(--rule);
    text-align: left;
}
.article-eyebrow {
    font-family: var(--sans);
    font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--lux-red); font-size: .8rem; margin-bottom: .6em;
}
.article-byline {
    font-family: var(--sans); color: var(--muted); font-size: .95rem;
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 1em;
}
.article-byline a { color: var(--ink); font-weight: 600; text-decoration: none; }
.article-byline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--rule-strong); }

/* Tables */
.prose table, .table-wrap > table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--sans);
    font-size: .94rem;
    margin: 1.4em auto;
    border: 1px solid var(--rule);
}
.prose th, .prose td {
    padding: 10px 14px; border: 1px solid var(--rule);
    text-align: left; vertical-align: top;
}
.prose thead th { background: var(--bg-soft); font-weight: 700; }
.prose tbody tr:nth-child(even) { background: rgba(0,0,0,0.015); }

/* ===== Code (programming-blog optimized) ===== */

/* Syntax-highlighting palette (highlight.js token classes) */
html, html[data-theme="dark"] {
    --hl-comment:  #7d8a91;
    --hl-keyword:  #f37b86;
    --hl-string:   #98c379;
    --hl-number:   #d9a263;
    --hl-function: #e5c07b;
    --hl-variable: #61afef;
    --hl-type:     #56b6c2;
    --hl-meta:     #c678dd;
    --hl-tag:      #f37b86;
    --hl-attr:     #d9a263;
    --hl-deletion-fg: #ff8585;
    --hl-deletion-bg: rgba(255,107,107,.10);
    --hl-addition-fg: #8ac26d;
    --hl-addition-bg: rgba(138,194,109,.10);
}
html[data-theme="light"] {
    --hl-comment:  #6a737d;
    --hl-keyword:  #c0392b;
    --hl-string:   #2e7d32;
    --hl-number:   #b76b00;
    --hl-function: #6a4c9c;
    --hl-variable: #1565c0;
    --hl-type:     #00838f;
    --hl-meta:     #8e24aa;
    --hl-tag:      #c0392b;
    --hl-attr:     #b76b00;
    --hl-deletion-fg: #b3261e;
    --hl-deletion-bg: rgba(179,38,30,.07);
    --hl-addition-fg: #2e7d32;
    --hl-addition-bg: rgba(46,125,50,.08);
}
html[data-theme="blueish"] {
    --hl-comment:  #6a7689;
    --hl-keyword:  #ff7c92;
    --hl-string:   #9bd28e;
    --hl-number:   #f1aa67;
    --hl-function: #ffd479;
    --hl-variable: #6cc0ff;
    --hl-type:     #65d6e0;
    --hl-meta:     #d499ff;
    --hl-tag:      #ff7c92;
    --hl-attr:     #f1aa67;
    --hl-deletion-fg: #ff8585;
    --hl-deletion-bg: rgba(255,107,107,.10);
    --hl-addition-fg: #9bd28e;
    --hl-addition-bg: rgba(155,210,142,.10);
}
html[data-theme="cream"] {
    --hl-comment:  #8a7a5c;
    --hl-keyword:  #b1392c;
    --hl-string:   #486a2a;
    --hl-number:   #b06800;
    --hl-function: #6a4a14;
    --hl-variable: #1f5e9b;
    --hl-type:     #137176;
    --hl-meta:     #884a99;
    --hl-tag:      #b1392c;
    --hl-attr:     #b06800;
    --hl-deletion-fg: #b1392c;
    --hl-deletion-bg: rgba(177,57,44,.07);
    --hl-addition-fg: #486a2a;
    --hl-addition-bg: rgba(72,106,42,.08);
}

.hljs { background: transparent !important; color: inherit; }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-doctag,
.hljs-section, .hljs-name, .hljs-tag { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-template-tag, .hljs-template-variable .hljs-string { color: var(--hl-string); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: var(--hl-number); }
.hljs-function .hljs-title, .hljs-title.function_, .hljs-title { color: var(--hl-function); }
.hljs-variable, .hljs-template-variable, .hljs-attribute, .hljs-attr { color: var(--hl-variable); }
.hljs-type, .hljs-class .hljs-title, .hljs-title.class_ { color: var(--hl-type); }
.hljs-meta, .hljs-meta-keyword, .hljs-link { color: var(--hl-meta); }
.hljs-deletion { color: var(--hl-deletion-fg); background: var(--hl-deletion-bg); }
.hljs-addition { color: var(--hl-addition-fg); background: var(--hl-addition-bg); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

.prose code, code {
    font-family: var(--mono);
    font-size: .9em;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 1px 5px; border-radius: 3px;
    color: var(--code-fg);
    font-feature-settings: "calt" 1, "liga" 0;
}
.prose pre {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-left: 3px solid var(--lux-blue);
    padding: 16px 18px;
    overflow-x: auto;
    border-radius: var(--radius);
    line-height: 1.55;
    font-size: .9rem;
}
.prose pre code {
    background: transparent; border: none; padding: 0; font-size: inherit;
    color: inherit;
}
kbd {
    font-family: var(--mono); font-size: .85em;
    background: var(--kbd-bg); border: 1px solid var(--rule-strong);
    border-bottom-width: 2px;
    border-radius: 3px; padding: 1px 6px;
}

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--sans); font-weight: 600; font-size: .95rem;
    padding: 9px 18px; border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    cursor: pointer; text-decoration: none;
    transition: background .12s, color .12s, border-color .12s, transform .04s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--lux-red); color: #ffffff; border-color: var(--lux-red); }
.btn-accent { background: var(--lux-red); color: #ffffff; border-color: var(--lux-red); }
.btn-accent:hover { background: #c81f2f; color: #ffffff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); background: var(--bg-soft); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Icon-only buttons stay square so they line up with text buttons */
.btn.btn-icon, .btn-sm.btn-icon { padding: 0; aspect-ratio: 1; }
.btn.btn-icon { width: 38px; height: 38px; }
.btn-sm.btn-icon { width: 30px; height: 30px; }
.btn.btn-icon .lc-icon { margin: 0; }

input, select, textarea {
    font-family: var(--sans); font-size: 1rem;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    color: var(--ink);
    transition: border-color .12s, box-shadow .12s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--lux-blue);
    box-shadow: 0 0 0 3px rgba(0,161,222,.15);
}

label { font-weight: 600; font-size: .9rem; color: var(--ink-soft); display:block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.field .err  { color: var(--lux-red); font-size: .85rem; margin-top: 4px; }

/* ===== Cards ===== */

.card {
    background: var(--bg-card); border: 1px solid var(--rule);
    border-radius: var(--radius); padding: 22px;
    transition: box-shadow .12s, border-color .12s, transform .12s;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--rule-strong); }

/* ===== Feed (Twitter-like) ===== */

.feed { max-width: 640px; margin: 0 auto; }
.feed-item {
    display: block; text-decoration: none; color: inherit;
    padding: 22px 24px; border-bottom: 1px solid var(--rule);
    transition: background .1s;
    cursor: pointer;
}
.feed-item:hover { background: var(--bg-card); }
/* Restore default cursor on interactive children inside the clickable card */
.feed-item .fr-stat, .feed-item .follow-chip,
.feed-item a, .feed-item button { cursor: pointer; }
.feed-item input, .feed-item textarea, .feed-item select { cursor: text; }
.feed-meta {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    color: var(--muted); font-size: .9rem; margin-bottom: 4px;
}
.feed-meta .who { font-weight: 700; color: var(--ink); }
.feed-meta .at  { color: var(--muted-2); }
.feed-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); display: inline-block; }

/* Inline follow chip (used in feed cards) */
.follow-chip-wrap { display: inline-flex; }
.follow-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--ink); color: var(--bg);
    border: 1px solid var(--ink);
    padding: 3px 10px; border-radius: 999px;
    font-family: var(--sans); font-size: .72rem; font-weight: 600;
    line-height: 1; cursor: pointer; user-select: none;
    margin-right: 4px;
    transition: background .12s ease, color .12s ease, border-color .12s ease, opacity .12s ease;
}
.follow-chip:hover { opacity: .9; }
.follow-chip:disabled { opacity: .55; cursor: default; }

.follow-chip.is-following {
    background: transparent; color: var(--ink);
    border-color: var(--rule);
}
.follow-chip.is-following .follow-chip-hover { display: none; }
.follow-chip.is-following:hover {
    background: rgba(237,41,57,.08); color: var(--lux-red);
    border-color: rgba(237,41,57,.4);
}
.follow-chip.is-following:hover .follow-chip-default { display: none; }
.follow-chip.is-following:hover .follow-chip-hover { display: inline-flex; align-items: center; gap: 5px; }
.follow-chip-default { display: inline-flex; align-items: center; gap: 5px; }
.feed-title {
    font-family: var(--display); font-weight: 700;
    font-size: 1.35rem; line-height: 1.25; color: var(--ink);
    margin: 4px 0 8px; text-wrap: balance;
}
.feed-excerpt {
    font-family: var(--serif); color: var(--ink-soft);
    line-height: 1.55; font-size: 1.02rem;
}

/* Markdown rendered inside feed cards needs compact, card-friendly typography. */
.feed-excerpt.prose { max-width: none; }
.feed-excerpt.prose > *:first-child { margin-top: 0; }
.feed-excerpt.prose > *:last-child { margin-bottom: 0; }
.feed-excerpt.prose p { margin: 0 0 .55em; line-height: 1.55; }
.feed-excerpt.prose h1,
.feed-excerpt.prose h2,
.feed-excerpt.prose h3,
.feed-excerpt.prose h4 {
    font-family: var(--display); font-weight: 700;
    margin: .8em 0 .35em; line-height: 1.25;
    color: var(--ink);
}
.feed-excerpt.prose h1 { font-size: 1.18rem; }
.feed-excerpt.prose h2 { font-size: 1.08rem; }
.feed-excerpt.prose h3 { font-size: 1rem; }
.feed-excerpt.prose h4 { font-size: .95rem; }
.feed-excerpt.prose ul, .feed-excerpt.prose ol { margin: .3em 0 .6em; padding-left: 1.5em; }
.feed-excerpt.prose li { margin: .15em 0; line-height: 1.5; }
.feed-excerpt.prose pre {
    font-size: .82rem; line-height: 1.45;
    padding: 10px 12px; margin: .4em 0;
    max-height: 180px; overflow: hidden;
}
.feed-excerpt.prose code { font-size: .85em; padding: 1px 4px; }
.feed-excerpt.prose blockquote {
    margin: .4em 0; padding: 4px 12px;
    border-left: 3px solid var(--rule-strong); color: var(--muted);
}
.feed-excerpt.prose img { max-width: 100%; border-radius: 8px; margin: .4em 0; }
.feed-excerpt.prose table { font-size: .9rem; }
.feed-excerpt.prose hr { margin: .6em 0; }
.feed-excerpt.prose .embed { display: none; } /* feed cards use the thumbnail at top instead */
.feed-actions {
    margin-top: 12px; display: flex; gap: 16px;
    color: var(--muted); font-size: .85rem;
}
.feed-actions button {
    background: none; border: none; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: .85rem;
    padding: 4px 8px; border-radius: 999px;
}
.feed-actions button:hover { background: var(--bg-soft); color: var(--ink); }
.feed-actions .liked { color: var(--lux-red); }
.feed-actions .saved { color: var(--accent); }
.feed-actions .reposted { color: #2ea043; }

.feed-actions-compact { gap: 4px; align-items: center; margin-top: 12px; }
.feed-actions-compact .fr-stat {
    font-size: .8rem; padding: 6px 10px;
}
.feed-actions-compact .fr-stat-link,
.feed-actions-compact .fr-stat-popout { margin-left: 0; }
.feed-actions-compact .fr-stat-link { margin-left: auto; }

/* Short-form post */
.feed-short .feed-title { display: none; }
.feed-short .feed-excerpt {
    font-size: 1.15rem; line-height: 1.5;
}

/* ===== Editor (VS-Code-like) ===== */

.editor-shell {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    height: calc(100vh - 64px);
    overflow: hidden;
    border-top: 1px solid var(--rule);
    background: var(--bg-card);
    font-family: var(--sans);
}
.editor-aside {
    background: var(--bg-soft);
    border-right: 1px solid var(--rule);
    overflow-y: auto;
    font-size: .92rem;
}
.editor-aside-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--rule);
    font-weight: 700; font-size: .8rem;
    text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.tree, .post-list { padding: 6px 4px; }
.tree-row { position: relative; }
.tree-node, .post-item {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-radius: 3px;
    cursor: pointer; color: var(--ink-soft);
    user-select: none;
}
.tree-node { padding: 5px 6px 5px 4px; }
.tree-node:hover, .post-item:hover { background: var(--rule); }
.tree-node.active, .post-item.active { background: var(--lux-blue); color: white; }
.tree-node.active .chev,
.tree-node.active .drag-grip { color: white; }
.tree-children {
    padding-left: 14px;
    border-left: 1px dashed var(--rule);
    margin-left: 8px;
}
.chev { color: var(--muted-2); font-size: .8em; width: 14px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tree-node-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tree-node-when { font-size: .72rem; color: var(--muted); margin-left: auto; flex: 0 0 auto; }
.tree-node.active .tree-node-when { color: rgba(255,255,255,.85); }

.drag-grip {
    color: var(--muted-2);
    font-size: .8rem;
    width: 12px;
    cursor: grab;
    user-select: none;
    flex: 0 0 auto;
    line-height: 1;
    opacity: 0;
    transition: opacity .12s;
}
.tree-node:hover .drag-grip,
.tree-node.dragging .drag-grip { opacity: 1; }
.tree-node:active .drag-grip { cursor: grabbing; }
.tree-node.dragging { opacity: .4; }

/* Drop indicators between siblings */
.tree-drop {
    height: 6px;
    margin: -3px 0;
    position: relative;
    z-index: 1;
}
.tree-drop.over::before {
    content: "";
    position: absolute; left: 6px; right: 6px; top: 50%;
    height: 2px;
    background: var(--lux-red);
    border-radius: 2px;
    transform: translateY(-50%);
    box-shadow: 0 0 0 3px rgba(237,41,57,.25);
}
.tree-drop.over::after {
    content: "";
    position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    width: 6px; height: 6px;
    background: var(--lux-red);
    border-radius: 50%;
}

/* "Drop INTO this node" — node-level highlight when hovered as a parent target */
.tree-node.drop-into {
    background: rgba(237,41,57,.14) !important;
    outline: 1px dashed var(--lux-red);
    outline-offset: -2px;
    color: var(--ink) !important;
}
.tree-node.drop-into .chev,
.tree-node.drop-into .drag-grip { color: var(--lux-red); }

.editor-main {
    display: flex; flex-direction: column; overflow: hidden;
    border-right: 1px solid var(--rule);
}
.editor-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 10px 14px; border-bottom: 1px solid var(--rule);
    background: var(--bg-soft);
    font-size: .9rem;
}
.editor-bar input.title-input {
    border: none; padding: 4px 0; font-size: 1.1rem; font-weight: 700; background: transparent;
    flex: 1;
}
.editor-bar input.title-input:focus { box-shadow: none; }

/* Segmented pill toggle (Long / Note) */
.seg-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 2px;
    gap: 0;
    flex: 0 0 auto;
}
.seg-toggle button {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--sans);
    font-size: .82rem;
    font-weight: 600;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.seg-toggle button:hover { color: var(--ink); }
.seg-toggle button.active {
    background: var(--ink);
    color: var(--bg);
}
.seg-toggle button.active .lc-icon { color: var(--bg); }

/* History drawer */
.history-drawer-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 900;
    display: flex; justify-content: flex-end;
    animation: wat-fade-in-soft .14s ease both;
}
.history-drawer {
    width: min(960px, 96vw);
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--rule);
    box-shadow: -16px 0 40px rgba(0,0,0,.3);
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 320px 1fr;
    grid-template-areas:
        "head head"
        "list preview";
    overflow: hidden;
    animation: wat-fade-in .18s ease both;
}
.history-head {
    grid-area: head;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--rule);
}
.history-head h3 {
    margin: 0; font-family: var(--display);
    font-size: 1.15rem;
}
.history-body {
    grid-area: list;
    overflow-y: auto;
    border-right: 1px solid var(--rule);
    background: var(--bg-soft);
}
.history-list { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.history-row {
    display: flex; flex-direction: column; gap: 2px;
    align-items: stretch;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: pointer;
    color: var(--ink-soft);
    font-family: var(--sans);
    transition: background .12s, border-color .12s;
}
.history-row:hover { background: var(--bg-card); border-color: var(--rule); color: var(--ink); }
.history-row.selected { background: var(--bg-card); border-color: var(--lux-red); color: var(--ink); }
.history-time { font-size: .75rem; color: var(--muted); font-weight: 600; }
.history-title {
    font-family: var(--display); font-size: 1rem; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-snippet {
    font-size: .82rem; color: var(--muted);
    overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.history-preview {
    grid-area: preview;
    display: flex; flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
}
.history-preview-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--rule);
    background: var(--bg-soft);
}
.history-preview-body {
    flex: 1; overflow-y: auto;
    padding: 28px 36px;
}
.history-preview-body h2 {
    font-family: var(--display); font-size: 1.6rem; margin: 0 0 .6em;
}

@media (max-width: 800px) {
    .history-drawer {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        grid-template-areas: "head" "list" "preview";
        width: 100vw;
    }
    .history-body { max-height: 35vh; border-right: none; border-bottom: 1px solid var(--rule); }
}

/* Confirm modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: wat-fade-in-soft .14s ease both;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.2);
    width: 100%; max-width: 460px;
    overflow: hidden;
    animation: wat-pop-in .16s ease both;
}
.modal-card.danger { border-color: rgba(237,41,57,.5); }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px 6px;
}
.modal-head h3 {
    margin: 0;
    font-family: var(--display);
    font-size: 1.15rem;
    color: var(--ink);
}
.modal-close {
    background: transparent; border: none; cursor: pointer;
    color: var(--muted);
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-soft); color: var(--ink); }
.modal-body {
    padding: 6px 18px 14px;
    color: var(--ink-soft);
    font-size: .95rem;
    line-height: 1.5;
}
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 18px 16px;
    background: var(--bg-soft);
    border-top: 1px solid var(--rule);
}

/* Tree row "⋮" context menu */
.tree-row .row-menu-trigger {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .12s, background .12s, color .12s;
    font-size: 1rem;
    line-height: 1;
    margin-left: 2px;
    flex: 0 0 auto;
}
.tree-node:hover .row-menu-trigger,
.tree-row.menu-open .row-menu-trigger { opacity: 1; }
.tree-row .row-menu-trigger:hover { background: var(--rule); color: var(--ink); }
.tree-node.active .row-menu-trigger { color: rgba(255,255,255,.85); opacity: 1; }
.tree-node.active .row-menu-trigger:hover { background: rgba(255,255,255,.18); color: white; }

.row-menu {
    position: absolute;
    z-index: 60;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 6px;
    box-shadow: var(--shadow);
    min-width: 180px;
    padding: 4px;
    display: flex; flex-direction: column;
    animation: wat-fade-in .12s ease both;
    right: 8px;
    top: calc(100% + 2px);
}
.row-menu button {
    display: flex; align-items: center; gap: 10px;
    background: transparent; border: none;
    padding: 8px 10px; border-radius: 4px;
    cursor: pointer;
    font-family: var(--sans); font-size: .9rem;
    color: var(--ink-soft); text-align: left;
    width: 100%;
}
.row-menu button:hover { background: var(--bg-soft); color: var(--ink); }
.row-menu .danger-item { color: var(--lux-red); }
.row-menu .danger-item:hover { background: rgba(237,41,57,.08); color: var(--lux-red); }
.row-menu-sep { height: 1px; background: var(--rule); margin: 4px 4px; }

/* "+" popover menu in the editor sidebar header */
.aside-add { position: relative; display: inline-block; }
.aside-add-menu {
    position: absolute;
    top: calc(100% + 6px); right: 0;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 6px;
    box-shadow: var(--shadow);
    z-index: 80;
    min-width: 200px;
    padding: 4px;
    display: flex; flex-direction: column;
    gap: 1px;
    animation: wat-fade-in .12s ease both;
}
.aside-add-menu button {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent; border: none; border-radius: 4px;
    cursor: pointer;
    font-family: var(--sans); font-size: .9rem;
    color: var(--ink-soft); text-align: left;
}
.aside-add-menu button:hover:not(:disabled) {
    background: var(--bg-soft);
    color: var(--ink);
}
.aside-add-menu button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Markdown formatting toolbar — sits between the editor-bar and the textarea */
.md-toolbar {
    display: flex; align-items: center; gap: 1px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--rule);
    background: var(--bg-soft);
    flex-wrap: wrap;
}
.md-toolbar .btn-icon {
    width: 28px; height: 28px;
    color: var(--ink-soft);
    border-color: transparent;
    background: transparent;
}
.md-toolbar .btn-icon:hover {
    background: var(--bg-card);
    color: var(--ink);
    border-color: var(--rule);
}
.md-toolbar .btn-icon:active { background: var(--rule); }
.md-tb-label {
    font-family: var(--sans);
    font-size: .82rem;
    font-weight: 600;
    line-height: 1;
    user-select: none;
}
.md-tb-sep {
    width: 1px; height: 18px;
    background: var(--rule);
    margin: 0 4px;
    flex: 0 0 auto;
}
.md-tb-spring { flex: 1 1 auto; }

/* Grok action — flagship right-aligned action with subtle gradient */
.grok-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--bg);
    background: linear-gradient(135deg, var(--lux-red), #b3148f 50%, var(--lux-blue));
    background-size: 200% 200%;
    background-position: 0% 50%;
    border: 1px solid transparent;
    border-radius: 999px;
    transition: background-position .35s ease, transform .04s, box-shadow .14s, opacity .14s;
}
.grok-btn:hover:not(:disabled) {
    background-position: 100% 50%;
    box-shadow: 0 1px 8px rgba(237,41,57,.25);
    color: var(--bg);
}
.grok-btn:active:not(:disabled) { transform: translateY(1px); }
.grok-btn:disabled { opacity: .8; cursor: progress; }
.grok-btn.is-loading {
    background: linear-gradient(135deg, var(--lux-red), #b3148f 50%, var(--lux-blue));
    background-size: 300% 300%;
    animation: grok-shimmer 1.6s linear infinite;
}
.grok-btn .lc-icon { color: inherit; }
.grok-btn .grok-spinner {
    width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 50%;
    animation: grok-spin .7s linear infinite;
    flex: 0 0 auto;
}
@keyframes grok-spin { to { transform: rotate(360deg); } }
@keyframes grok-shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Editor textarea while Grok is working */
.md-editor.md-editor-busy {
    opacity: .55;
    cursor: wait;
}

@media (prefers-reduced-motion: reduce) {
    .grok-btn.is-loading { animation: none; }
}

/* Title row sits between the markdown toolbar and the textarea — full width, prominent */
.title-row {
    padding: 14px 22px 4px;
    background: var(--bg-card);
    border-bottom: 1px dashed var(--rule);
}
.title-input-block {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: -.01em;
    padding: 4px 0;
}
.title-input-block::placeholder { color: var(--muted-2); font-weight: 600; }
.title-input-block:focus { box-shadow: none; }

.editor-bar-status { white-space: nowrap; min-width: 0; }

.md-editor {
    flex: 1;
    border: none; outline: none; resize: none; padding: 18px 22px;
    font-family: var(--mono); font-size: .94rem; line-height: 1.6;
    background: var(--bg-card); color: var(--ink);
    width: 100%;
}

.editor-preview {
    overflow-y: auto;
    padding: 22px 28px;
    background: var(--bg-card);
}
.editor-preview .prose {
    font-size: 17px; line-height: 1.7;
}
.editor-preview .prose > * { max-width: none; }

@media (max-width: 1100px) {
    .editor-shell { grid-template-columns: 220px 1fr; }
    .editor-preview { display: none; }
}
@media (max-width: 700px) {
    .editor-shell { grid-template-columns: 1fr; height: auto; }
    .editor-aside { display: none; }
    .editor-main { height: 60vh; }
}

/* ===== Reading view sidebar ===== */

.reading-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
}
.reading-shell.no-sidebar { grid-template-columns: 1fr; }
.reading-sidebar {
    border-right: 1px solid var(--rule);
    background: var(--bg-soft);
    padding: 24px 18px;
    font-size: .92rem;
    overflow-y: auto;
    max-height: calc(100vh - 64px);
    position: sticky;
    top: 64px;
}
.reading-sidebar h4 {
    font-family: var(--sans); font-size: .75rem;
    text-transform: uppercase; letter-spacing: .14em;
    color: var(--muted);
    margin: 0 0 14px;
}
.reading-sidebar ul { list-style: none; padding: 0; margin: 0; }
.reading-sidebar li { padding: 4px 0; }
.reading-sidebar a {
    display: block;
    padding: 6px 10px;
    border-radius: 3px;
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
    border-left: 2px solid transparent;
}
.reading-sidebar a:hover { color: var(--lux-red); background: var(--bg-card); }
.reading-sidebar a.active {
    color: var(--ink);
    background: var(--bg-card);
    border-left-color: var(--lux-red);
    font-weight: 600;
}
.reading-sidebar .tree-children { padding-left: 14px; border-left: 1px solid var(--rule); margin: 4px 0 4px 8px; }
.reading-sidebar .blog-when { font-size: .78rem; color: var(--muted); display: block; margin-top: 1px; }

@media (max-width: 900px) {
    .reading-shell { grid-template-columns: 1fr; }
    .reading-sidebar { display: none; }
}

/* ===== View-mode themes ===== */

/* Blog: magazine (default) — wide cards, big titles */
.blog-magazine .feed { max-width: 720px; }

/* Blog: stream — Twitter-like compact */
.blog-stream .feed { max-width: 600px; }
.blog-stream .feed-item { padding: 14px 18px; }
.blog-stream .feed-title { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; margin: 2px 0 4px; }
.blog-stream .feed-excerpt { font-family: var(--sans); font-size: .95rem; line-height: 1.5; }

/* Blog: minimal — index style, just titles + dates */
.blog-minimal .feed { max-width: 720px; padding: 0 16px; }
.blog-minimal .feed-item {
    display: grid; grid-template-columns: 7em 1fr; gap: 18px;
    align-items: baseline;
    padding: 12px 0; border-bottom: 1px dotted var(--rule);
}
.blog-minimal .feed-meta { font-family: var(--mono); font-size: .8rem; color: var(--muted); margin: 0; }
.blog-minimal .feed-title { font-family: var(--display); font-size: 1.1rem; margin: 0; line-height: 1.3; }
.blog-minimal .feed-excerpt, .blog-minimal .feed-actions { display: none; }

/* Docs: vscode (default) — handled by docs sidebar layout */
.docs-vscode {}

/* Docs: manual — numbered chapters, single column, no sidebar */
.docs-manual { max-width: 760px; margin: 0 auto; padding: 24px 16px; }
.docs-manual ol { counter-reset: ch; padding: 0; list-style: none; }
.docs-manual li { counter-increment: ch; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.docs-manual li::before {
    content: counter(ch, decimal-leading-zero) ".";
    font-family: var(--mono); font-size: .8rem; color: var(--lux-red);
    margin-right: 12px;
}
.docs-manual a { font-family: var(--display); font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.docs-manual a:hover { color: var(--lux-red); }

/* Docs: gitbook — sidebar tree + wide content */
.docs-gitbook { display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: calc(100vh - 80px); }
.docs-gitbook .docs-sidebar { background: var(--bg-soft); border-right: 1px solid var(--rule); padding: 20px 14px; font-size: .95rem; overflow-y: auto; }
.docs-gitbook .docs-content { padding: 28px 30px; }
@media (max-width: 800px) { .docs-gitbook { grid-template-columns: 1fr; } .docs-gitbook .docs-sidebar { display: none; } }

/* Gallery: grid (default) — already styled */
.gallery-grid-mode {}

/* Gallery: masonry — staggered columns */
.gallery-masonry {
    columns: 4 280px;
    column-gap: 4px;
    max-width: 1400px; margin: 0 auto; padding: 0 16px;
}
.gallery-masonry .gallery-card {
    aspect-ratio: auto;
    margin-bottom: 4px;
    break-inside: avoid;
    display: block;
}
.gallery-masonry .gallery-card img {
    width: 100%; height: auto; display: block;
}

/* Gallery: fullbleed — single big column */
.gallery-fullbleed { max-width: 800px; margin: 0 auto; padding: 0 16px; }
.gallery-fullbleed .gallery-card { aspect-ratio: auto; margin-bottom: 32px; }
.gallery-fullbleed .gallery-card img { width: 100%; height: auto; }
.gallery-fullbleed .overlay { opacity: 1; position: static; padding: 12px 4px 0; background: none; color: var(--ink-soft); }
.gallery-fullbleed .overlay .title { color: var(--ink); }
.gallery-fullbleed .overlay .meta { color: var(--muted); }

/* ===== Terminal theme (BOOTSTRA.386 vibe) ===== */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=IBM+Plex+Mono:wght@400;500;700&display=swap');

.terminal-frame {
    --term-bg: #000000;
    --term-fg: #b6f5b8;
    --term-fg-bright: #a3ff9b;
    --term-amber: #ffb000;
    --term-dim: #4a8a4a;
    --term-rule: #1a3a1a;
    --term-accent: #ED2939;
    background: var(--term-bg);
    color: var(--term-fg);
    font-family: "IBM Plex Mono", "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;
    font-size: 15px;
    line-height: 1.55;
    padding: 28px clamp(16px, 4vw, 64px) 80px;
    min-height: 60vh;
    margin: 0;
    max-width: none;
    position: relative;
    overflow-x: hidden;
}
.terminal-frame::before {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(rgba(0,0,0,0) 50%, rgba(0,0,0,.16) 50%);
    background-size: 100% 3px;
    pointer-events: none;
    z-index: 1;
    opacity: .35;
}
.terminal-frame::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.45) 100%);
    pointer-events: none;
    z-index: 1;
}

.terminal-frame > * { position: relative; z-index: 2; }

.terminal-frame a { color: var(--term-fg-bright); text-decoration: underline; text-underline-offset: 3px; }
.terminal-frame a:hover { color: var(--term-amber); background: rgba(255,176,0,.08); }
.terminal-frame strong { color: var(--term-fg-bright); font-weight: 700; }
.terminal-frame em { color: var(--term-amber); font-style: normal; }
.terminal-frame hr {
    border: none; border-top: 1px dashed var(--term-dim);
    margin: 1.6em 0;
}

.terminal-frame h1, .terminal-frame h2, .terminal-frame h3, .terminal-frame h4 {
    font-family: "VT323", "IBM Plex Mono", monospace;
    color: var(--term-fg-bright);
    letter-spacing: .02em;
    text-transform: none;
    font-weight: 400;
    margin-top: 1.2em;
}
.terminal-frame h1 { font-size: 2.4rem; line-height: 1.1; }
.terminal-frame h2 { font-size: 1.6rem; }
.terminal-frame h3 { font-size: 1.3rem; }
.terminal-frame h2::before, .terminal-frame h3::before { content: "## "; color: var(--term-dim); }
.terminal-frame h1::before { content: "# "; color: var(--term-amber); }

.terminal-frame ul, .terminal-frame ol { padding-left: 1.6em; }
.terminal-frame ul li::marker { content: "* "; color: var(--term-amber); }
.terminal-frame ol li::marker { color: var(--term-amber); }

.terminal-frame blockquote {
    border-left: 2px solid var(--term-amber);
    background: rgba(255,176,0,.06);
    margin: 1em 0; padding: 8px 14px;
    color: var(--term-fg-bright);
    font-style: normal;
}

.terminal-frame code, .terminal-frame pre code {
    font-family: "IBM Plex Mono", "JetBrains Mono", monospace;
}
.terminal-frame code {
    background: rgba(163,255,155,.08);
    color: var(--term-fg-bright);
    border: 1px dashed var(--term-dim);
    padding: 0 4px;
    font-size: .9em;
    border-radius: 0;
}
.terminal-frame pre {
    background: rgba(255,255,255,.02);
    border: 1px solid var(--term-dim);
    border-left: 3px solid var(--term-amber);
    padding: 12px 16px;
    color: var(--term-fg);
    border-radius: 0;
    overflow-x: auto;
    line-height: 1.5;
}
.terminal-frame pre::before {
    content: "$ ";
    color: var(--term-amber);
    display: block;
    margin-bottom: 4px;
    font-size: .85rem;
    opacity: .6;
}

.terminal-frame img {
    border: 2px solid var(--term-dim);
    image-rendering: pixelated;
    box-shadow: 0 0 0 1px rgba(0,0,0,.6) inset;
    filter: hue-rotate(-15deg) saturate(.65) contrast(1.1);
}

.terminal-frame table { border-collapse: collapse; margin: 1em 0; }
.terminal-frame th, .terminal-frame td {
    border: 1px solid var(--term-dim);
    padding: 6px 12px;
    background: transparent;
}
.terminal-frame thead th { background: rgba(163,255,155,.06); color: var(--term-fg-bright); }

/* Heading typewriter cursor */
.terminal-frame h1.typing::after,
.terminal-frame .term-cursor {
    content: "█";
    color: var(--term-fg-bright);
    animation: term-blink 1.05s steps(2, jump-none) infinite;
    margin-left: 4px;
    font-family: "VT323", monospace;
}
@keyframes term-blink { 50% { opacity: 0; } }

/* ASCII art header banner */
.terminal-banner {
    font-family: "IBM Plex Mono", monospace;
    color: var(--term-amber);
    font-size: 11px;
    line-height: 1.05;
    white-space: pre;
    margin: 0 0 14px;
    text-shadow: 0 0 6px rgba(255,176,0,.35);
    overflow-x: auto;
}
.terminal-prompt-line {
    color: var(--term-dim);
    font-size: .82rem;
    margin-bottom: 18px;
    border-bottom: 1px dashed var(--term-dim);
    padding-bottom: 10px;
}
.terminal-prompt-line .pp { color: var(--term-amber); }
.terminal-prompt-line .who { color: var(--term-fg-bright); }

/* Blog list (Terminal) */
.blog-terminal .feed { max-width: none; }
.blog-terminal .feed-item {
    display: block;
    padding: 10px 0;
    border-bottom: 1px dashed var(--term-dim);
    background: transparent;
    text-decoration: none;
    transition: background .1s;
}
.blog-terminal .feed-item:hover { background: rgba(163,255,155,.05); }
.blog-terminal .feed-meta { color: var(--term-dim); font-size: .82rem; margin-bottom: 0; }
.blog-terminal .feed-meta::before { content: "[ "; }
.blog-terminal .feed-meta::after { content: " ]"; }
.blog-terminal .feed-title {
    font-family: "VT323", monospace;
    font-size: 1.55rem; line-height: 1.1;
    color: var(--term-fg-bright);
    margin: 2px 0;
}
.blog-terminal .feed-title::before { content: "> "; color: var(--term-amber); }
.blog-terminal .feed-excerpt { color: var(--term-fg); font-size: .92rem; }
.blog-terminal .feed-actions { color: var(--term-dim); }

/* Docs list (Terminal) */
.docs-terminal { padding-top: 28px; }
.docs-terminal ul { list-style: none; padding-left: 0; }
.docs-terminal li { padding: 6px 0; border-bottom: 1px dashed var(--term-dim); }
.docs-terminal li a {
    font-family: "VT323", monospace;
    font-size: 1.2rem;
    color: var(--term-fg-bright);
}
.docs-terminal li a::before { content: "> "; color: var(--term-amber); }

/* Reading view (when notebook.theme == terminal) */
.reading-shell.terminal-reader { background: var(--term-bg); }
.terminal-frame .article-header {
    border-bottom: 1px dashed var(--term-dim);
    padding-bottom: 1em; margin-bottom: 1.2em;
    text-align: left;
}
.terminal-frame .article-eyebrow {
    color: var(--term-amber); font-family: "IBM Plex Mono", monospace;
    font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
}
.terminal-frame .article-title {
    font-family: "VT323", monospace; font-weight: 400;
    color: var(--term-fg-bright); font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.1; margin: .15em 0 .25em;
}
.terminal-frame .article-byline { color: var(--term-dim); font-size: .85rem; }
.terminal-frame .article-byline a { color: var(--term-amber); }
.terminal-frame .article-byline .dot { background: var(--term-dim); }
.terminal-frame .prose { font-size: 15px; line-height: 1.55; max-width: 80ch; }
.terminal-frame .prose > * { max-width: 80ch; }
.terminal-frame .prose.drop-cap > p:first-of-type::first-letter {
    color: var(--term-amber); font-family: "VT323", monospace;
}
.terminal-frame .tag { background: rgba(163,255,155,.08); color: var(--term-fg-bright); border: 1px dashed var(--term-dim); border-radius: 0; }

/* Notebook hero on terminal notebooks */
.notebook-hero.is-terminal {
    background: var(--term-bg);
    color: var(--term-fg);
    border-bottom: 1px dashed var(--term-dim);
    padding: 28px 16px 18px;
    margin-bottom: 0;
    font-family: "IBM Plex Mono", monospace;
    text-align: left;
    overflow: hidden;
    position: relative;
}
.notebook-hero.is-terminal h1 {
    font-family: "VT323", monospace;
    color: var(--term-fg-bright);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    line-height: 1.1; letter-spacing: .02em;
    text-shadow: 0 0 12px rgba(163,255,155,.3);
    margin: 0;
}
.notebook-hero.is-terminal .desc { color: var(--term-fg); font-style: normal; max-width: 70ch; }
.notebook-hero.is-terminal .by { color: var(--term-dim); }
.notebook-hero.is-terminal .stripe { display: none; }
.notebook-hero.is-terminal .tag { background: transparent; color: var(--term-amber); border: 1px dashed var(--term-amber); }

/* About panel inside terminal notebook */
.terminal-notebook .notebook-about {
    background: transparent;
    border: 1px dashed var(--term-dim);
    color: var(--term-fg);
    border-radius: 0;
}
.terminal-notebook .notebook-about h2 { font-family: "VT323", monospace; color: var(--term-fg-bright); }
.terminal-notebook .notebook-about a { color: var(--term-amber); }

/* Activity heatmap recolored on terminal */
.terminal-notebook .heatmap {
    background: transparent;
    border: 1px dashed var(--term-dim);
    border-radius: 0;
    color: var(--term-fg);
}
.terminal-notebook .heatmap h4 { color: var(--term-amber); }
.terminal-notebook .hm-l0 { fill: rgba(163,255,155,.08); stroke: var(--term-dim); }
.terminal-notebook .hm-l1 { fill: rgba(163,255,155,.18); }
.terminal-notebook .hm-l2 { fill: rgba(163,255,155,.40); }
.terminal-notebook .hm-l3 { fill: rgba(163,255,155,.65); }
.terminal-notebook .hm-l4 { fill: var(--term-fg-bright); }
.terminal-notebook .hm-swatch.hm-l0 { background: rgba(163,255,155,.08); border-color: var(--term-dim); }
.terminal-notebook .hm-swatch.hm-l1 { background: rgba(163,255,155,.18); }
.terminal-notebook .hm-swatch.hm-l2 { background: rgba(163,255,155,.40); }
.terminal-notebook .hm-swatch.hm-l3 { background: rgba(163,255,155,.65); }
.terminal-notebook .hm-swatch.hm-l4 { background: var(--term-fg-bright); }

/* CRT flicker */
@keyframes term-flicker {
    0%, 96%, 100% { opacity: 1; }
    97% { opacity: .82; }
    98% { opacity: .96; }
    99% { opacity: .88; }
}
.terminal-frame { animation: term-flicker 6s steps(1, end) infinite; }

@media (prefers-reduced-motion: reduce) {
    .terminal-frame { animation: none; }
    .terminal-frame::before { display: none; }
    .terminal-frame h1.typing::after, .terminal-frame .term-cursor { animation: none; }
}

/* ===== About panel ===== */
.notebook-about {
    display: flex; gap: 24px; align-items: flex-start;
    max-width: 900px; margin: 0 auto 36px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
.notebook-about .avatar {
    flex: 0 0 auto;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--bg-soft) center/cover;
    border: 1px solid var(--rule);
    overflow: hidden;
}
.notebook-about .avatar.placeholder {
    display: flex; align-items: center; justify-content: center;
    font-family: var(--display); font-size: 2.4rem; font-weight: 700; color: var(--muted);
}
.notebook-about .body { flex: 1; min-width: 0; }
.notebook-about h2 {
    font-family: var(--display); font-weight: 800;
    font-size: 1.3rem; margin: 0 0 4px;
}
.notebook-about .tagline { color: var(--muted); margin-bottom: 12px; font-style: italic; }
.notebook-about .meta-row { display: flex; flex-wrap: wrap; gap: 16px; font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.notebook-about .meta-row a { color: var(--ink-soft); text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.notebook-about .meta-row a:hover { color: var(--lux-red); }
.notebook-about .body .prose { font-size: 1rem; max-width: none; }
@media (max-width: 700px) {
    .notebook-about { flex-direction: column; text-align: center; gap: 16px; padding: 18px; }
    .notebook-about .avatar { margin: 0 auto; }
    .notebook-about .meta-row { justify-content: center; }
}

/* Video embeds (YouTube / Vimeo / Tweet) */
.embed {
    position: relative;
    margin: 1.6em auto;
    max-width: 90ch;
    background: var(--bg-soft);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}
.embed iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0;
}
.prose .embed { display: block; }
.embed-tweet {
    aspect-ratio: auto;
    padding: 16px 20px;
    border: 1px solid var(--rule);
    background: var(--bg-card);
}

/* Post cover photo (top of long-form post) */
.post-cover {
    margin: 0 auto 2.4em;
    max-width: 90ch;
    text-align: center;
}
.post-cover img {
    width: 100%;
    height: auto;
    max-height: 540px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* In the editor preview pane */
.editor-preview .cover-photo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1.4em;
}

/* ===== Activity heatmap ===== */
.heatmap {
    max-width: 900px;
    margin: 24px auto;
    padding: 18px 22px;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
.heatmap-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 12px;
}
.heatmap h4 {
    margin: 0;
    font-family: var(--sans); font-size: .8rem;
    text-transform: uppercase; letter-spacing: .14em;
    color: var(--muted);
}
.heatmap-meta { color: var(--muted); font-size: .85rem; }
.heatmap-scroll { overflow-x: auto; }
.heatmap svg { display: block; }
.hm-cell { transition: opacity .12s; }
.hm-cell:hover { opacity: .7; }
.hm-l0 { fill: var(--bg-soft); stroke: var(--rule); stroke-width: .5; }
.hm-l1 { fill: rgba(237,41,57,.18); }
.hm-l2 { fill: rgba(237,41,57,.40); }
.hm-l3 { fill: rgba(237,41,57,.65); }
.hm-l4 { fill: var(--lux-red); }
.heatmap-legend {
    display: flex; align-items: center; gap: 4px;
    justify-content: flex-end; margin-top: 10px;
    color: var(--muted); font-size: .75rem;
}
.hm-swatch {
    display: inline-block; width: 11px; height: 11px;
    border-radius: 2px;
}
.hm-swatch.hm-l0 { background: var(--bg-soft); border: 1px solid var(--rule); }
.hm-swatch.hm-l1 { background: rgba(237,41,57,.18); }
.hm-swatch.hm-l2 { background: rgba(237,41,57,.40); }
.hm-swatch.hm-l3 { background: rgba(237,41,57,.65); }
.hm-swatch.hm-l4 { background: var(--lux-red); }

/* ===== Gallery ===== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}
.gallery-card {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-soft);
    text-decoration: none;
    color: white;
    display: block;
}
.gallery-card img {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.gallery-card:hover img { transform: scale(1.04); }
.gallery-card .overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 14px;
    background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 50%);
    opacity: 0;
    transition: opacity .2s;
    color: white;
}
.gallery-card:hover .overlay { opacity: 1; }
.gallery-card .overlay .title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.25;
    margin-bottom: 4px;
}
.gallery-card .overlay .meta {
    font-size: .8rem;
    opacity: .85;
    display: flex; gap: 10px; align-items: center;
}

@media (max-width: 700px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 8px;
    }
    .gallery-card .overlay { opacity: 1; }
}

/* Photo detail page */
.photo-stage {
    background: #0c0c0c;
    text-align: center;
    padding: 30px 16px;
    margin-bottom: 28px;
}
.photo-stage img {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    display: inline-block;
    box-shadow: 0 4px 30px rgba(0,0,0,.4);
    border-radius: 2px;
}

/* Gallery editor */
.editor-shell.gallery-mode { grid-template-columns: 320px 1fr; }
@media (max-width: 1100px) { .editor-shell.gallery-mode { grid-template-columns: 260px 1fr; } }
@media (max-width: 800px)  { .editor-shell.gallery-mode { grid-template-columns: 1fr; } }

.photo-list { padding: 6px 4px; }
.photo-item {
    display: flex; gap: 10px; align-items: center;
    padding: 6px 8px; border-radius: 4px;
    cursor: pointer; user-select: none;
    color: var(--ink-soft);
}
.photo-item:hover { background: rgba(0,0,0,0.04); }
.photo-item.active { background: var(--lux-blue); color: white; }
.photo-item img {
    width: 56px; height: 56px;
    object-fit: cover;
    border-radius: 3px;
    flex: 0 0 auto;
    background: var(--bg-soft);
}
.photo-item-meta { flex: 1; min-width: 0; }
.photo-item-title {
    font-weight: 600; font-size: .9rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.photo-item-when { font-size: .75rem; color: var(--muted); }
.photo-item.active .photo-item-when { color: rgba(255,255,255,.85); }

.photo-edit {
    flex: 1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0;
    overflow: hidden;
}
.photo-edit-image {
    background: #1a1a1a;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    padding: 16px;
}
.photo-edit-image img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.photo-edit-side {
    display: flex; flex-direction: column;
    padding: 14px 16px;
    border-left: 1px solid var(--rule);
}
.photo-edit-side label {
    font-weight: 700; font-size: .8rem; text-transform: uppercase;
    letter-spacing: .1em; color: var(--muted);
    margin-bottom: 8px;
}
.photo-edit-side .md-editor {
    flex: 1; padding: 0;
    font-family: var(--mono); font-size: .92rem;
}

@media (max-width: 1100px) {
    .photo-edit { grid-template-columns: 1fr; }
    .photo-edit-image { max-height: 40vh; }
    .photo-edit-side { border-left: none; border-top: 1px solid var(--rule); }
}

.gallery-preview { padding: 16px; background: var(--bg-card); }
.gallery-preview figure { margin: 0; max-width: 100%; }
.gallery-preview img { max-width: 100%; max-height: 60vh; border-radius: 3px; }

.empty-pane {
    flex: 1;
    display: flex; flex-direction: column; gap: 8px;
    align-items: center; justify-content: center;
    color: var(--muted);
    padding: 40px 16px;
    text-align: center;
}

/* Landing hero on / when signed out */
.landing-hero {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
    padding: 80px 24px 60px;
}
.landing-hero h1 {
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 4.4rem);
    line-height: 1.05;
    letter-spacing: -.02em;
    margin: 0;
    text-wrap: balance;
}
.landing-hero .lead {
    color: var(--muted);
    font-size: 1.12rem;
    max-width: 520px;
    margin: 1.4em auto 0;
    line-height: 1.55;
}

/* Auth pages (login / register) — centered card */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 40px 20px;
}
.auth-card {
    width: 100%; max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 32px 32px 24px;
    box-shadow: var(--shadow);
}
.auth-card h1 {
    font-family: var(--display);
    font-size: 1.8rem; font-weight: 700;
    margin: 8px 0 4px;
}
.auth-stripe {
    width: 60px; height: 3px;
    background: linear-gradient(to right, var(--lux-red) 0 33%, #ffffff 33% 66%, var(--lux-blue) 66%);
    border-radius: 2px;
    margin-bottom: 6px;
}
.auth-alt {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: .9rem;
    text-align: center;
}

.btn.btn-wide { width: 100%; padding: 11px 18px; }

/* Page heads — consistent across Dashboard, New, Settings, etc. */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 26px;
}
.page-head h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(1.7rem, 3.2vw, 2.2rem);
    margin: .1em 0;
    line-height: 1.15;
}
.page-head .article-eyebrow {
    font-family: var(--sans);
    font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--lux-red); font-size: .72rem;
}
.page-head p { margin: .2em 0 0; }

/* Empty state */
.empty-state {
    text-align: center; padding: 48px 24px;
}
.empty-state h3 { font-size: 1.2rem; }

/* Dashboard notebook cards */
.notebook-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.notebook-card {
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; flex-direction: column;
    transition: box-shadow .14s, border-color .14s, transform .14s;
}
.notebook-card:hover {
    border-color: var(--rule-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.notebook-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
}
.notebook-card-title {
    font-family: var(--display); font-weight: 700;
    font-size: 1.15rem; margin: 0;
    line-height: 1.25;
    color: var(--ink);
}
.notebook-card-desc {
    margin: 6px 0 14px;
    line-height: 1.45;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notebook-card-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: auto;
}

.aside-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 10px; }
.aside-actions .btn { justify-content: flex-start; }
.aside-account { padding: 14px; }
.aside-account-name { font-weight: 700; margin-top: 2px; }

/* Type-pick card selected state (used on /dashboard/new) */
.type-pick { position: relative; }
.type-pick.selected.accent-red { border-color: var(--lux-red); box-shadow: 0 0 0 2px rgba(237,41,57,.15); }
.type-pick.selected.accent-blue { border-color: var(--lux-blue); box-shadow: 0 0 0 2px rgba(0,161,222,.15); }
.type-pick.selected:not(.accent-red):not(.accent-blue) { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0,0,0,.1); }

.new-page { padding-top: 24px; padding-bottom: 100px; }

/* Notebook settings page */
.settings-page { padding-top: 24px; padding-bottom: 100px; }
.settings-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 18px;
}
.settings-head h1 { font-size: 1.8rem; line-height: 1.15; }
.settings-section-title {
    font-family: var(--display);
    margin: 0 0 12px;
    font-size: 1.15rem;
}
.settings-nav {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--rule);
    border-radius: 999px;
    width: fit-content;
}
.settings-nav a {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: .85rem;
    color: var(--ink-soft);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.settings-nav a:hover { background: var(--bg-card); color: var(--ink); }
.settings-grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 700px) { .settings-grid-2 { grid-template-columns: 1fr; } }

.avatar-preview {
    width: 80px; height: 80px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--rule);
    background-color: var(--bg-soft);
    flex: 0 0 auto;
}
.avatar-preview.placeholder {
    display: flex; align-items: center; justify-content: center;
    font-family: var(--display); font-size: 1.8rem; color: var(--muted);
}

.danger-card { border-color: rgba(237,41,57,.4) !important; }
.danger-btn {
    color: var(--lux-red) !important;
    border-color: rgba(237,41,57,.4) !important;
}
.danger-btn:hover {
    background: rgba(237,41,57,.08) !important;
    border-color: var(--lux-red) !important;
}

.settings-save-bar {
    position: sticky;
    bottom: 14px;
    margin-top: 24px;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: 999px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    z-index: 50;
}
@media (max-width: 600px) {
    .settings-save-bar { border-radius: var(--radius); flex-wrap: wrap; }
    .settings-save-bar .text-muted { width: 100%; }
}

/* New notebook type picker */
.type-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.type-pick {
    cursor: pointer; padding: 18px;
    transition: border-color .12s, box-shadow .12s;
}
.type-pick:hover { box-shadow: var(--shadow); }
.type-pick input[type="radio"] { display: none; }
.type-pick strong { display: block; font-family: var(--display); font-size: 1.05rem; margin-top: 4px; }

/* Visual theme picker with previews */
.theme-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.theme-card {
    --tp-bg: var(--bg-card);
    --tp-soft: var(--bg-soft);
    --tp-rule: var(--rule);
    --tp-ink: var(--ink);
    --tp-muted: var(--muted-2);
    --tp-accent: var(--lux-red);

    display: flex; flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    color: inherit;
    font: inherit;
    transition: transform .12s, border-color .12s, box-shadow .12s;
}
.theme-card:hover {
    border-color: var(--rule-strong);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.theme-card.selected {
    border-color: var(--lux-red);
    box-shadow: 0 0 0 2px rgba(237,41,57,.18);
}
.theme-card-preview {
    position: relative;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--rule);
    aspect-ratio: 3 / 2;
    overflow: hidden;
}
.theme-card-preview .tp-svg {
    width: 100%; height: 100%;
    display: block;
}
.theme-card-check {
    position: absolute;
    top: 8px; right: 8px;
    width: 24px; height: 24px;
    background: var(--lux-red);
    color: white;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.theme-card-meta {
    padding: 10px 14px 14px;
    display: flex; flex-direction: column; gap: 2px;
}
.theme-card-meta strong {
    font-family: var(--display); font-size: 1.02rem;
}

/* Blog reader theme — full-screen VS-Code-style reading workspace.
   Tree on the left, content on the right. Nothing else.
   The body becomes a flex column so the shell fills the viewport with no double scroll. */
body:has(.reader-shell) {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body:has(.reader-shell) .site-bar { flex: 0 0 auto; position: static; }
body:has(.reader-shell) .page-host {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body:has(.reader-shell) .site-foot,
body:has(.reader-shell) .cookie-notice { display: none; }

.reader-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-width: none;
    margin: 0;
    overflow: hidden;
    border-top: 1px solid var(--rule);
    background: var(--bg-card);
}

.reader-sidebar {
    background: var(--bg-soft);
    border-right: 1px solid var(--rule);
    overflow-y: auto;
    padding: 0;
}
.reader-sidebar-head {
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--rule);
    position: sticky; top: 0;
    background: var(--bg-soft);
    z-index: 1;
}
.reader-sidebar-title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
    line-height: 1.2;
}
.reader-sidebar-sub {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 2px;
}

.reader-list { list-style: none; margin: 0; padding: 6px; }
.reader-list li { padding: 0; }
.reader-list a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--ink-soft);
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-bottom: 1px;
    line-height: 1.3;
    transition: background .1s, color .1s;
}
.reader-list a:hover { background: var(--bg-card); color: var(--ink); }
.reader-list a.active {
    background: var(--bg-card);
    color: var(--ink);
    border-left-color: var(--lux-red);
}
.reader-list-title {
    display: block;
    font-weight: 600;
    font-size: .92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reader-list-when {
    display: block;
    font-size: .74rem;
    color: var(--muted);
    margin-top: 2px;
    font-weight: 400;
}

/* Feed-reader: feed list on the left, post on the right */
.feed-reader-shell { grid-template-columns: 360px 1fr; }
.reader-shell.no-sidebar { grid-template-columns: 1fr; }
.reader-shell.no-sidebar .reader-sidebar { display: none; }

/* Whole sidebar head (icon + label + count) is one click-hotspot to "/" */
.reader-sidebar-head { display: flex; align-items: stretch; gap: 6px; }
.feed-reader-head-area {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
    color: inherit; text-decoration: none;
    padding: 0; border-radius: 8px;
    cursor: pointer;
    transition: background .12s ease;
}
.feed-reader-head-area:hover { background: var(--bg-card); }
.feed-reader-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--ink); font-family: var(--display);
    font-weight: 700; font-size: 1rem;
}
.feed-reader-head-area:hover .feed-reader-back { color: var(--lux-red); }
.feed-reader-back .lc-icon { color: var(--muted); }

/* Filter (show unread/all) toggle */
.feed-reader-filter {
    flex: 0 0 auto;
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 1px solid var(--rule); border-radius: 8px;
    color: var(--muted); cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.feed-reader-filter:hover { background: var(--bg-card); color: var(--ink); }
.feed-reader-filter.is-on {
    background: var(--bg-card); border-color: var(--lux-red); color: var(--lux-red);
}

.feed-reader-list { padding: 6px; }
.feed-reader-list li {
    list-style: none;
    border-bottom: 1px solid var(--rule);
    border-left: 3px solid transparent;
    transition: background .1s;
}
.feed-reader-list li:hover { background: var(--bg-card); }
.feed-reader-list li.active { background: var(--bg-card); border-left-color: var(--lux-red); }
.feed-reader-item {
    display: flex; flex-direction: column; gap: 4px;
    padding: 10px 12px 8px;
    cursor: pointer;
}
.feed-reader-author {
    display: flex; align-items: center; gap: 6px;
    font-size: .78rem;
}
.feed-reader-name { color: var(--ink); font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-reader-when { color: var(--muted-2); font-family: var(--mono); font-size: .72rem; flex-shrink: 0; }

.feed-reader-link-area {
    display: flex; flex-direction: column; gap: 2px;
    color: var(--ink-soft); text-decoration: none;
}
.feed-reader-link-area:hover .reader-list-title { color: var(--ink); }

.feed-reader-list .reader-list-title {
    white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .92rem;
    line-height: 1.3;
    font-weight: 600;
    color: var(--ink-soft);
}
.feed-reader-snippet {
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--muted); font-size: .82rem; line-height: 1.4;
}

.feed-reader-photo-thumb {
    display: block; width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--rule);
    margin: 4px 0 6px;
}
.feed-reader-empty {
    padding: 48px 24px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px;
    color: var(--muted);
    cursor: default;
    min-height: 220px;
}
.feed-reader-byline-name { color: var(--ink); font-weight: 700; text-decoration: none; }
.feed-reader-byline-name:hover { color: var(--accent); }

/* Unread indicator + per-item action row in the sidebar */
.unread-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--lux-red); margin-right: 6px; vertical-align: middle;
}
.feed-reader-list li:not(.is-unread) .feed-reader-name { color: var(--muted); font-weight: 600; }
.feed-reader-list li:not(.is-unread) .reader-list-title,
.feed-reader-list li:not(.is-unread) .feed-reader-snippet { color: var(--muted-2); }

.feed-reader-stats {
    display: flex; gap: 4px; align-items: center;
    margin-top: 6px; padding-top: 6px;
    border-top: 1px dashed var(--rule);
    font-variant-numeric: tabular-nums;
}
.fr-stat {
    background: none; border: none; cursor: pointer;
    color: var(--muted-2); font-family: inherit; font-size: .72rem;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 6px; border-radius: 6px;
    transition: background .1s, color .1s;
}
.fr-stat:hover { background: var(--rule); color: var(--ink); }
/* Default active state — overridden per modifier below */
.fr-stat.is-on { color: var(--accent); }
.fr-stat-like.is-on { color: var(--lux-red); }
.fr-stat-like:hover:not(:disabled) { background: rgba(237,41,57,.10); color: var(--lux-red); }
.fr-stat-bookmark.is-on { color: var(--ink); }
.fr-stat-bookmark:hover:not(:disabled) { background: var(--rule); color: var(--ink); }
/* Lock the icon color to the button's currentColor so it never desyncs from the count text */
.fr-stat .lc-icon, .fr-stat .lc-icon svg { color: currentColor; }
.fr-stat-passive { cursor: default; }
.fr-stat-passive:hover { background: transparent; color: var(--muted-2); }
.fr-stat-link { margin-left: auto; }
a.fr-stat { text-decoration: none; }
.fr-stat-mark.is-on,
.fr-stat-mark:hover:not(:disabled) { color: var(--ink); background: var(--rule); }

/* Center-pane feed stream (when sidebar is open and no specific post is selected) */
.feed-stream {
    max-width: 720px; margin: 0 auto; padding: 24px 24px 80px;
}
.feed-stream-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin-bottom: 12px;
}
.feed-stream-head h1 {
    font-family: var(--display); margin: 0; font-size: 1.6rem;
}

/* Inline media in feed cards */
.feed-media {
    margin: 8px 0 6px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--rule);
    background: var(--bg);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feed-media img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.feed-media-video {
    position: relative; width: 100%; height: 100%;
}
.feed-media-video img { width: 100%; height: 100%; object-fit: cover; }
.feed-media-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.18); color: white;
    font-size: 28px; pointer-events: none;
}
.feed-media-vimeo {
    aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-family: var(--mono); font-size: .85rem;
}

/* ===== Photo viewer ===== */

body:has(.photo-viewer) { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body:has(.photo-viewer) .site-bar { flex: 0 0 auto; position: static; }
body:has(.photo-viewer) .page-host { flex: 1 1 auto; min-height: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
body:has(.photo-viewer) .site-foot, body:has(.photo-viewer) .cookie-notice { display: none; }

/* Fullscreen mode — hide chrome (site-bar + any sidebar present) */
body:has(.photo-viewer.is-fullscreen) .site-bar { display: none; }
body:has(.photo-viewer.is-fullscreen) .reader-sidebar,
body:has(.photo-viewer.is-fullscreen) .feed-reader-sidebar { display: none; }

.photo-viewer {
    flex: 1 1 auto; min-height: 0;
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 1fr;
    background: #000;
    color: #fff;
    outline: none;
}
.photo-viewer.no-sidebar,
.photo-viewer.is-fullscreen { grid-template-columns: 1fr; }
.photo-viewer.no-sidebar .photo-viewer-sidebar,
.photo-viewer.is-fullscreen .photo-viewer-sidebar { display: none; }

.photo-viewer-sidebar {
    background: #0b0b0d;
    border-right: 1px solid rgba(255,255,255,.08);
    overflow-y: auto;
    display: flex; flex-direction: column;
}
.photo-viewer-sidebar-head {
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    color: rgba(255,255,255,.6);
    font-size: .76rem;
    position: sticky; top: 0; background: #0b0b0d; z-index: 1;
}
.photo-viewer-thumbs {
    list-style: none; margin: 0; padding: 6px;
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
}
.photo-viewer-thumbs li { margin: 0; padding: 0; }
.photo-viewer-thumb {
    display: block; width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    background: #050505;
    transition: border-color .12s ease, transform .12s ease;
}
.photo-viewer-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.photo-viewer-thumb:hover { border-color: rgba(255,255,255,.4); }
.photo-viewer-thumbs li.active .photo-viewer-thumb {
    border-color: var(--lux-red);
}

.photo-viewer-main {
    display: flex; flex-direction: column;
    min-width: 0; min-height: 0;
}

.photo-viewer-stage {
    flex: 1 1 auto; min-height: 0;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.photo-viewer-img {
    max-width: 100%; max-height: 100%; width: auto; height: auto;
    object-fit: contain; display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.photo-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.32); color: #fff;
    border-radius: 50%; text-decoration: none;
    transition: background .15s ease, opacity .15s ease;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 5;
}
.photo-nav:hover { background: rgba(0,0,0,.6); }
.photo-nav-prev { left: 18px; }
.photo-nav-next { right: 18px; }

.photo-caption-overlay {
    position: absolute; left: 0; bottom: 0;
    max-width: min(720px, 60%);
    padding: 28px 32px;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.55) 60%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}
.photo-caption-title {
    font-family: "Garamond", "Didot", "Bodoni MT", "Times New Roman", serif;
    font-size: clamp(1.6rem, 2.6vw, 2.4rem);
    line-height: 1.15;
    margin: 0 0 8px;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,.6);
    letter-spacing: -0.01em;
}
.photo-caption-body {
    font-family: var(--serif); font-size: .98rem; line-height: 1.5;
    color: rgba(255,255,255,.92);
    text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.photo-caption-body.prose p { margin: 0 0 .35em; }
.photo-caption-body.prose > *:last-child { margin-bottom: 0; }

.photo-reader-bottom-bar {
    flex: 0 0 auto;
    background: rgba(0,0,0,.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,.08);
    color: #fff;
}
.photo-reader-bottom-bar .reader-bb-meta { color: rgba(255,255,255,.78); }
.photo-reader-bottom-bar .reader-bb-author { color: #fff; }
.photo-reader-bottom-bar .reader-bb-notebook { color: rgba(255,255,255,.85); }
.photo-reader-bottom-bar .reader-bb-handle,
.photo-reader-bottom-bar .reader-bb-date,
.photo-reader-bottom-bar .text-muted { color: rgba(255,255,255,.55); }
.photo-reader-bottom-bar .action-btn { color: rgba(255,255,255,.78); }
.photo-reader-bottom-bar .action-btn:hover:not(:disabled) { color: #fff; background: rgba(255,255,255,.10); }
.photo-reader-bottom-bar .action-btn.action-like.is-on { color: var(--lux-red); }

.photo-bb-actions {
    display: inline-flex; align-items: center; gap: 4px;
}
.photo-rotate {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; color: rgba(255,255,255,.78);
    padding: 8px 10px; border-radius: 999px; cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.photo-rotate:hover:not(:disabled) { background: rgba(255,255,255,.10); color: #fff; }
.photo-rotate:disabled { opacity: .4; cursor: default; }

.photo-fullscreen {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; color: rgba(255,255,255,.78);
    padding: 8px 10px; border-radius: 999px; cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.photo-fullscreen:hover { background: rgba(255,255,255,.10); color: #fff; }

/* Sidebar toggle in bottom status bar (used by photo viewer + future sidebar pages) */
.bb-sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    padding: 8px 10px; border-radius: 999px;
    color: var(--muted);
    transition: background .12s ease, color .12s ease;
    flex-shrink: 0;
}
.bb-sidebar-toggle:hover { background: var(--bg-soft); color: var(--ink); }
/* Dark variant on the photo viewer's dark bottom bar */
.photo-reader-bottom-bar .bb-sidebar-toggle { color: rgba(255,255,255,.78); }
.photo-reader-bottom-bar .bb-sidebar-toggle:hover { background: rgba(255,255,255,.10); color: #fff; }

/* Fluent-style loading overlay while a rotate is in flight */
.photo-viewer-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 20;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    animation: wat-fade-in-soft .15s ease both;
}
.photo-viewer-loading-card {
    display: inline-flex; align-items: center; gap: 14px;
    padding: 14px 22px;
    background: rgba(28, 28, 32, .55);
    color: #fff;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    font-family: var(--sans); font-size: .95rem;
    letter-spacing: .01em;
}
.photo-viewer-spinner {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.15);
    border-top-color: rgba(255,255,255,.85);
    animation: photo-viewer-spin .8s linear infinite;
}
@keyframes photo-viewer-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
    .photo-caption-overlay { max-width: 100%; padding: 18px 18px 22px; }
    .photo-nav { width: 44px; height: 44px; }
    .photo-nav-prev { left: 8px; }
    .photo-nav-next { right: 8px; }
}

.reader-main {
    background: var(--bg-card);
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.reader-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}
.reader-article {
    max-width: 72ch;
    margin: 0 auto;
    padding: 60px 48px 80px;
}
.reader-cover {
    margin: 0 0 1.4em;
}
.reader-cover img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}
.reader-article-head {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1.4em;
    margin-bottom: 1.8em;
}
.reader-article-head h1 {
    font-family: "Garamond", "Didot", "Bodoni MT", "Times New Roman", serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.08;
    letter-spacing: -.01em;
    margin: 0 0 .35em;
    text-wrap: balance;
}
.reader-article-head h1:last-child { margin-bottom: 0; }
.reader-article-meta {
    color: var(--muted);
    font-size: .9rem;
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.reader-article-meta a { color: var(--ink-soft); }
.reader-article-meta .dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--rule-strong);
    display: inline-block;
}
.reader-article .prose {
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.7;
    color: var(--ink);
    max-width: none;
}
.reader-article .prose > * { max-width: none; }
.reader-rule {
    margin: 3em 0 1.4em;
    border: none;
    border-top: 1px solid var(--rule);
    max-width: 6em;
}

.reader-bottom-bar {
    flex: 0 0 auto;
    border-top: 1px solid var(--rule);
    background: var(--bar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 4px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 32px;
}
.reader-bb-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: .82rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reader-bb-author {
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}
.reader-bb-author:hover { color: var(--accent); }
.reader-bb-handle { color: var(--muted-2); font-family: var(--mono); font-size: .76rem; }
.reader-bb-notebook {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
}
.reader-bb-notebook:hover { color: var(--ink); }
.reader-bb-date { color: var(--muted); }
.reader-bb-dot {
    width: 3px; height: 3px; border-radius: 50%;
    background: var(--rule-strong);
    display: inline-block;
    flex-shrink: 0;
}
.reader-bottom-bar .action-bar {
    padding: 0;
    gap: 2px;
    flex-wrap: nowrap;
}
.reader-bottom-bar .action-btn {
    padding: 4px 8px;
    font-size: .8rem;
}
.reader-bottom-bar .action-signin { display: none; }

.reader-empty {
    height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .reader-shell {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    .reader-sidebar {
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--rule);
    }
    .reader-main { height: auto; }
    .reader-scroll { overflow-y: visible; }
    .reader-article { padding: 28px 18px 60px; }
    .reader-bottom-bar { padding: 4px 14px; flex-wrap: wrap; min-height: 0; }
}


/* ===== Notebook home, page list ===== */

.notebook-hero {
    text-align: center;
    padding: 60px 24px 40px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 40px;
}
.notebook-hero .stripe {
    width: 80px; height: 4px;
    margin: 0 auto 18px;
    background: linear-gradient(to right, var(--lux-red) 0 33%, var(--lux-white) 33% 66%, var(--lux-blue) 66%);
    box-shadow: 0 0 0 1px rgba(0,0,0,.04);
}
.notebook-hero h1 {
    font-family: var(--display); font-weight: 800;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -.02em;
    margin: 0 0 .25em;
}
.notebook-hero .by { color: var(--muted); }
.notebook-hero .desc { max-width: 620px; margin: 1em auto 0; color: var(--muted); }

/* ===== Dashboard ===== */

.dashboard {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}
@media (max-width: 900px) { .dashboard { grid-template-columns: 1fr; } }

.dashboard-aside h3 {
    font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .14em;
    color: var(--muted); margin: 0 0 12px;
}
.dashboard-aside .card { padding: 14px; margin-bottom: 12px; }
.notebook-mini {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
    text-decoration: none; color: inherit;
}
.notebook-mini .badge {
    font-family: var(--sans); font-size: .7rem;
    padding: 2px 8px; border-radius: 999px;
    background: var(--bg-soft); color: var(--muted);
    text-transform: uppercase; letter-spacing: .08em;
}
.notebook-mini .badge.blog { background: var(--lux-red); color: white; }
.notebook-mini .badge.docs { background: var(--lux-blue); color: white; }
.notebook-mini .name { font-weight: 600; }
.notebook-mini .slug { color: var(--muted); font-size: .85rem; }

/* ===== Flash messages ===== */

.flash {
    background: var(--bg-soft);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--lux-red);
    color: var(--ink);
    padding: 12px 16px; margin: 0 auto 16px; max-width: 760px;
    font-size: .95rem; border-radius: var(--radius);
}
.flash ul { margin: 4px 0 0; padding-left: 20px; }
.flash li { color: var(--ink-soft); }

/* ===== Helpers ===== */

.row { display: flex; gap: 12px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.text-muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 36px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 36px; }
.center { text-align: center; }

.tag {
    display: inline-block; padding: 2px 10px;
    background: var(--bg-soft); color: var(--ink-soft);
    font-family: var(--sans); font-size: .78rem;
    border-radius: 999px; letter-spacing: .03em;
}
.tag.blog { background: rgba(237,41,57,.18); color: var(--lux-red); }
.tag.docs { background: rgba(0,161,222,.18); color: var(--lux-blue); }
.tag.gallery { background: var(--bg-soft); color: var(--ink); }

/* ===== Validation ===== */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid var(--lux-red); }
.validation-message { color: var(--lux-red); font-size: .85rem; margin-top: 4px; }

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

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--ink);
    padding: 6px;
    border-radius: var(--radius);
}
.nav-toggle:hover { background: var(--bg-soft); }

@media (max-width: 800px) {
    .site-bar-inner { padding: 12px 16px; gap: 8px; }
    .nav-toggle { display: inline-flex; }
    .nav-primary {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--rule);
        flex-direction: column;
        align-items: stretch;
        padding: 14px 18px;
        gap: 12px;
        box-shadow: var(--shadow);
    }
    .nav-primary.open { display: flex; }
    .nav-links { flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
    .nav-links a { padding: 8px 0; border-bottom: 1px solid var(--rule); }
    .nav-cluster {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
        justify-content: flex-start;
    }
    .user-name { max-width: none; }

    main.page, .container-narrow, .container-prose { padding: 18px 14px; }
    .dashboard { padding: 18px 14px; gap: 18px; }

    .prose { font-size: 17px; line-height: 1.7; }
    .prose h1, .article-title { font-size: clamp(1.85rem, 7vw, 2.4rem); }
    .prose h2 { font-size: 1.4rem; }
    .prose h3 { font-size: 1.18rem; }

    .feed-item { padding: 16px 18px; }
    .feed-title { font-size: 1.18rem; }

    .notebook-hero { padding: 36px 16px 26px; margin-bottom: 24px; }

    .article-header { padding-bottom: 1em; margin-bottom: 1.4em; }
    .article-byline { font-size: .88rem; gap: 8px; }

    .feed-actions { font-size: .8rem; }

    .editor-shell { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 64px); }
    .editor-aside { display: none; max-height: 35vh; border-bottom: 1px solid var(--rule); }
    .editor-aside.open { display: block; }
    .editor-preview { display: none; }
    .editor-bar { padding: 8px 10px; gap: 6px; }
    .editor-bar input.title-input { font-size: 1rem; }
    .md-editor { padding: 14px 16px; font-size: .9rem; }
}

@media (min-width: 801px) and (max-width: 1100px) {
    .editor-shell { grid-template-columns: 240px 1fr; }
    .editor-preview { display: none; }
    .dashboard { grid-template-columns: 1fr; }
}

@media (min-width: 1101px) {
    .editor-shell { grid-template-columns: 300px 1fr 1fr; }
}

/* Tablet portrait */
@media (min-width: 700px) and (max-width: 1024px) {
    .feed { max-width: 600px; }
    .container-prose { padding: 24px 28px; }
}

@media (max-width: 480px) {
    body { font-size: 16px; }
    .brand { font-size: 1.35rem; }
    .feed-meta { font-size: .82rem; }
    .feed-excerpt { font-size: .98rem; }
    .btn { padding: 8px 14px; font-size: .9rem; }
    .btn-sm { padding: 5px 10px; font-size: .8rem; }
    .card { padding: 16px; }
    .article-eyebrow { font-size: .72rem; }
}

/* Print */
@media print {
    .site-bar, .site-foot, .feed-actions, .editor-shell { display: none !important; }
    .prose { font-size: 12pt; max-width: none; }
    .article-title { font-size: 28pt; }
    a { color: var(--ink); text-decoration: none; }
}

/* ===== Animations ===== */

@keyframes wat-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@keyframes wat-fade-in-soft {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes wat-pop-in {
    0%   { opacity: 0; transform: scale(.96); }
    100% { opacity: 1; transform: none; }
}

/* Page-load reveals.
   Scoped so we don't re-fire on every diff inside the interactive feed/reader shell —
   the animation would look like the page is "refreshing" on every nav.
   The :not selectors below intentionally exclude the live feed-reader tree. */
.page-host > *:not(.reader-shell):not(.feed-reader-shell) {
    animation: wat-fade-in .35s ease both;
}
.feed-stream .feed-item { animation: wat-fade-in .25s ease both; }
.gallery-card { animation: wat-pop-in .3s ease both; }
.gallery-grid .gallery-card:nth-child(1) { animation-delay: .02s; }
.gallery-grid .gallery-card:nth-child(2) { animation-delay: .04s; }
.gallery-grid .gallery-card:nth-child(3) { animation-delay: .06s; }
.gallery-grid .gallery-card:nth-child(4) { animation-delay: .08s; }
.gallery-grid .gallery-card:nth-child(5) { animation-delay: .10s; }
.gallery-grid .gallery-card:nth-child(6) { animation-delay: .12s; }
.gallery-grid .gallery-card:nth-child(7) { animation-delay: .14s; }
.gallery-grid .gallery-card:nth-child(8) { animation-delay: .16s; }

.notebook-hero { animation: wat-fade-in .45s ease both; }
.notebook-hero h1 { animation: wat-fade-in .55s .05s ease both; }
/* Skip the prose fade inside the live reader-shell — it would re-fire on every nav. */
.article-header, .reader-shell:not(.feed-reader-shell) .prose { animation: wat-fade-in .45s ease both; }
.notebook-about { animation: wat-fade-in .4s .1s ease both; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }

/* Smooth state transitions */
.btn { transition: background .14s ease, color .14s ease, border-color .14s ease, transform .06s ease, box-shadow .14s ease; }
.btn:hover { box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card { transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease; }
.feed-item { transition: background .15s ease; }

/* Toast */
#wat-toast {
    animation: wat-fade-in .15s ease both;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== Blazor framework ===== */

h1:focus { outline: none; }

.blazor-error-boundary {
    background: #b32121; padding: 1rem; color: white; border-radius: var(--radius); margin: 1rem 0;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

#blazor-error-ui {
    background: var(--ink); color: var(--bg); padding: 16px;
    position: fixed; bottom: 0; left: 0; right: 0; display: none; z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer; position: absolute; top: 8px; right: 16px;
}

/* ===== Bookmarks: added-bar + folder-picker modal ===== */

.wat-bookmark-bar {
    position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 28px);
    background: var(--ink); color: var(--bg);
    border-radius: 999px; box-shadow: 0 12px 36px rgba(0,0,0,.28);
    padding: 10px 14px 10px 18px; display: flex; align-items: center; gap: 14px;
    font-family: var(--sans); font-size: .92rem; z-index: 9998;
    opacity: 0; pointer-events: none;
    transition: opacity .18s ease, transform .22s ease;
    max-width: calc(100vw - 32px);
}
.wat-bookmark-bar.open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.wat-bookmark-bar .wat-bm-text { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.wat-bookmark-bar .wat-bm-check { color: var(--accent); display: inline-flex; }
.wat-bookmark-bar .wat-bm-actions { display: inline-flex; gap: 6px; align-items: center; }
.wat-bookmark-bar .wat-bm-choose,
.wat-bookmark-bar .wat-bm-view {
    background: rgba(255,255,255,.08); color: inherit; border: none;
    padding: 6px 12px; border-radius: 999px; font-size: .85rem; cursor: pointer;
    text-decoration: none; font-family: inherit;
    transition: background .12s ease;
}
.wat-bookmark-bar .wat-bm-choose:hover,
.wat-bookmark-bar .wat-bm-view:hover { background: rgba(255,255,255,.16); }

.wat-bm-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: none; align-items: center; justify-content: center;
    z-index: 9999; padding: 20px;
}
.wat-bm-modal-backdrop.open { display: flex; }
.wat-bm-modal {
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--rule); border-radius: 14px;
    width: min(440px, 100%); max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,.36);
    font-family: var(--sans);
}
.wat-bm-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--rule);
}
.wat-bm-modal-head h3 { margin: 0; font-family: var(--display); font-size: 1.15rem; }
.wat-bm-close {
    background: none; border: none; color: var(--muted); cursor: pointer;
    padding: 6px; border-radius: 8px; display: inline-flex;
}
.wat-bm-close:hover { background: var(--bg-soft); color: var(--ink); }
.wat-bm-modal-body { padding: 12px 16px 16px; overflow: auto; }

.wat-bm-folders {
    list-style: none; margin: 0 0 12px; padding: 0;
    display: flex; flex-direction: column; gap: 2px;
    max-height: 50vh; overflow: auto;
}
.wat-bm-folder { display: flex; align-items: stretch; gap: 4px; }
.wat-bm-folder-pick {
    flex: 1; display: flex; align-items: center; gap: 10px;
    background: none; border: 1px solid transparent; color: var(--ink);
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    font-family: inherit; font-size: .95rem; text-align: left;
    transition: background .12s ease, border-color .12s ease;
}
.wat-bm-folder-pick:hover { background: var(--bg-soft); border-color: var(--rule); }
.wat-bm-folder-icon { color: var(--muted); display: inline-flex; }
.wat-bm-folder-name { flex: 1; }
.wat-bm-folder-count { color: var(--muted); font-size: .82rem; font-family: var(--mono); }
.wat-bm-folder-del {
    background: none; border: 1px solid transparent; color: var(--muted); cursor: pointer;
    padding: 0 10px; border-radius: 10px; display: inline-flex; align-items: center;
}
.wat-bm-folder-del:hover { color: var(--lux-red); border-color: rgba(237,41,57,.25); }
.wat-bm-loading { padding: 12px 8px; color: var(--muted); }

.wat-bm-newrow {
    display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule);
}
.wat-bm-newname {
    flex: 1; padding: 9px 12px; border: 1px solid var(--rule); background: var(--bg);
    color: var(--ink); border-radius: 10px; font-family: inherit; font-size: .92rem;
}
.wat-bm-newname:focus { outline: none; border-color: var(--accent); }
.wat-bm-newbtn {
    background: var(--ink); color: var(--bg); border: none;
    padding: 9px 16px; border-radius: 10px; cursor: pointer;
    font-family: inherit; font-size: .9rem;
}
.wat-bm-newbtn:hover { opacity: .9; }

/* ===== /bookmarks page ===== */

.bookmarks-shell {
    display: grid; grid-template-columns: 260px 1fr; gap: 32px;
    max-width: 1100px; margin: 0 auto; padding: 32px 24px;
}
.bookmarks-side {
    position: sticky; top: 84px; align-self: start;
    background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 14px;
    padding: 14px;
}
.bookmarks-side-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; padding: 0 4px;
}
.bookmarks-side-head h2 {
    margin: 0; font-family: var(--display); font-size: 1.1rem;
}
.bookmarks-folders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.bookmarks-folders li { display: block; }
.bookmarks-folders-sep { height: 1px; background: var(--rule); margin: 8px 4px; }
.bookmarks-folders a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none;
    font-size: .92rem; position: relative;
}
.bookmarks-folders a:hover { background: var(--bg); }
.bookmarks-folders a.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.bf-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-count { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.bf-tools { display: none; gap: 2px; align-items: center; }
.bookmarks-folders a:hover .bf-tools { display: inline-flex; }
.bf-tool {
    background: none; border: none; color: var(--muted);
    padding: 4px; border-radius: 6px; cursor: pointer; display: inline-flex;
}
.bf-tool:hover { background: var(--rule); color: var(--ink); }
.bf-tool-del:hover { color: var(--lux-red); }

.bf-rename {
    display: flex; align-items: center; gap: 4px; padding: 4px;
}
.bf-rename-input {
    flex: 1; padding: 6px 10px; border: 1px solid var(--rule);
    background: var(--bg); color: var(--ink); border-radius: 8px;
    font-family: inherit; font-size: .9rem;
}
.bf-rename-input:focus { outline: none; border-color: var(--accent); }

.bookmarks-main { min-width: 0; }
.bookmarks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bookmarks-row {
    display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
    padding: 14px; background: var(--bg-soft); border: 1px solid var(--rule);
    border-radius: 12px;
}
.bookmarks-row-thumb {
    display: block; width: 92px; height: 64px; overflow: hidden;
    border-radius: 8px; background: var(--rule);
}
.bookmarks-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bookmarks-row-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bookmarks-row-title {
    font-family: var(--display); font-size: 1.08rem; color: var(--ink); text-decoration: none;
    line-height: 1.3;
}
.bookmarks-row-title:hover { color: var(--accent); }
.bookmarks-row-meta {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    color: var(--muted); font-size: .82rem;
}
.bookmarks-row-meta .dot {
    width: 3px; height: 3px; border-radius: 50%; background: var(--muted); display: inline-block;
}
.bookmarks-row-nb { color: var(--muted); text-decoration: none; }
.bookmarks-row-nb:hover { color: var(--ink); }
.bookmarks-row-excerpt {
    color: var(--muted); font-size: .9rem; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.bookmarks-row-tools {
    display: flex; align-items: center; gap: 8px;
}
.bookmarks-row-folder {
    background: var(--bg); border: 1px solid var(--rule); color: var(--ink);
    padding: 6px 10px; border-radius: 8px; font-family: inherit; font-size: .84rem;
    max-width: 140px;
}
.bookmarks-row-folder:focus { outline: none; border-color: var(--accent); }

@media (max-width: 760px) {
    .bookmarks-shell { grid-template-columns: 1fr; padding: 20px 16px; }
    .bookmarks-side { position: static; }
    .bookmarks-row { grid-template-columns: 1fr; }
    .bookmarks-row-thumb { width: 100%; height: 140px; }
    .bookmarks-row-tools { justify-content: flex-end; }
}

/* ===== Action bar (Twitter-style row) ===== */

.action-bar {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 6px 0; color: var(--muted);
}
.action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; color: inherit; cursor: pointer;
    padding: 8px 12px; border-radius: 999px;
    font-family: var(--sans); font-size: .85rem;
    transition: background .12s ease, color .12s ease;
    min-width: 0;
}
.action-btn:disabled { cursor: default; opacity: .5; }
.action-btn span { font-variant-numeric: tabular-nums; }

.action-btn.action-like:hover:not(:disabled) { background: rgba(237,41,57,.10); color: var(--lux-red); }
.action-btn.action-like.is-on { color: var(--lux-red); }

.action-btn.action-repost:hover:not(:disabled) { background: rgba(46,160,67,.10); color: #2ea043; }
.action-btn.action-repost.is-on { color: #2ea043; }

.action-btn.action-bookmark:hover:not(:disabled) { background: var(--rule); color: var(--ink); }
.action-btn.action-bookmark.is-on { color: var(--ink); }
/* Make sure the SVG inside the button always tracks the button's color */
.action-btn .lc-icon, .action-btn .lc-icon svg { color: currentColor; }

.action-btn.action-share:hover:not(:disabled),
.action-btn:not(.action-like):not(.action-repost):not(.action-bookmark):not(.action-views):hover:not(:disabled) {
    background: var(--bg-soft); color: var(--ink);
}
.action-btn.action-views { cursor: default; opacity: .85; }
.action-signin { margin-left: auto; }

/* ===== Reply box + replies list ===== */

.replies-section {
    margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule);
    max-width: var(--measure); margin-left: auto; margin-right: auto;
}
.replies-h {
    font-family: var(--display); font-size: 1.05rem; margin: 0 0 12px;
    color: var(--ink-soft);
}
.reply-box {
    background: var(--bg-card); border: 1px solid var(--rule); border-radius: 12px;
    padding: 12px;
}
.reply-box textarea {
    width: 100%; resize: vertical; min-height: 56px;
    background: transparent; border: none; outline: none;
    color: var(--ink); font-family: var(--sans); font-size: .98rem; line-height: 1.5;
}
.reply-box-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--rule);
}
.reply-box-locked { text-align: center; padding: 18px; }

.replies-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.reply-item {
    background: var(--bg-card); border: 1px solid var(--rule);
    border-radius: 12px; padding: 12px 14px;
}
.reply-meta {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    color: var(--muted); font-size: .85rem; margin-bottom: 4px;
}
.reply-author { color: var(--ink); font-weight: 700; text-decoration: none; }
.reply-author:hover { color: var(--accent); }
.reply-handle { color: var(--muted-2); text-decoration: none; }
.reply-handle:hover { color: var(--ink); }
.reply-meta .dot {
    width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); display: inline-block;
}
.reply-body { font-size: .95rem; }
.reply-body p { margin: 6px 0; }

/* ===== Quick compose on Home ===== */

.quick-compose {
    background: var(--bg-card); border: 1px solid var(--rule); border-radius: 14px;
    padding: 14px; margin: 16px 0 24px;
}
.quick-compose textarea {
    width: 100%; resize: vertical; min-height: 70px;
    background: transparent; border: none; outline: none;
    color: var(--ink); font-family: var(--sans); font-size: 1.02rem; line-height: 1.5;
}
.quick-compose-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--rule);
}
.quick-compose.is-loading { opacity: .6; }

/* Notebook picker inside quick compose */
.qc-notebook-picker { position: relative; }
.qc-picker-btn {
    background: none; border: 1px solid transparent; color: var(--ink);
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 999px; cursor: pointer;
    font-family: var(--sans); font-size: .85rem;
    transition: background .12s ease, border-color .12s ease;
}
.qc-picker-btn:hover { background: var(--bg-soft); border-color: var(--rule); }
.qc-current { font-weight: 600; }

.qc-picker-backdrop {
    position: fixed; inset: 0; z-index: 49; background: transparent;
}
.qc-picker-pop {
    position: absolute; bottom: calc(100% + 6px); left: 0;
    min-width: 240px; max-height: 280px; overflow: auto;
    background: var(--bg-card); border: 1px solid var(--rule); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,.18);
    padding: 6px; z-index: 50;
    display: flex; flex-direction: column; gap: 1px;
}
.qc-picker-item {
    background: none; border: none; color: var(--ink);
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left;
    font-family: inherit; font-size: .9rem;
}
.qc-picker-item:hover { background: var(--bg-soft); }
.qc-picker-item.is-selected { background: var(--bg-soft); }
.qc-pi-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-pi-slug { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.qc-pi-tick { color: var(--accent); display: inline-flex; }

/* New-post arrival animation in the feed */
@keyframes wat-feed-fresh {
    0%   { opacity: 0; transform: translateY(-10px); box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(0,0,0,.18); }
    25%  { opacity: 1; transform: translateY(0); box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(0,0,0,.12); }
    100% { box-shadow: none; }
}
.feed-item-fresh {
    animation: wat-feed-fresh 1.6s ease-out;
    position: relative;
}

/* ===== Mention + hashtag links inside prose ===== */
.prose a[href^="/@"], .prose a[href^="/tag/"] {
    color: var(--accent); text-decoration: none; font-weight: 600;
}
.prose a[href^="/@"]:hover, .prose a[href^="/tag/"]:hover { text-decoration: underline; }

/* ===== User profile ===== */

.profile-shell { max-width: 900px; margin: 0 auto; padding: 0 0 40px; }
.profile-banner {
    height: 200px; background-size: cover; background-position: center;
    border-bottom: 1px solid var(--rule);
}
.profile-header {
    display: flex; gap: 20px; align-items: flex-end;
    padding: 0 24px; margin-top: -56px;
}
.profile-avatar {
    width: 112px; height: 112px; border-radius: 50%;
    background: var(--bg-card); border: 4px solid var(--bg);
    overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--display); font-size: 2.4rem; color: var(--muted);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-initial { display: block; }
.profile-meta { padding-bottom: 8px; flex: 1; min-width: 0; }
.profile-name { font-family: var(--display); margin: 0; font-size: 1.8rem; line-height: 1.1; }
.profile-handle { color: var(--muted); font-family: var(--mono); font-size: .9rem; margin-top: 2px; }
.profile-bio { margin: 10px 0 0; color: var(--ink-soft); line-height: 1.5; }
.profile-stats {
    display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px;
    color: var(--muted); font-size: .9rem;
}
.profile-stats strong { color: var(--ink); font-family: var(--mono); }
.profile-joined { color: var(--muted-2); }

.profile-section-h {
    font-family: var(--display); margin: 32px 24px 12px; font-size: 1.15rem;
    color: var(--ink-soft);
}
.profile-nb-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px; padding: 0 24px;
}
.profile-nb-card {
    display: flex; gap: 10px; align-items: center;
    padding: 12px; background: var(--bg-card); border: 1px solid var(--rule);
    border-radius: 12px; color: var(--ink); text-decoration: none;
    transition: border-color .12s ease;
}
.profile-nb-card:hover { border-color: var(--rule-strong); }
.profile-nb-avatar { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.profile-nb-title { font-weight: 600; }
.profile-nb-slug { color: var(--muted); font-size: .82rem; font-family: var(--mono); }

.profile-posts { padding: 0 24px; }

@media (max-width: 720px) {
    .profile-header { flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 16px; }
    .profile-avatar { width: 88px; height: 88px; font-size: 1.9rem; }
    .profile-name { font-size: 1.5rem; }
    .profile-section-h, .profile-nb-grid, .profile-posts { padding-left: 16px; padding-right: 16px; }
}


