/* ulas — minimal one-page personal theme
   Fonts and accent come from Ghost admin (Settings > Design):
   --gh-font-heading, --gh-font-body, --ghost-accent-color */

:root {
    --bg: #fbfbf9;
    --fg: #1c1c1a;
    --muted: #686863;
    --line: #e5e4df;
    --code-bg: #f1f0ec;
    --accent: var(--ghost-accent-color, #0a8bd4);

    --font-body: var(--gh-font-body, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    --font-heading: var(--gh-font-heading, var(--font-body));
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --measure: 42rem;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121312;
        --fg: #e7e7e2;
        --muted: #9c9c95;
        --line: #2a2b29;
        --code-bg: #1c1d1b;
    }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

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

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

/* ---------- layout ---------- */

.site {
    max-width: var(--measure);
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
}

.main { flex: 1; }

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
    font-size: .875rem;
}

.brand {
    font-family: var(--font-heading);
    font-weight: 600;
    text-decoration: none;
}

.topnav { margin-left: auto; }

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    transition: color .15s;
}

.nav a:hover,
.nav-current a { color: var(--fg); }

.footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 3rem 0 2.5rem;
    font-size: .8125rem;
    color: var(--muted);
}

.footer a { text-decoration: none; }
.footer a:hover { color: var(--fg); }

/* ---------- home ---------- */

.hero { padding: 5rem 0 3.5rem; }

.hero-name {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.hero-tagline {
    max-width: 34rem;
    margin: .9rem 0 0;
    font-size: 1.125rem;
    color: var(--muted);
}

.section {
    padding: 2.5rem 0;
    border-top: 1px solid var(--line);
    scroll-margin-top: 1rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 0 1.5rem;
    font-family: var(--font-heading);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-title::before {
    content: "";
    width: .5rem;
    height: .5rem;
    border-radius: 1px;
    background: var(--accent);
}

/* Contact is rendered always; hide it until at least one link is set. */
.section-contact:not(:has(li)) { display: none; }

/* ---------- projects ---------- */

.projects {
    margin: 0;
    padding: 0;
    list-style: none;
}

.projects li + li { border-top: 1px solid var(--line); }

.project {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .2rem 1.5rem;
    padding: 1.1rem 0;
    text-decoration: none;
}

.projects li:first-child .project { padding-top: 0; }

.project-title {
    font-family: var(--font-heading);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    text-decoration-thickness: 1.5px;
    transition: text-decoration-color .15s;
}

.project:hover .project-title { text-decoration-color: var(--accent); }

.project-year {
    font-size: .875rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.project-desc,
.project-tags {
    grid-column: 1 / -1;
    color: var(--muted);
}

.project-desc { font-size: .9375rem; }
.project-tags { font-size: .8125rem; }

/* ---------- contact ---------- */

.links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.links li + li { border-top: 1px solid var(--line); }

.link-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 0;
    text-decoration: none;
}

.links li:first-child .link-row { padding-top: 0; }

.link-value {
    color: var(--muted);
    overflow-wrap: anywhere;
    text-align: right;
    transition: color .15s;
}

.link-row:hover .link-value { color: var(--accent); }

/* ---------- article (project / page) ---------- */

.article { padding: 2rem 0 1rem; }

.back {
    font-size: .875rem;
    color: var(--muted);
    text-decoration: none;
}

.back:hover { color: var(--fg); }

.article-title {
    margin: 1.5rem 0 .75rem;
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    line-height: 1.2;
    letter-spacing: -.015em;
}

.lede {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    color: var(--muted);
}

.meta {
    margin: 0 0 2.5rem;
    font-size: .8125rem;
    color: var(--muted);
}

.meta-sep { margin: 0 .5rem; }

.feature { margin: 0 0 2.5rem; }
.feature img { display: block; width: 100%; border-radius: 6px; }

.error { padding-top: 4rem; }

.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    font-size: .875rem;
    color: var(--muted);
}

.pagination a { text-decoration: none; }

/* ---------- prose (Ghost editor content) ---------- */

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

.prose p,
.prose ul,
.prose ol { margin: 0 0 1.15em; }

.prose ul,
.prose ol { padding-left: 1.25rem; }

.prose li + li { margin-top: .35em; }

.prose h2,
.prose h3 {
    margin: 2em 0 .6em;
    font-family: var(--font-heading);
    line-height: 1.3;
}

.prose h2 { font-size: 1.375rem; }
.prose h3 { font-size: 1.125rem; }

.prose a {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: color .15s;
}

.prose a:hover { color: var(--accent); }

.prose strong { font-weight: 600; }

.prose blockquote {
    margin: 1.5em 0;
    padding-left: 1rem;
    border-left: 2px solid var(--accent);
    color: var(--muted);
}

.prose hr {
    margin: 2.5em 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.prose code,
.prose pre {
    font-family: var(--font-mono);
    font-size: .875em;
}

.prose :not(pre) > code {
    padding: .1em .35em;
    border-radius: 4px;
    background: var(--code-bg);
}

.prose pre {
    overflow-x: auto;
    margin: 1.5em 0;
    padding: 1rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--code-bg);
    line-height: 1.55;
}

.prose figure { margin: 2em 0; }
.prose img { border-radius: 6px; }

.prose figcaption {
    margin-top: .6rem;
    font-size: .8125rem;
    color: var(--muted);
    text-align: center;
}

/* Ghost editor card widths (required by Ghost) */
.kg-width-wide {
    position: relative;
    left: 50%;
    width: min(56rem, calc(100vw - 3rem));
    transform: translateX(-50%);
}

.kg-width-full {
    position: relative;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
}

.kg-width-full img { border-radius: 0; }

/* ---------- small screens ---------- */

@media (max-width: 560px) {
    .topbar { padding: 1.5rem 0; }
    .nav { gap: .25rem 1rem; }
    .hero { padding: 3.5rem 0 2.5rem; }
    .section { padding: 2rem 0; }
}
