"""Academic template — serif-based, paper-like layout for research reports."""

from nhandu.templates import Template, register

CSS = """
body {
    font-family: Georgia, 'Times New Roman', Times, serif;
    line-height: 1.8;
    max-width: 750px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    color: #2c2c2c;
    background: #fafaf8;
}
h1, h2, h3, h4, h5, h6 {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: normal;
    color: #1a1a1a;
    margin-top: 2em;
    margin-bottom: 0.5em;
}
h1 {
    font-size: 2rem;
    text-align: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}
h2 {
    font-size: 1.4rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.3em;
}
h3 { font-size: 1.15rem; font-style: italic; }
a { color: #6b4c9a; text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 1em 0; text-align: justify; }
pre {
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
    background: #f4f2ee;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 2px;
    overflow-x: auto;
    line-height: 1.5;
}
code {
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.88em;
    background: #f4f2ee;
    padding: 0.15rem 0.35rem;
    border-radius: 2px;
}
pre code {
    background: none;
    padding: 0;
}
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5em 0;
    font-size: 0.95em;
}
th, td {
    border: 1px solid #ccc;
    padding: 0.4rem 0.75rem;
    text-align: left;
}
th {
    background: #f0ede8;
    font-weight: 600;
}
tr:nth-child(even) {
    background: #faf9f6;
}
blockquote {
    border-left: 3px solid #9b8bb4;
    margin: 1.5em 0;
    padding: 0.5em 1.5em;
    color: #555;
    font-style: italic;
}
hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 2.5em 0;
}
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
}
.code-block {
    margin: 1.5rem 0;
}
.code-input {
    padding: 1rem;
    background: #f4f2ee;
    border: 1px solid #ddd;
    border-radius: 2px 2px 0 0;
    margin: 0;
}
.code-input pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}
.code-output {
    background: #faf9f6;
    border: 1px solid #ddd;
    border-top: none;
    padding: 1rem;
    border-radius: 0 0 2px 2px;
    margin: 0;
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
}
.error {
    color: #a94442;
    background: #f9f0f0;
    padding: 1rem;
    border: 1px solid #e8c8c8;
    border-radius: 2px;
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.85em;
}
.nhandu-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
    font-size: 0.8rem;
    color: #999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.nhandu-footer a {
    color: #6b4c9a;
    text-decoration: none;
}
.nhandu-footer a:hover {
    text-decoration: underline;
}
"""

register(
    Template(
        name="academic",
        description="Serif-based, paper-like layout for research reports",
        css=CSS,
    )
)
