/**
 * 本地文件链接（file-link）样式
 *
 * 覆盖：详情页（.knowledge-content / #detailMain / #detailPanelMain）与编辑器（.ql-editor）
 * 与 kb-link 区分：kb-link 是站内知识跳转（蓝色超链图标），file-link 是本地文件（琥珀色文件图标）
 */

:root {
    --file-link-color: #b45309;          /* amber-700 */
    --file-link-color-hover: #92400e;    /* amber-800 */
    --file-link-bg-hover: rgba(180, 83, 9, 0.08);
    --file-link-border: rgba(180, 83, 9, 0.28);
}

[data-theme="dark"],
html.dark {
    --file-link-color: #fbbf24;          /* amber-400 */
    --file-link-color-hover: #fcd34d;    /* amber-300 */
    --file-link-bg-hover: rgba(251, 191, 36, 0.12);
    --file-link-border: rgba(251, 191, 36, 0.35);
}

a.file-link,
a.file-link:link,
a.file-link:visited {
    /* 覆盖 mobile.css 的全局 inline-flex，允许链接从前文后自然接续并在内部换行 */
    display: inline;
    color: var(--file-link-color);
    text-decoration: none;
    background-image: linear-gradient(transparent calc(100% - 1px), var(--file-link-border) 1px);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border-radius: 3px;
    padding: 1px 4px 1px 2px;
    margin: 0 1px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: normal;
    overflow-wrap: anywhere;
    /* 文件路径通常没有空格，逐字符断行才能利用当前行的剩余宽度 */
    word-break: break-all;
}

a.file-link::before {
    content: "\eceb"; /* ri-file-line */
    font-family: "remixicon" !important;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: inline-block;
    margin-right: 3px;
    font-size: 0.92em;
    vertical-align: -0.08em;
    opacity: 0.85;
}

a.file-link:hover {
    color: var(--file-link-color-hover);
    background-color: var(--file-link-bg-hover);
    background-image: linear-gradient(transparent calc(100% - 1px), var(--file-link-color-hover) 1px);
}

a.file-link:focus-visible {
    outline: 2px solid var(--file-link-color);
    outline-offset: 2px;
}

.ql-editor a.file-link {
    pointer-events: auto;
}
