:root {
    --bg-color: #FFFFFF;
    --page-bg: #F5F5F5;
    --text-main: #333333;
    --text-light: #6B7280;
    --accent-teal: #006064;
    --element-silver: #E5E7EB;
    --code-bg: #F3F4F6;
    /* Short pages use the narrow card; posts get enough room for 100-column code */
    --width-narrow: 680px;
    --width-wide: 880px;
    --card-padding-x: 30px;
}

* {
    box-sizing: border-box;
}

/* Reserve the scrollbar's space on every page, so short pages and long posts
   have the same width and the nav doesn't shift between them */
html {
    scrollbar-gutter: stable;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--page-bg);
    color: var(--text-main);
    margin: 0;
}

.page {
    padding: 60px 16px 30px 16px;
    display: flex;
    justify-content: center;
}

/* CARD */
main {
    background: var(--bg-color);
    width: 100%;
    max-width: var(--width-narrow);
    min-width: 0; /* lets wide code blocks scroll instead of stretching the card */
    padding: 40px var(--card-padding-x);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

main.wide {
    max-width: var(--width-wide);
}

/* Centred column for short pages (linktree, 404) inside the full-width card */
.narrow {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

/* HEADER */
.site-header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--element-silver);
    padding: 0 16px;
}

/* Full width, so the nav links stay put whatever the card width */
.site-nav {
    padding: 20px var(--card-padding-x);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.site-nav a.site-name {
    color: var(--text-main);
}

.site-nav-links {
    display: flex;
    gap: 20px;
}

.site-nav a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--accent-teal);
}

/* INTRO */
.intro {
    text-align: center;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 2px solid var(--accent-teal);
    object-fit: cover;
    margin-bottom: 16px;
}

h1 {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 5px 0;
    letter-spacing: -0.5px;
}

.title-sub {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-teal);
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
}

.bio {
    color: var(--text-light);
    font-size: 15px;
    line-height: 1.5;
    margin: 20px 0 0 0;
}

hr {
    border: none;
    border-top: 1px solid var(--element-silver);
    margin: 32px 0;
}

/* LINK BUTTONS */
ul.links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

ul.links a {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--element-silver);
    color: var(--text-main);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
}

ul.links a:hover,
ul.links a:focus-visible {
    border-color: var(--accent-teal);
    background: var(--accent-teal);
    color: #FFFFFF;
    outline: none;
}

/* POST LISTS */
h2.section-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0 0 16px 0;
}

ul.posts {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

ul.posts li {
    display: flex;
    gap: 16px;
    align-items: baseline;
}

ul.posts a {
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

ul.posts a:hover,
ul.posts a:focus-visible {
    color: var(--accent-teal);
}

.meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
}

.empty {
    color: var(--text-light);
    margin: 0;
}

/* POST */
.post-header h1 {
    font-size: 32px;
    line-height: 1.2;
    margin-bottom: 10px;
}

.prose {
    font-size: 17px;
    line-height: 1.7;
    overflow-wrap: break-word;
}

/* Larger text keeps the line length readable in the wide card */
main.wide .prose {
    font-size: 18px;
}

.prose > :first-child {
    margin-top: 0;
}

.prose h2,
.prose h3 {
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.3;
    margin: 40px 0 12px 0;
}

.prose h2 {
    font-size: 24px;
}

.prose h3 {
    font-size: 19px;
}

.prose a {
    color: var(--accent-teal);
    text-underline-offset: 2px;
}

.prose code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.35em;
}

.prose pre {
    background: var(--code-bg) !important;
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
}

.prose pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.prose blockquote {
    border-left: 2px solid var(--accent-teal);
    margin: 0;
    padding-left: 16px;
    color: var(--text-light);
}

.prose img {
    max-width: 100%;
    height: auto;
}

/* Required by Zola's syntax highlighter */
.giallo-l {
    display: inline-block;
    min-height: 1lh;
    width: 100%;
}

.giallo-ln {
    display: inline-block;
    user-select: none;
    margin-right: 0.4em;
    padding: 0.4em;
    min-width: 3ch;
    text-align: right;
    opacity: 0.8;
}

footer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 32px;
    text-align: center;
}

/* PHONES: give the text the full screen width */
@media (max-width: 600px) {
    :root {
        --card-padding-x: 18px;
    }

    .page {
        padding: 24px 0 30px 0;
    }

    .site-header {
        padding: 0;
    }
}
