* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(178, 168, 184, 0.3) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 184, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(178, 168, 184, 0.5);
}

::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f2ede6;
    background-color: #100e0a;
}

a {
    color: inherit;
    text-decoration: none;
}

body.flyout-lock {
    overflow: hidden;
}

:root {
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.home {
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(28, 14, 46, 0.36), rgba(28, 14, 46, 0.36)), url("../images/hero-background.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-blend-mode: multiply;
}

.home-mark {
    position: absolute;
    top: 47vh;
    left: 25vw;
}

.home-mark span {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.03em;
    color: #f2ede6;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.home-nav {
    position: absolute;
    top: 58vh;
    left: 25vw;
}

.home-nav table {
    border-collapse: collapse;
}

.home-nav td {
    padding: 0.35em 0;
    text-align: left;
}

.home-nav a {
    display: inline-block;
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    letter-spacing: 0.08em;
    color: #f2ede6;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
    transition: opacity 0.2s ease;
}

.home-nav a:hover,
.home-nav a:focus-visible {
    opacity: 0.65;
}

/* ---------- post feed (home) ---------- */

.home-scroll-spacer {
    height: 170vh;
}

.post-feed {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: 40vw;
    padding: 1.4vw;
    transform: translateY(112%);
    pointer-events: none;
}

.post-feed.is-visible {
    pointer-events: auto;
}

.post-feed-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6vw;
    max-height: calc(80vh - 2.8vw);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(178, 168, 184, 0.3) transparent;
}

.post-feed-list::-webkit-scrollbar {
    width: 5px;
}

.post-feed-list::-webkit-scrollbar-thumb {
    background: rgba(178, 168, 184, 0.3);
    border-radius: 3px;
}

.feed-card {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.5s ease calc(var(--i) * 70ms), transform 0.5s ease calc(var(--i) * 70ms);
}

.post-feed.is-visible .feed-card {
    opacity: 1;
    transform: translateY(0);
}

.feed-card-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85em;
    padding: 0.85em;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(52, 44, 50, 0.26), rgba(9, 7, 9, 0.58));
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.22),
        0 6px 16px rgba(4, 3, 6, 0.28);
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.feed-card-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--grain);
    background-size: 140px 140px;
    opacity: 0.09;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.feed-card-link:hover,
.feed-card-link:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    background: linear-gradient(160deg, rgba(64, 54, 60, 0.34), rgba(13, 10, 13, 0.66));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 -1px 0 rgba(0, 0, 0, 0.22),
        0 10px 22px rgba(4, 3, 6, 0.32);
}

.feed-card-link:active {
    transform: translateY(0) scale(0.985);
    transition-duration: 0.1s;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25),
        0 3px 8px rgba(4, 3, 6, 0.3);
}

.feed-card-body {
    min-width: 0;
}

.feed-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6em;
}

.feed-card-title {
    flex: 1 1 auto;
    min-width: 0;
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.25;
    color: #f2ede6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-card-date {
    flex: 0 0 auto;
    width: 4.4em;
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: right;
    color: rgba(242, 237, 230, 0.5);
    white-space: nowrap;
}

.feed-card-excerpt {
    margin-top: 0.2em;
    font-size: 0.78rem;
    line-height: 1.4;
    color: rgba(242, 237, 230, 0.65);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 780px) {
    .post-feed {
        left: 0;
        right: 0;
        width: 100%;
        padding: 4vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .post-feed,
    .feed-card {
        transition: none;
    }
}

/* ---------- post flyout (expanded reader) ---------- */

.post-flyout {
    position: fixed;
    inset: 0;
    z-index: 40;
    visibility: hidden;
    pointer-events: none;
}

.post-flyout.is-open {
    visibility: visible;
    pointer-events: auto;
}

.post-flyout-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 14, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.post-flyout.is-open .post-flyout-backdrop {
    opacity: 1;
}

.post-flyout-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(720px, 90vw);
    max-height: min(80vh, 820px);
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(94, 82, 98, 0.5), rgba(17, 14, 20, 0.96));
    border: 1px solid rgba(198, 190, 202, 0.08);
    backdrop-filter: blur(16px) saturate(88%);
    -webkit-backdrop-filter: blur(16px) saturate(88%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(4, 3, 6, 0.5),
        0 28px 60px rgba(4, 3, 6, 0.55);
    overflow-y: auto;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.post-flyout-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--grain);
    background-size: 140px 140px;
    opacity: 0.05;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.post-flyout.is-open .post-flyout-panel {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.post-flyout-panel::-webkit-scrollbar {
    width: 6px;
}

.post-flyout-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.6rem;
    background: linear-gradient(rgba(19, 16, 23, 0.85), rgba(19, 16, 23, 0.5) 85%, transparent);
}

.post-flyout-close,
.post-flyout-prev,
.post-flyout-next {
    appearance: none;
    background: none;
    border: none;
    color: #f2ede6;
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.post-flyout-close:hover,
.post-flyout-prev:hover,
.post-flyout-next:hover,
.post-flyout-close:focus-visible,
.post-flyout-prev:focus-visible,
.post-flyout-next:focus-visible {
    opacity: 1;
}

.post-flyout-close {
    font-size: 2rem;
    line-height: 1;
}

.post-flyout-nav {
    display: flex;
    gap: 1.4rem;
}

.post-flyout-prev,
.post-flyout-next {
    font-size: 1.3rem;
}

.post-flyout-prev:disabled,
.post-flyout-next:disabled {
    opacity: 0.2;
    cursor: default;
}

.flyout-feature-image {
    display: block;
    width: calc(100% - 3.2rem);
    height: auto;
    max-height: 36vh;
    margin: 1.6rem auto 0;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.flyout-title {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.75rem, 3.6vw, 2.75rem);
    line-height: 1.15;
    max-width: 720px;
    margin: 2rem auto 0;
    padding: 0 6vw;
}

.flyout-meta {
    display: flex;
    gap: 0.75em;
    max-width: 720px;
    margin: 0.75rem auto 0;
    padding: 0 6vw;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    opacity: 0.65;
}

.post-flyout-panel .flyout-title,
.post-flyout-panel .flyout-meta {
    max-width: none;
    padding: 0 1.6rem;
}

.post-flyout-panel .post-content {
    max-width: none;
    margin: 1.5rem 0 0;
    padding: 0 1.6rem 2rem;
}

@media (prefers-reduced-motion: reduce) {
    .post-flyout-backdrop,
    .post-flyout-panel {
        transition: none;
    }
}

/* ---------- site nav (post / page / archive / error headers) ---------- */

.site-nav {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1em;
    padding: 6vh 6vw 4vh;
}

.site-nav-mark {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    letter-spacing: 0.03em;
}

.site-nav table {
    border-collapse: collapse;
}

.site-nav td {
    padding: 0 0 0 1.5em;
}

.site-nav a {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    opacity: 0.65;
}

/* ---------- post / page ---------- */

.post-header {
    max-width: 720px;
    margin: 0 auto;
    padding-left: 6vw;
    padding-right: 6vw;
}

.post-feature-image {
    display: block;
    width: 100%;
    height: auto;
    margin: 2rem 0;
    border-radius: 2px;
}

.post-title {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.15;
    margin-bottom: 1rem;
}

.post-meta {
    display: flex;
    gap: 0.75em;
    flex-wrap: wrap;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

.post-tags {
    list-style: none;
    display: flex;
    gap: 0.75em;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.post-tags a {
    opacity: 0.7;
}

.post-tags a:hover {
    opacity: 1;
}

.post-content {
    max-width: 720px;
    margin: 2.5rem auto 0;
    padding: 0 6vw 8vh;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    line-height: 1.7;
}

.post-content p {
    margin-bottom: 1.4em;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    line-height: 1.25;
    margin: 1.8em 0 0.6em;
}

.post-content h2 {
    font-size: 1.75rem;
}

.post-content h3 {
    font-size: 1.4rem;
}

.post-content h4 {
    font-size: 1.15rem;
}

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

.post-content a {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.post-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 6vw 8vh;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    letter-spacing: 0.04em;
}

.post-footer a:empty {
    display: none;
}

/* ---------- archive (tag / author) ---------- */

.archive-header {
    padding: 0 6vw 2vh;
}

.archive-title {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
}

.archive-description {
    margin-top: 0.5rem;
    opacity: 0.75;
}

.archive-list {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 6vw 4vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.archive-post-link {
    display: block;
}

.archive-post-title {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
}

.archive-post-excerpt {
    opacity: 0.8;
    line-height: 1.6;
    margin-bottom: 0.4rem;
}

.archive-post-date {
    font-size: 0.85rem;
    opacity: 0.6;
}

.pagination {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 6vw 8vh;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

/* ---------- writing / photos (branded section pages) ---------- */

.section-hero {
    position: relative;
    display: flex;
    min-height: 44vh;
    background-color: #100e0a;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.section-hero.has-image {
    background-image: linear-gradient(rgba(16, 14, 10, 0.3), rgba(16, 14, 10, 0.88)), var(--section-image);
}

.section-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--grain);
    background-size: 140px 140px;
    opacity: 0.05;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.section-hero-inner {
    margin-top: auto;
    padding: 4vh 6vw 6vh;
}

.section-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.6;
}

.section-title {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-weight: 500;
    font-size: clamp(2.5rem, 6vw, 4.25rem);
    line-height: 1.1;
    margin-top: 0.5rem;
}

.section-description {
    margin-top: 1rem;
    max-width: 560px;
    line-height: 1.6;
    opacity: 0.75;
}

.section-page .post-content {
    margin-top: 1rem;
    opacity: 0;
    animation: section-body-in 0.6s ease 0.1s forwards;
}

.writing-body {
    max-width: 720px;
}

.photos-body {
    max-width: 1100px;
}

.photos-body img,
.photos-body .kg-gallery-image img {
    border-radius: 12px;
}

.photos-body .kg-gallery-image img {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes section-body-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .section-page .post-content {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ---------- error ---------- */

.error-template {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 6vw 8vh;
    text-align: center;
}

.error-code {
    font-family: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    font-size: clamp(3rem, 10vw, 6rem);
}

.error-message {
    opacity: 0.75;
    margin: 1rem 0 2rem;
}

/* ---------- Koenig editor card widths ---------- */

.kg-width-wide {
    max-width: 1040px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-width-full {
    max-width: 1600px;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
    height: auto;
    display: block;
}
