/* ============================================================
   ccsetsuki — 全站樣式
   深色藝廊：作品多在暗場發光，背景退後，讓光說話
   ============================================================ */

:root {
  --bg:        #08090d;
  --bg-2:      #10121a;
  --bg-3:      #181b26;
  --line:      #262a38;
  --text:      #e8e9f0;
  --text-dim:  #9a9db0;
  --text-mute: #626679;
  --glow:      #a9b8ff;   /* LED 冷光 */
  --glow-2:    #6f7fff;
  --ember:     #ff5a5a;   /* 紅色 LED，只點綴用 */

  --font-sans: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-disp: "Space Grotesk", "Noto Sans TC", sans-serif;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 48px);
  --radius: 6px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
img, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-family: var(--font-disp); font-weight: 500; line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
::selection { background: var(--glow-2); color: #fff; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ── 導覽列 ─────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  background: linear-gradient(to bottom, rgba(8,9,13,.9), rgba(8,9,13,0));
  transition: background .3s var(--ease);
}
.nav.scrolled { background: rgba(8,9,13,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav__logo { font-family: var(--font-disp); font-size: 1.15rem; letter-spacing: .08em; }
.nav__logo span { color: var(--glow); }
.nav__links { display: flex; gap: clamp(14px, 2.5vw, 32px); list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.nav__links a { color: var(--text-dim); transition: color .2s; position: relative; }
.nav__links a:hover, .nav__links a.active { color: var(--text); }
.nav__links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px; background: var(--glow); box-shadow: 0 0 8px var(--glow); }
.nav__toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.4rem; cursor: pointer; }

@media (max-width: 720px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: rgba(8,9,13,.97); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; transition: max-height .35s var(--ease);
  }
  .nav__links.open { max-height: 320px; }
  .nav__links li a { display: block; padding: 14px var(--gutter); }
  .nav__links a.active::after { display: none; }
}

/* ── 首頁主視覺 ─────────────────────────────────────── */
.hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; }
.hero__canvas { position: absolute; inset: 0; z-index: 0; }
.hero__canvas canvas { width: 100% !important; height: 100% !important; }
.hero__content { position: relative; z-index: 1; padding-bottom: clamp(48px, 12vh, 120px); pointer-events: none; }
.hero__eyebrow { font-size: .8rem; letter-spacing: .3em; color: var(--glow); text-transform: uppercase; margin-bottom: 1.2em; }
.hero__title { font-size: clamp(2.4rem, 7vw, 5.5rem); font-weight: 400; margin-bottom: .3em; }
.hero__sub { color: var(--text-dim); max-width: 34em; font-size: clamp(.95rem, 1.6vw, 1.1rem); }
.hero__hint { position: absolute; right: var(--gutter); bottom: 28px; z-index: 1; font-size: .75rem; color: var(--text-mute); letter-spacing: .2em; }

/* ── 區塊 ───────────────────────────────────────────── */
.section { padding: clamp(72px, 12vh, 140px) 0; }
.section--alt { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; }
.section__label { font-size: .75rem; letter-spacing: .3em; color: var(--text-mute); text-transform: uppercase; }
.section__title { font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin: 0; }
.link-more { color: var(--glow); font-size: .9rem; }
.link-more:hover { text-shadow: 0 0 10px var(--glow); }

.page-head { padding: 140px 0 40px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 400; }
.page-head p { color: var(--text-dim); max-width: 40em; }

/* ── 作品卡片 ───────────────────────────────────────── */
.grid { display: grid; gap: clamp(16px, 2.5vw, 28px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.card { display: block; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .4s var(--ease), border-color .3s, box-shadow .4s; }
.card:hover { transform: translateY(-4px); border-color: #3a4060; box-shadow: 0 10px 40px -12px rgba(111,127,255,.35); }
.card__media { aspect-ratio: 4 / 3; background: var(--bg-3); overflow: hidden; position: relative; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease), filter .4s; filter: saturate(.9); }
.card:hover .card__media img { transform: scale(1.04); filter: saturate(1.05); }
.card__media--empty { display: grid; place-items: center; color: var(--text-mute); font-size: .85rem; letter-spacing: .2em; }
.card__media--empty canvas { position: absolute; inset: 0; }
.card__body { padding: 18px 20px 22px; }
.card__meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .75rem; color: var(--text-mute); margin-bottom: 8px; }
.tag { border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; }
.tag--glow { border-color: rgba(169,184,255,.4); color: var(--glow); }
.tag--ember { border-color: rgba(255,90,90,.4); color: var(--ember); }
.card__title { font-size: 1.15rem; margin: 0 0 6px; }
.card__desc { color: var(--text-dim); font-size: .9rem; margin: 0; }

/* ── 篩選 ───────────────────────────────────────────── */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.filter { background: none; border: 1px solid var(--line); color: var(--text-dim); border-radius: 99px; padding: 6px 16px; font: inherit; font-size: .85rem; cursor: pointer; transition: all .2s; }
.filter:hover { color: var(--text); border-color: #3a4060; }
.filter.active { color: var(--bg); background: var(--glow); border-color: var(--glow); }
.card.hidden { display: none; }

/* ── 作品內頁 ───────────────────────────────────────── */
.work-hero { position: relative; height: min(88svh, 900px); overflow: hidden; }
.work-hero img { width: 100%; height: 100%; object-fit: cover; }
.work-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, rgba(8,9,13,.2) 45%, rgba(8,9,13,.4) 100%); }
.work-hero__text { position: absolute; left: 0; right: 0; bottom: 48px; z-index: 1; }
.work-hero__text h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); font-weight: 400; margin-bottom: .2em; }
.work-hero__text p { color: var(--text-dim); }

.work-info { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(24px, 6vw, 80px); }
@media (max-width: 800px) { .work-info { grid-template-columns: 1fr; } }
.spec { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.spec li { display: grid; grid-template-columns: 5.5em 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.spec li span:first-child { color: var(--text-mute); }
.prose h2 { font-size: 1.3rem; margin-top: 1.8em; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: #c9cbd8; }
.todo { color: var(--ember); border-bottom: 1px dashed rgba(255,90,90,.5); }

.gallery { columns: 3 280px; column-gap: 16px; }
.gallery figure { margin: 0 0 16px; break-inside: avoid; border-radius: var(--radius); overflow: hidden; cursor: zoom-in; background: var(--bg-3); }
.gallery img { width: 100%; height: auto; transition: opacity .3s; }
.gallery figure:hover img { opacity: .85; }
.gallery figcaption { font-size: .78rem; color: var(--text-mute); padding: 6px 10px 8px; }

.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(4,5,8,.95); display: none; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-height: 92vh; width: auto; border-radius: var(--radius); }

.pager { display: flex; justify-content: space-between; gap: 16px; padding-top: 40px; border-top: 1px solid var(--line); margin-top: 60px; font-size: .9rem; }
.pager a { color: var(--text-dim); }
.pager a:hover { color: var(--glow); }

/* ── 關於 ───────────────────────────────────────────── */
.about { display: grid; grid-template-columns: 1fr 1.6fr; gap: clamp(24px, 6vw, 80px); align-items: start; }
@media (max-width: 800px) { .about { grid-template-columns: 1fr; } }
.about__portrait { aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); position: relative; }
.about__portrait canvas { position: absolute; inset: 0; }
.skills { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 28px 12px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: .55em; width: 9px; height: 9px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 10px var(--glow); }
.timeline time { font-size: .8rem; color: var(--text-mute); letter-spacing: .1em; }
.timeline h3 { font-size: 1.05rem; margin: 2px 0 4px; }
.timeline p { color: var(--text-dim); font-size: .9rem; margin: 0; }

/* ── 實驗室（p5） ───────────────────────────────────── */
.lab { display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.lab__item { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lab__canvas { aspect-ratio: 4 / 3; background: #000; position: relative; }
.lab__canvas canvas { width: 100% !important; height: 100% !important; }
.lab__body { padding: 16px 20px 20px; }
.lab__body h3 { font-size: 1.05rem; margin-bottom: 4px; }
.lab__body p { color: var(--text-dim); font-size: .88rem; margin: 0; }
kbd { font-family: inherit; font-size: .78rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; color: var(--text); }

/* ── 聯絡 ───────────────────────────────────────────── */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 6vw, 80px); }
@media (max-width: 800px) { .contact { grid-template-columns: 1fr; } }
.contact__list { list-style: none; margin: 0; padding: 0; }
.contact__list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.contact__list span { display: block; font-size: .75rem; letter-spacing: .2em; color: var(--text-mute); text-transform: uppercase; }
.contact__list a { font-size: 1.1rem; }
.contact__list a:hover { color: var(--glow); }

/* ── CTA / 頁尾 ─────────────────────────────────────── */
.cta { text-align: center; }
.cta h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 400; }
.btn { display: inline-block; margin-top: 16px; padding: 12px 28px; border: 1px solid var(--glow); color: var(--glow); border-radius: 99px; transition: all .3s var(--ease); }
.btn:hover { background: var(--glow); color: var(--bg); box-shadow: 0 0 24px rgba(169,184,255,.5); }

.footer { padding: 40px 0; border-top: 1px solid var(--line); color: var(--text-mute); font-size: .8rem; }
.footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── 進場動畫 ───────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
