/* ===== 影廊首页 =====
   与 /gallery/ 共用同一套设计语言。取值来源是 /gallery/css/style.css 的 :root，
   两处数值请保持同步：
     · 深色为默认，浅色是「纸上展览」的暖纸色系
     · 红色只用于标记（描边、短线、装饰性符号），文字一律中性色 ——
       因为去饱和的砖红在纯黑上只有 4.23:1，达不到文字所需的 4.5:1
     · 字体：拉丁 Playfair Display / Source Serif 4，中文思源宋体 Noto Serif SC */

@font-face {
    font-family: 'Playfair Display';
    font-style: normal; font-weight: 400 900; font-display: swap;
    src: url('/gallery/fonts/playfair-display-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal; font-weight: 400 900; font-display: swap;
    src: url('/gallery/fonts/playfair-display-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal; font-weight: 200 900; font-display: swap;
    src: url('/gallery/fonts/source-serif-4-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Source Serif 4';
    font-style: normal; font-weight: 200 900; font-display: swap;
    src: url('/gallery/fonts/source-serif-4-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    color-scheme: dark;
    --font-display: 'Playfair Display', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
    --font-body: 'Source Serif 4', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
    --bg-primary: #0a0a0a;
    --bg-overlay: rgba(10, 10, 10, 0.85);
    --bg-tertiary: #161616;
    --border-color: #222222;
    --border-color-hover: #333333;
    --text-primary: #e8e6e3;
    --text-secondary: #999999;
    --text-tertiary: #8a8a8a;
    --accent-color: #c9483f;
    --accent-hover: #d96155;
    --accent-soft: rgba(201, 72, 63, 0.12);
}
[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #f2eee6;
    --bg-overlay: rgba(242, 238, 230, 0.92);
    --bg-tertiary: #e0dacd;
    --border-color: #d8d1c1;
    --border-color-hover: #a83e36;
    --text-primary: #1b1916;
    --text-secondary: #4a453e;
    --text-tertiary: #6b6459;
    --accent-color: #a83e36;
    --accent-hover: #8f322b;
    --accent-soft: rgba(168, 62, 54, 0.08);
}

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

body {
    min-height: 100vh;
    min-height: 100dvh;   /* 手机上 100vh 等于"地址栏收起时"的高度，比可见区域高 */
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ===== 页头：与影廊导航同一语言 —— 品牌 + 计数 + 圆形主题按钮 ===== */
.hd {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg-overlay);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    padding-top: env(safe-area-inset-top);
}
.hd-in {
    max-width: 1180px; margin: 0 auto; height: 64px;
    padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
}
@media (min-width: 768px) { .hd-in { padding: 0 40px; } }

.brand { display: flex; align-items: center; gap: 10px; }
.mark { color: var(--accent-color); font-size: 0.7rem; opacity: 0.6; }
.brand-t {
    font-family: var(--font-display);
    font-size: 1rem; font-weight: 300; letter-spacing: 4px;
}
/* 品牌第二个字用中性色：红色只留给装饰性标记 */
.brand-a { font-weight: 500; }

.hd-r { display: flex; align-items: center; gap: 12px; }
.cnt { font-size: 0.8rem; color: var(--text-tertiary); }
.cnt::after { content: ' 帧'; }

.tt {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
.tt:hover { border-color: var(--accent-color); color: var(--accent-color); }
.tt-i {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; line-height: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
/* 显示的是「点了会变成什么」 */
.tt-sun { opacity: 1; transform: scale(1); }
.tt-moon { opacity: 0; transform: scale(0.6); }
[data-theme="light"] .tt-sun { opacity: 0; transform: scale(0.6); }
[data-theme="light"] .tt-moon { opacity: 1; transform: scale(1); }
@media (max-width: 768px) { .tt { min-width: 44px; min-height: 44px; } }

/* ===== 主体 ===== */
main {
    flex: 1;
    width: 100%; max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}
@media (min-width: 768px) { main { padding: 0 40px; } }

.hero {
    padding: clamp(64px, 14vh, 140px) 0 clamp(48px, 9vh, 88px);
    text-align: center;
    /* 这里原来整块 hero 一起淡入。现在拆成按元素错峰（见文件末尾的 riseIn），
       「品牌字标 → 抬头 → 主题 → 副题」四个节拍各自可见。 */
}

/* 小型大写 + 宽字距：编辑式栏目标签，与影廊的 CURATED COLLECTIONS 同一处理 */
.eyebrow {
    font-family: var(--font-display);
    font-size: 0.62rem; font-weight: 500;
    letter-spacing: 0.34em; text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 22px;
}
.h1 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 8vw, 4rem);
    font-weight: 400; letter-spacing: 0.2em;
    line-height: 1.15;
    margin-bottom: 18px;
}
.sub {
    font-size: 0.85rem;
    letter-spacing: 0.22em;
    color: var(--text-secondary);
}
/* 主标题下一条短红线：红色作为标记出现，不承担文字职责 */
.hero::after {
    content: '';
    display: block;
    width: 36px; height: 1px;
    margin: 30px auto 0;
    background: var(--accent-color);
}

/* ===== 近作（区域外壳） ===== */
.strip-sec { padding-bottom: clamp(48px, 8vh, 72px); }

/* ===== 近作：单行横向精选 =====
   与展厅的网格刻意不同构 —— 首页是「封面」，一张一张领看；展厅才是目录。
   横向滚动区的两条硬约束（项目里踩过两次）：
     · 容器不许换行、每一条都要 nowrap —— 中文可以逐字换行，
       不锁住就会把题注压成竖排
     · scroll-snap 让手指停下时正好对齐一张，不会有半张卡在边上 */
.strip {
    display: flex; flex-wrap: nowrap;
    gap: 14px;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}
.strip::-webkit-scrollbar { display: none; }
.strip:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 6px; border-radius: 4px; }

.shot {
    flex: 0 0 auto;
    width: 78vw; max-width: 78vw;   /* 手机约 4/5 屏宽：下一张露一条边，明确"还能往右" */
    scroll-snap-align: start;
    display: block; text-decoration: none; color: inherit;
    min-width: 0; white-space: nowrap;
}
@media (min-width: 640px)  { .shot { width: 44%; max-width: 44%; } }   /* 平板：2 张多一点 */
@media (min-width: 1024px) { .shot { width: 31%; max-width: 31%; } }   /* 桌面：3 张 */
.shot img {
    display: block; width: 100%; height: auto;
    border-radius: 3px;
    background: var(--bg-tertiary);
    transition: transform 0.5s ease, opacity 0.3s ease;
}
.shot:hover img { transform: scale(1.015); }

/* 题注压成一行小字（名称 + 参数）。刻意不做成展厅那种「名称一行 / 参数一行」的
   题注块 —— 那是目录页的语言。字号比原来（名称 0.88rem）小一档。 */
.shot-c {
    display: block;
    margin-top: 9px;
    font-size: 0.72rem; line-height: 1.5;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot-n { color: var(--text-secondary); }
.shot-s { color: var(--text-tertiary); margin-left: 8px; letter-spacing: 0.06em; }

/* 末尾的入口卡：与照片卡等宽等高（flex 拉伸），文字居中，靠描边与底纹表达可点。
   箭头保持中性色 —— 红色只用于描边、发丝线这类标记，不承担文字职责。 */
.shot-all {
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.shot-all:hover { border-color: var(--accent-color); background: var(--accent-soft); }
.all-n {
    font-family: var(--font-display);
    font-size: 0.95rem; letter-spacing: 0.14em;
    color: var(--text-primary);
}
.all-ar { margin-left: 10px; color: var(--text-tertiary); }
.shot-all:hover .all-ar { color: var(--text-secondary); }

/* ===== 入场：一次领看 =====
   品牌字标 → 抬头 → 主题 → 副题 → 近作条，间隔 80ms 错峰淡入；
   最后一张可视的近作卡在 380ms 起、280ms 结束，总时长 900ms 以内。
   用 animation + fill-mode: backwards（不是 forwards）——
   播完就回到常态，hover 的 transform 不会被残留的动画值压住。
   没有 setInterval、没有常驻定时器；动画播完即止。 */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hd-in    { animation: riseIn 0.28s ease backwards; }
.eyebrow  { animation: riseIn 0.28s ease 0.08s backwards; }
.h1       { animation: riseIn 0.28s ease 0.16s backwards; }
.sub      { animation: riseIn 0.28s ease 0.24s backwards; }
.sec-head { animation: riseIn 0.28s ease 0.32s backwards; }
/* 逐张出现的那几张由 app.js 按「可视顺序」写 animation-delay（0.38s 起，每张 +60ms） */
.strip.in .shot { animation: riseIn 0.28s ease backwards; }
/* 入口按钮排在近作之后：近作区要等接口回来才显示（hidden 元素不跑动画），
   把它放在最后，节拍才和阅读顺序一致 */
.cta      { animation: riseIn 0.28s ease 0.6s backwards; }

.sec-head {
    display: flex; align-items: baseline; gap: 14px;
    padding-bottom: 16px; margin-bottom: 22px;
    border-bottom: 1px solid var(--border-color);
}
.sec-t {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3.4vw, 1.55rem);
    font-weight: 400; letter-spacing: 0.22em;
}
.sec-s {
    font-family: var(--font-display);
    font-size: 0.62rem; font-weight: 500;
    letter-spacing: 0.3em; text-transform: uppercase;
    color: var(--text-tertiary);
}

/* ===== 入口 ===== */
.cta {
    display: flex; flex-wrap: wrap; gap: 14px;
    justify-content: center;
    padding-bottom: clamp(56px, 10vh, 96px);
}
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 46px; padding: 0 34px;
    font-family: var(--font-body);
    font-size: 0.85rem; letter-spacing: 0.18em;
    text-decoration: none;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    background: transparent;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}
/* 主按钮：只把描边和底色染红，文字仍为中性 —— 与影廊的按钮处理一致 */
.btn:hover {
    border-color: var(--accent-color);
    background: var(--accent-soft);
}
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); }

.ft {
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    text-align: center;
    font-size: 0.68rem; letter-spacing: 0.08em;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-color);
}

/* 无照片时只保留入口按钮，不显示空的近作区 */
.strip-sec[hidden] { display: none; }

/* ===== 走进展厅：退场 =====
   纸色遮罩淡入 + 页头与内容淡出，约 0.42s 后 location.href 跳转。
   目标页（/gallery/）首屏有对应的错峰进场，两页接起来像一次连续过渡。
   不用 View Transitions API —— Safari 还不支持。 */
.wipe {
    position: fixed; inset: 0; z-index: 60;
    background: var(--bg-primary);
    opacity: 0; pointer-events: none;
    transition: opacity 0.42s ease;
}
body.leaving .wipe { opacity: 1; }
.hd, main { transition: opacity 0.3s ease; }
body.leaving .hd, body.leaving main { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    /* 这里显式把本轮的动画整个关掉、内容直接呈现。
       下面那条通用规则只把时长压到 0.01ms，延迟仍在 ——
       带 delay 的元素会先隐身一段时间再出现，读起来仍像"动画"。 */
    .hd-in, .eyebrow, .h1, .sub, .sec-head, .cta,
    .strip.in .shot {
        animation: none !important;
        opacity: 1 !important; transform: none !important;
    }
    .wipe { transition: none !important; }
    .hd, main { transition: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
