/* =====================
   Reset & Base
   ===================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-width: 210px;
    --sidebar-bg: #222222;
    --main-bg: #F8F8F8;
    --accent: #4a90a4;
    --text: #1a1a1a;
    --text-muted: #666;
    --sidebar-text: #c8c8c8;
    --sidebar-name: #ffffff;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --content-max: 740px;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: var(--main-bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =====================
   Sidebar
   ===================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 100;
    overflow-y: auto;
}

.sidebar-inner {
    padding: 40px 28px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.site-name {
    color: var(--sidebar-name);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.3;
    margin-bottom: 52px;
    display: block;
    letter-spacing: -0.2px;
}

.site-name:hover {
    text-decoration: none;
    color: var(--sidebar-name);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.sidebar-nav a {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    transition: color 0.15s ease;
    letter-spacing: 0.1px;
}

.sidebar-nav a:hover {
    color: #fff;
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--accent);
}

/* =====================
   Main Content
   ===================== */
.mobile-header {
    display: none;
}

.overlay {
    display: none;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 64px 72px;
}

/* =====================
   Home
   ===================== */
.home-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 48px;
    max-width: var(--content-max);
}

.home-text {
    flex: 1;
}

.home-text h1 {
    font-size: 40px;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 28px;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.home-text p {
    font-size: 15.5px;
    line-height: 1.85;
    color: var(--text);
    margin-bottom: 16px;
}

.home-text p:last-child {
    margin-bottom: 0;
}

.home-text p.home-footnote {
    font-size: 13px;
    color: #aaa;
    margin-top: 4px;
}

.home-photo {
    flex-shrink: 0;
    width: 240px;
}

.home-photo img {
    width: 100%;
    display: block;
}

/* =====================
   List Pages (Essay / Notes)
   ===================== */
.page-title {
    font-size: 40px;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 36px;
    letter-spacing: -0.5px;
    line-height: 1.15;
}

.post-list {
    list-style: none;
    max-width: var(--content-max);
}

.post-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 18px;
}

.bullet {
    color: var(--text);
    font-size: 9px;
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

.post-list a {
    color: var(--text);
    font-size: 15.5px;
    line-height: 1.5;
    text-decoration: none;
}

.post-list a:hover {
    text-decoration: underline;
}

.empty-message {
    font-size: 15px;
    color: var(--text-muted);
}

/* =====================
   Detail Pages
   ===================== */
.detail-article {
    max-width: 680px;
}

.back-link {
    display: inline-block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
    text-decoration: none;
    transition: color 0.15s;
}

.back-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.detail-header {
    margin-bottom: 44px;
    padding-bottom: 28px;
    border-bottom: 1px solid #e2e2e0;
}

.detail-header h1 {
    font-size: 28px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.detail-meta {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 400;
}

.detail-content {
    font-size: 17.5px;
    line-height: 2;
    color: var(--text);
    word-break: keep-all;
    word-wrap: break-word;
}

.detail-content p {
    margin-bottom: 28px;
}

.detail-content p:last-child {
    margin-bottom: 0;
}

/* =====================
   Channel
   ===================== */
.channel-desc {
    font-size: 15.5px;
    color: var(--text-muted);
    margin-bottom: 36px;
    max-width: var(--content-max);
}

.channel-list {
    list-style: none;
    max-width: var(--content-max);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.channel-list li {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e5e5e3;
}

.channel-list li:first-child {
    border-top: 1px solid #e5e5e3;
}

.channel-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
    min-width: 90px;
    flex-shrink: 0;
}

.channel-list a {
    font-size: 15.5px;
    color: var(--accent);
    text-decoration: none;
}

.channel-list a:hover {
    text-decoration: underline;
}

/* =====================
   Contact
   ===================== */
.contact-text {
    font-size: 15.5px;
    line-height: 2;
    color: var(--text);
}

.contact-text a {
    color: var(--accent);
}

/* =====================
   Mobile
   ===================== */
@media (max-width: 768px) {

    /* Mobile header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        height: 54px;
        background: var(--main-bg);
        position: sticky;
        top: 0;
        z-index: 200;
        border-bottom: 1px solid #e0e0de;
    }

    .mobile-site-name {
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        text-decoration: none;
        letter-spacing: -0.1px;
    }

    .mobile-site-name:hover {
        text-decoration: none;
        color: var(--text);
    }

    .menu-toggle {
        background: none;
        border: none;
        cursor: pointer;
        padding: 6px 4px;
        display: flex;
        flex-direction: column;
        gap: 5px;
        -webkit-tap-highlight-color: transparent;
    }

    .menu-toggle span {
        display: block;
        width: 22px;
        height: 1.5px;
        background: var(--text);
        transition: all 0.25s ease;
    }

    /* Sidebar becomes slide-in drawer */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 72%;
        max-width: 280px;
        z-index: 300;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay */
    .overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 250;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .overlay.visible {
        opacity: 1;
        pointer-events: all;
    }

    /* Main content */
    .main-content {
        margin-left: 0;
        padding: 36px 24px 60px;
    }

    /* Home: stack photo below text */
    .home-layout {
        flex-direction: column;
        gap: 32px;
    }

    .home-photo {
        width: 100%;
        max-width: 280px;
    }

    .home-text h1 {
        font-size: 32px;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 32px;
        margin-bottom: 28px;
    }

    .detail-header h1 {
        font-size: 23px;
    }

    .detail-content {
        font-size: 16.5px;
        line-height: 1.95;
    }

    .channel-label {
        min-width: 80px;
    }

    .channel-list li {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 28px 20px 60px;
    }

    .home-text h1,
    .page-title {
        font-size: 28px;
    }

    .detail-header h1 {
        font-size: 21px;
    }

    .detail-content {
        font-size: 16px;
    }
}
