:root {
    --bg: #ffffff;
    --surface-soft: #f6f6f7;
    --text: #18181b;
    --muted: #71717a;
    --radius: 8px;
    --pill-radius: 10px;
    --shadow-soft: 0 8px 24px rgba(17, 24, 39, 0.06);
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

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

.site-container {
    min-height: 100vh;
}

.home-layout {
    display: grid;
    grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
    gap: 30px;
    padding: 24px;
}

.home-sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
    background: transparent;
    border-radius: var(--radius);
    padding: 6px;
    color: var(--muted);
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 0;
}

.site-title {
    margin: 0;
    display: block;
    padding: 7px 12px;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--muted);
}

.sidebar-character {
    --size: 30px;
    --line: #666670;
    --fill: #f0f0f2;
    --gaze-x: 0px;
    --gaze-y: 0px;
    --tilt: 0deg;
    --lift: 0px;
    --shift-x: 0px;
    --scale-x: 1;
    --scale-y: 1;
    --radius-shape: 32%;
    --left-eye: 27%;
    --right-eye: 27%;
    width: var(--size);
    height: var(--size);
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}

.sidebar-character .body {
    position: relative;
    width: 88%;
    height: 88%;
    border-radius: var(--radius-shape);
    background: var(--fill);
    transform: translate(var(--shift-x), var(--lift)) rotate(var(--tilt)) scale(var(--scale-x), var(--scale-y));
    transition: transform 220ms ease, border-radius 260ms ease;
}

.sidebar-character .face {
    position: absolute;
    inset: 0;
    transform: translate(var(--gaze-x), var(--gaze-y));
    transition: transform 120ms ease;
}

.sidebar-character .eye {
    position: absolute;
    top: 42%;
    width: 4px;
    height: 10px;
    border-radius: 999px;
    background: var(--line);
    transition: all 180ms ease;
}

.sidebar-character .eye.left {
    left: var(--left-eye);
}

.sidebar-character .eye.right {
    right: var(--right-eye);
}

@keyframes sidebar-character-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.sidebar-character.g-float {
    animation: sidebar-character-float 2.8s ease-in-out infinite;
}

.sidebar-character.sp-wide {
    --left-eye: 27%;
    --right-eye: 27%;
}

.sidebar-character.sp-ultra {
    --left-eye: 22%;
    --right-eye: 22%;
}

.sidebar-character.e-tall .eye {
    width: 4px;
    height: 10px;
}

.sidebar-character.m-blink .eye,
.sidebar-character.m-wink .eye.right,
.sidebar-character.m-sleepy .eye {
    height: 2px;
    width: 8px;
    top: 49%;
}

.sidebar-character.m-focus .eye {
    height: 11px;
}

.sidebar-character.m-happy .eye {
    height: 11px;
    transform: scaleY(1.1);
}

.sidebar-character.m-alert .eye {
    transform: scale(1.13);
}

.sidebar-character.m-look-left .eye {
    transform: translateX(-1.5px);
}

.sidebar-character.m-look-right .eye {
    transform: translateX(1.5px);
}

.sidebar-character.m-sit {
    --lift: 2px;
    --scale-x: 1.07;
    --scale-y: 0.92;
}

.sidebar-character.m-loved .eye {
    height: 8px;
    width: 5px;
    transform: translateY(-1px) scaleY(1.08);
}

.sidebar-character.is-petted .body {
    animation: sidebar-character-pet 520ms ease;
}

@keyframes sidebar-character-pet {
    0% { transform: translate(var(--shift-x), var(--lift)) rotate(0deg) scale(var(--scale-x), var(--scale-y)); }
    25% { transform: translate(var(--shift-x), var(--lift)) rotate(-7deg) scale(var(--scale-x), var(--scale-y)); }
    60% { transform: translate(var(--shift-x), var(--lift)) rotate(6deg) scale(var(--scale-x), var(--scale-y)); }
    100% { transform: translate(var(--shift-x), var(--lift)) rotate(0deg) scale(var(--scale-x), var(--scale-y)); }
}

.sidebar-group + .sidebar-group {
    margin-top: 10px;
}

.sidebar-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-list li + li {
    margin-top: 6px;
}

.sidebar-link,
.sidebar-muted {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 7px 12px;
    border-radius: var(--pill-radius);
    width: 100%;
    color: var(--muted);
}

.sidebar-link:hover,
.sidebar-link.is-active {
    background: var(--surface-soft);
    color: #52525b;
}

.sidebar-muted {
    color: var(--muted);
    background: var(--surface-soft);
}

.home-posts {
    min-width: 0;
}

.info-page {
    width: 100%;
    max-width: 900px;
    justify-self: end;
    align-self: start;
    padding-top: 8px;
}

.info-page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
    gap: 26px;
    align-items: start;
}

.info-main-col {
    min-width: 0;
}

.info-main-col .info-content + .info-content {
    margin-top: 14px;
}

.info-side-col {
    min-width: 0;
}

.info-content {
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--muted);
}

.info-structure-grid {
    display: grid;
    gap: 12px;
}

.info-structure-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.info-structure-list li + li {
    margin-top: 6px;
}

.info-structure-link,
.info-structure-text {
    font-size: 0.82rem;
    color: var(--muted);
}

.info-structure-link {
    display: inline-block;
    transition: transform 160ms ease, color 160ms ease;
}

.info-structure-link::before {
    content: "-> ";
}

.info-structure-link:hover {
    color: #5f5f69;
    transform: translateX(3px);
}

.post-page-wrap {
    width: 100%;
    max-width: min(1320px, 100%);
    justify-self: end;
    align-self: start;
}

.post-gallery {
    display: flex;
    gap: clamp(10px, 1.2vw, 16px);
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: clamp(16px, 2vw, 26px);
    scrollbar-width: thin;
}

.post-gallery-item {
    margin: 0;
    flex: 0 0 auto;
    width: auto;
    height: clamp(360px, 39vw, 700px);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    display: block;
}

.post-gallery-media {
    width: auto;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

.post-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(240px, 0.95fr);
    gap: clamp(18px, 2vw, 30px);
    align-items: start;
}

.post-title-main {
    margin: 0 0 10px;
    font-size: clamp(0.96rem, 0.3vw + 0.88rem, 1.1rem);
    font-weight: 500;
    line-height: 1.35;
    color: #3f3f46;
}

.post-description-main {
    font-size: clamp(0.84rem, 0.18vw + 0.78rem, 0.95rem);
    line-height: 1.65;
    color: var(--muted);
}

.post-side-item {
    margin: 0 0 8px;
    font-size: 0.8rem;
    color: var(--muted);
}

.post-meta-block {
    margin-bottom: 14px;
}

.post-links-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-links-list li + li {
    margin-top: 6px;
}

.post-side-link {
    font-size: 0.82rem;
    color: var(--muted);
    display: inline-block;
    transition: transform 160ms ease, color 160ms ease;
}

.post-side-link:hover {
    color: #5f5f69;
    transform: translateX(3px);
}

.home-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

.post-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.post-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
}

.post-card-link {
    display: block;
    position: relative;
}

.post-media {
    margin: 0;
    aspect-ratio: 16 / 11;
    background: #f4f4f5;
}

.post-media img,
.post-media video,
.post-media-fallback {
    width: 100%;
    height: 100%;
    display: block;
}

.post-media img,
.post-media video {
    object-fit: cover;
}

.post-media-fallback {
    background: linear-gradient(135deg, #f4f4f5, #ededf0);
}

.post-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.25;
    color: #3f3f46;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-card-pill {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 24px);
    min-width: 0;
    padding: 5px 7px 5px 9px;
    border-radius: var(--pill-radius);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px) saturate(130%);
    -webkit-backdrop-filter: blur(10px) saturate(130%);
}

.post-progress {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--pill-radius);
    padding: 5px 10px;
    font-size: 0.88rem;
    line-height: 1;
    white-space: nowrap;
    color: #092016;
    background: #56f96a;
}

.post-progress.is-active {
    background: #14f305;
    color: #063f00;
}

.post-progress.is-idea {
    background: #0ef2d1;
    color: #08362f;
}

.post-progress.is-discovery {
    background: #35d8ff;
    color: #062e45;
}

.post-progress.is-planning {
    background: #7ce7ff;
    color: #08374b;
}

.post-progress.is-paused {
    background: #ffe04a;
    color: #4a2c00;
}

.post-progress.is-review {
    background: #ff9a2b;
    color: #4a1f00;
}

.post-progress.is-complete {
    background: #00f0ff;
    color: #05363f;
}

.post-progress.is-blocked {
    background: #ff3131;
    color: #3f0707;
}

.post-progress.is-archived {
    background: #ff00a8;
    color: #420524;
}

.empty-state {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.home-pagination {
    margin-top: 16px;
    width: 100%;
}

.home-pagination__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.home-pagination__pages {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(44px, 1fr);
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.home-pagination__pages::-webkit-scrollbar {
    display: none;
}

.home-pagination__page,
.home-pagination__prev,
.home-pagination__next,
.home-pagination__page--active,
.home-pagination__prev--disabled,
.home-pagination__next--disabled {
    display: inline-block;
    border-radius: var(--pill-radius);
    background: var(--surface-soft);
    padding: 6px 10px;
    font-size: 0.86rem;
    text-align: center;
    white-space: nowrap;
}

.home-pagination__prev,
.home-pagination__next,
.home-pagination__prev--disabled,
.home-pagination__next--disabled {
    flex: 0 0 104px;
}

.home-pagination__page,
.home-pagination__page--active {
    width: 100%;
    min-width: 44px;
}

.home-pagination__page--active {
    background: #18181b;
    color: #fff;
}

.home-pagination__prev--disabled,
.home-pagination__next--disabled {
    color: #9b9d95;
}

.site-footer {
    padding: 8px 24px 24px;
    color: var(--muted);
    font-size: 0.8rem;
}

.site-footer p {
    margin: 0;
}

.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.94);
    z-index: 120;
    opacity: 0;
    transition: opacity 220ms ease;
}

.lightbox.active {
    opacity: 1;
}

.lightbox-content {
    width: 100%;
    height: 100%;
    padding: clamp(18px, 2.8vw, 36px) clamp(62px, 5vw, 96px);
    box-sizing: border-box;
    display: grid;
    place-items: center;
}

.lightbox-image,
.lightbox-video {
    width: auto;
    height: auto;
    max-width: calc(100vw - clamp(124px, 10vw, 192px));
    max-height: calc(100vh - clamp(72px, 8vh, 120px));
    display: none;
    object-fit: contain;
    object-position: center;
    border-radius: var(--radius);
}

.lightbox-image.active,
.lightbox-video.active {
    display: block;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    border: 0;
    border-radius: 10px;
    background: rgba(113, 113, 122, 0.22);
    color: #3f3f46;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1;
    backdrop-filter: blur(8px) saturate(115%);
    -webkit-backdrop-filter: blur(8px) saturate(115%);
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:hover {
    background: rgba(113, 113, 122, 0.3);
}

.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }

.lightbox-prev[disabled],
.lightbox-next[disabled] {
    opacity: 0.35;
    cursor: default;
}

@media (min-width: 1400px) {
    .post-page-wrap {
        max-width: min(1520px, 100%);
    }

    .post-gallery-item {
        height: clamp(420px, 36vw, 780px);
    }
}

@media (max-width: 1200px) {
    .post-page-wrap {
        max-width: none;
    }

    .post-gallery-item {
        height: clamp(310px, 49vw, 560px);
    }

    .post-content-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(220px, 1fr);
    }
}

@media (max-width: 940px) {
    .home-layout {
        grid-template-columns: 1fr;
        padding: 16px 16px 96px;
    }

    .home-sidebar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 12px;
        top: auto;
        z-index: 40;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px;
        border-radius: var(--pill-radius);
        background: rgba(255, 255, 255, 0.62);
        backdrop-filter: blur(14px) saturate(130%);
        -webkit-backdrop-filter: blur(14px) saturate(130%);
        box-shadow: 0 10px 30px rgba(17, 24, 39, 0.14);
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .home-sidebar::-webkit-scrollbar {
        display: none;
    }

    .home-sidebar .sidebar-head {
        display: flex;
        margin: 0;
        padding: 0 2px 0 0;
        gap: 0;
    }

    .home-sidebar .site-title {
        display: none;
    }

    .home-sidebar .sidebar-character {
        --size: 28px;
        margin-right: 2px;
    }

    .home-sidebar .sidebar-group {
        display: contents;
    }

    .home-sidebar .sidebar-group + .sidebar-group {
        margin-top: 0;
    }

    .home-sidebar .sidebar-list {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex-wrap: nowrap;
    }

    .home-sidebar .sidebar-list li {
        flex: 0 0 auto;
    }

    .home-sidebar .sidebar-list li + li {
        margin-top: 0;
    }

    .home-sidebar .sidebar-link,
    .home-sidebar .sidebar-muted {
        width: auto;
        padding: 7px 12px;
        border-radius: var(--pill-radius);
        background: rgba(255, 255, 255, 0.56);
        color: #5f5f69;
    }

    .home-sidebar .sidebar-link:hover {
        background: rgba(113, 113, 122, 0.14);
        color: #4b4b55;
    }

    .home-sidebar .sidebar-link.is-active {
        background: rgba(113, 113, 122, 0.2);
        color: #3f3f46;
    }

    .home-posts-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .info-page {
        justify-self: stretch;
        max-width: none;
    }

    .info-page-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .post-page-wrap {
        justify-self: stretch;
        max-width: none;
    }

    .post-gallery-item {
        width: auto;
        height: clamp(240px, 68vw, 420px);
    }

    .post-content-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
