@tailwind base;
@tailwind components;
@tailwind utilities;

/* Hide scrollbar for Chrome, Safari and Opera */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Selection Highlight Color */
::selection {
    background-color: #c7d2fe; /* indigo-200 */
    color: #1e1b4b; /* indigo-950 */
}

.dark ::selection {
    background-color: #4338ca; /* indigo-700 */
    color: #e0e7ff; /* indigo-100 */
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Contenteditable Placeholder */
[contenteditable]:empty:before {
    content: attr(placeholder);
    color: #9ca3af; /* gray-400 */
    cursor: text;
}

.dark [contenteditable]:empty:before {
    color: #4b5563; /* gray-600 */
}

/* Ensure focus outline is removed but cursor is visible */
[contenteditable]:focus {
    outline: none;
}

/* Fix for tailwind typography in contenteditable */
.prose :where(p):not(:where([class~="not-prose"] *)) {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose :where(h2):not(:where([class~="not-prose"] *)) {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

/*
   标题使用 rem 单位，固定大小，不随编辑器基准字号(body size)变化
   这样调整"字号"时仅影响正文，符合用户对"设置正文大小"的预期
*/
.prose :where(h1) {
    font-size: 2.25rem;
    line-height: 1.3;
}

.prose :where(h2) {
    font-size: 1.875rem;
    line-height: 1.35;
}

.prose :where(h3) {
    font-size: 1.5rem;
    line-height: 1.4;
}

/* 正文使用 em，跟随编辑器容器的 font-size 设置 */
.prose :where(p), .prose :where(ul), .prose :where(ol) {
    font-size: 1em;
    line-height: 1.75;
}