@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');
}

@font-face {
    font-family: 'Inter';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/Inter-Italic-VariableFont_opsz,wght.ttf') format('truetype');
}

:root {
    /* Layout */
    --column-width: 1024px;
    --column-width-wide: 1280px;

    /* Spacing scale */
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-5: 3rem;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'Roboto Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    --line-height-tight: 1.3;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.8;

    /* Dark theme colors */
    --color-bg: #0a0a0a;
    --color-bg-elevated: #161616;
    --color-bg-code: #1a1a1a;

    --color-text: #e8e8e8;
    --color-text-muted: #a0a0a0;
    --color-text-subtle: #6a6a6a;

    --color-accent: #60a5fa;
    --color-accent-hover: #93c5fd;

    --color-border: #2a2a2a;
    --color-border-focus: #404040;

    --color-warning-bg: #1e1510;
    --color-warning-border: #78350f;
    --color-warning-text: #fcd34d;

    --color-selection: #1e40af;
}

/* Reset */
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
/* End Reset */

/* Selection */
::selection {
    background-color: var(--color-selection);
    color: var(--color-text);
}

/* Base */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    padding: var(--space-4) var(--space-3);
    max-width: var(--column-width);
    margin: 0 auto;
}

.header a {
    font-size: 1.125rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--color-text);
    transition: color 0.2s ease;
}

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

/* Main */
main {
    padding: var(--space-3);
    max-width: var(--column-width);
    margin: 0 auto;
}

/* Links */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

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

/* Typography */
article h1,
article h2,
article h3,
article h4 {
    font-weight: 600;
    line-height: var(--line-height-tight);
    letter-spacing: -0.02em;
    color: var(--color-text);
}

article h1 {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
    font-weight: 700;
    padding-bottom: var(--space-2);
    border-bottom: 4px solid var(--color-text);
}

article h2 {
    font-size: 1.75rem;
    margin-top: var(--space-5);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 3px solid var(--color-text);
}

article h3 {
    font-size: 1.375rem;
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-1);
    border-bottom: 2px solid var(--color-text);
}

article h4 {
    font-size: 1.125rem;
    margin-top: var(--space-3);
    margin-bottom: var(--space-2);
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--color-text);
}

article h1 a,
article h2 a,
article h3 a,
article h4 a {
    color: inherit;
}

article p {
    margin-top: var(--space-3);
    margin-bottom: var(--space-3);
    line-height: var(--line-height-relaxed);
}

article img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* Inline code */
article code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.2em 0.4em;
    background-color: var(--color-bg-code);
    border: 1px solid var(--color-border);
    border-radius: 0.25rem;
    color: var(--color-accent);
}

/* Code blocks */
.highlight {
    border-radius: 0.5rem;
    margin: var(--space-3) 0;
}

article pre {
    padding: var(--space-3);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: var(--line-height-normal);
    background-color: var(--color-bg-code);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    margin: var(--space-3) 0;
}

article pre code {
    padding: 0;
    background: none;
    border: none;
    color: var(--color-text);
}

article pre.mermaid {
    background-color: var(--color-bg);
    border: none;
}

/* Lists */
article ul,
article ol {
    margin: var(--space-3) 0;
    padding-left: var(--space-4);
}

article ul {
    list-style-type: disc;
}

article ol {
    list-style-type: decimal;
}

article ul li,
article ol li {
    margin: var(--space-1) 0;
    line-height: var(--line-height-relaxed);
}

article ul li::marker {
    color: var(--color-text-muted);
}

article ol li::marker {
    color: var(--color-text-muted);
}

/* Blockquotes */
blockquote {
    margin: var(--space-4) 0;
    padding: var(--space-3);
    background-color: var(--color-bg-elevated);
    border-left: 4px solid var(--color-accent);
    border-radius: 0.25rem;
    font-style: italic;
    color: var(--color-text-muted);
}

blockquote:after {
    content: "\2013 \2003" attr(cite);
    display: block;
    text-align: right;
    font-size: 0.875em;
    margin-top: var(--space-2);
}

/* Text emphasis */
em {
    font-style: italic;
}

strong {
    font-weight: 600;
    color: var(--color-text);
}

mark {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

/* Figures */
figcaption {
    padding: var(--space-2) 0;
    text-align: center;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--color-text-muted);
}

/* Footnotes */
sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
    top: -0.5em;
}

.footnote-ref {
    font-weight: 600;
    padding: 0 0.15em;
}

.footnote {
    margin-top: var(--space-5);
    font-size: 0.9375rem;
}

.footnote ol {
    padding-left: var(--space-3);
    counter-reset: footnote;
}

.footnote li {
    margin: var(--space-2) 0;
    color: var(--color-text-muted);
}

.footnote li p {
    margin: 0;
    display: inline;
}

.footnote-backref {
    margin-left: 0.25em;
    font-size: 0.875em;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: var(--space-4) 0;
    font-size: 0.9375rem;
}

td, th {
    border: 1px solid var(--color-border);
    padding: var(--space-2);
    text-align: left;
}

th {
    font-weight: 600;
    background-color: var(--color-bg-elevated);
    color: var(--color-text);
}

tr:hover {
    background-color: var(--color-bg-elevated);
}

/* Aside/Warning boxes */
article aside {
    margin: var(--space-4) 0;
    padding: var(--space-3);
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: 0.5rem;
}

article aside p {
    margin: 0;
    color: var(--color-text);
}

article aside strong {
    color: var(--color-warning-text);
}

article aside em {
    color: var(--color-text-muted);
}

/* Horizontal rule */
article hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-5) 0;
}


/* Landing page */
.landing {
    max-width: var(--column-width);
}

/* Hero section */
.hero {
    padding: var(--space-5) 0 var(--space-4) 0;
    margin-bottom: var(--space-4);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: var(--line-height-tight);
    letter-spacing: -0.03em;
    margin-bottom: var(--space-3);
    color: var(--color-text);
}

.tagline {
    margin-bottom: var(--space-3);
}

.tagline-intro {
    font-size: 1.25rem;
    line-height: var(--line-height-relaxed);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.tagline-detail {
    font-size: 1rem;
    line-height: var(--line-height-relaxed);
    color: var(--color-text-muted);
    margin: 0;
}

.contact-info {
    font-size: 1.0625rem;
    line-height: var(--line-height-normal);
    color: var(--color-text-muted);
    margin: 0;
}

.contact-info a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.contact-info .separator {
    margin: 0 var(--space-2);
    color: var(--color-text-subtle);
}

/* Recent articles section */
.recent-articles {
    margin-bottom: var(--space-5);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-4);
    letter-spacing: -0.02em;
    padding-bottom: var(--space-2);
    border-bottom: 3px solid var(--color-text);
}

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

.article-item {
    padding: var(--space-3) 0;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.article-item .separator {
    color: var(--color-text-subtle);
}

.article-date {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-text-subtle);
    flex-shrink: 0;
}

.article-link {
    color: var(--color-text);
    font-weight: 500;
    font-size: 1.0625rem;
    line-height: var(--line-height-normal);
}

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

/* Syntax highlighting - Dark theme */
.hll { background-color: #2a2a2a }
.c { color: #7c7c7c; font-style: italic } /* Comment */
.err { color: #f87171; background-color: #3f1f1f } /* Error */
.k { color: #c084fc; font-weight: 600 } /* Keyword */
.o { color: #94a3b8 } /* Operator */
.ch { color: #7c7c7c; font-style: italic } /* Comment.Hashbang */
.cm { color: #7c7c7c; font-style: italic } /* Comment.Multiline */
.cp { color: #60a5fa } /* Comment.Preproc */
.cpf { color: #7c7c7c; font-style: italic } /* Comment.PreprocFile */
.c1 { color: #7c7c7c; font-style: italic } /* Comment.Single */
.cs { color: #7c7c7c; font-weight: 600; font-style: italic } /* Comment.Special */
.gd { background-color: #3f1f1f; border-left: 3px solid #f87171 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #f87171 } /* Generic.Error */
.gh { color: #86efac; font-weight: 600 } /* Generic.Heading */
.gi { background-color: #1f3f1f; border-left: 3px solid #86efac } /* Generic.Inserted */
.go { color: #7c7c7c } /* Generic.Output */
.gp { color: #60a5fa; font-weight: 600 } /* Generic.Prompt */
.gs { font-weight: 600 } /* Generic.Strong */
.gu { color: #86efac; font-weight: 600 } /* Generic.Subheading */
.gt { color: #a5b4fc } /* Generic.Traceback */
.kc { color: #c084fc; font-weight: 600 } /* Keyword.Constant */
.kd { color: #c084fc; font-weight: 600 } /* Keyword.Declaration */
.kn { color: #c084fc; font-weight: 600 } /* Keyword.Namespace */
.kp { color: #c084fc } /* Keyword.Pseudo */
.kr { color: #c084fc; font-weight: 600 } /* Keyword.Reserved */
.kt { color: #60a5fa; font-weight: 600 } /* Keyword.Type */
.m { color: #fbbf24 } /* Literal.Number */
.s { color: #86efac } /* Literal.String */
.na { color: #93c5fd } /* Name.Attribute */
.nb { color: #60a5fa } /* Name.Builtin */
.nc { color: #fbbf24; font-weight: 600 } /* Name.Class */
.no { color: #f87171 } /* Name.Constant */
.nd { color: #a5b4fc } /* Name.Decorator */
.ni { color: #7c7c7c; font-weight: 600 } /* Name.Entity */
.ne { color: #f87171; font-weight: 600 } /* Name.Exception */
.nf { color: #93c5fd } /* Name.Function */
.nl { color: #a5b4fc } /* Name.Label */
.nn { color: #fbbf24; font-weight: 600 } /* Name.Namespace */
.nt { color: #c084fc; font-weight: 600 } /* Name.Tag */
.nv { color: #e8e8e8 } /* Name.Variable */
.ow { color: #c084fc; font-weight: 600 } /* Operator.Word */
.w { color: #4a4a4a } /* Text.Whitespace */
.mb { color: #fbbf24 } /* Literal.Number.Bin */
.mf { color: #fbbf24 } /* Literal.Number.Float */
.mh { color: #fbbf24 } /* Literal.Number.Hex */
.mi { color: #fbbf24 } /* Literal.Number.Integer */
.mo { color: #fbbf24 } /* Literal.Number.Oct */
.sa { color: #86efac } /* Literal.String.Affix */
.sb { color: #86efac } /* Literal.String.Backtick */
.sc { color: #86efac } /* Literal.String.Char */
.dl { color: #86efac } /* Literal.String.Delimiter */
.sd { color: #7c7c7c; font-style: italic } /* Literal.String.Doc */
.s2 { color: #86efac } /* Literal.String.Double */
.se { color: #fbbf24; font-weight: 600 } /* Literal.String.Escape */
.sh { color: #86efac } /* Literal.String.Heredoc */
.si { color: #fbbf24 } /* Literal.String.Interpol */
.sx { color: #86efac } /* Literal.String.Other */
.sr { color: #93c5fd } /* Literal.String.Regex */
.s1 { color: #86efac } /* Literal.String.Single */
.ss { color: #fbbf24 } /* Literal.String.Symbol */
.bp { color: #60a5fa } /* Name.Builtin.Pseudo */
.fm { color: #93c5fd } /* Name.Function.Magic */
.vc { color: #e8e8e8 } /* Name.Variable.Class */
.vg { color: #e8e8e8 } /* Name.Variable.Global */
.vi { color: #e8e8e8 } /* Name.Variable.Instance */
.vm { color: #e8e8e8 } /* Name.Variable.Magic */
.il { color: #fbbf24 } /* Literal.Number.Integer.Long */

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-2);
    margin: var(--space-4) 0;
}

.gallery a {
    display: block;
    line-height: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery a:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16 / 10;
    border-radius: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .header {
        padding: var(--space-3) var(--space-2);
    }

    main {
        padding: var(--space-2);
    }

    article h1 {
        font-size: 2rem;
    }

    article h2 {
        font-size: 1.5rem;
    }

    article h3 {
        font-size: 1.25rem;
    }

    /* Landing page mobile adjustments */
    .hero {
        padding: var(--space-4) 0;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .tagline {
        font-size: 1.125rem;
    }

    .contact-info {
        font-size: 1rem;
    }

    .contact-info .separator {
        margin: 0 var(--space-1);
    }

    .article-item {
        flex-direction: column;
        gap: var(--space-1);
        align-items: flex-start;
    }

    .article-date {
        font-size: 0.8125rem;
        min-width: auto;
    }

    .article-link {
        font-size: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    body {
        background-color: white;
        color: black;
    }

    .header,
    nav {
        display: none;
    }

    article {
        max-width: 100%;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    pre,
    code {
        background-color: #f5f5f5;
        border: 1px solid #ddd;
    }
}