/* ==========================================================================
   Markdown 扩展样式 —— 洛谷 / GFM 兼容
   - .luogu-container  折叠容器（::::success / ::::successopen）
   - .luogu-alert      GFM 提示块（> [!NOTE] 等）
   兼容明暗双主题（Hydro 使用 html.dark / [data-theme="dark"]）
   ========================================================================== */

/* ---------- 折叠容器 ---------- */
.luogu-container {
    margin: 1em 0;
    border: 1px solid var(--sui-border, #e4e7ec);
    border-radius: 10px;
    background: var(--sui-card-bg, #fff);
    overflow: hidden;
}

.luogu-container__summary {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.6em 1em;
    font-weight: 600;
    font-size: 0.95em;
    color: var(--sui-title, #1d293d);
    cursor: pointer;
    user-select: none;
    list-style: none;
    background: var(--sui-muted-bg, #f4f5f7);
    transition: background-color 0.15s ease;
}

.luogu-container__summary::-webkit-details-marker {
    display: none;
}

/* 自绘展开箭头 */
.luogu-container__summary::before {
    content: '';
    flex: none;
    width: 0.6em;
    height: 0.6em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

.luogu-container[open] > .luogu-container__summary::before {
    transform: rotate(45deg);
}

.luogu-container__summary:hover {
    background: var(--sui-muted-bg-hover, #eceef2);
}

.luogu-container__body {
    padding: 0.25em 1em 0.75em;
}

/* 内部首个/末个元素收紧间距 */
.luogu-container__body > :first-child {
    margin-top: 0.5em;
}

.luogu-container__body > :last-child {
    margin-bottom: 0.5em;
}

/* 配色：每种类型一条左边框 + 标题色 */
.luogu-container--success { border-color: #a7d8b4; }
.luogu-container--success > .luogu-container__summary { color: #1e7b3c; background: #eefaf1; }

.luogu-container--info { border-color: #a8c8ee; }
.luogu-container--info > .luogu-container__summary { color: #1a5fa8; background: #eef5fd; }

.luogu-container--tip { border-color: #9ed8cf; }
.luogu-container--tip > .luogu-container__summary { color: #10716a; background: #edfaf8; }

.luogu-container--warning { border-color: #ecd48f; }
.luogu-container--warning > .luogu-container__summary { color: #8a6100; background: #fdf8e8; }

.luogu-container--danger { border-color: #f0a9a9; }
.luogu-container--danger > .luogu-container__summary { color: #a11d1d; background: #fdeeee; }

.luogu-container--primary { border-color: #a8c8ee; }
.luogu-container--primary > .luogu-container__summary { color: #1a5fa8; background: #eef5fd; }

.luogu-container--secondary { border-color: #d3d6dc; }
.luogu-container--secondary > .luogu-container__summary { color: #4a5568; background: #f4f5f7; }

/* ---------- GFM 提示块 ---------- */
.luogu-alert {
    margin: 1em 0;
    padding: 0.75em 1em;
    border: 1px solid var(--sui-border, #e4e7ec);
    border-left-width: 4px;
    border-radius: 8px;
    background: var(--sui-card-bg, #fff);
}

.luogu-alert__title {
    display: flex;
    align-items: center;
    gap: 0.4em;
    margin: 0 0 0.35em;
    font-weight: 600;
    font-size: 0.95em;
}

.luogu-alert__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    color: inherit;
}

.luogu-alert__icon svg {
    width: 1em;
    height: 1em;
    display: block;
}

.luogu-alert__body > :first-child { margin-top: 0; }
.luogu-alert__body > :last-child { margin-bottom: 0; }

/* NOTE — 蓝 */
.luogu-alert--note { border-color: #a8c8ee; border-left-color: #2f7ed8; background: #f4f9fe; }
.luogu-alert--note .luogu-alert__title { color: #1a5fa8; }

/* TIP — 绿 */
.luogu-alert--tip { border-color: #a7d8b4; border-left-color: #2ea44f; background: #f2fbf5; }
.luogu-alert--tip .luogu-alert__title { color: #1e7b3c; }

/* IMPORTANT — 紫 */
.luogu-alert--important { border-color: #cdbdf0; border-left-color: #8250df; background: #f9f6ff; }
.luogu-alert--important .luogu-alert__title { color: #6639ba; }

/* WARNING — 黄 */
.luogu-alert--warning { border-color: #ecd48f; border-left-color: #d4a72c; background: #fefbf0; }
.luogu-alert--warning .luogu-alert__title { color: #8a6100; }

/* CAUTION — 红 */
.luogu-alert--caution { border-color: #f0a9a9; border-left-color: #d1242f; background: #fef3f3; }
.luogu-alert--caution .luogu-alert__title { color: #a11d1d; }

/* ---------- 暗色主题 ---------- */
html.dark .luogu-container,
[data-theme='dark'] .luogu-container,
html.dark .luogu-alert,
[data-theme='dark'] .luogu-alert {
    border-color: rgb(255 255 255 / 12%);
    background: var(--sui-card-bg, #1d293d);
}

html.dark .luogu-container__summary,
[data-theme='dark'] .luogu-container__summary {
    background: rgb(255 255 255 / 6%);
    color: var(--sui-title, #e8edf7);
}

html.dark .luogu-container__summary:hover,
[data-theme='dark'] .luogu-container__summary:hover {
    background: rgb(255 255 255 / 10%);
}

html.dark .luogu-container--success > .luogu-container__summary,
[data-theme='dark'] .luogu-container--success > .luogu-container__summary { color: #7ee2a0; background: rgb(46 164 79 / 16%); }
html.dark .luogu-container--info > .luogu-container__summary,
[data-theme='dark'] .luogu-container--info > .luogu-container__summary { color: #8fc3ff; background: rgb(47 126 216 / 16%); }
html.dark .luogu-container--tip > .luogu-container__summary,
[data-theme='dark'] .luogu-container--tip > .luogu-container__summary { color: #7fe0d0; background: rgb(16 113 106 / 20%); }
html.dark .luogu-container--warning > .luogu-container__summary,
[data-theme='dark'] .luogu-container--warning > .luogu-container__summary { color: #f5cf6a; background: rgb(212 167 44 / 16%); }
html.dark .luogu-container--danger > .luogu-container__summary,
[data-theme='dark'] .luogu-container--danger > .luogu-container__summary { color: #ff9b9b; background: rgb(209 36 47 / 16%); }
html.dark .luogu-container--primary > .luogu-container__summary,
[data-theme='dark'] .luogu-container--primary > .luogu-container__summary { color: #8fc3ff; background: rgb(47 126 216 / 16%); }
html.dark .luogu-container--secondary > .luogu-container__summary,
[data-theme='dark'] .luogu-container--secondary > .luogu-container__summary { color: #b9c1ce; background: rgb(255 255 255 / 6%); }

html.dark .luogu-alert--note,
[data-theme='dark'] .luogu-alert--note { background: rgb(47 126 216 / 12%); border-color: rgb(47 126 216 / 35%); }
html.dark .luogu-alert--tip,
[data-theme='dark'] .luogu-alert--tip { background: rgb(46 164 79 / 12%); border-color: rgb(46 164 79 / 35%); }
html.dark .luogu-alert--important,
[data-theme='dark'] .luogu-alert--important { background: rgb(130 80 223 / 14%); border-color: rgb(130 80 223 / 35%); }
html.dark .luogu-alert--warning,
[data-theme='dark'] .luogu-alert--warning { background: rgb(212 167 44 / 14%); border-color: rgb(212 167 44 / 35%); }
html.dark .luogu-alert--caution,
[data-theme='dark'] .luogu-alert--caution { background: rgb(209 36 47 / 14%); border-color: rgb(209 36 47 / 35%); }

html.dark .luogu-alert--note .luogu-alert__title,
[data-theme='dark'] .luogu-alert--note .luogu-alert__title { color: #8fc3ff; }
html.dark .luogu-alert--tip .luogu-alert__title,
[data-theme='dark'] .luogu-alert--tip .luogu-alert__title { color: #7ee2a0; }
html.dark .luogu-alert--important .luogu-alert__title,
[data-theme='dark'] .luogu-alert--important .luogu-alert__title { color: #c3a6ff; }
html.dark .luogu-alert--warning .luogu-alert__title,
[data-theme='dark'] .luogu-alert--warning .luogu-alert__title { color: #f5cf6a; }
html.dark .luogu-alert--caution .luogu-alert__title,
[data-theme='dark'] .luogu-alert--caution .luogu-alert__title { color: #ff9b9b; }

/* ---------- 折叠容器标题内的 SVG 图标 ---------- */
.luogu-container__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    color: currentColor;
}

.luogu-container__icon svg {
    width: 1em;
    height: 1em;
    display: block;
}

.luogu-container__title {
    min-width: 0;
}

/* 折叠容器扩展配色：note / tip 之外的补充 */
.luogu-container--note { border-color: #d3d6dc; }
.luogu-container--note > .luogu-container__summary { color: #4a5568; background: #f4f5f7; }

html.dark .luogu-container,
[data-theme='dark'] .luogu-container {
    border-color: rgba(255, 255, 255, .12);
    background: #1d293d;
}

html.dark .luogu-container__summary,
[data-theme='dark'] .luogu-container__summary {
    background: rgba(255, 255, 255, .05);
}

html.dark .luogu-container__summary:hover,
[data-theme='dark'] .luogu-container__summary:hover {
    background: rgba(255, 255, 255, .09);
}

html.dark .luogu-container > .luogu-container__summary,
[data-theme='dark'] .luogu-container > .luogu-container__summary {
    color: #e6edf7;
    background: rgba(255, 255, 255, .05);
}
