* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #ffffff;
}

.zen-view {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    color: #222;
    min-height: 100vh;
}

.zen-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    z-index: 100;
    gap: 16px;
}

.zen-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.zen-back:hover {
    background: #eceadf;
    color: #555;
}

.zen-status {
    flex: 1;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 12px;
    color: #888;
}

.zen-cycle-btn {
    font-family: 'Iosevka SS14 Web', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    background: transparent;
    color: #8b7355;
    border: 1px solid #d8d4c8;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.zen-cycle-btn:hover {
    background: #eceadf;
    border-color: #c8c4b8;
}

.zen-edit {
    font-family: 'Iosevka SS14 Web', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 20px;
    background: #8b7355;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.zen-edit:hover {
    background: #7a6248;
}

.zen-main {
    min-height: calc(100vh - 60px);
}

.zen-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 24px 100px;
}

.zen-view-title {
    font-family: 'Charter', Georgia, serif;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-bottom: 16px;
    color: #2a2520;
}

.zen-view-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e6e6e0;
}

.zen-view-date {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 12px;
    color: #888;
}

.zen-tag {
    display: inline-flex;
    align-items: center;
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 12px;
    padding: 3px 8px;
    background: #e8e4d8;
    border-radius: 3px;
    color: #6b5a42;
    text-decoration: none;
    transition: background 0.15s;
}

.zen-tag:hover {
    background: #ddd8c8;
}

.zen-view-body {
    font-family: 'Charter', 'Georgia', serif;
    font-size: 16px;
    line-height: 1.7;
    color: #3a3530;
}

.zen-view-body h1, .zen-view-body h2, .zen-view-body h3 {
    font-family: 'Iosevka SS14 Web', Georgia, serif;
    margin-top: 32px;
    margin-bottom: 16px;
    color: #222;
    font-weight: 500;
}

.zen-view-body h1 { font-size: 1.5em; font-weight: 700; margin: 1.5em 0 0.5em; }
.zen-view-body h2 { font-size: 1.25em; font-weight: 600; margin: 1.25em 0 0.5em; }
.zen-view-body h3 { font-size: 1.1em; font-weight: 600; margin: 1em 0 0.4em; text-decoration: underline; text-decoration-color: rgba(139, 115, 85, 0.15); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.zen-view-body h4 { font-size: 1em; font-weight: 600; margin: 1em 0 0.4em; }

.zen-view-body p { margin-bottom: 1em; line-height: 1.6; }
.zen-view-body ul, .zen-view-body ol,
.org-fold > ul, .org-fold > ol { margin: 0 0 1em; padding-left: 1.5em; list-style-position: outside; }
.zen-view-body li { margin-bottom: 0.4em; line-height: 1.5; }
.zen-view-body li::marker { color: #8b7355; }

.zen-view-body pre {
    background: #fffef8;
    border: 1px solid #e6e6e0;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Iosevka SS14 Web', 'JetBrains Mono', monospace;
    font-size: 13px;
    margin-bottom: 16px;
    color: #333;
}

.zen-view-body code {
    font-family: 'Iosevka SS14 Web', 'JetBrains Mono', monospace;
    background: #ebe8df;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.zen-view-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.zen-view-body blockquote {
    border-left: 3px solid #8b7355;
    padding-left: 20px;
    color: #666;
    font-style: italic;
    margin: 16px 0;
}

.zen-view-body a {
    color: #486878;
    text-decoration: underline;
    text-decoration-color: rgba(72, 104, 120, 0.35);
    text-underline-offset: 2px;
    background: rgba(72, 104, 120, 0.06);
    padding: 0 2px;
    border-radius: 2px;
}

.zen-view-body a:hover {
    color: #385868;
    text-decoration-color: rgba(72, 104, 120, 0.7);
    background: rgba(72, 104, 120, 0.12);
}


:root {
    --bg: #fcfbf7;
    --surface: #ffffff;
    --surface-muted: #f7f4ec;
    --text: #2c2823;
    --text-muted: #746c62;
    --border: #e5e0d6;
    --accent: #7c664a;
    --accent-strong: #68533b;
    --link: #3f6679;
}

html, body {
    background: var(--bg);
    color: var(--text);
}

.zen-header {
    padding: 12px 16px;
    background: rgba(252, 251, 247, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.zen-back,
.zen-cycle-btn,
.zen-edit {
    min-height: 40px;
}

.zen-back {
    color: var(--text-muted);
    border-radius: 8px;
}

.zen-back:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.zen-status {
    font-size: 12px;
    color: var(--text-muted);
}

.zen-cycle-btn {
    color: var(--accent);
    border: 1px solid #d8d0c3;
    border-radius: 8px;
}

.zen-cycle-btn:hover {
    background: var(--surface-muted);
    border-color: #c6bcad;
}

.zen-edit {
    background: var(--accent);
    border-radius: 8px;
    padding: 8px 18px;
}

.zen-edit:hover {
    background: var(--accent-strong);
}

.zen-content {
    max-width: 720px;
    padding: 44px 24px 120px;
}

.zen-view-title {
    font-size: 38px;
    line-height: 1.12;
    margin-bottom: 14px;
    color: var(--text);
}

.zen-view-meta {
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.zen-view-date {
    color: var(--text-muted);
}

.zen-tag {
    padding: 4px 9px;
    background: #ece7da;
    color: #625541;
    border-radius: 999px;
}

.zen-view-body {
    font-size: 17px;
    line-height: 1.75;
    color: #322d28;
}

.zen-view-body h1, .zen-view-body h2, .zen-view-body h3 {
    margin-top: 34px;
    margin-bottom: 12px;
    color: #201c18;
}

.zen-view-body p {
    margin-bottom: 1.05em;
    line-height: 1.72;
}

.zen-view-body ul, .zen-view-body ol,
.org-fold > ul, .org-fold > ol {
    margin: 0 0 1.05em;
    padding-left: 1.45em;
}

.zen-view-body li {
    margin-bottom: 0.45em;
    line-height: 1.62;
}

.zen-view-body pre {
    background: #fffdf8;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.zen-view-body code {
    background: #ece7dc;
    border-radius: 4px;
}

.zen-view-body blockquote {
    border-left: 3px solid #9b886e;
    padding-left: 16px;
    color: #655d53;
}

.zen-view-body a {
    color: var(--link);
    text-decoration-color: rgba(63, 102, 121, 0.35);
    background: rgba(63, 102, 121, 0.08);
}

.zen-view-body a:hover {
    color: #315669;
    text-decoration-color: rgba(63, 102, 121, 0.7);
    background: rgba(63, 102, 121, 0.14);
}

.zen-back:focus-visible,
.zen-cycle-btn:focus-visible,
.zen-edit:focus-visible,
.zen-view-body a:focus-visible {
    outline: 2px solid #7d9fb2;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .zen-content {
        padding: 24px 16px 96px;
    }

    .zen-view-title {
        font-size: 30px;
        line-height: 1.15;
    }

    .zen-view-body {
        font-size: 16px;
        line-height: 1.7;
    }

    .zen-header {
        gap: 8px;
        padding: 10px 12px;
    }

    .zen-status {
        display: none;
    }
}

.org-fold {
    margin: 0;
    border: none;
}

.org-fold + .org-fold {
    margin-top: 0.5em;
}

.org-fold-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.25em 0;
}

.org-fold-summary::-webkit-details-marker {
    display: none;
}

.org-fold-summary::after {
    content: '▾';
    font-size: 0.9em;
    color: #9a8a7a;
    flex-shrink: 0;
    transition: transform 0.15s ease;
    margin-left: 0.5em;
}

.org-fold:not([open]) > .org-fold-summary::after {
    transform: rotate(-90deg);
}

.org-fold-summary h1,
.org-fold-summary h2,
.org-fold-summary h3,
.org-fold-summary h4,
.org-fold-summary h5,
.org-fold-summary h6 {
    margin: 0;
    display: inline;
    letter-spacing: -0.01em;
}

/* Typography hierarchy - size, weight, and underlines distinguish levels */

/* Level 1: Major sections - big and bold with underline */
.org-fold-summary h1 {
    font-size: 1.75em;
    font-weight: 700;
    color: #1a1815;
    letter-spacing: -0.02em;
    text-decoration: underline;
    text-decoration-color: rgba(139, 115, 85, 0.4);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
}

.org-fold[data-level="1"] {
    margin-top: 2.5em;
}

.org-fold[data-level="1"]:first-child {
    margin-top: 0;
}

/* Level 2: Clear subsections with subtle underline */
.org-fold-summary h2 {
    font-size: 1.35em;
    font-weight: 600;
    color: #2a2520;
    text-decoration: underline;
    text-decoration-color: rgba(139, 115, 85, 0.25);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.org-fold[data-level="2"] {
    margin-top: 1.75em;
}

/* Level 3: Smaller with very subtle underline */
.org-fold-summary h3 {
    font-size: 1.15em;
    font-weight: 600;
    color: #3a3530;
    text-decoration: underline;
    text-decoration-color: rgba(139, 115, 85, 0.15);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.org-fold[data-level="3"] {
    margin-top: 1.25em;
}

/* Level 4: Body-sized, bold, no underline */
.org-fold-summary h4 {
    font-size: 1em;
    font-weight: 600;
    color: #4a4540;
}

.org-fold[data-level="4"] {
    margin-top: 1em;
}

/* Level 5-6: Subtle, collapsed by default, with background */
.org-fold-summary h5,
.org-fold-summary h6 {
    font-size: 0.95em;
    font-weight: 600;
    color: #5a5550;
}

.org-fold[data-level="5"],
.org-fold[data-level="6"] {
    margin-top: 0.75em;
    background: rgba(139, 115, 85, 0.06);
    border-radius: 6px;
    padding: 4px 10px 4px 10px !important;
}

/* Quote blocks */
.org-quote {
    margin: 1em 0;
    padding: 0.75em 1em;
    border-left: 4px solid #8b7355;
    background: rgba(139, 115, 85, 0.08);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #5a5550;
}

.org-quote p {
    margin: 0.5em 0;
}

.org-quote p:first-child {
    margin-top: 0;
}

.org-quote p:last-child {
    margin-bottom: 0;
}

/* Aside drawer - collapsible supplementary content */
.org-aside {
    margin: 0.75em 0;
    background: rgba(139, 115, 85, 0.06);
    border-radius: 6px;
    padding: 4px 10px 0 10px;
}

.org-aside-summary {
    cursor: pointer;
    list-style: none;
    font-family: 'Iosevka SS14 Web', sans-serif;
    font-size: 0.95em;
    font-weight: 600;
    color: #5a5550;
    padding: 0 0 4px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.org-aside-summary::-webkit-details-marker {
    display: none;
}

.org-aside-summary::after {
    content: '▸';
    font-size: 0.9em;
    color: #9a8a7a;
    transition: transform 0.15s ease;
}

.org-aside[open] > .org-aside-summary::after {
    transform: rotate(90deg);
}

.org-aside-content {
    padding: 0.5em 0;
}

.org-fold-summary:hover {
    color: #2a2520;
}

/* Flat structure - no indentation, typography conveys hierarchy */
.org-fold .org-fold {
    margin-left: 0;
    padding-left: 0;
}

/* Image grid for consecutive images */
.org-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    align-items: flex-start;
}

/* Make captioned wrappers stretch to full height */
.org-image-grid .org-image-wrapper {
    align-self: stretch;
}

/* Only style unwrapped images directly in grids (not in wrappers) */
.zen-view-body .org-image-grid > img.org-image {
    margin: 0;
    width: calc(50% - 4px);
    height: auto;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 0 1px rgba(0,0,0,0.35), 0 3px 10px rgba(0,0,0,0.12);
    flex-shrink: 0;
}

/* Mobile: larger images in grid */
@media (max-width: 480px) {
    .org-image-grid {
        gap: 6px;
    }
    
    .org-image-grid .org-image-wrapper {
        width: calc(50% - 3px);
    }
}

/* Captioned image wrapper */
.org-image-wrapper {
    display: inline-block;
    margin: 0;
}

.org-image-wrapper img.org-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 0 1px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    margin: 0;
    flex-shrink: 0;
}

.org-image-wrapper img.org-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.org-image-caption {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted, #666);
    text-align: center;
    margin: 8px 0 0;
    line-height: 1.4;
}

.org-image-grid .org-image-wrapper {
    width: calc(50% - 4px);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    /* Override inline-block */
    display: flex !important;
}

.org-image-grid .org-image-wrapper img.org-image {
    width: 100%;
    height: auto !important;
    max-height: none !important;
    object-fit: contain;
    margin: 0;
}

.org-image-grid .org-image-caption {
    font-size: 0.8em;
    margin-top: 4px;
}

/* Single images (not in grid, not in wrapper) - uncaptioned */
.zen-view-body p > img.org-image:only-child,
.zen-view-body > img.org-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 16px 0;
    display: block;
    box-shadow: 0 0 1px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.zen-view-body p > img.org-image:only-child:hover,
.zen-view-body > img.org-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Captioned single image wrapper */
.zen-view-body p > .org-image-wrapper:only-child {
    margin: 0;
}

.zen-view-body p:not(:empty) {
    margin: 16px 0;
}

.org-image-grid + .org-image-grid {
    margin-top: -8px;
}

/* Image modal */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #000;
}

.image-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

html.modal-open,
html.modal-open body {
    overflow: hidden;
}

.image-modal-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 80px;
    background: #000;
}

.image-modal-img {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    border-radius: 4px;
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    pointer-events: none;
}

.image-modal-img.active {
    opacity: 1;
    position: relative;
    transform: translateX(0);
    pointer-events: auto;
}

.image-modal-img.slide-left {
    transform: translateX(-30px);
}

.image-modal-img.slide-right {
    transform: translateX(30px);
}

.image-modal-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-modal-nav:hover {
    background: rgba(255,255,255,0.4);
}

/* Modal caption */
.image-modal-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    text-align: center;
    color: white;
    font-size: 1rem;
    line-height: 1.5;
    padding: 12px 24px;
    background: rgba(0,0,0,0.7);
    border-radius: 6px;
    margin-top: 16px;
    backdrop-filter: blur(4px);
    z-index: 1002;
}

.image-modal-caption:empty {
    display: none;
}

.image-modal-prev {
    left: 16px;
}

.image-modal-next {
    right: 16px;
}

/* Mobile modal improvements */
@media (max-width: 720px) {
    .image-modal-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        padding: 0;
        gap: 0;
    }

    .image-modal-img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        flex: 1 1 auto;
        min-height: 0;
    }

    .image-modal-img.active {
        position: relative;
        opacity: 1;
        transform: none;
    }

    .image-modal-img.slide-left,
    .image-modal-img.slide-right {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .image-modal-caption {
        position: absolute;
        top: 78%;
        left: 50%;
        transform: translateX(-50%);
        bottom: auto;
        margin: 0;
        font-size: 0.9rem;
        padding: 8px 20px;
        max-width: 90%;
        background: rgba(0,0,0,0.5);
        color: #fff;
        text-shadow: 0 1px 4px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.5);
        border-radius: 4px;
        backdrop-filter: none;
        z-index: 1002;
    }

    .image-modal-prev,
    .image-modal-next {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }

    .image-modal-prev {
        left: 6px;
    }

    .image-modal-next {
        right: 6px;
    }

    .image-modal-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
        top: 12px;
        right: 12px;
    }
}

.zen-view-body video.org-video {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 16px 0;
    display: block;
    background: #000;
}

.zen-view-body audio.org-audio {
    width: 100%;
    margin: 16px 0;
    display: block;
}

.zen-view-body .org-pdf-preview {
    margin: 16px 0;
}

/* Table styling */
.org-table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 6px;
    -webkit-overflow-scrolling: touch;
}

.org-table {
    min-width: max-content;
    border-collapse: collapse;
    font-family: 'Iosevka SS14 Web', 'SF Mono', monospace;
    font-size: 14px;
    border: 1px solid #e0dcd0;
    background: #fffef8;
}

.org-table th,
.org-table td {
    padding: 8px 12px;
    border: 1px solid #e0dcd0;
    text-align: left;
}

.org-table th {
    background: #f0ede5;
    font-weight: 600;
    color: #4a4035;
}

.org-table tr:nth-child(even) td {
    background: #faf9f4;
}

.org-table tr:hover td {
    background: #f5f3ea;
}

.zen-view-body .org-pdf-frame {
    width: 100%;
    height: 400px;
    border: 1px solid #e6e6e0;
    border-radius: 6px;
    display: block;
}

.zen-view-body .org-pdf-link {
    display: block;
    margin-top: 8px;
    font-size: 14px;
}

/* Property drawer display - compact vertical badges */
.org-properties-details {
    margin: 8px 0 16px 0;
}

.org-properties-summary {
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 11px;
    font-weight: 500;
    color: #8b7355;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.org-properties-summary::-webkit-details-marker {
    display: none;
}

.org-properties-summary::before {
    content: '▸ ';
    font-size: 10px;
}

.org-properties-details[open] .org-properties-summary::before {
    content: '▾ ';
}

.org-properties-summary:hover {
    color: #6b5a42;
}

.org-properties-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 0 0;
    padding: 0;
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 12px;
    background: transparent;
    border: none;
}

.org-property-line {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.org-property-key {
    display: inline-block;
    padding: 2px 6px;
    background: #6b5a42;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px 0 0 3px;
    min-width: 60px;
    text-align: right;
}

.org-property-value {
    display: inline-block;
    padding: 2px 8px;
    background: #f0ede5;
    color: #4a4035;
    font-size: 12px;
    border-radius: 0 3px 3px 0;
    border: 1px solid #e0dcd0;
    border-left: none;
}

.zen-view-body .html-embed {
    max-width: 100%;
    overflow: hidden;
    margin: 16px 0;
}

.zen-view-body .html-embed iframe {
    max-width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    border-radius: 6px;
}

/* Maps embed */
.zen-view-body .maps-embed {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #d4d4c8;
    background: #f8f8f4;
}

.zen-view-body .maps-iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #e8e8e0;
}

.zen-view-body .maps-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.zen-view-body .maps-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 14px;
    font-family: 'Iosevka SS14 Web', sans-serif;
}

.zen-view-body .maps-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #3d5a3d;
    text-decoration: none;
    font-size: 14px;
    font-family: 'Iosevka SS14 Web', sans-serif;
    background: linear-gradient(135deg, #e8f5e8 0%, #dceadc 100%);
    border-top: 1px solid #c8d8c8;
    transition: background 0.2s;
}

.zen-view-body .maps-link:hover {
    background: linear-gradient(135deg, #dceadc 0%, #d0e0d0 100%);
}

.zen-view-body .maps-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #4a7c4a;
}

.zen-view-body .maps-text {
    flex: 1;
    font-weight: 500;
}

.zen-view-body .maps-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

@media (max-width: 480px) {
    .zen-view-body .maps-iframe-container {
        padding-bottom: 75%; /* Taller on mobile */
    }
}

@media (max-width: 720px) {
    .zen-content {
        padding: 32px 20px 80px;
    }
    .zen-view-title { font-size: 24px; }
    .zen-view-body { font-size: 17px; }

    .zen-view-body .html-embed iframe {
        width: 100% !important;
        height: auto !important;
        min-height: 300px;
    }
    
    /* Single images smaller on mobile (not in grid or wrapper) */
    .zen-view-body p > img.org-image:only-child,
    .zen-view-body > img.org-image {
        max-width: 60%;
    }
    
    /* Grid wrappers: flex to fill row on mobile */
    .org-image-grid .org-image-wrapper {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }

    /* Images inside wrappers: fill the wrapper */
    .org-image-grid .org-image-wrapper img.org-image {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Direct grid images (not in wrapper): 50% of grid */
    .org-image-grid > img.org-image {
        max-width: calc(50% - 4px) !important;
        width: calc(50% - 4px) !important;
    }
    
    .org-image-grid .org-image-caption {
        font-size: 0.75em;
        margin-top: 3px;
    }
}

/* Backlinks */
.zen-backlinks {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px dashed #d0c8c0;
}

.zen-backlinks-title {
    font-family: 'Iosevka SS14', monospace;
    font-size: 12px;
    font-weight: 500;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 12px 0;
}

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

.zen-backlinks-list li {
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid #eae5e0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.zen-backlinks-list a {
    font-size: 15px;
    color: #6b5a4a;
    text-decoration: none;
}

.zen-backlinks-list a:hover {
    color: #4a3a2a;
    text-decoration: underline;
}

.backlink-date {
    font-family: 'Iosevka SS14', monospace;
    font-size: 12px;
    color: #999;
}

/* TODO states and priorities */
.org-todo, .org-doing, .org-done, .org-waiting, .org-next {
    display: inline-block;
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
    margin-right: 4px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.org-todo:hover, .org-doing:hover, .org-done:hover, .org-waiting:hover, .org-next:hover {
    opacity: 0.85;
}

.org-todo:active, .org-doing:active, .org-done:active, .org-waiting:active, .org-next:active {
    transform: scale(0.95);
}

.org-todo {
    background: #dc3545;
    color: #fff;
}

.org-done {
    background: #28a745;
    color: #fff;
}

.org-waiting {
    background: #ffc107;
    color: #333;
}

.org-next {
    background: #17a2b8;
    color: #fff;
}

.org-doing {
    background: #fd7e14;
    color: #fff;
}

.org-priority {
    display: inline-block;
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}

.org-priority-a {
    background: #ff6b6b;
    color: #fff;
}

.org-priority-b {
    background: #ffd93d;
    color: #333;
}

.org-priority-c {
    background: #6bcb77;
    color: #fff;
}

/* Completed headings get muted styling */
.org-fold-done > .org-fold-summary h1,
.org-fold-done > .org-fold-summary h2,
.org-fold-done > .org-fold-summary h3,
.org-fold-done > .org-fold-summary h4,
.org-fold-done > .org-fold-summary h5,
.org-fold-done > .org-fold-summary h6 {
    text-decoration: line-through;
    color: #888;
}

/* Checkbox lists */
.org-checklist {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

.org-checklist .org-checklist {
    margin-left: 24px;
}

.org-checkbox {
    font-size: 18px;
    color: #8b7355;
    user-select: none;
    background: none;
    border: none;
    padding: 2px 6px;
    margin: -2px 2px -2px -6px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    vertical-align: middle;
}

.org-checkbox:hover {
    background: rgba(139, 115, 85, 0.1);
}

.org-checkbox:active {
    transform: scale(0.9);
}

.org-checkbox-checked {
    color: #28a745;
}

.org-checkbox-partial {
    color: #ffc107;
}

.org-checkbox-item {
    padding: 4px 0;
    line-height: 1.5;
}

.org-checkbox-item-done {
    color: #888;
    text-decoration: line-through;
}

.org-checkbox-item-done .org-checkbox {
    color: #28a745;
}

/* LLM Conversation blocks */
.llm-message {
    margin: 0 0 16px 0;
    padding: 12px 16px;
    border-left: 3px solid;
}

.llm-tool {
    margin-bottom: 16px;
}

/* Remove bottom margin when followed by another LLM block */
.llm-message + .llm-message,
.llm-message + .llm-tool,
.llm-tool + .llm-message,
.llm-tool + .llm-tool {
    margin-top: 0;
}

.llm-message:has(+ .llm-message),
.llm-message:has(+ .llm-tool),
.llm-tool:has(+ .llm-message),
.llm-tool:has(+ .llm-tool) {
    margin-bottom: 0;
}

.llm-message:first-child,
.llm-tool:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.llm-message:last-child,
.llm-tool:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* When user/assistant/tool blocks are adjacent, join them */
.llm-message + .llm-message,
.llm-message + .llm-tool,
.llm-tool + .llm-message,
.llm-tool + .llm-tool {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.llm-user {
    background: #fefefe;
    border-left-color: #9080c0;
}

.llm-assistant {
    background: #fefefe;
    border-left-color: #50a8b8;
}

.llm-role {
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ececec;
    opacity: 0.7;
}

.llm-user .llm-role {
    color: #9080c0;
}

.llm-assistant .llm-role {
    color: #50a8b8;
}

.llm-content {
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Tool blocks - collapsible */
.llm-tool {
    margin: 0;
    border: none;
    border-left: 3px solid #a0a0a8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #fafafa;
}

.llm-tool-summary {
    padding: 12px 16px;
    cursor: pointer;
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 13px;
    display: block;
    user-select: none;
    list-style: none;
}

.llm-tool-summary::-webkit-details-marker {
    display: none;
}

.llm-tool-call-line {
    display: block;
    position: relative;
    padding-right: 24px;
}

.llm-tool-summary .llm-tool-name {
    font-weight: 600;
    color: #5a5068;
    display: block;
    margin-bottom: 4px;
}

.llm-tool-summary .llm-tool-arrow {
    position: absolute;
    top: 0;
    right: 0;
    color: #9a8a7a;
    font-size: 0.9em;
    transition: transform 0.15s ease;
}

.llm-tool[open] > .llm-tool-summary .llm-tool-arrow {
    transform: rotate(90deg);
}

.llm-tool-role {
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #808088;
    display: block;
    margin-bottom: 4px;
    opacity: 0.7;
}

.llm-tool-args-table {
    border-collapse: collapse;
    font-size: 12px;
    margin-left: 16px;
}

.llm-tool-arg-key {
    color: #808088;
    padding-right: 12px;
    padding-top: 1px;
    padding-bottom: 1px;
    white-space: nowrap;
    vertical-align: top;
}

.llm-tool-arg-val {
    color: #555;
    padding-top: 1px;
    padding-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

@media (min-width: 600px) {
    .llm-tool-arg-val {
        max-width: 400px;
    }
}

.llm-tool-content {
    margin: 8px 16px 12px;
    padding: 10px 12px;
    background: #f5f5f3;
    border: 1px solid #e0ddd8;
    border-radius: 4px;
}

.llm-tool-content pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}


.llm-content code {
    background: #eff5fb;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.llm-content pre code {
    display: block;
    padding: 12px;
    overflow-x: auto;
}

/* DEADLINE and SCHEDULED planning lines */
.org-planning {
    padding: 4px 0 8px 0;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.org-deadline,
.org-scheduled {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.org-deadline-label {
    font-family: 'Iosevka SS14 Web', monospace;
    font-weight: 600;
    font-size: 11px;
    color: #c62828;
}

.org-scheduled-label {
    font-family: 'Iosevka SS14 Web', monospace;
    font-weight: 600;
    font-size: 11px;
    color: #2e7d32;
}

.org-timestamp {
    font-family: 'Iosevka SS14 Web', monospace;
    font-size: 12px;
    color: #666;
    background: #f5f3e8;
    padding: 2px 6px;
    border-radius: 4px;
}

.org-deadline .org-timestamp {
    background: #ffebee;
    color: #c62828;
}

.org-scheduled .org-timestamp {
    background: #e8f5e9;
    color: #2e7d32;
}
