/* 山水水墨風格：宣紙底色、淡墨層次、朱砂印章點綴 */
:root {
    --bg: #efece4;          /* 宣紙色，與插圖紙底相近 */
    --bg-alt: #e6e2d6;      /* 淡墨暈染的區塊底色 */
    --text: #1f2321;        /* 濃墨 */
    --muted: #5b625f;       /* 淡墨 */
    --accent: #a63a2b;      /* 朱砂紅（印章） */
    --accent-text: #f7f3ea;
    --border: #c9c3b3;
    --card: rgba(250, 247, 240, 0.78);
    --shadow-color: rgba(31, 35, 33, 0.12);
    --header-bg: rgba(239, 236, 228, 0.9);
    --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", "Microsoft JhengHei", serif;
}

/* 深色模式：墨夜 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1b1e1d;
        --bg-alt: #232726;
        --text: #e7e3d8;
        --muted: #a7aca7;
        --accent: #d4604d;
        --accent-text: #1b1e1d;
        --border: #3b403e;
        --card: rgba(35, 39, 38, 0.8);
        --shadow-color: rgba(0, 0, 0, 0.35);
        --header-bg: rgba(27, 30, 29, 0.9);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 64px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--serif);
    line-height: 1.8;
    overflow-x: hidden;
}

/* 宣紙纖維質感 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 0.18 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)'/%3E%3C/svg%3E");
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    position: relative;
    z-index: 1;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

h1, h2, h3 {
    font-family: var(--serif);
    line-height: 1.3;
    margin: 0 0 0.5em;
    letter-spacing: 0.08em;
}

/* 導覽列 */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 56px;
}

.brand {
    display: flex;
    align-items: center;
}

/* 頭像做成朱砂印章的方圓形 */
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--accent);
    object-fit: cover;
}

.site-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--text);
    padding: 8px 14px;
    letter-spacing: 0.2em;
    position: relative;
}

/* 懸停時一筆淡墨由左而右暈開 */
.site-nav a::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 2px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--text), transparent);
    opacity: 0;
    transform: scaleX(0.3);
    transform-origin: left;
    transition: opacity 0.3s ease, transform 0.4s ease;
}

.site-nav a:hover::after {
    opacity: 0.7;
    transform: scaleX(1);
}

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 12px;
    font: inherit;
    cursor: pointer;
}

/* 首屏：遠山、薄霧與少年 */
.hero {
    position: relative;
    padding: 56px 0 150px;
    overflow: hidden;
}

/* 三層遠山 */
.hero-mountains,
.footer-mountains {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 300px;
    background: url("mountains.svg") center bottom / cover no-repeat;
    pointer-events: none;
}

/* 山腰薄霧 */
.hero-mountains::after {
    content: "";
    position: absolute;
    inset: 40% 0 0;
    background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

/* 紙面上一輪淡墨暈出的日月 */
.hero::before {
    content: "";
    position: absolute;
    top: 40px;
    right: 8%;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(166, 58, 43, 0.22) 0%, rgba(166, 58, 43, 0.08) 55%, transparent 72%);
    filter: blur(2px);
    pointer-events: none;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 48px;
}

.hero-text {
    flex: 1;
    min-width: 0;
}

/* 插圖的紙底以 multiply 與頁面融合，看起來像直接畫在宣紙上 */
.hero-art {
    width: 300px;
    height: auto;
    flex-shrink: 0;
    order: 2;
    mix-blend-mode: multiply;
    /* 左右、上緣與下緣都淡出；下緣從褲管以下淡掉，不露出球鞋商標 */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to bottom, transparent, #000 10%, #000 80%, transparent 91%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to bottom, transparent, #000 10%, #000 80%, transparent 91%);
    mask-composite: intersect;
}

@media (prefers-color-scheme: dark) {
    .hero-art {
        mix-blend-mode: normal;
        filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.95);
    }
}

.eyebrow {
    color: var(--accent);
    margin: 0 0 8px;
    letter-spacing: 0.4em;
    font-weight: 600;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 900;
    position: relative;
    display: inline-block;
}

/* 標題下方一筆飛白墨痕 */
.hero h1::after {
    content: "";
    position: absolute;
    left: 0;
    right: -12px;
    bottom: -8px;
    height: 6px;
    background: linear-gradient(to right, var(--text) 0%, var(--text) 55%, transparent 100%);
    clip-path: polygon(0 40%, 30% 0, 62% 55%, 100% 20%, 100% 100%, 0 100%);
    opacity: 0.8;
}

.lead {
    max-width: 560px;
    color: var(--muted);
    font-size: 1.08rem;
    margin-top: 28px;
}

.section {
    padding: 64px 0;
    position: relative;
}

.section.alt {
    background: var(--bg-alt);
}

/* 區塊標題：朱砂印章 */
.section h2 {
    font-size: 1.7rem;
    margin-bottom: 28px;
    padding-left: 44px;
    position: relative;
}

.section h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%) rotate(-4deg);
    border-radius: 5px;
    background: var(--accent);
    box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--accent);
}

.section.alt h2::before {
    box-shadow: inset 0 0 0 3px var(--bg-alt), inset 0 0 0 4px var(--accent);
}

.button {
    display: inline-block;
    background: var(--text);
    color: var(--bg);
    padding: 12px 28px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.15em;
    overflow-wrap: anywhere;
    box-shadow: 0 6px 14px var(--shadow-color);
    transition: transform 0.3s ease, background 0.3s ease;
}

.button:hover {
    background: var(--accent);
    color: var(--accent-text);
    transform: translateY(-2px);
}

/* 經歷時間軸：一筆墨線 */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 28px;
    border-left: 2px solid var(--text);
    border-image: linear-gradient(to bottom, var(--text), transparent) 1;
}

.timeline li {
    margin-bottom: 32px;
    position: relative;
}

.timeline li::before {
    content: "";
    position: absolute;
    left: -37px;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg);
}

.period {
    color: var(--muted);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.timeline h3 {
    margin: 6px 0;
}

.timeline p {
    margin: 0;
    color: var(--muted);
}

/* 專長與卡片 */
.skill-groups,
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.skill-group h3 {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.tags {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tags li {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 14px;
    font-size: 0.92rem;
    transition: border-color 0.3s ease, color 0.3s ease;
}

.tags li:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* 卡片：像一幅小立軸 */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--text);
    border-radius: 2px;
    padding: 24px;
    position: relative;
    box-shadow: 0 8px 20px var(--shadow-color);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px var(--shadow-color);
}

.card h3 {
    font-size: 1.2rem;
}

.card p {
    margin: 0 0 14px;
    color: var(--muted);
}

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

.card .meta {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 3px;
    padding: 0 8px;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 8px;
    letter-spacing: 0.05em;
}

/* 聯絡區 */
.contact-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.contact-text {
    min-width: 0;
}

/* 字標已去除紙底，只保留墨跡 */
.contact-logo {
    display: block;
    width: 380px;
    max-width: 48%;
    height: auto;
    flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
    .contact-logo {
        filter: invert(1) brightness(0.9);
    }
}

/* 頁尾：近山入畫 */
.site-footer {
    position: relative;
    padding: 110px 0 28px;
    color: var(--muted);
    text-align: center;
    overflow: hidden;
}

.footer-mountains {
    top: 0;
    bottom: auto;
    height: 200px;
    opacity: 0.8;
    transform: scale(-1, -1);
    background-position: center top;
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
    mask-image: linear-gradient(to bottom, #000, transparent);
}

.site-footer p {
    margin: 0;
    letter-spacing: 0.2em;
    position: relative;
}

/* 行動版 */
@media (max-width: 640px) {
    .hero {
        padding: 40px 0 120px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .hero-art {
        order: 0;
        width: 200px;
        align-self: center;
    }

    .contact-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
    }

    .contact-logo {
        width: 280px;
        max-width: 90%;
    }

    .nav-toggle {
        display: block;
    }

    .site-nav {
        display: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding-bottom: 8px;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 10px 0;
        border-top: 1px solid var(--border);
    }

    .site-nav a::after {
        display: none;
    }
}

/* 尊重減少動態偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

.muted {
    color: var(--muted);
}
