/* ── Okuma yazı boyutu (kütüphane + Yazar Masası) ── */
.resource-reading-column {
    position: relative;
    --library-font-scale: 1;
    --library-font-rail-width: 2.65rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--library-font-rail-width);
    column-gap: clamp(0.65rem, 2vw, 1.15rem);
    align-items: start;
}

.resource-reading-column .resource-body {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    --library-font-scale: 1;
}

.library-article-shell {
    transform-origin: top left;
    will-change: transform;
}

.resource-body :where(p, li, span, div, td, th, blockquote, figcaption, a, strong, em, b, i, u) {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.resource-body pre,
.resource-body code {
    overflow-x: auto;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

.resource-body table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.resource-body :where(h1, h2, h3, h4, h5, h6) strong,
.resource-body :where(h1, h2, h3, h4, h5, h6) b {
    font-weight: 400;
}

.resource-body :where(p, li, span, div, td, th, em, strong, b, i, u, a) {
    font-size: inherit;
    line-height: inherit;
}

.resource-body *[style*="font-size"] {
    font-size: inherit !important;
}

.library-font-rail {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--site-header-height, 70px) + 0.75rem);
    z-index: 40;
    align-self: start;
    width: var(--library-font-rail-width);
    flex-shrink: 0;
}

.library-font-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--article-border, rgba(0, 0, 0, 0.15));
    border-radius: 0;
    overflow: hidden;
    background: #ffffff;
    box-shadow: none;
}

html[data-theme="dark"] .library-font-controls {
    background: #111111;
    border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .library-font-control + .library-font-control {
    border-top-color: rgba(255, 255, 255, 0.14) !important;
}

.library-font-control {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 2.35rem !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--article-ink, #000) !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-size: 0.72rem !important;
    font-weight: 300 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease;
}

html[data-theme="dark"] .library-font-control {
    color: rgba(255, 255, 255, 0.88) !important;
}

.library-font-control + .library-font-control {
    border-left: 0 !important;
    border-top: 1px solid var(--article-border, rgba(0, 0, 0, 0.15)) !important;
}

.library-font-control:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04) !important;
    transform: none !important;
    filter: none !important;
}

html[data-theme="dark"] .library-font-control:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06) !important;
}

.library-font-control--reset {
    font-size: 0.68rem !important;
}

.library-font-control:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Yazar Masası detay */
.writer-desk-detail__reading-wrap {
    max-width: calc(680px + var(--library-font-rail-width) + clamp(0.65rem, 2vw, 1.15rem));
    margin: 0 auto;
    padding: 0 1.35rem;
}

.writer-desk-detail__body .writer-desk-detail__content {
    max-width: none;
    margin: 0;
}

@media (max-width: 768px) {
    .resource-reading-column {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0;
    }

    .library-font-rail {
        position: fixed;
        left: 50%;
        right: auto;
        top: auto;
        bottom: max(1.15rem, calc(env(safe-area-inset-bottom) + 0.75rem));
        transform: translateX(-50%);
        z-index: 9995;
        width: auto;
        grid-column: 1;
    }

    .library-font-controls {
        flex-direction: row;
    }

    .library-font-control {
        width: 3.25rem !important;
        height: 3.25rem !important;
    }

    .library-font-control + .library-font-control {
        border-top: 0 !important;
        border-left: 1px solid var(--article-border, rgba(0, 0, 0, 0.15)) !important;
    }

    html[data-theme="dark"] .library-font-control + .library-font-control {
        border-left-color: rgba(255, 255, 255, 0.14) !important;
    }
}

@media (max-width: 480px) {
    .library-font-control {
        width: 3rem !important;
        height: 3rem !important;
    }
}

@media print {
    .library-font-rail {
        display: none !important;
    }

    .resource-reading-column {
        grid-template-columns: minmax(0, 1fr);
    }

    .resource-body,
    .library-article-shell {
        font-size: 12pt !important;
        transform: none !important;
        width: auto !important;
        min-height: 0 !important;
        --library-font-scale: 1 !important;
    }
}
