* {
    box-sizing: border-box;
}

html {
    min-width: 0;
    color: var(--foreground);
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--foreground);
    background-color: var(--background);
}

::selection {
    color: var(--background);
    background: var(--link-color);
}

.page-content a,
.page-content a:visited {
    color: var(--link-color);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.page-content a:hover,
.page-content a:focus-visible {
    color: var(--link-hover);
}


.wrapper {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin-inline: auto;
    padding-inline: var(--page-gutter);
}

.page-content {
    --blog-top-padding: var(--section-space);
    padding-block: var(--blog-top-padding);
}


.draft-marker {
    display: inline-block;
    margin: 0 0.45rem 0.65rem 0;
    padding: 0.2rem 0.5rem;
    color: var(--primary-foreground);
    background: var(--danger);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
}

.post-list-heading,
.home > h1:not(.page-heading),
.home > h2:not(.post-list-heading) {
    font-family: var(--font-body);
    font-weight: 600;
    line-height: 1.3;
    text-transform: none;
}

.post-list-heading {
    margin: 0 0 20px;
    padding-bottom: 14px;
    color: var(--link-color);
    border-bottom: 1px solid var(--border-color);
    font-size: clamp(1.5rem, 4vw, 2rem);
    letter-spacing: 0.01em;
}

.post-list {
    display: grid;
    gap: 20px;
    margin: 0;
}

.post-list > li {
    position: relative;
    margin: 0;
    padding: clamp(18px, 3vw, 28px);
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    box-shadow: var(--shadow-soft);
    transition: transform 140ms ease-out, box-shadow 140ms ease-out;
}

.post-list > li:hover {
    box-shadow: var(--shadow-soft);
    border-color: var(--input-border);
}

.post-list h2,
.post-list h3 {
    margin: 4px 0 0;
}

.post-link,
.post-link:visited {
    color: var(--foreground);
    font-family: var(--font-body);
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 600;
    line-height: 1.3;
    text-transform: none;
}

.post-link::after {
    position: absolute;
    inset: 0;
    content: "";
}

.post-link:hover,
.post-link:focus-visible,
.post-list > li:hover .post-link {
    color: var(--link-color);
    text-decoration: none;
}


.post-meta {
    color: var(--muted-foreground);
    font-family: "Courier New", monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: none;
}

.rss-subscribe {
    margin-top: 28px;
    font-family: "Courier New", monospace;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
}

.post {
    padding: clamp(22px, 5vw, 56px);
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
}

.post-header {
    margin-bottom: clamp(28px, 5vw, 48px);
    border-bottom: 1px solid var(--border-color);
}

.post-content {
    margin-bottom: 0;
}

.post-content p,
.post-content li {
    max-width: var(--reading-width);
}

.post-content img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin: 28px auto;
    border: 1px solid var(--border-color);
}

.post-content iframe {
    display: block;
    width: 100%;
    min-height: min(68vh, 560px);
    margin: 30px 0;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: var(--control-radius);
}

blockquote {
    margin-inline: 0;
    padding: 14px 18px;
    color: var(--foreground);
    background: var(--muted);
    border-left: 5px solid var(--link-color);
    font-size: 1.05rem;
    letter-spacing: 0;
}

pre,
code {
    border-radius: 6px;
}

code {
    color: var(--foreground);
    background: var(--muted);
    border: 1px solid var(--border-color);
}

pre {
    padding: 18px;
    background: var(--muted);
    border: 1px solid var(--border-color);
}

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

table {
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border-color);
}

.table-scroll {
    max-width: 100%;
    margin-bottom: 30px;
    overflow-x: auto;
}


.table-scroll table {
    margin-bottom: 0;
}

table th {
    color: var(--background);
    background: var(--link-color);
    border-color: var(--foreground);
}

table td {
    border-color: var(--border-color);
}

.back-to-top {
    display: flex;
    justify-content: center;
}

.back-to-top a,
.back-to-top a:visited {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 7px 10px;
    color: var(--foreground);
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), color 150ms cubic-bezier(0.4, 0, 0.2, 1),
        transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.back-to-top a:hover,
.back-to-top a:focus-visible {
    color: var(--background);
    background: var(--link-color);
    text-decoration: none;
}


@media (max-width: 680px) {
    .post-list {
        margin-right: 0;
    }

    .post-list > li {
        box-shadow: var(--shadow-soft);
    }

    .post {
        box-shadow: none;
    }

    .post-content iframe {
        min-height: 260px;
        box-shadow: none;
    }




}

/* Match the app's shadcn controls without adding React to the Hugo blog. */
.back-to-top a { border-radius: var(--control-radius); }
.site-label, .draft-marker { border-radius: 4px; }
.post-content { overflow-wrap: anywhere; }
.post-meta, .rss-subscribe { font-family: var(--font-body); letter-spacing: 0; }
.post-header .post-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin: 32px 0 0; font-size: var(--type-sm); font-weight: 500; }
.post-meta time { color: var(--foreground); }
.post-meta-item { display: inline-flex; align-items: baseline; gap: 16px; white-space: nowrap; }
.meta-separator { color: var(--link-color); }
.opinion-notice {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    overflow: hidden;
    margin: -1px calc(-1 * var(--page-gutter)) 48px;
    color: var(--foreground);
    background: var(--opinion-surface);
}
/* Skew whole stripe panels so their inner edges end diagonally, never mid-stripe. */
.opinion-notice::before,
.opinion-notice::after {
    content: "";
    flex: 1 1 0;
    min-width: 0;
    transform: skewX(-45deg);
}
.opinion-notice::before {
    /* Extend by a full repeat so skew cannot expose a bare wedge at the viewport edge. */
    margin-inline-start: -64px;
    background: repeating-linear-gradient(to left, var(--foreground) 0 32px, var(--opinion-surface) 32px 64px);
}
.opinion-notice::after {
    margin-inline-end: -64px;
    background: repeating-linear-gradient(to right, var(--foreground) 0 32px, var(--opinion-surface) 32px 64px);
}
.reading-post:has(.opinion-notice) { --reading-top: 76px; }
.opinion-notice span { position: relative; flex: 0 0 auto; padding: var(--space-2) var(--space-12); font-size: 1rem; font-weight: 700; }
.post-header:has(+ .opinion-notice) { margin-bottom: 0; border-bottom: 0; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Fluid Markdown reading layouts, shared visually with About. */
.blog-banner { padding-block: var(--page-banner-padding); border-bottom: 1px solid var(--border-color); }
.blog-banner, .reading-post > .post-header {
    background: var(--card);
    margin-inline: calc(-1 * var(--page-gutter));
    margin-top: calc(-1 * var(--blog-top-padding));
    padding-inline: var(--page-gutter);
    padding-block: var(--page-banner-padding);
}
.blog-banner h1 { margin: 0; }
.archive-year { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 5fr); gap: var(--layout-gap); padding-top: var(--section-space); }
.archive-year-heading { align-self: start; position: sticky; top: 32px; }
.archive-year-heading h2 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; margin: 0; scroll-margin-top: 32px; line-height: 1.2; }
.archive-year-heading p, .archive-posts time { color: var(--muted-foreground); }
.archive-posts { list-style: none; margin: 0; }
.archive-posts li { display: grid; grid-template-columns: 1fr 1fr; align-items: baseline; gap: var(--layout-gap); padding-block: 24px; border-bottom: 1px solid var(--border-color); }
.archive-posts li:first-child { padding-top: 0; }
.archive-posts h3 { font-size: var(--type-title); font-weight: 600; line-height: 1.3; margin: 4px 0 0; }
.archive-posts h3 a { color: var(--foreground); }
.archive-posts h3 a:hover { color: var(--link-color); }
.archive-posts p { margin: 0; color: var(--muted-foreground); }
.archive-posts time { font-size: .9rem; }
.reading-post { padding: 0; border: 0; border-radius: 0; background: transparent; }
.reading-layout { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 3fr); gap: var(--layout-gap); }
.reading-layout .post-content { min-width: 0; width: 100%; max-width: var(--reading-width); grid-column: 2; }
.reading-layout .post-content > :first-child { margin-top: 0; }
.reading-layout .post-content :is(h2,h3) { scroll-margin-top: var(--reading-top, 32px); }
.reading-sidebar-inner { position: sticky; top: var(--reading-top, 32px); max-height: calc(100dvh - var(--reading-top, 32px) - 32px); overflow-y: auto; }
.reading-contents nav { border-top: 2px solid var(--foreground); padding-top: 16px; }
.reading-contents .post-tags { margin-top: 24px; }
.post-tags p { font-size: .8rem; font-weight: 700; }
.post-tags ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.post-tags a { border: 1px solid var(--border-color); padding: 8px 12px; }
.reading-contents .contents-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.contents-heading p { margin: 0; font-size: .8rem; font-weight: 700; }
.reading-contents .contents-empty { margin: 0; color: var(--muted-foreground); font-size: .9rem; line-height: 1.4; }
.contents-heading button { background: transparent; border: 0; border-radius: var(--control-radius); min-width: 44px; min-height: 44px; color: var(--foreground); cursor: pointer; font: inherit; }
.contents-heading button:hover { background: var(--card); }
.reading-contents a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-inline-start: 2px solid var(--border-color); color: var(--muted-foreground); font-size: .9rem; line-height: 1.4; }
.reading-contents a.contents-subheading { padding-inline-start: 24px; font-size: .85rem; }
.reading-contents a:hover, .reading-contents a[aria-current="location"] { color: var(--link-color); border-color: var(--link-color); background: var(--card); text-decoration: none; }
.reading-contents a[aria-current="location"] { font-weight: 700; }
.page-content:has(.reading-post) { padding-bottom: 0; }
.post-timeline { --timeline-gap: var(--layout-gap); --timeline-gutter: var(--page-gutter); --timeline-block-padding: var(--section-space); margin: var(--section-space) calc(-1 * var(--timeline-gutter)) 0; padding: var(--timeline-block-padding) var(--timeline-gutter); background: var(--card); }
.post-timeline ol { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: var(--timeline-gap); margin: 0; list-style: none; }
.post-timeline li { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 28px 0 0; }
.post-timeline li:not(:last-child)::before { content: ""; position: absolute; top: -2px; left: 0; width: calc(100% + var(--timeline-gap)); height: 2px; background: var(--border-color); }
.post-timeline[data-has-older="true"] li:first-child::after { content: ""; position: absolute; top: -2px; left: calc(-1 * var(--timeline-gutter)); width: var(--timeline-gutter); height: 2px; background: var(--border-color); }
.post-timeline[data-has-newer="true"] li:last-child::before { content: ""; position: absolute; top: -2px; left: 0; width: calc(100% + var(--timeline-gutter)); height: 2px; background: var(--border-color); }
.timeline-stop { position: absolute; z-index: 1; top: -7px; left: 0; width: 12px; height: 12px; border: 2px solid var(--muted-foreground); border-radius: 50%; background: var(--background); }
.post-timeline time { color: var(--muted-foreground); font-size: 1rem; line-height: 1.5; }
.timeline-title { font-size: var(--type-lead); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.post-timeline [aria-current="page"] time { color: var(--link-color); }
.post-timeline [aria-current="page"] .timeline-stop { background: var(--link-color); border-color: var(--link-color); box-shadow: 0 0 0 5px var(--muted); }
.post-timeline [aria-current="page"] .timeline-title { color: var(--foreground); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (max-width: 767px) {
    .reading-contents:not(:has(.post-tags)) { display: none; }
    .reading-contents .post-tags { margin-top: 0; }
    .archive-year { grid-template-columns: 1fr; padding-top: 48px; gap: 24px; }
    .archive-year-heading { position: static; display: flex; align-items: baseline; gap: 16px; }
    .archive-year-heading p { margin: 0; }
    .archive-posts li { grid-template-columns: 1fr; gap: 12px; }
    .reading-layout { grid-template-columns: 1fr; gap: var(--layout-gap); }
    .reading-layout .post-content { grid-column: 1; }
    .reading-sidebar-inner { position: static; max-height: none; }
    .post-timeline { --timeline-block-padding: var(--space-12); }
    .post-timeline ol { display: block; }
    .post-timeline li { margin-left: 6px; padding: 0 0 32px 28px; }
    .post-timeline li:not(:last-child)::before { top: 8px; left: -1px; width: 2px; height: 100%; }
    .post-timeline[data-has-older="true"] li:first-child::after { top: calc(-1 * var(--timeline-block-padding)); left: -1px; width: 2px; height: calc(var(--timeline-block-padding) + 8px); }
    .post-timeline[data-has-newer="true"] li:last-child::before { top: 8px; left: -1px; width: 2px; height: calc(100% + var(--timeline-block-padding) - 8px); }
    .post-timeline li:last-child { padding-bottom: 0; }
    .timeline-stop { left: -7px; top: 4px; }
}

/* Baseline typography previously supplied by the Jekyll theme. */
.page-content :where(p, ul, ol, pre, blockquote, figure) { margin: 0 0 24px; }
.page-content :is(ul, ol) { padding-inline-start: 24px; }
.page-content a { text-decoration: none; }
.page-content a:hover { text-decoration: underline; }
.post-content a { text-decoration: underline; }
.post-content pre { overflow-x: auto; }
.post-content table { border-collapse: collapse; width: 100%; }
.post-content th, .post-content td { padding: 12px; border: 1px solid var(--border-color); }
.archive-posts, .post-timeline ol, .post-tags ul { padding: 0; }
.contents-links ul { list-style: none; padding: 0; margin: 0; }
.contents-links ul ul a { padding-inline-start: 24px; }
.skip-link { position: absolute; transform: translateY(-150%); padding: 12px; background: var(--background); z-index: 10; }
.skip-link:focus { transform: none; }
.empty-archive { padding-block: 48px; }

/* Hugo prose keeps its own rhythm; site chrome uses the homepage baseline. */
.blog-chrome { font-size: 1rem; line-height: 1.5; }

/* Build-time writing statistics share one vertical rhythm at every viewport. */
.blog-stats { display: flex; flex-direction: column; gap: var(--section-space); }
.blog-stats > [data-stats-interactions] { display: none; }
.stats-introduction { max-width: var(--reading-width); margin: 0; font-size: var(--type-lead); line-height: var(--leading-prose); }
.stats-totals { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-8); margin: 0; }
.stats-totals > div { border-top: 2px solid var(--foreground); padding-top: var(--space-4); }
.stats-totals dt { font-weight: 600; }
.stats-totals dd { margin: 0; display: flex; flex-direction: column; }
.stats-totals strong { font-family: var(--font-display); font-size: var(--type-display); font-weight: 500; line-height: 1.3; }
.stats-totals dd span, .stats-note, .stats-year-label p { color: var(--muted-foreground); }
.blog-stats h2 { font-family: var(--font-display); font-size: var(--type-section); font-weight: 500; line-height: var(--leading-heading); margin: 0 0 var(--space-6); }
.stats-note { max-width: var(--reading-width); }
.stats-legend { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-block: var(--space-6); font-size: .875rem; }
.stats-legend span { display: flex; align-items: center; gap: var(--space-2); }
.stats-legend i { width: 12px; height: 12px; }
.stats-day { fill: var(--border-color); background: var(--border-color); }
.stats-day.has-posts { fill: var(--foreground); background: var(--foreground); }
.stats-activity > h2 { padding-bottom: var(--space-6); border-bottom: 2px solid var(--foreground); }
.stats-calendar-year { container-type: inline-size; min-width: 0; margin-top: var(--space-8); }
.stats-calendar-year + .stats-calendar-year { margin-top: var(--section-space); }
.stats-year-label { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); padding-bottom: var(--space-4); margin-bottom: var(--space-2); border-bottom: 2px solid var(--foreground); }
.stats-year-label h3 { font-size: var(--type-title); margin: 0; }
.stats-year-label p { margin: 0; }
.stats-calendar-full, .stats-calendar-quarters { padding-block: var(--space-2); }
.stats-calendar-quarters { display: none; }
@container (max-width: 799px) {
    .stats-calendar-full { display: none; }
    .stats-calendar-quarters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-8); }
}
@container (max-width: 499px) {
    .stats-calendar-quarters { grid-template-columns: minmax(0, 1fr); }
}
.stats-calendar { display: block; width: 100%; min-width: 0; max-width: 100%; height: auto; }
.stats-calendar text { fill: var(--muted-foreground); font: 11px var(--font-body); }
.stats-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--section-space); }
.stats-chart { min-width: 0; container-type: inline-size; }
.stats-chart > h2 { padding-bottom: var(--space-6); border-bottom: 2px solid var(--foreground); }
.stats-chart-viewport { position: relative; width: 100%; padding-block: 0 var(--space-2); }
.stats-plot { width: 100%; padding-block: var(--space-2) var(--space-16); position: relative; font-variant-numeric: tabular-nums; }
.stats-plot-area { position: relative; height: 280px; margin-inline-start: var(--space-16); border-inline-start: 1px solid var(--border-color); }
.stats-y-axis { position: absolute; top: var(--space-2); left: 0; height: 280px; width: var(--space-12); color: var(--muted-foreground); font-size: var(--type-sm); }
.stats-y-axis span { position: absolute; bottom: var(--tick-position); right: 0; transform: translateY(50%); }
.stats-gridline { position: absolute; bottom: var(--tick-position); width: 100%; border-top: 1px solid var(--border-color); }
.stats-columns { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--chart-columns), minmax(0, 1fr)); }
.stats-column { position: relative; min-width: 0; }
.stats-bar { position: absolute; bottom: 0; left: 15%; width: 70%; height: var(--bar-height); background: var(--accent-yellow); }
.stats-x-label { position: absolute; top: 100%; left: 0; width: 100%; padding-top: var(--space-3); color: var(--muted-foreground); font-size: var(--type-sm); line-height: 1.4; text-align: center; white-space: nowrap; }
.stats-chart-data { margin-top: var(--space-4); }
.stats-chart-data summary { display: list-item; width: fit-content; min-height: var(--control-height); padding-block: var(--space-2); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.stats-chart table { background: transparent; border: 0; width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats-chart th, .stats-chart td { border-bottom: 1px solid var(--border-color); padding: var(--space-3) var(--space-2); }
.stats-chart th { color: var(--foreground); background: transparent; text-align: start; font-weight: 500; }
.stats-chart thead { border-bottom: 2px solid var(--foreground); }
.stats-chart td { text-align: end; }
.stats-method { margin: 0; }
@media (min-width: 600px) {
    .stats-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stats-totals strong { font-size: clamp(2.5rem, 5vw, 5rem); }
}


.stats-day-trigger, .stats-column { cursor: pointer; }
.stats-column:is(:hover, :focus-visible) .stats-bar { background: var(--foreground); }

.stats-plot[data-dense="true"] .stats-x-label { display: none; width: max-content; left: 50%; transform: translateX(-50%); font-size: var(--type-xs); }
.stats-plot[data-dense="true"] .stats-column:nth-child(4n+1) .stats-x-label { display: block; }
@container (max-width: 500px) {
    .stats-plot[data-dense="true"] .stats-column:nth-child(n) .stats-x-label { display: none; }
    .stats-plot[data-dense="true"] .stats-column:nth-child(6n+1) .stats-x-label { display: block; }
}
@container (max-width: 360px) {
    .stats-plot:not([data-dense="true"]) .stats-column .stats-x-label { display: none; }
    .stats-plot:not([data-dense="true"]) .stats-column:nth-child(3n+1) .stats-x-label,
    .stats-plot:not([data-dense="true"]) .stats-column:last-child .stats-x-label { display: block; }
    .stats-plot[data-dense="true"] .stats-column:nth-child(n) .stats-x-label { display: none; }
    .stats-plot[data-dense="true"] .stats-column:nth-child(8n+1) .stats-x-label { display: block; }
}
.stats-column:first-child .stats-x-label { text-align: start; }
.stats-column:last-child .stats-x-label { text-align: end; }
.stats-plot[data-dense="true"] .stats-column:first-child .stats-x-label { left: 0; transform: none; }
.stats-plot[data-dense="true"] .stats-column:last-child .stats-x-label { display: block; left: auto; right: 0; transform: none; }
@media (min-width: 1024px) {
    .stats-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--section-space) var(--layout-gap); }
}

/* ECharts is loaded only on the stats page; keep Hugo's plot until it is ready. */
.stats-chart-viewport[data-enhanced="true"] > .stats-plot { display: none; }
.stats-chart-viewport:not([data-enhanced="true"]) .stats-chart-enhancement { position: absolute; visibility: hidden; width: 100%; }
.stats-library-chart { width: 100%; height: 340px; min-width: 0; font-family: var(--font-body); }
@media (max-height: 600px) { .stats-library-chart { height: 260px; } }
