/*
 * NetBSD Theme for BSSG
 * NetBSD-recognizable orange engineering look with flag-inspired geometry.
 */

:root {
    --netbsd-navy: #003c78;
    --netbsd-deep: #002a54;
    --netbsd-sky: #2d5d90;
    --netbsd-orange: #f4821f;
    --paper: #fbfdff;
    --paper-2: #f1f5f9;
    --text: #163046;
    --muted: #506578;
    --border: #cfdae4;
    --link: #004a90;
    --link-hover: #00366a;
    --tag-bg: #edf4fb;
    --tag-text: #184b78;
    --quote-bg: #f2f7fc;
    --code-bg: #edf3f8;
    --radius: 8px;
    --shadow: 0 12px 28px rgba(0, 28, 52, 0.2);
    --content-width: 920px;
    --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-heading: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
    --font-mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

html {
    font-size: 17px;
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.72;
    background:
        radial-gradient(circle at 0 0, rgba(244, 130, 31, 0.1) 0 18%, transparent 19%),
        linear-gradient(180deg, #f3f8fc 0%, #e7eef5 100%);
}

::selection {
    background: #cfe2f3;
    color: #0f2a3e;
}

.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.2rem 2.7rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
    border-left: 1px solid #c6d2dd;
    border-right: 1px solid #c6d2dd;
    box-shadow: var(--shadow);
    min-height: 100vh;
}

header {
    margin: 0 -1.2rem 1.95rem;
    padding: 1rem 1.2rem 0.95rem;
    color: #f2f7fb;
    background:
        linear-gradient(135deg, rgba(244, 130, 31, 0.2) 0 14%, transparent 15%),
        linear-gradient(180deg, var(--netbsd-navy) 0%, var(--netbsd-deep) 100%);
    border-top: 6px solid var(--netbsd-orange);
    border-bottom: 1px solid #0e2942;
    position: relative;
    overflow: hidden;
}

header::before {
    content: "Of course it runs NetBSD!";
    position: absolute;
    right: 18px;
    top: 12px;
    background: linear-gradient(180deg, #0f447a 0%, #06315a 100%);
    color: #ffe1be;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-bottom-color: var(--netbsd-orange);
    border-radius: 4px;
    padding: 0.16rem 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.25);
}

header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--netbsd-orange), transparent);
}

.site-title,
header h1 {
    margin: 0;
    color: #f4f8fc;
    font-family: var(--font-heading);
    font-size: clamp(1.9rem, 3.6vw, 2.65rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.2;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover,
.site-title a:focus {
    color: #ffd7b3;
}

header p {
    margin: 0.42rem 0 0;
    color: #c7d9e8;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

nav {
    margin-top: 0.92rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

nav a {
    display: inline-block;
    color: #e9f2f9;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-bottom: 2px solid rgba(244, 130, 31, 0.55);
    border-radius: 5px;
    padding: 0.24rem 0.6rem;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

nav a:hover,
nav a:focus {
    background: rgba(244, 130, 31, 0.18);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

main {
    min-height: 62vh;
}

article {
    margin-bottom: 1.4rem;
}

article.post,
article.page,
.posts-list article {
    background: #fff;
    border: 1px solid var(--border);
    border-top: 4px solid var(--netbsd-navy);
    border-radius: var(--radius);
    padding: 1.14rem 1rem 0.95rem;
}

article.post::before,
article.page::before,
.posts-list article::before {
    content: "";
    display: block;
    height: 2px;
    margin: -0.25rem -1rem 0.85rem;
    background: linear-gradient(90deg, transparent, rgba(244, 130, 31, 0.62), transparent);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #102f48;
    font-family: var(--font-heading);
    margin: 1.08rem 0 0.68rem;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

h1 { font-size: clamp(1.7rem, 3.1vw, 2.22rem); }
h2 { font-size: clamp(1.38rem, 2.5vw, 1.78rem); }
h3 { font-size: clamp(1.14rem, 1.9vw, 1.38rem); }

p,
ul,
ol {
    margin-top: 0;
    margin-bottom: 0.92rem;
}

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.14em;
}

a:hover,
a:focus {
    color: var(--link-hover);
}

.page-meta {
    margin-bottom: 0.74rem;
}

.meta {
    margin: 0;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reading-time {
    margin-top: 0.24rem;
}

.summary {
    margin-top: 0.72rem;
    color: #39576f;
}

.post-content {
    margin-top: 0.64rem;
}

.featured-image,
.index-image,
.tag-image,
.archive-image,
.author-image {
    margin: 0.94rem 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid #b9c8d6;
    border-radius: 4px;
}

.image-caption,
figcaption {
    margin-top: 0.34rem;
    color: #61778a;
    font-size: 0.78rem;
    font-style: italic;
}

blockquote {
    margin: 0.98rem 0;
    padding: 0.68rem 0.85rem;
    border-left: 4px solid var(--netbsd-sky);
    background: var(--quote-bg);
    color: #2d4a61;
}

pre,
code {
    font-family: var(--font-mono);
    font-size: 0.84rem;
}

code {
    background: var(--code-bg);
    border: 1px solid #d3dfeb;
    border-radius: 3px;
    padding: 0.08rem 0.26rem;
}

pre {
    background: var(--code-bg);
    border: 1px solid #d0dde8;
    border-radius: 6px;
    padding: 0.78rem;
    overflow-x: auto;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
}

hr {
    border: 0;
    border-top: 1px solid #d2dee8;
    margin: 1.1rem 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.34rem;
    margin-top: 0.84rem;
}

.tags a,
.tags-list a {
    display: inline-block;
    text-decoration: none;
    color: var(--tag-text);
    background: var(--tag-bg);
    border: 1px solid #cadcec;
    border-radius: 999px;
    padding: 0.17rem 0.52rem;
    font-family: var(--font-mono);
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tags a:hover,
.tags a:focus,
.tags-list a:hover,
.tags-list a:focus {
    background: #deebf8;
    border-color: #b8d0e7;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.tag-count {
    color: #61798f;
}

.posts-list article + article {
    margin-top: 0.82rem;
}

.posts-list h2,
.posts-list h3 {
    margin-top: 0;
}

.pagination {
    margin-top: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.44rem;
}

.pagination a {
    display: inline-block;
    color: #17364f;
    text-decoration: none;
    border: 1px solid #c0d2e1;
    border-radius: 5px;
    padding: 0.22rem 0.6rem;
    background: #eff5fb;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pagination a:hover,
.pagination a:focus {
    background: var(--netbsd-navy);
    color: #fff;
    border-color: #1f4e7e;
}

.page-info {
    color: #5f7488;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.related-posts {
    margin-top: 1.3rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #c2d2df;
}

.related-posts h3 {
    margin-top: 0;
    font-size: 1.05rem;
}

.related-posts-list {
    display: grid;
    gap: 0.6rem;
}

.related-post {
    border: 1px solid #c5d5e4;
    border-left: 4px solid var(--netbsd-orange);
    background: #f6fafe;
    border-radius: 5px;
    padding: 0.52rem 0.64rem;
}

.related-post h4 {
    margin: 0 0 0.2rem;
    font-size: 0.94rem;
}

.related-post p {
    margin: 0;
    color: #4c6980;
    font-size: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.9rem 0;
}

th,
td {
    border: 1px solid #d0dde8;
    padding: 0.38rem 0.5rem;
}

th {
    background: #edf4fb;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

footer {
    margin-top: 1.78rem;
    padding: 0.84rem 0 0.08rem;
    border-top: 2px solid #d1dbe5;
    color: #577084;
    font-family: var(--font-mono);
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
}

footer p {
    margin: 0.32rem 0;
}

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

footer a:hover,
footer a:focus {
    color: var(--link-hover);
}

@media (max-width: 840px) {
    .container {
        padding: 0 0.82rem 2rem;
    }

    header {
        margin: 0 -0.82rem 1.45rem;
        padding: 0.88rem 0.82rem 0.8rem;
    }

    header::before {
        right: 10px;
        top: 10px;
        padding: 0.12rem 0.42rem;
        font-size: 0.55rem;
        letter-spacing: 0.01em;
    }

    nav {
        padding-right: 0;
    }

    article.post,
    article.page,
    .posts-list article {
        padding: 0.96rem 0.8rem 0.8rem;
    }

    nav a,
    .meta,
    .page-info,
    .pagination a {
        letter-spacing: 0.02em;
    }
}
