/* =============================================================================
   Personal site — classic serif "reading document" theme.
   System serif (Georgia), warm paper, a narrow column, underlined links,
   hairline rules. No cards, no shadows, no animations.
   ========================================================================== */

:root {
    /* Light (default) — warm paper */
    --bg:        #fbf8f2;
    --text:      #211c16;
    --muted:     #6f665a;
    --faint:     #938a7c;
    --line:      #e2dacc;
    --accent:    #8a2f23;
    --accent-hover: #6f241b;
    --code-bg:   #f4efe4;
    --code-border: #e4ddce;

    /* code tokens (light) */
    --c-key:  #8a2f23;
    --c-str:  #5b6b2f;
    --c-num:  #7a4ea8;
    --c-com:  #9a907e;
    --c-fn:   #3f5d86;
    --c-type: #8a5a2f;

    --serif: Georgia, "Times New Roman", Times, "Noto Serif", serif;
    --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --measure: 42rem;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg:        #1a1712;
    --text:      #e9e3d6;
    --muted:     #9d9483;
    --faint:     #7c7464;
    --line:      #352f25;
    --accent:    #d68a6b;
    --accent-hover: #e6a98c;
    --code-bg:   #221e17;
    --code-border: #352f25;

    --c-key:  #d68a6b;
    --c-str:  #a3b06a;
    --c-num:  #c0a0e0;
    --c-com:  #847b6a;
    --c-fn:   #88a6d0;
    --c-type: #d6a878;

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg:        #1a1712;
        --text:      #e9e3d6;
        --muted:     #9d9483;
        --faint:     #7c7464;
        --line:      #352f25;
        --accent:    #d68a6b;
        --accent-hover: #e6a98c;
        --code-bg:   #221e17;
        --code-border: #352f25;
        --c-key:  #d68a6b;
        --c-str:  #a3b06a;
        --c-num:  #c0a0e0;
        --c-com:  #847b6a;
        --c-fn:   #88a6d0;
        --c-type: #d6a878;
        color-scheme: dark;
    }
}

/* ---- base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    width: 100%;
    max-width: var(--measure);
    margin-inline: auto;
    padding-inline: 1.4rem;
}

main { flex: 1 0 auto; padding-block: 2.5rem; }

::selection { background: var(--accent); color: var(--bg); }

img, svg { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.13em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.95rem; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.18rem; }

hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.4rem; }

/* A muted monospace caption used sparingly for dates/labels. */
.meta { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); letter-spacing: 0.01em; }

/* ---- header --------------------------------------------------------------- */
.site-header { padding-top: 2.6rem; }
.site-name {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.site-name:hover { color: var(--text); text-decoration: none; }
.site-tagline { color: var(--muted); font-style: italic; margin-top: 0.1rem; }
.nav { margin-top: 0.9rem; font-size: 1rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); text-decoration: underline; }
.nav a.is-active { color: var(--text); }
.nav .sep { color: var(--faint); margin-inline: 0.45rem; }
.site-header hr { margin-top: 1.4rem; margin-bottom: 0; }

/* ---- generic content ------------------------------------------------------ */
.lead { font-size: 1.28rem; line-height: 1.45; margin-bottom: 1.4rem; }

.content > * + * { margin-top: 1.1rem; }
.content h2 { margin-top: 2.2rem; }
.content h3 { margin-top: 1.7rem; }
.content p, .content li { line-height: 1.7; }
.content ul, .content ol { padding-left: 1.4rem; }
.content li + li { margin-top: 0.35rem; }
.content a { /* inherits underlined link */ }
.content img { border: 1px solid var(--line); margin-block: 1.6rem; }
.content strong { font-weight: 700; }

.content blockquote {
    border-left: 3px solid var(--line);
    padding-left: 1.1rem;
    margin-left: 0;
    color: var(--muted);
    font-style: italic;
}
.content blockquote .cite, .content blockquote cite {
    display: block; margin-top: 0.5rem; font-style: normal;
    font-family: var(--mono); font-size: 0.82rem; color: var(--faint);
}

/* page title block */
.page-title { margin-bottom: 1.6rem; }
.page-title h1 { margin-bottom: 0.4rem; }
.page-title .excerpt { color: var(--muted); font-size: 1.12rem; }

/* article header meta */
.article-meta { margin-top: 0.5rem; }
.article-meta .sep { color: var(--faint); margin-inline: 0.4rem; }

/* featured image */
.banner { margin: 1.6rem 0; }
.banner img { display: block; width: 100%; border: 1px solid var(--line); }

/* ---- simple lists (projects / posts) -------------------------------------- */
.section { margin-top: 2.4rem; }
.section > h2 { margin-bottom: 1rem; }

.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 1rem 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }

.item-title { font-size: 1.18rem; font-weight: 700; color: var(--text); text-decoration: none; }
.item-title:hover { color: var(--accent); text-decoration: underline; }
.item-date { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); margin-left: 0.6rem; }
.item-desc { color: var(--muted); margin-top: 0.25rem; }
.item-tech { color: var(--faint); font-style: italic; }
.item-links { margin-top: 0.4rem; font-size: 0.95rem; }
.item-links a { margin-right: 0.9rem; }
.item .star { color: var(--accent); }

/* ---- code ----------------------------------------------------------------- */
.code { margin: 1.6rem 0; }
.code-lang {
    font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--muted); margin-bottom: 0.35rem;
}
pre {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.86rem;
    line-height: 1.6;
    tab-size: 4;
}
pre code { font-family: inherit; color: var(--text); }

/* inline code */
.content :not(pre) > code, p > code, li > code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    padding: 0.05em 0.35em;
}

/* highlight.js tokens — restrained, theme-aware */
.hljs { color: var(--text); background: transparent; }
.hljs-comment, .hljs-quote { color: var(--c-com); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-meta-keyword { color: var(--c-key); }
.hljs-string, .hljs-regexp, .hljs-template-string { color: var(--c-str); }
.hljs-number, .hljs-literal, .hljs-symbol { color: var(--c-num); }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--c-fn); }
.hljs-title.class_, .hljs-type, .hljs-class .hljs-title { color: var(--c-type); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-property, .hljs-params { color: var(--text); }
.hljs-strong { font-weight: 700; }
.hljs-emphasis { font-style: italic; }

/* gallery / columns kept simple */
.columns { display: grid; gap: 1.2rem; }
@media (min-width: 36rem) { .columns.cols-2 { grid-template-columns: 1fr 1fr; } }
.gallery { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery img { width: 100%; border: 1px solid var(--line); }
figure { margin: 1.4rem 0; }
figcaption { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-top: 0.4rem; }

/* ---- pagination ----------------------------------------------------------- */
.pagination { margin-top: 2.4rem; font-family: var(--mono); font-size: 0.9rem; }
.pagination a, .pagination span { margin-right: 0.7rem; text-decoration: none; }
.pagination a { color: var(--accent); }
.pagination .current { color: var(--text); font-weight: 700; }
.pagination .disabled { color: var(--faint); }

/* ---- footer --------------------------------------------------------------- */
.site-footer { flex-shrink: 0; }
.site-footer .page { padding-block: 1.6rem 2.6rem; }
.site-footer hr { margin-bottom: 1.4rem; }
.footer-line { font-size: 0.95rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; align-items: baseline; justify-content: space-between; }
.footer-line .links a { margin-right: 1rem; }
.footer-line .meta { font-family: var(--mono); }
.theme-toggle {
    background: none; border: 0; padding: 0; cursor: pointer;
    font: inherit; color: var(--muted); text-decoration: underline; text-underline-offset: 0.13em;
}
.theme-toggle:hover { color: var(--accent); }

/* ---- misc ----------------------------------------------------------------- */
.notice { color: var(--muted); font-style: italic; }

.skip-link {
    position: absolute; left: 0.5rem; top: -3rem; z-index: 10;
    background: var(--accent); color: var(--bg); padding: 0.4rem 0.8rem; text-decoration: none;
}
.skip-link:focus { top: 0.5rem; color: var(--bg); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
