/* ========================================================
   Editorial Portfolio Theme  v3  —  Soft Gallery
   深炭黑侧栏 + 淡水泥灰主区，对比强烈、画廊气质
   ======================================================== */

:root {
    /* 主区（右侧） */
    --bg: #FFFFFF;
    --bg-alt: #F4F4F2;       /* 干净的深一点的灰白【分类/搜索底色】 */
    --ink: #1A1A1A;
    --ink-soft: #4A4A48;
    --ink-mute: #8A8780;
    --rule: #1A1A1A;
    --rule-soft: #ECECE8;
    --accent: #B6471A;       /* 赤陶橙（主警示仍保留） */
    --accent-red: #FF5A6E;   /* 粉红色搜索按钮 */

    /* 侧栏（纯黑） */
    --sidebar-bg: #000000;
    --sidebar-ink: #F0EDE5;
    --sidebar-ink-soft: #B8B4AB;
    --sidebar-ink-mute: #807C75;
    --sidebar-rule: #2A2A2A;

    --sidebar-w: 320px;

    --font-serif: "Cormorant Garamond", "MiSans", "PingFang SC", "Songti SC", Georgia, serif;
    --font-sans:  "MiSans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono:  "JetBrains Mono", "SFMono-Regular", Menlo, "MiSans", monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; transition: opacity .2s ease, color .2s ease; }
a:hover { opacity: .65; }
img { max-width: 100%; height: auto; display: block; }

/* ============= layout ============= */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ============= sidebar (深色) ============= */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
}
.sidebar-inner {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 40px 32px 28px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-top { flex: 1 1 auto; }
.sidebar-bottom {
    flex: 0 0 auto;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--sidebar-rule);
}

.avatar {
    display: inline-block;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 24px;
    background: #2E2E2E;
}
.avatar img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 1.4s cubic-bezier(.2,.8,.2,1);
}
.avatar:hover img { transform: scale(1.06); }

.sidebar .role {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--sidebar-ink-mute);
    margin-bottom: 8px;
}
.sidebar .brand {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.005em;
    margin: 0 0 12px;
    color: var(--sidebar-ink);
}
.sidebar .brand em { font-style: italic; color: var(--accent); }
.sidebar .brand a { color: inherit; }

.sidebar .tagline {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 17px;
    line-height: 1.45;
    color: var(--sidebar-ink-soft);
    margin: 0 0 22px;
}
.sidebar .bio {
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--sidebar-ink-soft);
    margin-bottom: 24px;
}
.sidebar .bio p { margin: 0 0 12px; }

.meta-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    border-top: 1px solid var(--sidebar-rule);
}
.meta-list li {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--sidebar-rule);
    font-size: 13px;
}
.meta-list li span {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--sidebar-ink-mute);
}
.meta-list li strong {
    font-weight: 500;
    color: var(--sidebar-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}
.skills span {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 4px 10px;
    border: 1px solid var(--sidebar-rule);
    color: var(--sidebar-ink-soft);
    border-radius: 999px;
}

.back-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--sidebar-ink-mute);
    margin-top: 8px;
}
.back-link:hover { color: var(--sidebar-ink); opacity: 1; }

.social {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--sidebar-ink-soft);
    margin-bottom: 12px;
}
.social a:hover { color: var(--sidebar-ink); opacity: 1; }

.copyright {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .15em;
    color: var(--sidebar-ink-mute);
    text-transform: uppercase;
}

/* ============= main (浅色) ============= */
.main {
    padding: 40px 64px 96px;
    min-width: 0;
    background: var(--bg);
}

@media (max-width: 1100px) {
    :root { --sidebar-w: 280px; }
    .main { padding: 32px 40px 80px; }
}

/* ============= hero banner (单行) ============= */
.hero-banner {
    padding: 8px 0 16px;
    margin-bottom: 0;
}
.hero-banner .eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .25em;
    color: var(--ink-mute);
    margin-bottom: 0;
}
@media (max-width: 800px) {
    .hero-banner { padding: 4px 0 10px; }
}

/* ============= filter (sticky) ============= */
.filter {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 18px 0;
    margin-bottom: 32px;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .15em;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.filter a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 64px;
    padding: 6px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--ink-soft);
    background: var(--bg-alt);
    transition: color .25s ease, background .25s ease;
    font-size: 11px;
    letter-spacing: .15em;
}
.filter a:hover {
    color: var(--ink);
    opacity: 1;
    background: #ECECE8;
}
.filter a.active {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
    opacity: 1;
}
.filter a.active:hover {
    background: #000;
    border-color: #000;
}
.filter .filter-meta {
    margin-left: auto;
    color: var(--ink-mute);
    font-size: 11px;
    letter-spacing: .15em;
    padding: 0 4px;
}
.filter form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 5px 5px 5px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--bg-alt);
    transition: background .25s ease, box-shadow .25s ease;
}
.filter form:hover {
    background: #ECECE8;
}
.filter form:focus-within {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.06), 0 6px 20px rgba(26, 26, 26, 0.06);
}

.filter input[type="text"] {
    border: none;
    background: transparent;
    padding: 0;
    width: 200px;
    font-family: var(--font-sans);
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    outline: none;
    transition: width .3s cubic-bezier(.4, 0, .2, 1);
}
.filter input[type="text"]::placeholder {
    color: var(--ink-mute);
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
}
.filter input[type="text"]:focus { width: 260px; }
.filter input[type="text"]:focus::placeholder { opacity: .5; }

/* 红色圆形搜索按钮 */
.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-red);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
    flex-shrink: 0;
    padding: 0;
}
.search-btn:hover {
    background: #F04057;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 90, 110, 0.35);
}
.search-btn:active {
    transform: scale(0.96);
}
.search-btn svg {
    display: block;
}

/* ============= works grid ============= */
.works {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 56px 40px;
}
@media (max-width: 800px) {
    .works { grid-template-columns: 1fr; gap: 40px; }
}

.work { display: block; color: inherit; }
.work .frame {
    position: relative;
    overflow: hidden;
    background: var(--bg-alt);
    aspect-ratio: 4 / 3;
    margin-bottom: 18px;
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.work .frame img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 1.4s cubic-bezier(.2,.8,.2,1);
    image-rendering: -webkit-optimize-contrast;
}
.work:hover .frame img { transform: scale(1.02); }
.work .frame::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.25));
    opacity: 0; transition: opacity .4s ease;
}
.work:hover .frame::after { opacity: 1; }

.work .meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 8px;
}
.work h3 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.005em;
    margin: 0 0 8px;
    color: var(--ink);
}
.work h3 em { font-style: italic; color: var(--accent); }
.work p {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 0 0 10px;
    max-width: 56ch;
}
.work .tags {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .15em;
    color: var(--ink-mute);
    text-transform: uppercase;
}
.work .tags span:not(:last-child)::after { content: " / "; opacity: .5; }

.works .work:nth-child(even) { transform: none; }
@media (max-width: 800px) {
    .works .work:nth-child(even) { transform: none; }
}

/* ============= pagination ============= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 72px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .15em;
    text-transform: uppercase;
}
.pagination a, .pagination span {
    padding: 8px 16px;
    color: var(--ink-mute);
    border: 1px solid transparent;
}
.pagination a:hover { color: var(--ink); }
.pagination .current { color: var(--ink); border-bottom: 1px solid var(--ink); opacity: 1; }

/* ============= empty ============= */
.empty {
    text-align: center;
    padding: 100px 0;
    border-top: 1px solid var(--rule-soft);
    border-bottom: 1px solid var(--rule-soft);
}
.empty h3 {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 30px;
    color: var(--ink-soft);
    margin: 0 0 8px;
}
.empty p {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--ink-mute);
}

/* ============= detail ============= */
.cover {
    width: 100%;
    background: var(--bg-alt);
    margin: 0 0 56px;
    overflow: hidden;
}
.cover img { width: 100%; height: auto; display: block; }

.project-head {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 56px;
    align-items: end;
    margin-bottom: 56px;
}
@media (max-width: 900px) { .project-head { grid-template-columns: 1fr; gap: 24px; } }

.project-head .label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-bottom: 12px;
}
.project-head h1 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: clamp(40px, 6vw, 88px);
    line-height: 1;
    margin: 0;
    letter-spacing: -.005em;
}
.project-head h1 em { font-style: italic; color: var(--accent); }
.project-head .lede {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 22px;
    line-height: 1.5;
    color: var(--ink-soft);
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 28px;
    padding: 24px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 48px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--ink-mute);
}
.facts strong {
    display: block;
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    margin-top: 6px;
    font-weight: 500;
}
@media (max-width: 700px) { .facts { grid-template-columns: 1fr; } }

.body-text {
    font-family: var(--font-serif);
    font-size: 19px;
    line-height: 1.75;
    color: var(--ink);
    max-width: 70ch;
    margin: 0 auto 80px;
}
.body-text p { margin: 0 0 24px; }
.body-text p:first-of-type::first-letter {
    font-family: var(--font-serif);
    float: left;
    font-size: 78px;
    line-height: .9;
    padding: 8px 12px 0 0;
    color: var(--accent);
    font-weight: 600;
}

/* ============= reveal ============= */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============= mobile ============= */
@media (max-width: 800px) {
    .layout {
        grid-template-columns: 1fr;
    }
    /* 手机端：主内容在上、个人信息在下 */
    .main {
        order: 1;
        padding: 24px 24px 60px;
    }
    .sidebar {
        order: 2;
        border-right: none;
        border-top: 1px solid var(--sidebar-rule);
    }
    .sidebar-inner {
        position: relative;
        height: auto;
        padding: 32px 24px 28px;
        overflow: visible;
    }

    /* 手机端：搜索框另起一行，居左占满 */
    .filter { position: relative; gap: 8px; }
    .filter form {
        order: 99;          /* 排到分类后面 */
        flex: 0 0 100%;     /* 独占一行 */
        margin-left: 0;
        margin-top: 6px;
        padding: 5px 5px 5px 18px;
        background: var(--bg-alt);
    }
    .filter input[type="text"] {
        flex: 1;
        width: auto;
        min-width: 0;
        /* iOS Safari 输入框 font-size < 16px 会触发自动缩放，这里强制 16px */
        font-size: 16px;
    }
    .filter input[type="text"]:focus { width: auto; }
    .filter input[type="text"]::placeholder {
        color: var(--ink-mute);
        font-size: 12px;   /* 仅占位符仍小，不会影响 iOS 缩放 */
    }

    /* filter-meta 在分类后另起一行也行，让排版自然 */
    .filter .filter-meta {
        order: 50;
        margin-left: 0;
    }
}

/* ============= scrollbar ============= */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8C5BE; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #A8A59E; }
.sidebar-inner::-webkit-scrollbar-thumb { background: #3A3A3A; }
.sidebar-inner::-webkit-scrollbar-thumb:hover { background: #555; }

@media print {
    .filter, .pagination, .sidebar-bottom, .back-link { display: none !important; }
    body { color: #000; background: #fff; }
}
