/* Base & Layout */
body {
    font-family: "Inter", system-ui, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
}

:root {
    --bg: #fdfdfd;
    --text: #111;
    --link: #1a73e8;
    --link-hover: #0c47b7;
    --accent: #ff4081;
    --highlight: #ffd740;
    --code-bg: #f5f5f5;
    --border: #ddd;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111;
        --text: #eee;
        --link: #8ab4f8;
        --link-hover: #aecbfa;
        --accent: #ff79b0;
        --highlight: #ffeb70;
        --code-bg: #222;
        --border: #333;
    }
}

header {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

main {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

footer {
    margin: 2rem auto;
    margin-top: 2rem;
    padding: 0 1rem;
    max-width: 900px;
    font-size: 0.8rem;
    color: #999;
    text-align: right;
}

/* Title */
.title#title {
    font-size: 2.4rem;
    font-weight: 700;
    text-align: center;
    margin: 2rem 0;
    color: var(--text);
}

/* TODO/DONE keywords */
.todo-keyword {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    line-height: 1;
}

.todo-keyword.TODO {
    background: var(--accent);
    color: #fff;
}

.todo-keyword.DONE {
    background: #4caf50;
    color: #fff;
}

/* Priority */
.priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: var(--highlight);
    color: #000;
    line-height: 1;
}

/* Tags (chips) */
.tags {
    margin-left: auto; /* push tags to right edge of heading */
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--code-bg);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1;
}

/* Verse blocks */
pre.verse {
    font-style: italic;
    background: var(--code-bg);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Fixed width blocks (like output) */
pre.fixed-width {
    background: var(--code-bg);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-family: "Fira Code", monospace;
    overflow-x: auto;
}

/* Headings */
h1, h2, h3, h4 {
    display: flex;
    align-items: center; /* vertical alignment */
    gap: 0.4rem;
    flex-wrap: wrap; /* prevent overflow */
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

/* Paragraphs */
p { margin-bottom: 1rem; }

/* Lists */
ul, ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

li { margin-bottom: 0.5rem; }

/* Links */
a {
    color: var(--link);
    text-decoration: none;
}
a:hover { color: var(--link-hover); text-decoration: underline; }

/* Code blocks & inline code */
pre, code.hljs {
    background-color: var(--code-bg);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: "Fira Code", monospace;
}

code.hljs {
    padding: 0 !important;
}

code.inline-code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: "Fira Code", monospace;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

table, th, td {
    border: 1px solid var(--border);
}

th, td {
    padding: 0.5rem 1rem;
    text-align: left;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    margin: 0.2rem 0;
    border-radius: 4px;
    border: 1px solid transparent;
    text-decoration: none;
    color: #fff;
    background-color: #666;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn.small { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
.btn.disabled { opacity: 0.5; pointer-events: none; }
.btn.primary { background-color: var(--accent); }
.btn.highlight { background-color: var(--highlight); color: #000; }

/* Blockquote */
blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    color: var(--text);
    margin: 1rem 0;
    font-style: italic;
}

/* Footnotes */
.footnote-definition {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footnote-definition .footdef {
    margin-left: 1rem;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 6px;
}

/* Videos */
video {
    max-width: 100%;
    border-radius: 6px;
    margin: 1rem 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    header { padding: 0 0.5rem; }
    main { padding: 0 0.5rem; }
    footer { padding: 0 0.5rem; }
}
