@charset "UTF-8";
/* ==========================================================================
   Hejinの主页 — Ink
   宣纸作底，墨色写字，右上竖排题款；朱红只在悬停、焦点这类细节上出现
   ========================================================================== */

/* ==========================================================================
   1. 令牌
   ========================================================================== */

:root {
    --sheet: 1120px;
    --aside: 300px;
    --gutter: clamp(40px, 6vw, 96px);

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --kai: "LXGW WenKai", "霞鹜文楷", "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", serif;
}

[data-theme="light"] {
    --paper:      #f4efe4;
    --paper-deep: #ebe3d3;

    --ink:   #1f1b16;
    --ink-2: #4b443a;
    --ink-3: #6e6656;
    --ink-4: #a59c8a;

    --line:      rgba(31, 27, 22, 0.17);
    --line-soft: rgba(31, 27, 22, 0.09);
    --wash:      rgba(31, 27, 22, 0.04);

    --accent:     #b93a26;
    --accent-ink: #f6eee2;
    --accent-rgb: 185, 58, 38;

    --haze-1: rgba(70, 56, 36, 0.09);
    --haze-2: rgba(185, 58, 38, 0.05);
    --grain-a: 0.07;

    color-scheme: light;
}

[data-theme="dark"] {
    --paper:      #141210;
    --paper-deep: #1c1916;

    --ink:   #ede6d8;
    --ink-2: #bcb3a3;
    --ink-3: #8f8676;
    --ink-4: #5b5449;

    --line:      rgba(237, 230, 216, 0.16);
    --line-soft: rgba(237, 230, 216, 0.08);
    --wash:      rgba(237, 230, 216, 0.04);

    --accent:     #c4432c;
    --accent-ink: #f3e9da;
    --accent-rgb: 196, 67, 44;

    --haze-1: rgba(237, 230, 216, 0.035);
    --haze-2: rgba(196, 67, 44, 0.06);
    --grain-a: 0.05;

    color-scheme: dark;
}

/* ==========================================================================
   2. 基础
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
    min-height: 100dvh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--kai);
    font-size: 16px;
    line-height: 1.8;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
    outline: 1.5px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
}

::selection { background: rgba(var(--accent-rgb), 0.2); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--ink-4);
    border: 3px solid transparent;
    border-radius: 99px;
    background-clip: content-box;
}

.ico {
    display: inline-block;
    width: 1.15em;
    height: 1em;
    flex-shrink: 0;
    vertical-align: -0.125em;
}

.num { font-variant-numeric: tabular-nums; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ==========================================================================
   3. 纸面：两团极淡的墨晕 + 纸纹
   ========================================================================== */

.paper {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(55% 45% at 92% 0%, var(--haze-1), transparent 72%),
        radial-gradient(45% 40% at 0% 100%, var(--haze-1), transparent 70%),
        radial-gradient(30% 26% at 86% 92%, var(--haze-2), transparent 70%);
}

.paper::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: var(--grain-a);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75 0.55' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.38  0 0 0 0 0.28  0 0 0 1.1 -0.2'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="dark"] .paper::after { mix-blend-mode: screen; }

/* ==========================================================================
   4. 载入发丝 + 主题切换
   ========================================================================== */

.boot {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 1px;
    pointer-events: none;
}

.boot span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, transparent, var(--accent));
    transition: width 0.5s var(--ease-out), opacity 0.4s 0.25s linear;
}

.boot.is-loading span { width: 72%; }
.boot.is-done span { width: 100%; opacity: 0; }

/* 一个字的按钮：浅色时写「夜」，深色时写「昼」，点了就去那边 */
.mode {
    position: fixed;
    top: clamp(16px, 3vw, 28px);
    right: clamp(16px, 3vw, 28px);
    z-index: 90;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    line-height: 1;
    color: var(--ink-2);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
                background-color 0.5s var(--ease), transform 0.5s var(--ease);
}

.mode:hover {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.5);
    transform: rotate(-12deg);
}

.mode span {
    grid-area: 1 / 1;
    transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}

[data-theme="light"] .mode__to-light,
[data-theme="dark"] .mode__to-dark { opacity: 0; transform: scale(0.6); }

/* ==========================================================================
   5. 版心
   ========================================================================== */

.sheet {
    width: 100%;
    max-width: var(--sheet);
    min-height: 100dvh;
    margin-inline: auto;
    padding: clamp(48px, 7vh, 88px) clamp(20px, 5vw, 56px) 96px;
}

.masthead,
.body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--aside);
    column-gap: var(--gutter);
}

/* ==========================================================================
   6. 题头
   ========================================================================== */

.masthead {
    padding-bottom: 44px;
    border-bottom: 1px solid var(--line);
}

.masthead__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.byline {
    display: flex;
    align-items: center;
    gap: 14px;
}

.byline__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--line), 0 0 0 4px var(--paper), 0 0 0 5px var(--line-soft);
}

.byline__date {
    font-size: 0.84rem;
    letter-spacing: 0.18em;
    color: var(--ink-3);
}

.title {
    margin-top: clamp(26px, 4.5vh, 40px);
    font-size: clamp(2.6rem, 6.2vw, 5.4rem);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.about {
    margin-top: 22px;
    max-width: 30em;
    font-size: 1.02rem;
    line-height: 1.9;
    color: var(--ink-2);
}

.contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
    margin-top: 26px;
}

.contact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.94rem;
    color: var(--ink-2);
    transition: color 0.3s var(--ease);
}

.contact .ico { color: var(--ink-3); transition: color 0.3s var(--ease); }

.contact span {
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.4em;
    transition: text-decoration-color 0.3s var(--ease);
}

.contact:hover { color: var(--ink); }
.contact:hover .ico { color: var(--accent); }
.contact:hover span { text-decoration-color: var(--accent); }

/* ---- 竖排题款 ---- */

.inscription {
    display: flex;
    justify-content: flex-end;
    padding-top: 6px;
}

.inscription__text {
    writing-mode: vertical-rl;
    font-size: 1.28rem;
    line-height: 2;
    letter-spacing: 0.34em;
    color: var(--ink-2);
}

.inscription__line { display: block; }

/* 后一列错开半个字，像随手写下的落款 */
.inscription__line + .inscription__line { padding-inline-start: 1.6em; }

/* ==========================================================================
   7. 网站目录
   ========================================================================== */

.body { padding-top: 14px; }

/* 各行共用一套列宽（subgrid），名字、说明、域名上下对齐 */
.index {
    display: grid;
    grid-template-columns: 1.4rem max-content minmax(0, 1fr) max-content 1rem;
    column-gap: 22px;
    align-content: start;
}

.entry {
    position: relative;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    padding: 20px 6px;
    border-bottom: 1px solid var(--line-soft);
    transition: background-color 0.4s var(--ease);
}

.entry::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, var(--wash), transparent 75%);
    opacity: 0;
    transition: opacity 0.4s var(--ease);
}

.entry__icon {
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: var(--ink-3);
    transition: color 0.35s var(--ease), transform 0.5s var(--ease);
}

.entry__name {
    position: relative;
    font-size: 1.42rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink);
    transition: transform 0.5s var(--ease);
}

/* 悬停时名字下面走一笔朱红 */
.entry__name::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--ease);
}

.entry__desc {
    min-width: 0;
    overflow: hidden;
    font-size: 0.92rem;
    color: var(--ink-3);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.entry__host {
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--ink-4);
    transition: color 0.35s var(--ease);
}

.entry__go {
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    color: var(--ink-4);
    transform: rotate(-45deg);
    transition: color 0.35s var(--ease), transform 0.5s var(--ease);
}

.entry:hover::before { opacity: 1; }
.entry:hover .entry__icon { color: var(--ink); transform: translateX(2px); }
.entry:hover .entry__name { transform: translateX(4px); }
.entry:hover .entry__name::after { transform: scaleX(1); }
.entry:hover .entry__host { color: var(--ink-3); }
.entry:hover .entry__go { color: var(--accent); transform: rotate(-45deg) translateX(4px); }

/* ==========================================================================
   8. 一言
   ========================================================================== */

/* 宽度收到正文那么宽，出处才能贴着句尾右对齐 */
.saying {
    position: relative;
    display: flex;
    flex-direction: column;
    width: fit-content;
    padding-top: 40px;
}

.saying__text {
    font-size: 1.16rem;
    line-height: 2;
    color: var(--ink);
    text-wrap: pretty;
    transition: opacity 0.4s var(--ease), filter 0.4s var(--ease);
}

.saying__text::before { content: "「"; margin-left: -0.5em; color: var(--ink-4); }
.saying__text::after  { content: "」"; color: var(--ink-4); }

.saying__from {
    margin-top: 10px;
    align-self: flex-end;
    font-size: 0.86rem;
    color: var(--ink-3);
    text-align: right;
    transition: opacity 0.4s var(--ease);
}

.saying__from:not(:empty)::before { content: "—— "; color: var(--ink-4); }

.saying.is-loading .saying__text { opacity: 0.3; filter: blur(3px); }
.saying.is-loading .saying__from { opacity: 0; }

.saying__more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: flex-start;
    margin-top: 22px;
    font-size: 0.84rem;
    color: var(--ink-3);
    transition: color 0.3s var(--ease);
}

.saying__more .ico { font-size: 0.78rem; transition: transform 0.6s var(--ease); }

.saying__more:hover { color: var(--ink); }
.saying__more:hover .ico { transform: rotate(150deg); }

.saying.is-loading .saying__more { pointer-events: none; }
.saying.is-loading .saying__more .ico { animation: spin 0.9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   9. 版权页
   ========================================================================== */

.colophon {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px 40px;
    margin-top: clamp(40px, 6vh, 72px);
    padding-top: 22px;
    border-top: 3px double var(--line);
}

.tally {
    display: flex;
    gap: clamp(28px, 4vw, 52px);
}

.tally__item dt {
    font-size: 0.78rem;
    letter-spacing: 0.24em;
    color: var(--ink-3);
}

.tally__item dd {
    font-size: 1.6rem;
    line-height: 1.3;
    color: var(--ink);
}

.tally__item dd em {
    margin-left: 4px;
    font-size: 0.82rem;
    font-style: normal;
    color: var(--ink-3);
}

.legal {
    font-size: 0.8rem;
    line-height: 1.9;
    color: var(--ink-3);
    text-align: right;
}

.legal a { transition: color 0.3s var(--ease); }
.legal a:hover { color: var(--accent); }

.legal__beian { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 16px; }

/* ==========================================================================
   10. 入场：墨迹由虚到实，站名从左往右写出来
   ========================================================================== */

[data-r] {
    opacity: 0;
    filter: blur(5px);
    transform: translateY(8px);
    transition: opacity 0.8s var(--ease-out), filter 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.is-ready [data-r] {
    opacity: 1;
    filter: none;
    transform: none;
    transition-delay: calc(var(--d, 0) * 70ms + 80ms);
}

.title {
    clip-path: inset(-10% 100% -10% 0);
    transition: opacity 0.6s var(--ease-out), filter 0.8s var(--ease-out),
                transform 0.8s var(--ease-out), clip-path 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

.is-ready .title { clip-path: inset(-10% -2% -10% 0); }

/* ==========================================================================
   11. APlayer
   ========================================================================== */

.aplayer.aplayer-fixed { z-index: 80; }

.aplayer.aplayer-fixed .aplayer-body {
    background: var(--paper-deep) !important;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 4px 4px 0;
    box-shadow: none !important;
    overflow: hidden;
}

.aplayer.aplayer-fixed .aplayer-pic { border-radius: 0; }

.aplayer .aplayer-info { border-color: var(--line-soft) !important; }

.aplayer .aplayer-info .aplayer-music .aplayer-title,
.aplayer .aplayer-list ol li { color: var(--ink) !important; }

.aplayer .aplayer-info .aplayer-music .aplayer-author,
.aplayer .aplayer-info .aplayer-controller .aplayer-time { color: var(--ink-3) !important; }

.aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar {
    background: var(--line) !important;
}

.aplayer .aplayer-list {
    background: var(--paper-deep) !important;
    border-top: 1px solid var(--line-soft);
}

.aplayer.aplayer-fixed .aplayer-miniswitcher {
    background: var(--paper-deep) !important;
    border-left: 1px solid var(--line-soft);
}

.aplayer .aplayer-icon path { fill: var(--ink-3); }
.aplayer .aplayer-icon:hover path { fill: var(--ink) !important; }

.aplayer .aplayer-list ol li {
    background: transparent !important;
    border-color: var(--line-soft) !important;
}

.aplayer .aplayer-list ol li:hover,
.aplayer .aplayer-list ol li.aplayer-list-light {
    background: var(--wash) !important;
}

.aplayer.aplayer-fixed .aplayer-lrc {
    left: auto !important;
    right: 16px !important;
    width: min(340px, 44vw) !important;
    margin-right: 0 !important;
    text-align: right !important;
    text-shadow: none !important;   /* 自带的白色描边在深色主题下是一圈白边 */
    transition: opacity 0.4s var(--ease);
}

/* 暂停时不让歌词悬在页面角落 */
.aplayer.aplayer-fixed:has(.aplayer-pic .aplayer-play) .aplayer-lrc { opacity: 0; }

/* 收起成迷你条时，APlayer 的提示文字会溢出盖住封面；出错提示交给 .music-status */
.aplayer.aplayer-fixed.aplayer-narrow .aplayer-notice { display: none !important; }

.aplayer.aplayer-fixed .aplayer-lrc p { color: var(--ink-4) !important; }
.aplayer.aplayer-fixed .aplayer-lrc p.aplayer-lrc-current { color: var(--ink-2) !important; }
.aplayer.aplayer-fixed .aplayer-lrc::before,
.aplayer.aplayer-fixed .aplayer-lrc::after { background: none !important; }

/* 播放器 API 失败时仍给出可见反馈，不依赖 APlayer 是否成功创建 */
.music-status {
    position: fixed;
    left: 50%;
    bottom: 86px;
    z-index: 81;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(92vw, 420px);
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper-deep);
    color: var(--ink);
    font-size: 0.84rem;
    line-height: 1.4;
    transform: translateX(-50%);
}

.music-status[hidden] { display: none; }

.music-status button {
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 3px;
    padding: 4px 9px;
    background: var(--accent);
    color: var(--accent-ink);
}

/* ==========================================================================
   12. 响应式
   ========================================================================== */

/* 放不下右栏：目录和一言上下排 */
@media (max-width: 900px) {
    :root { --aside: auto; }

    .body { grid-template-columns: minmax(0, 1fr); }

    .saying { max-width: 34em; }
}

@media (max-width: 640px) {
    :root { --gutter: 18px; }

    body { font-size: 15px; }

    .sheet { padding: 76px 18px 150px; }

    .byline__avatar { width: 46px; height: 46px; }
    .byline__date { font-size: 0.8rem; letter-spacing: 0.12em; }

    .title { margin-top: 24px; font-size: clamp(2.3rem, 11vw, 3rem); }
    .about { margin-top: 16px; font-size: 0.96rem; }
    .contacts { gap: 10px 20px; margin-top: 20px; }

    .masthead { padding-bottom: 32px; }

    .inscription { padding-top: 2px; }
    .inscription__text { font-size: 1.08rem; letter-spacing: 0.26em; line-height: 1.85; }

    /* 目录改成两行：名字一行，说明一行；域名收起 */
    .index { grid-template-columns: minmax(0, 1fr); }

    .entry {
        grid-template-columns: 1.3rem minmax(0, 1fr) 1rem;
        grid-template-areas: "icon name go" "icon desc go";
        column-gap: 16px;
        row-gap: 2px;
        padding: 16px 4px;
    }

    .entry__icon { grid-area: icon; }
    .entry__name { grid-area: name; justify-self: start; font-size: 1.22rem; }
    .entry__desc { grid-area: desc; font-size: 0.86rem; }
    .entry__go   { grid-area: go; }
    .entry__host { display: none; }

    .saying { padding-top: 32px; }
    .saying__text { font-size: 1.04rem; }

    .colophon { flex-direction: column; align-items: stretch; margin-top: 44px; }
    .tally { justify-content: space-between; }
    .tally__item dd { font-size: 1.36rem; }
    .legal { text-align: left; }
    .legal__beian { justify-content: flex-start; }

    .aplayer.aplayer-fixed .aplayer-lrc { display: none !important; }
}

/* 触屏没有 hover，箭头直接给足颜色 */
@media (hover: none) {
    .entry__go { color: var(--ink-3); }
}

/* ==========================================================================
   13. 主题切换的圆形扩散
   ========================================================================== */

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

/* ==========================================================================
   14. 降级
   ========================================================================== */

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

    [data-r], .title { opacity: 1; filter: none; transform: none; clip-path: none; }
}

@media print {
    .paper, .boot, .mode, .saying__more, .aplayer, .music-status { display: none !important; }
    body { background: #fff; color: #000; }
    [data-r], .title { opacity: 1; filter: none; transform: none; clip-path: none; }
}
