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

* {
    margin: 0;
}

html {
    scroll-behavior: smooth;
}

img {
    max-width: 100%;
    display: block;
}

:root {
    --bg: #ffffff;
    --fg: #1a1a1a;
    --muted: #5a5a5a;
    --accent: #2563eb;
    --card: #f7f7f8;
    --border: #e5e5e5;

    --font: system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "JetBrains Mono", monospace;

    --space: 1rem;
    --max-width: 52rem;
    --measure: 65ch;
    --radius: 10px;
}

body {
    font-family: var(--font);
    color: var(--fg);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: var(--space);
}

nav {
    display: flex;
    gap: calc(var(--space) * 1.5);
    padding-block: var(--space);
}

nav a {
    color: var(--muted);
    text-decoration: none;
}

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

section {
    padding-block: calc(var(--space) * 3);
    scroll-margin-top: var(--space);
}

h1 {
    font-size: clamp(2rem, 6vw, 3.25rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: var(--space);
}

#hero p {
    font-size: 1.15rem;
    color: var(--muted);
    max-width: var(--measure);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: calc(var(--space) * 1.5);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space);
}

.project {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: calc(var(--space) * 1.25);
    display: flex;
    flex-direction: column;
    gap: calc(var(--space) * 0.75);
}

.project h3 {
    font-size: 1.1rem;
}

.project p {
    color: var(--muted);
    font-size: 0.95rem;
}

.project a {
    margin-top: auto;
    align-self: flex-start;
    position: relative;
}

.project-links {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--space) * 0.75);
}

.project .project-links a {
    margin-top: 0;
}

.project a,
.post-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.project a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2.5px;
    border-radius: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.project a:hover::after,
.project a:focus-visible::after {
    transform: scaleX(1);
}

.tags {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tags li {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 1000px;
}

footer {
    border-top: 1px solid var(--border);
    padding-block: calc(var(--space) * 2);
    color: var(--muted);
}

footer a {
    color: var(--accent);
}

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

.post-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: calc(var(--space) * 1.5);
    max-width: var(--measure);
}

.post-item .post-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--fg);
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.post-item .post-link:hover .post-title {
    color: var(--accent);
}

.post-date {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.post-excerpt {
    color: var(--muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.post-header {
    margin-bottom: calc(var(--space) * 2);
}

.post-header .post-date {
    display: block;
    margin-top: 0.5rem;
}

.back-link {
    margin-top: 0;
    margin-bottom: calc(var(--space) * 3);
}

.back-link a {
    color: var(--accent);
    text-decoration: none;
}

.post {
    padding-block: calc(var(--space) * 3);
    max-width: var(--measure);
}

.post-content>*+* {
    margin-top: var(--space);
}

.post-content h2 {
    margin-top: calc(var(--space) * 2.5);
    font-size: 1.4rem;
}

.post-content pre {
    overflow-x: auto;
    padding: var(--space);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.875rem;
}

.post-content code {
    font-family: var(--mono);
}

.post-content :not(pre)>code {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-screenshot {
    width: 100%;
    max-width: 22rem;
    margin: calc(var(--space) * 2) auto;
}

.post-screenshot img {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.16);
}

.post-screenshot figcaption {
    margin-top: calc(var(--space) * 0.6);
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e0e10;
        --fg: #ededed;
        --muted: #9a9a9a;
        --accent: #60a5fa;
        --card: #1a1a1a;
        --border: #2a2a2a;
    }
}
