@import url("https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Newsreader:opsz,wght@6..72,400..800&display=swap");

:root {
    color-scheme: dark;
    --paper: #101417;
    --surface: #171d21;
    --soft: #222a30;
    --shade: #3a454d;
    --ink: #e6edf3;
    --muted: #9aa7b2;
    --line: #c8d3dc;
    --accent: #ff8a52;
    --blue: #79b8ff;
    --focus: #79b8ff;
    --grid-line: rgba(230, 237, 243, 0.08);
    --contour-opacity: 0.12;
    --contour-filter: none;
    --site-font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --site-heading-font-family: "Newsreader", Georgia, "Times New Roman", serif;
    --pico-font-family: var(--site-font-family);
    --pico-border-radius: 0;
    --pico-primary: var(--accent);
    --pico-primary-hover: #ffad82;
    --pico-primary-focus: rgba(121, 184, 255, 0.32);
    --pico-color: var(--ink);
    --pico-h1-color: var(--ink);
    --pico-h2-color: var(--ink);
    --pico-h3-color: var(--ink);
    --pico-h4-color: var(--ink);
    --pico-h5-color: var(--ink);
    --pico-h6-color: var(--ink);
    --pico-background-color: var(--paper);
    --pico-card-background-color: transparent;
    --pico-card-box-shadow: none;
    font-family: var(--site-font-family);
}

:root[data-theme="light"] {
    color-scheme: light;
    --paper: #f4f6f8;
    --surface: #ffffff;
    --soft: #e1e6eb;
    --shade: #c8d0d8;
    --ink: #1f252b;
    --muted: #5d6873;
    --line: #252b31;
    --accent: #e6531d;
    --blue: #1f6feb;
    --focus: #0b63ce;
    --grid-line: rgba(37, 43, 49, 0.07);
    --contour-opacity: 0.1;
    --contour-filter: invert(1);
    --pico-primary-hover: #b83f14;
    --pico-primary-focus: rgba(31, 111, 235, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--paper);
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--site-font-family);
    font-size: 14px;
    line-height: 1.2;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("assets/background-contours.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: var(--contour-opacity);
    filter: var(--contour-filter);
}

a {
    color: var(--accent);
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

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

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
}

h1,
h2,
h3,
p,
ul,
ol {
    margin-top: 0;
}

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

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1040px, calc(100% - 24px));
    margin: 0 auto;
    padding: 14px 0 48px;
}

.site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 10px 0 12px;
    border-top: 4px solid var(--line);
    border-bottom: 2px solid var(--line);
}

.domain-label {
    margin: 0 0 4px;
    color: var(--accent);
    font-family: var(--site-heading-font-family);
    font-size: 0.86rem;
    font-weight: 800;
}

.site-header h1 {
    margin: 0;
    color: var(--ink);
    font-family: var(--site-heading-font-family);
    font-size: 1.8rem;
    line-height: 1.1;
    letter-spacing: 0;
}

.intro {
    max-width: 72ch;
    margin: 8px 0 0;
    color: var(--muted);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: 8px 12px;
    font-size: 0.86rem;
}

.site-nav a {
    color: var(--ink);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--accent);
}

.theme-toggle {
    width: auto;
    align-self: baseline;
    appearance: none;
    -webkit-appearance: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--muted);
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-weight: 700;
    line-height: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--accent);
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    justify-content: flex-end;
    align-items: baseline;
    margin-top: 22px;
    padding-top: 8px;
    border-top: 2px solid var(--line);
    font-size: 0.86rem;
}

.footer-home {
    margin-right: auto;
}

.footer-home.is-current {
    color: var(--muted);
}

.section-block {
    margin-top: 18px;
    padding-top: 8px;
    border-top: 2px solid var(--line);
}

.site-header + .section-block {
    padding-top: 0;
    border-top: 0;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 7px;
}

.section-head h2,
.section-head p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: 0;
}

.section-head h2 {
    color: var(--ink);
    font-family: var(--site-heading-font-family);
    font-weight: 800;
}

.section-head p {
    color: var(--muted);
}

.section-summary {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.86rem;
}

.link-list,
.latest-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.link-row {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid var(--shade);
}

.link-row:first-child {
    border-top: 0;
}

.row-kicker,
.record-date,
.placeholder-row {
    color: var(--muted);
    font-size: 0.78rem;
}

.placeholder-row {
    padding: 7px 0;
    border-top: 1px solid var(--shade);
}

.latest-list {
    border-top: 1px solid var(--line);
}

.latest-record {
    display: grid;
    grid-template-columns: 72px 8.5rem minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--shade);
}

.latest-thumb,
.astro-thumb {
    display: block;
    background: #090b0d;
    cursor: zoom-in;
}

.latest-thumb picture,
.astro-thumb picture {
    display: block;
}

.latest-thumb img {
    width: 72px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--line);
}

.latest-thumb:hover img,
.latest-thumb:focus-visible img,
.astro-thumb:hover img,
.astro-thumb:focus-visible img {
    border-color: var(--accent);
}

.latest-main {
    min-width: 0;
}

.latest-title {
    display: inline-block;
    margin-bottom: 3px;
    font-family: var(--site-heading-font-family);
}

.record-note {
    display: block;
    color: var(--muted);
    font-size: 0.86rem;
}

.resume-section {
    max-width: 880px;
}

.resume-list {
    border-top: 1px solid var(--line);
}

.resume-entry {
    padding: 10px 0;
    border-bottom: 1px solid var(--shade);
}

.resume-entry-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 18px;
    align-items: start;
    margin-bottom: 7px;
}

.resume-entry h3,
.resume-role,
.resume-location,
.resume-meta,
.resume-note {
    margin: 0;
}

.resume-entry h3 {
    color: var(--ink);
    font-family: var(--site-heading-font-family);
    font-size: 0.98rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.resume-role {
    color: var(--ink);
    font-size: 0.86rem;
}

.resume-location,
.resume-meta,
.resume-note {
    color: var(--muted);
    font-size: 0.78rem;
}

.resume-meta {
    text-align: right;
    white-space: nowrap;
}

.resume-entry ul {
    margin: 0;
    padding-left: 1.2rem;
}

.resume-entry li {
    margin: 4px 0;
}

.resume-entry-compact {
    padding-bottom: 9px;
}

.astro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    border-top: 2px solid var(--line);
    border-left: 1px solid var(--line);
}

.astro-card {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
    overflow: hidden;
}

.astro-thumb,
.astro-meta {
    color: inherit;
    text-decoration: none;
}

.astro-thumb {
    border-bottom: 1px solid var(--line);
}

.astro-meta {
    display: grid;
    grid-template-rows: auto auto 1fr;
}

.astro-meta:hover h2,
.astro-meta:focus-visible h2 {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.astro-thumb img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.astro-meta {
    padding: 8px;
}

.astro-meta time {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
}

.astro-meta h2 {
    margin: 0;
    color: var(--ink);
    font-family: var(--site-heading-font-family);
    font-size: 0.98rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.astro-meta p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.astro-post {
    max-width: 760px;
}

.astro-post-body {
    max-width: 72ch;
}

.astro-post-body h1 {
    margin-bottom: 8px;
    font-family: var(--site-heading-font-family);
    font-size: 1.39rem;
    line-height: 1.2;
    letter-spacing: 0;
}

.astro-post-body h2,
.astro-post-body h3 {
    margin-top: 18px;
    font-family: var(--site-heading-font-family);
    font-size: 1.2rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.astro-post-body p,
.astro-post-body ul,
.astro-post-body ol {
    margin-bottom: 12px;
}

.astro-post-body img {
    margin: 8px 0 14px;
    border: 1px solid var(--line);
    background: #090b0d;
}

.astro-post-body .post-image-link {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 8px 0 14px;
}

.astro-post-body .post-image-link img {
    margin: 0;
    cursor: zoom-in;
}

.astro-post-body .post-image-link:hover img,
.astro-post-body .post-image-link:focus-visible img {
    border-color: var(--accent);
}

.astro-post-body a {
    overflow-wrap: anywhere;
}

body.post-lightbox-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
    touch-action: none;
}

.post-lightbox[hidden] {
    display: none;
}

.post-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    padding:
        calc(14px + env(safe-area-inset-top))
        calc(14px + env(safe-area-inset-right))
        calc(14px + env(safe-area-inset-bottom))
        calc(14px + env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.86);
}

.post-lightbox-viewport {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    touch-action: none;
}

.post-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid var(--line);
    background: #090b0d;
    cursor: zoom-in;
    object-fit: contain;
    touch-action: none;
    user-select: none;
    will-change: transform;
}

.post-lightbox-loading .post-lightbox-image {
    cursor: wait;
}

.post-lightbox-zoomed .post-lightbox-image {
    cursor: grab;
}

.post-lightbox-dragging .post-lightbox-image {
    cursor: grabbing;
}

.post-lightbox-error {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--paper);
    font-size: 0.86rem;
}

.post-lightbox-footer {
    z-index: 1001;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    min-width: 0;
}

.post-lightbox-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: baseline;
    min-width: 0;
    max-width: min(72ch, 100%);
    margin: 0;
    color: var(--ink);
    font-size: 0.82rem;
    line-height: 1.25;
}

.post-lightbox-caption {
    overflow-wrap: anywhere;
}

.post-lightbox-count,
.post-lightbox-post-link {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

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

.post-lightbox-controls {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
}

.post-lightbox-controls button,
.post-lightbox-close,
.post-lightbox-nav {
    width: auto;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 0;
    color: var(--ink);
    background: var(--paper);
    box-shadow: none;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.post-lightbox-controls button + button {
    border-left: 0;
}

.post-lightbox-controls button:hover:not(:disabled),
.post-lightbox-close:hover,
.post-lightbox-nav:hover:not(:disabled) {
    color: var(--accent);
}

.post-lightbox-controls button:disabled,
.post-lightbox-nav:disabled {
    color: var(--muted);
    cursor: default;
    opacity: 0.48;
}

.post-lightbox-close {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
    z-index: 1002;
}

.post-lightbox-nav {
    position: fixed;
    top: 50%;
    z-index: 1001;
    transform: translateY(-50%);
}

.post-lightbox-prev {
    left: calc(10px + env(safe-area-inset-left));
}

.post-lightbox-next {
    right: calc(10px + env(safe-area-inset-right));
}

@media (prefers-reduced-motion: no-preference) {
    .post-lightbox {
        animation: lightbox-fade 120ms ease-out;
    }

    .post-lightbox-image {
        transition: transform 120ms ease-out;
    }

    .post-lightbox-dragging .post-lightbox-image {
        transition: none;
    }
}

@keyframes lightbox-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 760px) {
    .site-header,
    .section-grid,
    .link-row,
    .latest-record,
    .resume-entry-head {
        grid-template-columns: 1fr;
    }

    .site-nav {
        justify-content: start;
    }

    .site-footer {
        justify-content: flex-start;
    }

    .latest-record {
        gap: 6px;
    }

    .latest-thumb {
        width: 96px;
    }

    .latest-thumb img {
        width: 96px;
    }

    .post-lightbox {
        gap: 8px;
        padding:
            calc(10px + env(safe-area-inset-top))
            calc(10px + env(safe-area-inset-right))
            calc(10px + env(safe-area-inset-bottom))
            calc(10px + env(safe-area-inset-left));
    }

    .post-lightbox-footer {
        align-items: flex-start;
    }

    .post-lightbox-controls {
        width: 100%;
        justify-content: center;
    }

    .post-lightbox-meta {
        max-width: 100%;
    }

    .resume-meta {
        text-align: left;
        white-space: normal;
    }
}
