/* Minimal Geeky Theme - Digital Garden */

/* Typography System */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Manjari:wght@100;400;700&display=swap');

/* CSS Variables - Light Mode */
:root {
    /* Colors */
    --bg-primary: #fafafa;
    --bg-secondary: #f5f5f5;
    --text-primary: #2e3440;
    --text-secondary: #4c566a;
    --text-muted: #8c92a0;
    --accent: #5e81ac;
    --border: #e5e7eb;
    --link: #5e81ac;
    --bracket: #8c92a0;
    /* Code colours match the Chroma styles in syntax.css (catppuccin-latte / nordic) */
    --code-bg: #eff1f5;
    --code-fg: #4c4f69;
    --code-border: #ccd0da;
    
    /* Typography */
    --font-heading: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    --font-body: 'IBM Plex Mono', 'Menlo', 'Monaco', monospace;
    --font-code: 'Fira Code', 'Cascadia Code', monospace;
    --font-malayalam: 'Manjari', sans-serif;
    
    /* Status Colors */
    --status-seeding: #f59e0b;
    --status-growing: #3b82f6;
    --status-evergreen: #10b981;
}

/* Dark Mode — html.dark-theme is set by the inline script in head.html
   before first paint; body.dark-theme is kept for dark.js/back-compat. */
html.dark-theme,
body.dark-theme,
[data-theme="dark"] {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252525;
    --text-primary: #d8dee9;
    --text-secondary: #b8c0d0;
    --text-muted: #6b7280;
    --accent: #88c0d0;
    --border: #3a3a3a;
    --link: #88c0d0;
    --bracket: #6b7280;
    --code-bg: #242933;
    --code-fg: #bbc3d4;
    --code-border: #2e3440;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    /* Paint the root canvas too, so nothing light shows behind/around body */
    background-color: var(--bg-primary);
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
nav {
    background: var(--bg-primary);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

nav .container {
    max-width: 65ch;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    text-decoration: none;
    border-bottom: none !important;
    transition: color 0.2s ease;
}

nav > .container > a {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

nav ul li a {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

nav ul li a:hover {
    color: var(--link);
}

@media (max-width: 768px) {
    nav .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    nav ul {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: 1rem;
}

/* Links */
a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px dotted var(--link);
    transition: border-bottom 0.2s ease;
}

a:hover {
    border-bottom: 1px solid var(--link);
}

/* Wiki-link Brackets */
.wikilink-bracket {
    color: var(--bracket);
    font-size: 0.9em;
    user-select: none;
    pointer-events: none;
}

.wikilink {
    color: var(--bracket);
    font-weight: normal;
    user-select: none;
    pointer-events: none;
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.25rem;
}

/* Code */
code {
    font-family: var(--font-code);
    font-size: 0.9em;
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    border: 1px solid var(--code-border);
}

pre {
    font-family: var(--font-code);
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--code-border);
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    background: none;
    padding: 0;
    border: none;
}

/* Blockquotes */
blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Horizontal Rule */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

th, td {
    padding: 0.5rem;
    border: 1px solid var(--border);
    text-align: left;
}

th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* Container */
.container {
    max-width: 65ch;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Status Indicators */
.status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-seeding { color: var(--status-seeding); }
.status-growing { color: var(--status-growing); }
.status-evergreen { color: var(--status-evergreen); }

/* Tags */
.tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    margin-right: 0.5rem;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
}

.tag:hover {
    background: var(--border);
}

/* Metadata */
.metadata {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Note Metadata */
.note-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.note-meta .meta-item {
    display: flex;
    align-items: center;
}

.note-meta .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.note-meta .badge-source {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.note-meta .date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Tags Container */
.tags {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

/* Content Separator */
.content-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem auto;
    max-width: 65ch;
}

/* Footer Separator */
.footer-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem auto 2rem auto;
    max-width: 65ch;
}

/* Back Link */
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--text-muted);
    border-bottom: 1px dotted var(--text-muted);
}

.back-link:hover {
    color: var(--text-primary);
    border-bottom: 1px solid var(--text-primary);
}

/* Graph Container */
#graph-container {
    width: 100%;
    height: 400px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    background: var(--bg-secondary);
    margin-bottom: 2rem;
}

/* Recent Notes List */
.recent-list {
    list-style: none;
    margin-left: 0;
}

.recent-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.recent-list li:last-child {
    border-bottom: none;
}

/* Taxonomy index (e.g. /tags/): plain list, no dividers */
.taxonomy-list li {
    padding: 0.35rem 0;
    border-bottom: none;
}

/* Content starts at the same height below the header on every page */
.taxonomy-title {
    margin-top: 0;
}

.taxonomy-list li:first-child,
.tag-note-item:first-child {
    padding-top: 0;
}

.recent-list a {
    border-bottom: none;
}

.recent-list a:hover {
    color: var(--accent);
}

.recent-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Backlinks */
.backlinks {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.backlinks h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.backlinks ul {
    list-style: none;
    margin-left: 0;
}

.backlinks li {
    padding: 0.5rem 0;
}

.backlinks-summary {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background-color: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background-color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle:hover svg {
    stroke: var(--bg-primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-primary);
    transition: stroke 0.2s ease;
}

@media (max-width: 768px) {
    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding: 1rem 0.75rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.35rem; }
    
    #graph-container {
        height: 300px;
    }
}

/* Smooth Transitions */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

a, button {
    transition: all 0.2s ease;
}

/* Heading Anchor Links */
.anchor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.2rem;
    padding: 0.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    vertical-align: middle;
}

.anchor svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

h1:hover .anchor,
h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
h5:hover .anchor,
h6:hover .anchor,
.anchor:focus {
    opacity: 1;
}

.anchor:hover {
    color: var(--accent);
}

.anchor:active {
    transform: scale(0.95);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--accent);
    color: var(--bg-primary);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
    pointer-events: none;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .toast-notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        text-align: center;
    }
}

/* Malayalam Typography */
/* Apply Manjari font to content with Malayalam language attribute */
[lang="malayalam"],
.language-malayalam,
*[lang="ml"] {
    font-family: var(--font-malayalam);
    line-height: 1.8;
    font-size: 1.1em;
}

/* Ensure Malayalam text in quotes and paragraphs uses Manjari */
blockquote[lang="malayalam"],
blockquote[lang="ml"],
p:lang(ml),
.content:lang(ml) {
    font-family: var(--font-malayalam);
    line-height: 1.8;
}

/* Auto-detect Malayalam script using Unicode range */
/* Malayalam Unicode range: U+0D00-U+0D7F */
@supports (font-family: var(--font-malayalam)) {
    body {
        font-family: var(--font-body), var(--font-malayalam);
    }
}

/* ═══════════════════════════════════════════════
   GARDEN HOME — Homepage Layout
   ═══════════════════════════════════════════════ */

.garden-home {
    max-width: 90ch;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
}

/* ── Hero ── */
.garden-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

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

.garden-intro {
    font-size: 0.95rem;
    line-height: 1.7;
}

.garden-intro h1,
.garden-intro h2,
.garden-intro h3 {
    display: none;
}

.garden-intro p {
    margin-bottom: 0.6rem;
}

.garden-intro blockquote {
    margin-top: 1rem;
    font-size: 0.85rem;
    border-left-color: var(--accent);
    opacity: 0.8;
}

.garden-stats {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 3.5rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-primary);
}

.stat-evergreen { color: var(--status-evergreen); }
.stat-growing { color: var(--status-growing); }
.stat-seeding { color: var(--status-seeding); }

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.garden-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-shrink: 0;
}

.garden-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.garden-action-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-code);
    font-size: 0.78rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    width: 100%;
    justify-content: center;
}

.garden-action-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.action-icon {
    font-size: 0.9rem;
}

.garden-action-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    border-bottom: none;
    transition: color 0.15s;
}

.garden-action-link:hover {
    color: var(--link);
    border-bottom: none;
}

@media (max-width: 640px) {
    .garden-hero {
        flex-direction: column;
    }
    .garden-sidebar {
        width: 100%;
    }
    .garden-stats {
        width: 100%;
        justify-content: space-around;
    }
    .garden-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    .garden-action-btn {
        width: auto;
    }
}

/* ── Section Headings ── */
.section-heading {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    color: var(--accent);
    font-weight: 400;
    font-size: 1rem;
    opacity: 0.7;
}

.section-count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
}

/* ── Dual Column Layout (Recently Tended / Most Connected) ── */
.garden-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.garden-column {
    min-width: 0;
}

@media (max-width: 640px) {
    .garden-dual {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ── Garden Lists (shared between Recently Tended & Most Connected) ── */
.garden-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.garden-list-item {
    margin: 0;
    padding: 0;
}

.garden-list-link {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: none;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
}

.garden-list-link:hover {
    color: var(--link);
    border-bottom: none;
}

.garden-list-title {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.garden-list-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* ── Status Dots ── */
.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-evergreen { background: var(--status-evergreen); }
.status-dot-growing { background: var(--status-growing); }
.status-dot-seeding { background: var(--status-seeding); }

/* ── Garden Section ── */
.garden-section {
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.garden-section:last-of-type {
    border-bottom: none;
}

/* ── Topic Grid ── */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.topic-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.topic-card[open] {
    border-color: var(--accent);
}

.topic-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    list-style: none;
    user-select: none;
}

.topic-card-header::-webkit-details-marker {
    display: none;
}

.topic-card-header::before {
    content: '>';
    color: var(--accent);
    font-family: var(--font-code);
    margin-right: 0.5rem;
    transition: transform 0.15s;
    display: inline-block;
}

.topic-card[open] > .topic-card-header::before {
    transform: rotate(90deg);
}

.topic-card-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-weight: 400;
}

.topic-card-list {
    list-style: none;
    margin: 0;
    padding: 0 0.9rem 0.7rem;
    border-top: 1px solid var(--border);
}

.topic-card-list li {
    margin: 0;
    padding: 0;
}

.topic-card-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-bottom: none;
    transition: color 0.15s;
}

.topic-card-list a:hover {
    color: var(--link);
    border-bottom: none;
}

/* ── All Notes Section ── */
.all-notes-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.notes-filter-input {
    flex: 1;
    padding: 0.45rem 0.7rem;
    font-family: var(--font-code);
    font-size: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.notes-filter-input:focus {
    border-color: var(--accent);
}

.notes-filter-input::placeholder {
    color: var(--text-muted);
}

.all-notes-sort {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.sort-btn {
    padding: 0.4rem 0.65rem;
    font-family: var(--font-code);
    font-size: 0.72rem;
    background: var(--bg-secondary);
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sort-btn:last-child {
    border-right: none;
}

.sort-btn:hover {
    color: var(--text-primary);
}

.sort-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

.all-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: 2rem;
}

.all-note-item {
    break-inside: avoid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}

.all-note-item a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: none;
    color: var(--text-secondary);
    font-size: 0.82rem;
    min-width: 0;
    overflow: hidden;
    transition: color 0.15s;
}

.all-note-item a:hover {
    color: var(--link);
    border-bottom: none;
}

.all-note-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.all-note-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

@media (max-width: 640px) {
    .all-notes-list {
        columns: 1;
    }
    .all-notes-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .all-notes-sort {
        align-self: flex-start;
    }
}

/* ── Garden Footer Tagline ── */
.garden-footer-link {
    text-align: center;
    padding: 1rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ═══════════════════════════════════════════════
   TAG PAGES — Tag list & single tag
   ═══════════════════════════════════════════════ */

.tag-page {
    max-width: 72ch;
    margin: 0 auto;
    padding: 1rem 1.5rem 2rem;
}

/* ── Tag Header ── */
.tag-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tag-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.3rem 0;
}

.tag-hash {
    color: var(--accent);
    font-weight: 400;
    margin-right: 0.15rem;
}

.tag-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

/* ── Tags Cloud (all tags view) ── */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tags-cloud-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    border-bottom: none;
    transition: border-color 0.15s, background 0.15s;
}

.tags-cloud-item:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
    border-bottom: none;
}

.tags-cloud-name {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.tags-cloud-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    min-width: 1.4rem;
    text-align: center;
}

/* ── Tag Notes List (single tag view) ── */
.tag-notes-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.tag-notes-sort {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.tag-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    line-height: 1.7;
}

.tag-note-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

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

.tag-note-link {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    border-bottom: none;
    transition: color 0.15s;
}

.tag-note-link:hover {
    border-bottom: none;
}

.tag-note-link:hover .tag-note-title {
    border-bottom: 1px solid var(--link);
}

/* Block, not flex: the title stays inline so a wrapped title is
   underlined on every line, like a regular link */
.tag-note-main {
    display: block;
    min-width: 0;
}

.tag-note-main .status-dot {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Styled like a regular link (see `a` / `a:hover`) */
.tag-note-title {
    font-size: 1rem;
    color: var(--link);
    border-bottom: 1px dotted var(--link);
    transition: border-bottom 0.2s ease;
}

.tag-note-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    font-size: 1rem;
    color: var(--text-muted);
}

.tag-note-status {
    text-transform: lowercase;
}

.tag-note-date {
    white-space: nowrap;
}

.tag-note-summary {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 0.3rem 0 0 0;
    line-height: 1.7;
}

/* ── Related Tags ── */
.tag-related {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.tag-related-heading {
    /* Same as section headings on prose pages */
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
}

.tag-related-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-related-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    transition: border-color 0.15s, color 0.15s;
}

.tag-related-item:hover {
    border-color: var(--accent);
    color: var(--link);
}

.tag-related-count {
    font-size: 1rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .tag-page {
        padding: 1rem 0.75rem 2rem;
    }
    .tag-title {
        font-size: 1.5rem;
    }
    .tag-note-link {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* ═══════════════════════════════════════════════
   NOTE PAGE — Single note layout
   ═══════════════════════════════════════════════ */

.note {
    max-width: 72ch;
    margin: 0 auto;
    padding: 1rem 1.5rem 2rem;
}

/* ── Note Header ── */
.note-header {
    margin-bottom: 2rem;
}

.note-back {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: none;
    margin-bottom: 1.25rem;
    transition: color 0.15s;
}

.note-back:hover {
    color: var(--link);
    border-bottom: none;
}

.note-title {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.6rem 0;
}

.note-summary {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1rem 0;
    font-style: italic;
}

.note-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.note-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.note-status-evergreen { border-color: var(--status-evergreen); color: var(--status-evergreen); }
.note-status-growing { border-color: var(--status-growing); color: var(--status-growing); }
.note-status-seeding { border-color: var(--status-seeding); color: var(--status-seeding); }

.note-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--accent);
    color: var(--bg-primary);
}

.note-dates {
    color: var(--text-muted);
}

.note-reading-time {
    color: var(--text-muted);
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.note-tag {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-muted);
    border-bottom: none;
    transition: color 0.15s, border-color 0.15s;
}

.note-tag:hover {
    color: var(--link);
    border-color: var(--link);
    border-bottom: none;
}

/* ── Note Content ── */
.note-content {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    line-height: 1.7;
}

.note-content h2 {
    margin-top: 2rem;
}

.note-content h3 {
    margin-top: 1.5rem;
}

/* ── Backlinks ── */
.note-backlinks {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.note-backlinks-heading {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.note-backlinks-list li {
    margin: 0;
    padding: 0;
}

.backlink-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.65rem;
    margin: 0 -0.65rem;
    border-radius: 4px;
    border-bottom: none;
    transition: background 0.15s;
}

.backlink-item:hover {
    background: var(--bg-secondary);
    border-bottom: none;
}

.backlink-title {
    font-size: 0.88rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.backlink-summary {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: calc(6px + 0.4rem);
}

/* ── Note Footer ── */
.note-footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

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

.note-footer-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: none;
    font-family: var(--font-body);
    transition: color 0.15s;
}

.note-footer-link:hover {
    color: var(--link);
    border-bottom: none;
}

@media (max-width: 640px) {
    .note {
        padding: 1rem 0.75rem 2rem;
    }
    .note-title {
        font-size: 1.5rem;
    }
    .note-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
}

/* ── Site Footer ── */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.footer-container {
    max-width: 90ch;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2rem;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.footer-brand {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.footer-logo {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    border-bottom: none;
}

.footer-logo:hover {
    color: var(--link);
    border-bottom: none;
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.footer-social-link:hover {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.footer-bottom {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.footer-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
}

.footer-nav a {
    color: var(--text-muted);
    border-bottom: none;
    transition: color 0.15s;
}

.footer-nav a:hover {
    color: var(--link);
    border-bottom: none;
}

.footer-sep {
    color: var(--border);
    font-size: 0.7rem;
}

.footer-theme-credit {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    text-align: center;
}

.footer-theme-credit a {
    color: var(--text-muted);
    border-bottom: 1px dotted var(--border);
    transition: color 0.15s, border-color 0.15s;
}

.footer-theme-credit a:hover {
    color: var(--link);
    border-bottom-color: var(--link);
}

@media (max-width: 640px) {
    .footer-top {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    .footer-nav {
        flex-wrap: wrap;
    }
}

/* Keep content images inside the column */
.note-content img,
.note-hero img {
    max-width: 100%;
    height: auto;
}

/* Optional hero image from the `image` front matter param */
.note-hero {
    margin: 0 0 2rem;
}

/* The hero already separates header and body; drop the divider */
/* No header above the body (e.g. hideTitle): no divider either */
.note-content:first-child {
    border-top: none;
    padding-top: 0;
}

.note-hero + .note-content {
    border-top: none;
    padding-top: 0;
}

.note-hero img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Lightbox (js/lightbox.js) */
.lightbox-trigger {
    cursor: zoom-in;
}

.lightbox {
    /* <dialog> is centered by the browser's modal positioning */
    margin: auto;
    padding: 0;
    border: none;
    background: transparent;
    max-width: 95vw;
    max-height: 95vh;
    overflow: visible;
    cursor: zoom-out;
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.lightbox img {
    display: block;
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    border-radius: 4px;
}

/* Text links are always bold (in-text links, article list titles, tag index) */
.note-content a,
.tag-note-title,
.taxonomy-list a {
    font-weight: 700;
}

/* Search box above the article list (_default/list.html) */
.list-search {
    display: flex;
    margin-bottom: 1.5rem;
}

.list-search .notes-filter-input {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    padding: 0.4rem 0.75rem;
}

.list-search-empty {
    color: var(--text-muted);
    margin: 0;
}
