/* Bearcave TW — awwwards-inspired 淺色高科技單頁（canvas 粒子網路背景） */

:root {
  --bg: #eef1f6;
  --bg-soft: #e6ebf3;
  --line: rgba(15, 23, 42, 0.1);
  --text: #0b1220;
  --text-dim: #55637a;
  --accent: #0e7490;
  --accent-soft: rgba(8, 145, 178, 0.08);
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --pad: clamp(1.25rem, 5vw, 4.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* 淺色高科技漸層底：同時也是 canvas 失敗時的 fallback */
  background:
    radial-gradient(60% 45% at 50% -5%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(45% 40% at 88% 70%, rgba(37, 99, 235, 0.07), transparent 65%),
    linear-gradient(160deg, #f6f8fc, #eef1f6 55%, #e9eef7);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #f6f8fc; }

.has-cursor,
.has-cursor a { cursor: none; }

/* 背景：canvas 粒子網路（JS 驅動）+ 細網格 */
#bg-net {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 75%);
  opacity: 0.4;
}

/* 自訂游標（淺底改用半透明冷色圓環，不用 mix-blend-mode） */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: rgba(8, 145, 178, 0.25);
  border: 1.5px solid rgba(8, 145, 178, 0.65);
  pointer-events: none;
  z-index: 999;
  transition: width 0.3s var(--ease), height 0.3s var(--ease),
    margin 0.3s var(--ease), opacity 0.3s;
  display: none;
}

.has-cursor .cursor { display: block; }

.cursor.is-hover {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  opacity: 0.7;
  background: rgba(8, 145, 178, 0.12);
}

/* 固定導覽列（淺色毛玻璃） */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--pad);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand-dot { color: var(--accent); margin-left: 0.35em; }

.nav-links {
  display: flex;
  gap: clamp(1rem, 3vw, 2.25rem);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-links a {
  color: var(--text-dim);
  transition: color 0.25s;
}

.nav-links a:hover,
.nav-links a:focus { color: var(--accent); }

/* Hero */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem var(--pad) 4rem;
}

.hero-eyebrow {
  margin: 0 0 1.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.4rem, 14vw, 15rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--text);
}

.hero-line { display: block; }

/* 空心 TW.：淺底改用深色描邊，仍可辨識 */
.hero-line-2 {
  color: transparent;
  -webkit-text-stroke: max(1px, 0.012em) var(--text);
  paint-order: stroke fill;
}

.accent-dot { color: var(--accent); font-style: normal; }

.hero-sub {
  margin: 2rem auto 0;
  max-width: 34ch;
  color: var(--text-dim);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
}

.hero-scroll {
  margin-top: 3.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.3s;
}

.hero-scroll:hover { color: var(--accent); }

.hero-scroll svg { animation: nudge 2s ease-in-out infinite; }

/* Hero 進場動畫 */
[data-anim] {
  opacity: 0;
  transform: translateY(36px);
  animation: rise 1s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* 區塊 */
.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(5rem, 12vw, 9rem) var(--pad);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.section-index {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.2em;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(44px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

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

/* 關於 */
.lead {
  margin: 0 0 3rem;
  max-width: 42ch;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
}

.about-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 720px;
}

.about-list li {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.about-list span { font-weight: 500; }

.about-list em {
  color: var(--text-dim);
  font-style: normal;
  font-size: 0.9rem;
  text-align: right;
}

/* 作品（淺色卡片） */
.works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
}

.work {
  position: relative;
  display: block;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-soft);
}

.work-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(45deg,
      rgba(15, 23, 42, 0.04) 0 2px, transparent 2px 14px),
    linear-gradient(135deg, #e8edf5, #dfe6f0 55%, #d9e2ee);
  transition: transform 0.7s var(--ease);
}

.work:nth-child(2) .work-media { background:
  repeating-linear-gradient(-45deg, rgba(8, 145, 178, 0.08) 0 2px, transparent 2px 16px),
  linear-gradient(150deg, #e3ebf2, #d5e4ec 60%, #dce4ee); }

.work:nth-child(3) .work-media { background:
  radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.10), transparent 55%),
  linear-gradient(210deg, #e6eaf4, #dde4f0 60%, #e2e8f2); }

.work:nth-child(4) .work-media { background:
  repeating-radial-gradient(circle at 70% 80%, rgba(15, 23, 42, 0.04) 0 1px, transparent 1px 18px),
  linear-gradient(30deg, #e8ecf3, #dfe7ef 55%, #e4e9f2); }

.work::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(246, 248, 252, 0.94) 15%, rgba(246, 248, 252, 0.35) 55%, transparent);
  transition: opacity 0.5s;
}

.work:hover .work-media,
.work:focus-visible .work-media { transform: scale(1.06); }

.work-meta {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: 1.5rem;
  color: var(--text);
}

.work-tag {
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.work-meta h3 {
  margin: 0.4rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  transform: translateY(8px);
  transition: transform 0.5s var(--ease);
}

.work-meta p {
  margin: 0.4rem 0 0;
  max-height: 0;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.5s var(--ease), max-height 0.5s var(--ease), margin 0.5s var(--ease);
}

.work-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--ease) 0.05s, transform 0.5s var(--ease) 0.05s;
}

.work:hover .work-meta h3,
.work:focus-visible .work-meta h3 { transform: none; }

.work:hover .work-meta p,
.work:focus-visible .work-meta p {
  max-height: 6rem;
  opacity: 1;
  margin-top: 0.5rem;
}

.work:hover .work-cta,
.work:focus-visible .work-cta {
  opacity: 1;
  transform: none;
}

/* 聯絡 */
.contact { text-align: center; }

.contact .section-head { justify-content: center; }

.mega-mail {
  display: block;
  margin: 0 auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 6.5vw, 5.5rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  word-break: break-word;
  color: var(--text);
  transition: color 0.4s var(--ease), transform 0.4s var(--ease);
}

.mega-mail:hover,
.mega-mail:focus {
  color: var(--accent);
  transform: translateY(-4px);
}

.contact-note {
  margin: 2rem auto 0;
  max-width: 40ch;
  color: var(--text-dim);
}

/* 頁尾 */
.footer {
  padding: 2.5rem var(--pad);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer p { margin: 0; }

.footer-meta { font-size: 0.75rem; }

/* RWD */
@media (max-width: 760px) {
  .works-grid { grid-template-columns: 1fr; }

  .about-list li {
    flex-direction: column;
    gap: 0.25rem;
  }

  .about-list em { text-align: left; }

  .nav { padding: 0.85rem var(--pad); }

  .nav-links { gap: 1rem; font-size: 0.75rem; }

  .hero-sub { margin-top: 1.5rem; }

  .work-meta p {
    max-height: 6rem;
    opacity: 1;
    margin-top: 0.5rem;
  }

  .work-cta { opacity: 1; transform: none; }

  .cursor { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  [data-anim] { animation: none; opacity: 1; transform: none; }

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

  .hero-scroll svg { animation: none; }

  * { transition-duration: 0.01ms !important; }
}
