:root {
  /* 淺色底：春夏藍綠系，橘色少量點綴 */
  --bg: #f7fbff;
  --bg2: #f2fff9;
  --panel: rgba(0, 20, 40, 0.05);
  --panel2: rgba(0, 20, 40, 0.08);
  --text: rgba(10, 18, 28, 0.92);
  --muted: rgba(10, 18, 28, 0.62);
  --border: rgba(10, 18, 28, 0.12);
  --shadow: 0 18px 46px rgba(10, 20, 30, 0.12);

  /* 主色（藍綠） */
  --accent: #60b9ff; /* sky */
  --accent2: #36d6c6; /* teal */
  --accent3: #7bdc57; /* green */
  /* 少量重點（橘） */
  --hot: #ff8a3d;

  --radius: 18px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(
      1200px 700px at 18% 10%,
      rgba(96, 185, 255, 0.28),
      transparent 55%
    ),
    radial-gradient(
      900px 620px at 78% 22%,
      rgba(54, 214, 198, 0.22),
      transparent 60%
    ),
    radial-gradient(
      1100px 740px at 35% 95%,
      rgba(123, 220, 87, 0.16),
      transparent 55%
    ),
    linear-gradient(180deg, var(--bg), var(--bg2));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
  line-height: 1.55;
  letter-spacing: 0.2px;
  overflow-x: clip;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  width: min(var(--max), 100% - 36px);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(247, 251, 255, 0.78);
  border-bottom: 1px solid rgba(10, 18, 28, 0.08);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
  box-shadow: 0 0 0 6px rgba(96, 185, 255, 0.18);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.nav a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nav a:hover {
  text-decoration: none;
  color: var(--text);
  border-color: var(--border);
  background: rgba(0, 20, 40, 0.045);
}

@media (max-width: 520px) {
  /* 手機版導覽固定單行，必要時可橫向滑動，避免換行變醜 */
  .topbar-inner {
    gap: 10px;
  }

  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    justify-content: flex-end;
  }

  .nav::-webkit-scrollbar {
    height: 0;
  }

  .nav a {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 8px;
  }
}

.section {
  padding: 72px 0;
  position: relative;
  isolation: isolate;
}

.section > .container {
  position: relative;
  z-index: 1;
}

/* Section color blocks (except hero): soft decorative tints */
.section.has-color-blocks::before,
.section.has-color-blocks::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  filter: blur(0.5px);
}

.section.has-color-blocks::before {
  top: clamp(16px, 4vw, 34px);
  left: clamp(-24px, -2vw, -8px);
  width: clamp(220px, 34vw, 480px);
  height: clamp(120px, 20vw, 240px);
  border-radius: 999px;
  transform: rotate(var(--block-tilt-a, -10deg));
  background: linear-gradient(
    135deg,
    var(--block-a1, rgba(96, 185, 255, 0.22)),
    var(--block-a2, rgba(54, 214, 198, 0.08))
  );
}

.section.has-color-blocks::after {
  right: clamp(-24px, -2vw, -8px);
  bottom: clamp(8px, 2vw, 24px);
  width: clamp(180px, 26vw, 360px);
  height: clamp(120px, 18vw, 220px);
  border-radius: 36px;
  transform: rotate(var(--block-tilt-b, 12deg));
  background: linear-gradient(
    145deg,
    var(--block-b1, rgba(255, 138, 61, 0.16)),
    var(--block-b2, rgba(123, 220, 87, 0.08))
  );
  opacity: 0.92;
}

.section.has-color-blocks.block-sky {
  --block-a1: rgba(96, 185, 255, 0.26);
  --block-a2: rgba(54, 214, 198, 0.1);
  --block-b1: rgba(96, 185, 255, 0.12);
  --block-b2: rgba(255, 255, 255, 0.06);
  --block-tilt-a: -9deg;
  --block-tilt-b: 11deg;
}

.section.has-color-blocks.block-mint {
  --block-a1: rgba(54, 214, 198, 0.24);
  --block-a2: rgba(123, 220, 87, 0.12);
  --block-b1: rgba(96, 185, 255, 0.14);
  --block-b2: rgba(255, 255, 255, 0.05);
  --block-tilt-a: -13deg;
  --block-tilt-b: 8deg;
}

.section.has-color-blocks.block-peach {
  --block-a1: rgba(255, 138, 61, 0.2);
  --block-a2: rgba(255, 184, 107, 0.12);
  --block-b1: rgba(96, 185, 255, 0.12);
  --block-b2: rgba(54, 214, 198, 0.08);
  --block-tilt-a: -7deg;
  --block-tilt-b: 14deg;
}

.section.has-color-blocks.block-lilac {
  --block-a1: rgba(146, 140, 255, 0.18);
  --block-a2: rgba(96, 185, 255, 0.12);
  --block-b1: rgba(54, 214, 198, 0.12);
  --block-b2: rgba(255, 255, 255, 0.05);
  --block-tilt-a: -11deg;
  --block-tilt-b: 9deg;
}

/* Optional custom hand-drawn decoration per section.
   Add data-deco on section; JS injects .section-deco-image. */
.global-deco-image {
  position: fixed;
  right: clamp(10px, 2vw, 24px);
  bottom: clamp(10px, 2vw, 24px);
  z-index: 1;
  pointer-events: none;
  width: min(30vw, 300px);
  aspect-ratio: 1 / 1;
  background-image: var(--global-deco-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.18;
  mix-blend-mode: multiply;
}

@media (max-width: 860px) {
  .global-deco-image {
    width: min(42vw, 220px);
    opacity: 0.14;
    right: 6px;
    bottom: 108px;
  }
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.6px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* GREETER (floating) */
.greeter-float {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.greeter-float-btn {
  position: fixed;
  width: 140px;
  height: 140px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  overflow: visible;
  pointer-events: auto;
}

.greeter-float-btn:hover {
  filter: drop-shadow(0 14px 22px rgba(10, 20, 30, 0.22));
}

.greeter-float-btn:active {
  transform: translateY(1px);
}

.greeter-float-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.greeter-float-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.greeter-float-btn.pos-kt {
  left: 14px;
  top: 74px;
}

.greeter-float-btn.pos-yt {
  right: 14px;
  bottom: 14px;
}

.greeter-float-bubble {
  position: fixed;
  z-index: 81;
  width: min(360px, calc(100vw - 36px));
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid rgba(10, 18, 28, 0.12);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  --bubble-border: rgba(10, 18, 28, 0.12);
  --bubble-bg: rgba(255, 255, 255, 0.92);
}

/* 氣泡箭頭：依人物頭部動態決定方向 */
.greeter-float-bubble::before,
.greeter-float-bubble::after {
  content: "";
  position: absolute;
  left: var(--tail-x, 24px);
  top: var(--tail-y, 24px);
  width: 0;
  height: 0;
}

/* 外框三角形（邊線） */
.greeter-float-bubble::before {
  border-style: solid;
}

/* 內層三角形（填色） */
.greeter-float-bubble::after {
  border-style: solid;
}

.greeter-float-bubble.tail-left::before {
  left: -11px;
  border-width: 10px 11px 10px 0;
  border-color: transparent var(--bubble-border) transparent transparent;
}

.greeter-float-bubble.tail-left::after {
  left: -9px;
  border-width: 9px 10px 9px 0;
  border-color: transparent var(--bubble-bg) transparent transparent;
}

.greeter-float-bubble.tail-right::before {
  right: -11px;
  left: auto;
  border-width: 10px 0 10px 11px;
  border-color: transparent transparent transparent var(--bubble-border);
}

.greeter-float-bubble.tail-right::after {
  right: -9px;
  left: auto;
  border-width: 9px 0 9px 10px;
  border-color: transparent transparent transparent var(--bubble-bg);
}

.greeter-float-bubble.tail-top::before {
  top: -11px;
  border-width: 0 10px 11px 10px;
  border-color: transparent transparent var(--bubble-border) transparent;
}

.greeter-float-bubble.tail-top::after {
  top: -9px;
  border-width: 0 9px 10px 9px;
  border-color: transparent transparent var(--bubble-bg) transparent;
}

.greeter-float-bubble.tail-bottom::before {
  top: auto;
  bottom: -11px;
  border-width: 11px 10px 0 10px;
  border-color: var(--bubble-border) transparent transparent transparent;
}

.greeter-float-bubble.tail-bottom::after {
  top: auto;
  bottom: -9px;
  border-width: 10px 9px 0 9px;
  border-color: var(--bubble-bg) transparent transparent transparent;
}

/* KT：冷色框線 */
.greeter-float-bubble.speaker-kt {
  --bubble-border: rgba(70, 140, 210, 0.58);
  --bubble-bg: rgba(250, 255, 255, 0.95);
  border-color: var(--bubble-border);
}

/* YT：暖色框線 */
.greeter-float-bubble.speaker-yt {
  --bubble-border: rgba(235, 138, 78, 0.58);
  --bubble-bg: rgba(255, 252, 247, 0.95);
  border-color: var(--bubble-border);
}

@media (max-width: 520px) {
  /* 手機版避免擋住內容：縮小、貼邊（雙人同時存在） */
  .greeter-float-btn {
    width: 92px;
    height: 92px;
  }

  .greeter-float-btn.pos-kt {
    left: 8px;
    top: auto;
    bottom: 8px;
  }

  .greeter-float-btn.pos-yt {
    right: 8px;
    bottom: 8px;
  }

  .greeter-float-bubble {
    width: min(320px, calc(100vw - 16px));
  }

  /* Footer 加高，避免被浮動小人擋住 */
  footer {
    padding-bottom: 140px;
  }
}

.mobile-footer-spacer {
  display: none;
}

@media (max-width: 520px) {
  .mobile-footer-spacer {
    display: block;
    height: 160px;
  }
}

.greeter-bubble-inner {
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}

.greeter-bubble-speaker {
  display: none;
}

.greeter-bubble-text {
  font-size: 14px;
  line-height: 1.75;
}

.greeter-bubble-sub {
  color: var(--muted);
  font-size: 11px;
}

/* HERO */
.hero {
  min-height: calc(100svh - 62px);
  display: grid;
  align-items: stretch;
  padding: 18px 0 0;
}

.hero-stage {
  position: relative;
  isolation: isolate;
  min-height: min(720px, calc(100svh - 110px));
  display: grid;
  align-items: end;
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid rgba(10, 18, 28, 0.12);
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.65);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    135deg,
    rgba(96, 185, 255, 0.42),
    rgba(54, 214, 198, 0.28),
    rgba(123, 220, 87, 0.22)
  );
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.06) contrast(1.02);
  opacity: 0.62;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
      180deg,
      rgba(247, 251, 255, 0.28),
      rgba(247, 251, 255, 0.62)
    ),
    radial-gradient(
      1000px 500px at 20% 30%,
      rgba(96, 185, 255, 0.25),
      transparent 55%
    );
}

@media (max-width: 520px) {
  /* 手機版把 Hero 文字往上提一些，避免「上面空一大塊」的視覺感 */
  .hero {
    padding-top: 10px;
  }
  .hero-stage {
    min-height: calc(100svh - 140px);
    align-items: center;
  }
  .hero-content {
    padding: 26px 18px 20px;
  }

  .hero-head {
    align-items: center;
    gap: 12px;
  }

  .hero-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
  }
}

.hero-content {
  padding: 40px 22px 24px;
  display: grid;
  gap: 12px;
  max-width: 760px;
}

.hero-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.hero-avatar {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  outline: 1px solid rgba(10, 18, 28, 0.12);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 24px rgba(10, 20, 30, 0.12);
}

.hero-kicker {
  color: rgba(10, 18, 28, 0.66);
  font-size: 12px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 74px);
  line-height: 0.98;
  letter-spacing: -0.8px;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
}

.hero h1 .alt {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    sans-serif;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero .one-liner {
  margin: 0;
  color: rgba(10, 18, 28, 0.86);
  font-size: 16px;
}

.hero .sub {
  margin: 0;
  color: rgba(10, 18, 28, 0.62);
  font-size: 14px;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  min-height: 44px;
  text-decoration: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.86);
  text-decoration: none;
}

.btn.primary {
  border-color: rgba(96, 185, 255, 0.38);
  background: linear-gradient(
    135deg,
    rgba(96, 185, 255, 0.28),
    rgba(54, 214, 198, 0.18),
    rgba(123, 220, 87, 0.12)
  );
}

/* 橘色重點（少量使用）：把 CTA/重要連結加上 .hot 就會變橘 */
.btn.hot,
.links a.hot,
.social a.hot {
  border-color: rgba(255, 138, 61, 0.5);
  background: linear-gradient(
    135deg,
    rgba(255, 138, 61, 0.18),
    rgba(255, 255, 255, 0.76)
  );
}

.btn.hot:hover,
.links a.hot:hover,
.social a.hot:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 138, 61, 0.26),
    rgba(255, 255, 255, 0.9)
  );
}

/* WHAT I DO */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.cards.two {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 860px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .section {
    padding: 58px 0;
  }
}

.card {
  border-radius: var(--radius);
  border: 1px solid rgba(10, 18, 28, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.focus-card {
  position: relative;
  border-color: rgba(10, 18, 28, 0.16);
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.85),
      rgba(255, 255, 255, 0.55)
    ),
    radial-gradient(
      900px 260px at 30% 0%,
      var(--focus-tint, rgba(96, 185, 255, 0.18)),
      transparent 55%
    );
}

.focus-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--focus-bar, linear-gradient(90deg, var(--accent), var(--accent2)));
  opacity: 0.95;
}

.focus-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255, 255, 255, 0.16) 40%,
    transparent 70%
  );
  opacity: 0.55;
}

.focus-indie {
  --focus-tint: rgba(96, 185, 255, 0.32);
  --focus-bar: linear-gradient(90deg, rgba(96, 185, 255, 0.95), rgba(56, 189, 248, 0.55));
}

.focus-techart {
  --focus-tint: rgba(54, 214, 198, 0.32);
  --focus-bar: linear-gradient(90deg, rgba(54, 214, 198, 0.95), rgba(123, 220, 87, 0.55));
}

.focus-teaching {
  --focus-tint: rgba(255, 138, 61, 0.26);
  --focus-bar: linear-gradient(90deg, rgba(255, 138, 61, 0.95), rgba(255, 184, 107, 0.6));
}

.card-inner {
  padding: 18px 16px;
  display: grid;
  gap: 10px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(10, 18, 28, 0.12);
  color: rgba(10, 18, 28, 0.68);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.6);
}

/* WORKS */
.work {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
}

.work + .work {
  margin-top: 18px;
}

.work.reverse {
  grid-template-areas: "text media";
}

.work-media {
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid rgba(10, 18, 28, 0.12);
  box-shadow: var(--shadow);
  position: relative;
  min-height: 260px;
  background: rgba(255, 255, 255, 0.65);
}

.work-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

.work-media .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    rgba(96, 185, 255, 0.34),
    rgba(54, 214, 198, 0.22),
    rgba(123, 220, 87, 0.16)
  );
  color: rgba(10, 18, 28, 0.78);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.work-text {
  display: grid;
  gap: 10px;
}

.work h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.2px;
}

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

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

.links a {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(10, 18, 28, 0.12);
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.links a:hover {
  background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 860px) {
  .work {
    grid-template-columns: 1fr;
  }
}

/* ABOUT */
.about {
  text-align: left;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 18px;
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid rgba(10, 18, 28, 0.12);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
}

.about blockquote {
  margin: 0;
  padding: 0;
  color: rgba(10, 18, 28, 0.82);
  font-size: 15px;
  line-height: 1.7;
}

.about .sig {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* FOOTER */
footer {
  padding: 26px 0 44px;
  border-top: 1px solid rgba(10, 18, 28, 0.08);
  color: var(--muted);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.55)
  );
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

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

.social a {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(10, 18, 28, 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  text-decoration: none;
}

.social a:hover {
  background: rgba(255, 255, 255, 0.9);
}

/* REVEAL ANIMATION
   預設「可見」，只有 JS 啟用時才做淡入，避免 script 沒載入就整頁消失。 */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms ease;
  will-change: opacity, transform;
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
