/* ================================================================
   Footnotes
   ================================================================ */

/* Inline reference — render as blue [1] superscript */
a.footnote-ref {
    /* color: var(--c-highlight); */
    text-decoration: underline;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
}

/* a.footnote-ref::before { content: '['; }
a.footnote-ref::after  { content: ']'; } */

a.footnote-ref:hover {
    text-decoration: underline;
}

/* Footnotes section at the bottom of a post */
.footnotes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--c-border);
    font-size: var(--fs-sm);
    color: var(--c-fg-muted);
}

.footnotes > hr { display: none; }

.footnotes ol {
    padding-left: 1.5rem;
}

.footnotes li {
    margin-bottom: 0.5rem;
    line-height: var(--lh-relaxed);
}

a.footnote-backref {
    color: var(--c-fg-muted);
    text-decoration: none;
    margin-left: 0.25rem;
}

a.footnote-backref:hover { color: var(--c-highlight); }

/* ----------------------------------------------------------------
   Tooltip — desktop hover popup
   ---------------------------------------------------------------- */
.fn-tooltip {
    position: fixed;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    max-width: 22rem;
    z-index: 200;
    font-size: var(--fs-sm);
    font-family: var(--font-body);
    line-height: var(--lh-relaxed);
    pointer-events: none;
    color: var(--c-fg);
}

.fn-tooltip[hidden] { display: none; }

.fn-tooltip-content p { margin: 0; }

/* ----------------------------------------------------------------
   Drawer — mobile tap popup
   ---------------------------------------------------------------- */
.fn-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.fn-drawer-overlay--active { opacity: 1; }
.fn-drawer-overlay[hidden] { display: none; }

.fn-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--c-bg);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.15);
    z-index: 200;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.2s ease;
}

.fn-drawer[hidden] { display: none; }
.fn-drawer--active { transform: translateY(0); }

.fn-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    background: var(--c-bg);
}

.fn-drawer-label {
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-fg-muted);
}

.fn-drawer-close {
    background: none;
    border: none;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--c-fg-muted);
    padding: 0.25rem 0.375rem;
    border-radius: 3px;
    transition: background 0.1s;
}

.fn-drawer-close:hover { background: var(--c-border); }

.fn-drawer-content {
    padding: 1.25rem;
    font-family: var(--font-body);
    font-size: var(--fs-md);
    line-height: var(--lh-relaxed);
    color: var(--c-fg);
}

.fn-drawer-content p { margin: 0; }

/* Hide drawer on desktop, tooltip on mobile */
@media (min-width: 897px) {
    .fn-drawer,
    .fn-drawer-overlay { display: none !important; }
}

@media (max-width: 896px) {
    .fn-tooltip { display: none !important; }
}
