/* ============================================================
   Custom properties
   ============================================================ */
:root {
    --color-navy:        #0c1f30;
    --color-teal:        #0085a1;
    --color-teal-dark:   #006478;
    --color-text:        #404040;
    --color-text-muted:  #808080;
    --color-border:      #e0e0e0;
    --color-bg:          #ffffff;
    --color-code-inline: #f4f4f4;

    /* Masthead PCB pattern - change these to retheme the header */
    --masthead-bg:        #0c1f30;
    --masthead-tint-from: rgba(0, 100, 130, 0.45);
    --masthead-tint-to:   transparent;
    --pcb-trace:          #3a7cc3;

    --font-serif:  'Lora', Georgia, 'Times New Roman', serif;
    --font-sans:   'Open Sans', system-ui, -apple-system, sans-serif;
    --font-mono:   ui-monospace, 'Cascadia Code', 'Fira Code', monospace;

    --nav-height:         60px;
    --content-width:      800px;
    --masthead-min-height: 340px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text);
    background: var(--color-bg);
}

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

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background-color: transparent;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.navbar.is-scrolled {
    background-color: var(--color-navy);
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}

.navbar-inner {
    max-width: calc(var(--content-width) + 4rem);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-brand {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.05rem;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.navbar-brand:hover {
    color: rgba(255, 255, 255, 0.8);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin-left: auto;
}

.navbar-links a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.15s;
}

.navbar-links a:hover {
    color: #ffffff;
}

.navbar-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    flex-direction: column;
    gap: 5px;
}

.navbar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* ============================================================
   Masthead â€” PCB pattern with gradient overlay
   ============================================================ */
.masthead {
    min-height: var(--masthead-min-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + 3rem) 2rem 4rem;
    text-align: center;

    background-color: var(--masthead-bg);
    position: relative;
    overflow: hidden;
}

.masthead-inner {
    position: relative;
    z-index: 1;
    max-width: var(--content-width);
    width: 100%;
}

.masthead-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.masthead-subtitle {
    margin-top: 1rem;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: rgba(255, 255, 255, 0.75);
    font-style: italic;
    font-family: var(--font-serif);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.55;
}
.masthead-pcb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.masthead::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(150deg, var(--masthead-tint-from) 0%, var(--masthead-tint-to) 55%);
    pointer-events: none;
}

/* ============================================================
   Main content container
   ============================================================ */
.main-content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

/* ============================================================
   Post list (index + tag pages)
   ============================================================ */
.post-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.post-list-item {
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--color-border);
}

.post-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.post-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    display: block;
    line-height: 1.25;
    transition: color 0.15s;
}

.post-title:hover {
    color: var(--color-teal);
}

.post-list-item time {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.825rem;
    color: var(--color-text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.post-summary {
    margin-top: 0.6rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ============================================================
   Post / page article
   ============================================================ */
.post-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.post-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 4vw, 2.25rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.post-meta time {
    font-size: 0.825rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.post-header .post-summary {
    margin-top: 0.75rem;
    font-size: 1.05rem;
    font-style: italic;
    font-family: var(--font-serif);
    color: var(--color-text-muted);
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
}

.tag a {
    display: inline-block;
    padding: 0.2em 0.65em;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-teal);
    border: 1.5px solid var(--color-teal);
    border-radius: 3px;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.tag a:hover {
    background-color: var(--color-teal);
    color: #ffffff;
}

/* ============================================================
   Post content typography
   ============================================================ */
.post-content,
.page-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-content h2,
.post-content h3,
.post-content h4,
.page-content h2,
.page-content h3,
.page-content h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.post-content h2, .page-content h2 { font-size: 1.7rem; }
.post-content h3, .page-content h3 { font-size: 1.35rem; }
.post-content h4, .page-content h4 { font-size: 1.1rem; }

.post-content p,
.page-content p {
    margin-bottom: 1.25rem;
}

.post-content a,
.page-content a {
    color: var(--color-teal);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.post-content a:hover,
.page-content a:hover {
    color: var(--color-teal-dark);
}

.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
    margin: 0 0 1.25rem 1.5rem;
}

.post-content li,
.page-content li {
    margin-bottom: 0.35rem;
}

.post-content blockquote,
.page-content blockquote {
    margin: 1.5rem 0;
    padding: 0.75rem 1.5rem;
    border-left: 4px solid var(--color-teal);
    background: rgba(0, 133, 161, 0.05);
    font-style: italic;
    color: var(--color-text-muted);
}

.post-content blockquote p:last-child,
.page-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Inline code */
.post-content code,
.page-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-code-inline);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    white-space: nowrap;
}

/* Code blocks (highlight.js wraps pre > code) */
.post-content pre,
.page-content pre {
    margin: 1.5rem 0;
    border-radius: 6px;
    overflow: auto;
}

.post-content pre code,
.page-content pre code {
    background: none;
    padding: 0;
    white-space: pre;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* highlight.js atom-one-dark overrides â€” keep padding/font consistent */
.hljs {
    padding: 1.25rem 1.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.post-content hr,
.page-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    background: var(--color-navy);
    color: rgba(255, 255, 255, 0.6);
    padding: 2rem 2rem;
}

.footer-inner {
    max-width: calc(var(--content-width) + 4rem);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.footer-rss {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s;
}

.footer-rss:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
    :root {
        --masthead-min-height: 260px;
    }

    .main-content {
        padding: 2rem 1.25rem 3rem;
    }

    .navbar-inner {
        padding: 0 1.25rem;
    }

    .navbar-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background-color: var(--color-navy);
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0.5rem 0 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }

    .navbar-links.is-open {
        display: flex;
    }

    .navbar-links li {
        width: 100%;
    }

    .navbar-links a {
        padding: 0.65rem 1.5rem;
        display: block;
        width: 100%;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .navbar-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .navbar-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .post-title {
        font-size: 1.35rem;
    }

    .footer-inner {
        padding: 0;
        justify-content: center;
        text-align: center;
    }
}
