/* ============================================================
   個人作品集 — 清新簡潔風格
   主色：暖白底 + 乾燥玫瑰粉點綴
   如需調整配色，改下面的 :root 變數即可
   ============================================================ */

:root {
  --bg: #F8F5F2;          /* 頁面底色：暖奶油白 */
  --surface: #FFFFFF;     /* 卡片底色 */
  --ink: #4A3A45;         /* 主標題：深梅子灰 */
  --body: #62575B;        /* 正文：深暖灰 */
  --ink-soft: #7B6D73;    /* 次要文字：柔和灰棕 */
  --pink: #BD7588;        /* 按鈕與互動強調：豆沙粉 */
  --pink-deep: #A55F74;   /* 豆沙粉（深，hover） */
  --pink-tint: #F3E8EA;   /* 極淡霧粉（交替版塊） */
  --line: #E5DDDC;        /* 細線邊框：淡暖灰 */
  --blue: #A8B8C5;        /* 點綴：海港灰藍 */
  --sage: #B7C8B0;        /* 點綴：鼠尾草綠 */
  --radius: 16px;
  --shadow: 0 10px 30px rgba(74, 58, 69, 0.12);
  --font-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

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

/* hidden 屬性必須真正隱藏（防止被 display 等樣式覆蓋） */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--body);
  background: var(--bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

section[id] { scroll-margin-top: 76px; }

/* ============================================================
   頂部選單
   ============================================================ */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(253, 251, 249, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}

.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 2px 16px rgba(160, 100, 120, 0.06);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.nav-links { display: flex; gap: 36px; }

.nav-links a {
  font-size: .95rem;
  color: var(--ink-soft);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--pink-deep);
  border-bottom-color: var(--pink);
}

/* 手機版漢堡選單 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: .3s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    display: none;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 16px;
  }

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

  .nav-links a {
    display: block;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    border-bottom-width: 1px;
  }

  .nav-links li:last-child a { border-bottom: 0; }

  .nav-links a.active { border-bottom-color: var(--line); color: var(--pink-deep); }
}

/* ============================================================
   首屏 Hero
   ============================================================ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, var(--pink-tint) 0%, transparent 70%),
    var(--bg);
}

.hero-inner {
  position: relative;
  width: 100%;
  padding: 96px 24px 72px;
  display: grid;
  grid-template-columns: 44% 56%;
  gap: 48px;
  align-items: center;
  text-align: center;
}

/* 左：個人照片（大圓形，約佔頁面 40%）
   尺寸由外層 wrap 決定（min(40vw, 欄寬)），照片填滿即可，避免循環依賴 */
.hero-photo-wrap {
  position: relative;
  justify-self: center;
  width: min(40vw, 100%);
  animation: heroPhotoIn 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.hero-photo {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--pink-tint);
  border: 5px solid #fff;
  box-shadow: 0 16px 44px rgba(74, 58, 69, 0.18);
  transition: box-shadow .4s ease;
}

.hero-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transition: transform .45s ease;
}

.hero-photo:hover { box-shadow: 0 22px 56px rgba(74, 58, 69, 0.26); }

.hero-photo:hover img { transform: scale(1.06) rotate(3deg); }

.hero-photo-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--pink-tint), #F0E3E7);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: .8rem;
  line-height: 2;
}

.hero-photo-placeholder code {
  font-size: .72rem;
}

/* 右：文字依次進場 */
.hero-text > * {
  animation: fadeUpIn .7s ease-out both;
}

.hero-text > *:nth-child(1) { animation-delay: .15s; }
.hero-text > *:nth-child(2) { animation-delay: .3s; }
.hero-text > *:nth-child(3) { animation-delay: .45s; }

@keyframes heroPhotoIn {
  from { opacity: 0; transform: rotate(-5deg) scale(0.94); }
  to { opacity: 1; transform: rotate(0deg) scale(1); }
}

@keyframes fadeUpIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* 手機：照片與文字上下排列 */
@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 36px;
    text-align: center;
    padding-top: 88px;
  }

  .hero-photo-wrap { width: auto; }
  .hero-photo { width: clamp(240px, 64vw, 360px); }
  .hero-cta { justify-content: center; }
}

.hero-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.15;
  letter-spacing: .01em;
}

.hero-tagline {
  margin-top: 20px;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 600;
  color: var(--ink);
}

.hero-cta {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 13px 34px;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 500;
  letter-spacing: .06em;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all .25s;
}

.btn-primary {
  background: var(--pink);
  color: #fff;
}

.btn-primary:hover {
  background: var(--pink-deep);
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow);
}

.btn-ghost {
  border-color: var(--pink);
  color: var(--pink-deep);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--pink-tint);
  transform: translateY(-2px) scale(1.02);
}

.scroll-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  color: var(--blue);
  font-size: 1.3rem;
  animation: float 2.2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ============================================================
   通用區塊
   ============================================================ */

.section { padding: 96px 0; }

.section-tint {
  background: linear-gradient(180deg, var(--pink-tint) 0%, rgba(250, 241, 244, 0) 100%);
}

.section-head { max-width: 640px; margin-bottom: 56px; }

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
}

.section-note {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: .95rem;
}

/* ============================================================
   關於我
   ============================================================ */

.about-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 48px;
  align-items: start;
}

.about-photo {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.about-photo img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  transition: transform .4s ease;
}

.about-photo:hover img { transform: scale(1.03); }

.photo-placeholder {
  aspect-ratio: 2 / 3;
  background: linear-gradient(135deg, var(--pink-tint), #F4E7EC);
  border: 1.5px dashed var(--pink);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: .85rem;
  line-height: 2;
}

.about-bio { color: var(--ink-soft); white-space: pre-line; }

.about-facts { margin-top: 24px; display: grid; gap: 12px; }

.about-facts li { font-size: .95rem; color: var(--ink-soft); }

.about-facts strong {
  display: inline-block;
  min-width: 64px;
  color: var(--ink);
  margin-right: 8px;
}

.about-subtitle {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin-top: 32px;
  margin-bottom: 14px;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: 10px; }

.skill-tags li {
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--pink-tint);
  border: 1px solid var(--line);
  color: var(--pink-deep);
  font-size: .88rem;
}

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .about-photo { max-width: 420px; margin: 0 auto; }
}

/* ============================================================
   作品集
   ============================================================ */

/* 章節式豎直敘事：左側成長脈絡線 + 大圖章節 */
.works-chapters {
  position: relative;
  display: grid;
  gap: 76px;
  padding-left: 64px;
  border-left: 2px solid var(--line);
}

.work-chapter { position: relative; }

.work-num {
  position: absolute;
  left: -89px;
  top: -8px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--pink-tint);
  border: 2px solid var(--pink);
  color: var(--pink-deep);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-media {
  position: relative;
  aspect-ratio: 16 / 10;
  max-width: 740px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--pink-tint);
  cursor: pointer;
  transition: box-shadow .35s ease;
}

.work-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-chapter:hover .work-media { box-shadow: var(--shadow); }

.work-chapter:hover .work-media img { transform: scale(1.04); }

/* 第一章封面：裁切取原圖最頂部 */
.work-chapter:first-child .work-media img { object-position: top; }

.media-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--pink-tint), #F4E7EC);
  border: 1.5px dashed var(--pink);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: .85rem;
  line-height: 2;
}

.work-info { padding: 22px 6px 0; }

.work-tag {
  display: inline-block;
  font-size: .78rem;
  color: var(--pink-deep);
  background: var(--pink-tint);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.work-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
}

.work-desc {
  margin-top: 8px;
  font-size: .95rem;
  color: var(--ink-soft);
  max-width: 65ch;
}

/* 章節滑入進場：奇數從左、偶數從右，彼此錯開 100ms */
.works-chapters .reveal {
  opacity: 0;
  transition: opacity .8s ease, transform .8s ease;
}

.works-chapters .reveal:nth-child(odd) { transform: translateX(-44px); }
.works-chapters .reveal:nth-child(even) { transform: translateX(44px); }
.works-chapters .reveal:nth-child(2) { transition-delay: 100ms; }
.works-chapters .reveal:nth-child(3) { transition-delay: 200ms; }
.works-chapters .reveal:nth-child(4) { transition-delay: 300ms; }
.works-chapters .reveal:nth-child(5) { transition-delay: 400ms; }
.works-chapters .reveal:nth-child(6) { transition-delay: 500ms; }

.works-chapters .reveal.visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 860px) {
  .works-chapters { padding-left: 36px; gap: 52px; }
  .work-num { left: -56px; top: -6px; width: 38px; height: 38px; font-size: .88rem; }
  .work-media { aspect-ratio: 4 / 3; }
  .works-chapters .reveal:nth-child(odd),
  .works-chapters .reveal:nth-child(even) { transform: translateX(-24px); }
}

/* ============================================================
   經歷（時間線）
   ============================================================ */

.timeline {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid var(--sage);
  display: grid;
  gap: 40px;
}

.timeline-item {
  position: relative;
  transition: transform .3s ease;
}

.timeline-item:hover { transform: translateX(4px); }

.timeline-item:hover .timeline-title { color: var(--pink-deep); }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -38px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 4px var(--pink-tint);
}

.timeline-date {
  font-size: .82rem;
  color: var(--pink-deep);
  letter-spacing: .04em;
}

.timeline-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin-top: 4px;
}

.timeline-desc {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: .93rem;
  white-space: pre-line;
}

/* ============================================================
   聯絡 + 頁尾
   ============================================================ */

.contact-inner { text-align: center; }

.contact-inner .section-head { margin-left: auto; margin-right: auto; }

.contact-line {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin-bottom: 32px;
}

.contact-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

footer {
  border-top: 1px solid var(--line);
  padding: 28px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: .85rem;
}

/* ============================================================
   捲動出現動畫
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .works-chapters .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-hint { animation: none; }
  .hero-photo-wrap, .hero-photo, .hero-text > * { animation: none; opacity: 1; transform: none; }
  .hero-photo:hover img { transform: none; }
}

/* ============================================================
   作品詳情彈出視窗
   ============================================================ */

.work-more {
  margin-top: 14px;
  font-size: .88rem;
  color: var(--pink-deep);
  font-weight: 500;
}

.work-card { cursor: pointer; }

.work-card:hover .work-more { text-decoration: underline; }

.work-card:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

.work-media img { transition: transform .5s ease; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(56, 48, 58, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(56, 48, 58, 0.25);
  animation: modal-in .25s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.modal-close:hover { background: var(--pink-tint); color: var(--pink-deep); }

.modal-media {
  position: relative;
  background: #F3EDEF;
  min-height: 200px;
}

.modal-slide { display: none; }

.modal-slide.active { display: block; }

.modal-slide img,
.modal-slide iframe {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 0;
  background: #F3E8EA;
}

.modal-slide img { cursor: zoom-in; }

.modal-slide iframe { height: 70vh; }

.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pink-deep);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}

.modal-arrow:hover { background: var(--pink-tint); }
.modal-arrow.prev { left: 14px; }
.modal-arrow.next { right: 14px; }
.modal-arrow.hidden { display: none; }

.modal-counter {
  position: absolute;
  bottom: 12px;
  right: 16px;
  z-index: 5;
  background: rgba(56, 48, 58, 0.6);
  color: #fff;
  font-size: .78rem;
  padding: 3px 12px;
  border-radius: 999px;
  letter-spacing: .05em;
}

.modal-counter.hidden { display: none; }

.modal-hint {
  position: absolute;
  bottom: 12px;
  left: 16px;
  z-index: 5;
  background: rgba(74, 58, 69, 0.6);
  color: #fff;
  font-size: .75rem;
  padding: 3px 12px;
  border-radius: 999px;
  letter-spacing: .04em;
}

.modal-hint.hidden { display: none; }

.modal-info { padding: 26px 30px 30px; }

.modal-links {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-links a {
  font-size: .85rem;
  color: var(--pink-deep);
  border: 1px solid var(--pink);
  padding: 6px 16px;
  border-radius: 999px;
  transition: background .2s;
}

.modal-links a:hover { background: var(--pink-tint); }

.modal-info .work-desc {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: .95rem;
  white-space: pre-line;
}

.modal-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.modal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--line);
  cursor: pointer;
  transition: background .2s, transform .2s;
}

.modal-dot.active { background: var(--pink); transform: scale(1.3); }

.modal-dots.hidden { display: none; }

/* ============================================================
   列印樣式（產生 PDF 保底版用，網頁顯示不受影響）
   ============================================================ */

@media print {
  .site-header,
  .scroll-hint,
  .hero-cta,
  .work-more,
  .modal,
  .nav-toggle {
    display: none !important;
  }

  body { background: #fff; }

  .section-tint { background: #fff; }

  .hero {
    min-height: auto;
    padding: 24px 0 8px;
    background: #fff;
    text-align: left;
  }

  .hero-inner {
    padding: 0;
    grid-template-columns: 36% 1fr;
    gap: 28px;
  }

  .hero-photo-wrap { animation: none; opacity: 1; transform: none; }

  .hero-photo {
    animation: none;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .hero-photo img { max-height: none; }
  .hero-photo-placeholder { display: none; }
  .hero-text > * { animation: none; opacity: 1; transform: none; }
  .hero-name { font-size: 32px; }
  .hero-name-cn { margin-top: 2px; }
  .hero-tagline { font-size: .95rem; }

  .section { padding: 28px 0; }
  .section-head { margin-bottom: 20px; }
  .section-note { font-size: .85rem; }

  .reveal { opacity: 1 !important; transform: none !important; }

  .about-grid { grid-template-columns: 280px 1fr; gap: 24px; }
  .photo-placeholder { display: none; }

  .works-chapters { padding-left: 36px; gap: 28px; border-left: 2px solid #ccc; }
  .works-chapters .reveal { opacity: 1; transform: none; }
  .work-num { left: -54px; width: 36px; height: 36px; font-size: .85rem; }
  .work-chapter { break-inside: avoid; }
  .media-placeholder { display: none; }
  .work-media { aspect-ratio: 16 / 10; }
  .work-desc { font-size: .82rem; }

  .btn {
    background: none;
    border: 1px solid #999;
    color: #000;
    font-size: .85rem;
    padding: 8px 22px;
  }

  .skill-tags li { border-color: #ccc; }

  footer { border-top: 1px solid #ccc; }
}
