/* ============================================================
   蔡秉育 Caibo — Portfolio (Apple cinematic, black edition)
   ============================================================ */

:root {
  --bg:        #000000;
  --bg-soft:   #0a0a0a;
  --bg-card:   #1d1d1f;
  --bg-raise:  #161617;
  --ink:       #f5f5f7;
  --ink-dim:   #86868b;
  --ink-muted: #6e6e73;
  --line:      rgba(245, 245, 247, 0.08);
  --line-strong: rgba(245, 245, 247, 0.16);
  --accent:    #2997ff;

  --font: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont,
          "Helvetica Neue", "Noto Sans TC", "PingFang TC", sans-serif;

  --fs-display:  clamp(56px, 8vw, 96px);
  --fs-h1:       clamp(40px, 5vw, 64px);
  --fs-h2:       clamp(28px, 3vw, 40px);
  --fs-h3:       22px;
  --fs-body:     19px;
  --fs-caption:  14px;
  --fs-eyebrow:  12px;

  --pad-section: clamp(80px, 10vw, 140px);
  --pad-gutter:  clamp(22px, 5vw, 48px);
  --max:         1280px;

  --r-card: 22px;
  --r-btn:  980px;

  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img {
  display: block;
  max-width: 100%;
  height: auto;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

::selection { background: var(--ink); color: var(--bg); }

/* ------------------------------------------------------------
   Nav — Apple sticky glass
   ------------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 100;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--pad-gutter);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.nav-mark {
  font-size: 18px; font-weight: 600; letter-spacing: -0.02em;
}
.nav-mark .dot { color: var(--accent); }

.nav-links {
  display: flex; gap: 32px;
  color: var(--ink-dim);
}
.nav-links a { transition: color 0.2s var(--ease); }
.nav-links a:hover { color: var(--ink); }

.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink);
  font-weight: 500;
}
.nav-cta .status {
  width: 6px; height: 6px; border-radius: 50%;
  background: #32d74b;
  box-shadow: 0 0 8px rgba(50, 215, 75, 0.6);
  animation: breathe 2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ------------------------------------------------------------
   Pill Bar — mobile section nav (≤ 900px only)
   ------------------------------------------------------------ */
.pill-bar {
  display: none;
  position: sticky; top: 52px; z-index: 99;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.pill-bar-inner {
  display: flex; gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 10px var(--pad-gutter);
  height: 52px; align-items: center;
}
.pill-bar-inner::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 980px;
  font-size: 13px;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
  text-decoration: none;
}
.pill.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero {
  padding: clamp(80px, 12vw, 140px) var(--pad-gutter) clamp(60px, 8vw, 100px);
  max-width: var(--max);
  margin: 0 auto;
  position: relative;
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.hero-meta {
  display: flex; gap: 20px; align-items: center;
  margin-bottom: 28px;
}
.hero-meta .eyebrow + .eyebrow { color: var(--ink-muted); }

.hero-title {
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin-bottom: 28px;
  max-width: 14ch;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.5;
  color: var(--ink-dim);
  max-width: 56ch;
  margin-bottom: 40px;
}
.hero-sub strong { color: var(--ink); font-weight: 500; }

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: var(--r-btn);
  font-size: 16px; font-weight: 400;
  transition: all 0.22s var(--ease);
  line-height: 1;
  letter-spacing: -0.01em;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: #fff; transform: translateY(-1px); }

.btn-ghost {
  color: var(--accent);
  padding: 13px 0;
}
.btn-ghost:hover { color: #6ab7ff; }
.btn-ghost .arrow { transition: transform 0.22s var(--ease); display: inline-block; }
.btn-ghost:hover .arrow { transform: translateX(3px); }

/* ------------------------------------------------------------
   Featured — 滿版 hero visual（WAVE ON 當 featured）
   ------------------------------------------------------------ */
.featured {
  padding: 0 var(--pad-gutter) var(--pad-section);
  max-width: var(--max);
  margin: 0 auto;
}

.featured-tag {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.featured-tag .num {
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}
.featured-tag .dot-line {
  height: 1px; flex: 1; max-width: 80px;
  background: var(--line-strong);
}

.featured-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-card);
  margin-bottom: 28px;
}
.featured-stage > img,
.case-stage > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 2;
  transition: transform 0.7s var(--ease);
}
.case:hover .case-stage > img { transform: scale(1.02); }

.featured-caption {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  padding: 0 4px;
}
.featured-caption h2 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.featured-caption p {
  color: var(--ink-dim);
  max-width: 40ch;
  justify-self: end;
  font-size: 17px;
  line-height: 1.5;
}

/* ------------------------------------------------------------
   Work — 縱向 full-bleed stack
   ------------------------------------------------------------ */
.work-intro {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad-gutter) clamp(60px, 7vw, 100px);
}
.work-intro h2 {
  font-size: var(--fs-h1);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  max-width: 20ch;
  margin-top: 12px;
}

.case {
  padding: clamp(60px, 8vw, 120px) var(--pad-gutter);
  border-top: 1px solid var(--line);
}
.case-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.case-index {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
  font-size: var(--fs-caption);
  color: var(--ink-muted);
  letter-spacing: 0.08em;
}
.case-index .num {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}
.case-index .bar {
  height: 1px; width: 40px;
  background: var(--line-strong);
}

.case-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-card);
  margin-bottom: 40px;
  transition: transform 0.5s var(--ease);
}
.case:hover .case-stage { transform: scale(1.004); }

.case-caption {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}
.case-caption h3 {
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 14px;
}
.case-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 4px;
}
.case-tags span {
  font-size: 12px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-dim);
  letter-spacing: 0;
}
.case-body p {
  color: var(--ink-dim);
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.case-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
  font-size: 16px;
}
.case-link .arrow { transition: transform 0.22s var(--ease); }
.case-link:hover .arrow { transform: translateX(4px); }

/* ------------------------------------------------------------
   Section head — category intro rail
   ------------------------------------------------------------ */
.section-head-wrap {
  padding: clamp(60px, 7vw, 100px) var(--pad-gutter) 0;
  max-width: var(--max);
  margin: 0 auto;
}
.cat-grid {
  padding: clamp(60px, 7vw, 100px) var(--pad-gutter) clamp(60px, 7vw, 100px);
  max-width: var(--max);
  margin: 0 auto;
  border-top: 1px solid var(--line);
}
.cat-head,
.section-head {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 44ch);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.cat-head .eyebrow,
.section-head .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}
.cat-head h2,
.section-head h2 {
  font-size: var(--fs-h1);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.06;
  max-width: 18ch;
}
.section-lede {
  color: var(--ink-dim);
  font-size: 18px;
  line-height: 1.55;
  max-width: 44ch;
}

/* ------------------------------------------------------------
   Grid tiles — poster wall / KV gallery
   ------------------------------------------------------------ */
.grid {
  display: grid;
  gap: clamp(14px, 1.6vw, 24px);
}
.grid-drama {
  grid-template-columns: repeat(4, 1fr);
}
.grid-drama .tile:nth-child(1),
.grid-drama .tile:nth-child(6),
.grid-drama .tile:nth-child(11) {
  grid-column: span 2;
}
.grid-games {
  grid-template-columns: repeat(3, 1fr);
}
.grid-games .tile:nth-child(1) {
  grid-column: span 2;
}
.grid-commercial {
  grid-template-columns: repeat(3, 1fr);
}
.grid-commercial .tile:nth-child(1) {
  grid-column: span 2;
}


.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: inherit;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.tile.in {
  opacity: 1;
  transform: none;
}
.tile-media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-card);
}
.grid-games .tile-media,
.grid-commercial .tile-media {
  aspect-ratio: 16 / 9;
}
.grid-drama .tile:nth-child(1) .tile-media,
.grid-drama .tile:nth-child(6) .tile-media,
.grid-drama .tile:nth-child(11) .tile-media,
.grid-games .tile:nth-child(1) .tile-media,
.grid-commercial .tile:nth-child(1) .tile-media {
  aspect-ratio: 16 / 9;
}
.tile-media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
  z-index: 3;
}
.tile-media img,
.tile-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease), filter 0.4s var(--ease);
  filter: brightness(0.94);
}
.tile:hover .tile-media img,
.tile:hover .tile-media video {
  transform: scale(1.04);
  filter: brightness(1);
}
.tile-title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.3;
  padding: 0 4px;
}
.tile-meta {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 4px;
  margin-top: -8px;
}

/* ------------------------------------------------------------
   Placeholder visuals — 每件作品獨特色彩 + 疊字
   ------------------------------------------------------------ */
.ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(32px, 4vw, 56px);
  color: var(--ink);
  overflow: hidden;
}
.ph::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.04), transparent 40%);
  pointer-events: none;
}
.ph-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  z-index: 1;
}
.ph-bottom {
  z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px;
}
.ph-title {
  font-size: clamp(40px, 6vw, 88px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  max-width: 12ch;
}
.ph-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
  line-height: 1.5;
}

/* 專案主色 */
.ph-wave {
  background: radial-gradient(ellipse at 30% 40%, #1a3a6e 0%, #0a1628 60%, #050a14 100%);
}
.ph-wave::after {
  content: ""; position: absolute;
  inset: 30% -10% 10% -10%;
  background: radial-gradient(ellipse at center, rgba(78, 189, 226, 0.35), transparent 60%);
  filter: blur(30px);
}
.ph-abalone {
  background: linear-gradient(145deg, #8b1a1a 0%, #3a0808 100%);
}
.ph-abalone::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 18px,
    rgba(255,255,255,0.04) 18px, rgba(255,255,255,0.04) 19px
  );
}
.ph-interview {
  background: linear-gradient(165deg, #e8a0bf 0%, #b85d8a 100%);
}
.ph-interview .ph-title { color: #2a0e1a; }
.ph-interview .ph-top, .ph-interview .ph-sub { color: rgba(42, 14, 26, 0.6); }
.ph-dash {
  background: linear-gradient(160deg, #0a3d2e 0%, #052018 100%);
}
.ph-dash::after {
  content: ""; position: absolute; inset: 55% 8% 10% 8%;
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.25), transparent);
  border-top: 1px solid rgba(74, 222, 128, 0.5);
  clip-path: polygon(0 80%, 15% 55%, 32% 65%, 48% 35%, 65% 45%, 80% 20%, 100% 30%, 100% 100%, 0 100%);
}
.ph-b2b {
  background: linear-gradient(165deg, #1a2632 0%, #0a1018 100%);
}
.ph-b2b::after {
  content: ""; position: absolute; inset: 20% 15% 20% 15%;
  background: linear-gradient(145deg, rgba(100, 140, 180, 0.15), rgba(100, 140, 180, 0.03));
  border: 1px solid rgba(100, 140, 180, 0.2);
  border-radius: 12px;
}
.ph-app {
  background: linear-gradient(135deg, #5b3aa8 0%, #2a1560 50%, #0a0420 100%);
}
.ph-app::after {
  content: ""; position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(120px, 18vw, 240px);
  aspect-ratio: 9 / 19;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 32px;
}

/* ------------------------------------------------------------
   About
   ------------------------------------------------------------ */
.about {
  padding: var(--pad-section) var(--pad-gutter);
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
}
.about-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
  margin-top: 48px;
}

.about-portrait {
  width: clamp(180px, 18vw, 260px);
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-card);
  margin-bottom: 32px;
  filter: grayscale(0.15) contrast(1.02);
}
.about-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.about-intro h2 {
  font-size: var(--fs-h1);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.about-intro h2 em {
  font-style: normal;
  color: var(--ink-dim);
}
.about-intro .role {
  margin-top: 24px;
  font-size: 19px;
  color: var(--ink-dim);
  line-height: 1.5;
}
.about-intro .role strong { color: var(--ink); font-weight: 500; }

.about-body p {
  color: var(--ink-dim);
  font-size: 18px;
  line-height: 1.65;
  margin-bottom: 20px;
}
.about-body p strong { color: var(--ink); font-weight: 500; }
.about-body .quote {
  margin-top: 32px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  font-size: 21px;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

/* Experience timeline */
.exp {
  margin-top: clamp(60px, 8vw, 100px);
  padding-top: 48px;
  border-top: 1px solid var(--line);
}
.exp h3 {
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 500;
  margin-bottom: 32px;
}
.exp-list { display: flex; flex-direction: column; gap: 40px; }
.exp-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
}
.exp-item:last-child { border-bottom: none; }
.exp-meta {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  font-size: 15px;
  letter-spacing: 0.02em;
}
.exp-meta .year { display: block; color: var(--ink-dim); margin-bottom: 4px; }
.exp-body h4 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.exp-body .role {
  font-size: 14px; color: var(--ink-muted);
  margin-bottom: 14px; letter-spacing: 0.02em;
}
.exp-body p {
  color: var(--ink-dim);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.exp-body ul { list-style: none; padding: 0; }
.exp-body ul li {
  position: relative; padding-left: 18px;
  color: var(--ink-dim);
  font-size: 15px; line-height: 1.6;
  margin-bottom: 6px;
}
.exp-body ul li::before {
  content: ""; position: absolute;
  left: 0; top: 11px;
  width: 6px; height: 1px;
  background: var(--ink-muted);
}

/* ------------------------------------------------------------
   Contact
   ------------------------------------------------------------ */
.contact {
  padding: var(--pad-section) var(--pad-gutter);
  text-align: center;
  border-top: 1px solid var(--line);
}
.contact-inner {
  max-width: 900px;
  margin: 0 auto;
}
.contact h2 {
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 20px 0 48px;
}
.contact h2 em {
  font-style: normal;
  color: var(--ink-dim);
}

.contact-email {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: clamp(22px, 2.5vw, 32px);
  color: var(--accent);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
}
.contact-email .arrow { transition: transform 0.22s var(--ease); }
.contact-email:hover .arrow { transform: translate(3px, -3px); }

.contact-secondary {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 40px;
  color: var(--ink-dim);
  font-size: 15px;
}
.contact-secondary a {
  transition: color 0.2s var(--ease);
}
.contact-secondary a:hover { color: var(--ink); }
.contact-secondary a span:last-child {
  display: block;
  color: var(--ink-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ------------------------------------------------------------
   Brief Form (contact section expandable)
   ------------------------------------------------------------ */
.brief-cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--r-btn);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  letter-spacing: -0.01em; cursor: pointer;
  transition: opacity 0.2s, transform 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.brief-cta:hover { opacity: 0.88; }
.brief-cta:active { transform: scale(0.97); }
.brief-cta-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #30d158; display: inline-block; flex-shrink: 0;
}

.brief-wrap {
  max-width: 720px; margin: 0 auto;
  padding: 0 var(--pad-gutter);
  overflow: hidden;
}
.brief-inner {
  display: none; opacity: 0; transform: translateY(20px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  padding-top: 64px; border-top: 1px solid var(--line);
  margin-top: 64px; text-align: left;
}
.brief-inner.show { display: block; }
.brief-inner.visible { opacity: 1; transform: translateY(0); }

.brief-header { margin-bottom: 48px; }
.brief-header .eyebrow { color: var(--accent); margin-bottom: 14px; display: block; }
.brief-header h3 {
  font-size: clamp(26px, 3vw, 36px); font-weight: 600;
  letter-spacing: -0.03em; margin-bottom: 10px;
}
.brief-header p { color: var(--ink-dim); font-size: 15px; line-height: 1.6; }

.q-block { margin-bottom: 40px; }
.q-label {
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-dim);
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.q-num {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-card); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-muted);
}
.q-hint { font-size: 13px; color: var(--ink-muted); margin-bottom: 12px; line-height: 1.5; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 16px; border-radius: var(--r-btn);
  border: 1px solid var(--line-strong);
  font-size: 14px; font-weight: 500; color: var(--ink-dim);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: border-color 0.18s var(--ease), color 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: rgba(245,245,247,.3); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.q-input {
  width: 100%; background: var(--bg-card);
  border: 1px solid var(--line-strong); border-radius: 14px;
  color: var(--ink); font-family: var(--font); font-size: 15px;
  padding: 14px 18px; resize: none; outline: none;
  transition: border-color 0.2s; -webkit-appearance: none;
}
.q-input::placeholder { color: var(--ink-muted); }
.q-input:focus { border-color: rgba(245,245,247,.35); }
.q-input.error { border-color: #ff453a; }
.field-error { font-size: 12px; color: #ff453a; margin-top: 6px; display: none; }
.field-error.show { display: block; }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .input-row { grid-template-columns: 1fr; } }

.budget-options { display: flex; flex-direction: column; gap: 8px; }
.budget-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border: 1px solid var(--line-strong);
  border-radius: 12px; cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.budget-opt:hover { border-color: rgba(245,245,247,.25); }
.budget-opt.active { border-color: rgba(245,245,247,.35); background: var(--bg-card); }
.budget-opt input { display: none; }
.budget-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--ink-muted); flex-shrink: 0;
  position: relative; transition: border-color 0.18s;
}
.budget-opt.active .budget-dot { border-color: var(--ink); }
.budget-opt.active .budget-dot::after {
  content: ''; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--ink);
}
.budget-opt-label { font-size: 15px; color: var(--ink-dim); }
.budget-opt.active .budget-opt-label { color: var(--ink); }

.q-divider { height: 1px; background: var(--line); margin: 8px 0 40px; }

.action-wrap { padding-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.submit-btn {
  width: 100%; padding: 16px; background: var(--accent); color: #fff;
  border: none; border-radius: 14px; font-family: var(--font);
  font-size: 16px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: opacity 0.2s, transform 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.submit-btn:hover { opacity: 0.88; }
.submit-btn:active { transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.copy-btn {
  width: 100%; padding: 14px; background: transparent;
  color: var(--ink-dim); border: 1px solid var(--line-strong);
  border-radius: 14px; font-family: var(--font); font-size: 14px;
  font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.copy-btn:hover { border-color: rgba(245,245,247,.3); color: var(--ink); }
.copy-btn:active { transform: scale(0.98); }

.action-note {
  font-size: 13px; color: var(--ink-muted);
  text-align: center; line-height: 1.5;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.success-state {
  display: none; text-align: center; padding: 48px 0 32px;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.success-state.visible { opacity: 1; transform: translateY(0); }
.success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(48,209,88,.12);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
}
.success-icon svg { stroke: #30d158; }
.success-state h4 {
  font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 10px;
}
.success-state p { color: var(--ink-dim); font-size: 15px; line-height: 1.6; }

.brief-toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card); border: 1px solid var(--line-strong);
  border-radius: var(--r-btn); padding: 12px 24px;
  font-size: 14px; font-weight: 500; opacity: 0;
  transition: all 0.3s var(--ease); pointer-events: none;
  white-space: nowrap; box-shadow: 0 8px 32px rgba(0,0,0,.5); z-index: 999;
}
.brief-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.footer {
  padding: 40px var(--pad-gutter);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: 20px;
  max-width: var(--max); margin: 0 auto;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------
   Reveal animation
   ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------
   Case page — 作品詳情頁
   ------------------------------------------------------------ */
.case-page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad-gutter);
}
.case-head {
  padding: clamp(40px, 6vw, 80px) 0 clamp(40px, 5vw, 64px);
  max-width: 80ch;
}
.case-crumb {
  display: inline-block;
  color: var(--ink-dim);
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
  transition: color 0.2s var(--ease);
}
.case-crumb:hover { color: var(--ink); }
.case-head .eyebrow {
  display: block;
  margin-bottom: 18px;
}
.case-head h1 {
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.case-sub {
  color: var(--ink-dim);
  font-size: 20px;
  margin-top: 16px;
  letter-spacing: -0.01em;
}
.case-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.case-tags span {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}
.case-desc {
  max-width: 64ch;
  color: var(--ink-dim);
  font-size: 18px;
  line-height: 1.65;
  margin-top: 32px;
}

.case-hero {
  aspect-ratio: 16 / 9;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-card);
  margin-bottom: clamp(60px, 8vw, 120px);
  position: relative;
}
.case-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.case-hero--wide {
  aspect-ratio: unset;
}
.case-hero--wide img {
  height: auto;
  object-fit: unset;
}

.case-video {
  border-radius: var(--r-card);
  overflow: hidden;
  background: #000;
  margin-bottom: clamp(60px, 8vw, 120px);
}
.case-video video {
  width: 100%;
  display: block;
  max-height: 80vh;
}

.gallery-section {
  margin-bottom: clamp(60px, 8vw, 100px);
}
.gallery-section h2 {
  font-size: var(--fs-h3);
  color: var(--ink-dim);
  margin-bottom: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.gallery-section h3 {
  font-size: 22px;
  color: var(--ink-dim);
  margin-top: 40px;
  margin-bottom: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.gallery-section h4 {
  font-size: 16px;
  color: var(--ink-dim);
  margin-top: 28px;
  margin-bottom: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.gallery-section > h3:first-child,
.gallery-section h2 + h3,
.gallery-section > h4:first-child,
.gallery-section h3 + h4 {
  margin-top: 0;
}
.gallery {
  column-count: 3;
  column-gap: clamp(10px, 1.4vw, 18px);
}
@media (max-width: 1100px) {
  .gallery { column-count: 2; }
}
@media (max-width: 560px) {
  .gallery { column-count: 1; }
}

/* Row-based gallery (opt-in per case via "layout": "rows") --- */
.gallery-rows {
  column-count: unset;
  column-gap: unset;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.4vw, 18px);
}
.g-row {
  display: grid;
  gap: clamp(10px, 1.4vw, 18px);
  align-items: start;
}
.g-row-landscape,
.g-row-plan { grid-template-columns: 1fr; }
.g-row-square,
.g-row-portrait { grid-template-columns: repeat(3, 1fr); }
.g-row-small { grid-template-columns: repeat(var(--cols, 3), 1fr); }

.gallery-rows .g-item {
  margin-bottom: 0;
  break-inside: unset;
  -webkit-column-break-inside: unset;
  page-break-inside: unset;
}
.gallery-rows .g-item-plan {
  column-span: unset;
  -webkit-column-span: unset;
  margin-bottom: 0;
}

@media (max-width: 1100px) {
  .g-row-portrait { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .g-row-small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}
@media (max-width: 700px) {
  .g-row-square,
  .g-row-portrait,
  .g-row-small { grid-template-columns: 1fr; }
}
.g-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: clamp(10px, 1.4vw, 18px);
  display: block;
}
.g-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.6s var(--ease);
}
.g-item:hover img { transform: scale(1.02); }
.g-item figcaption {
  position: absolute;
  left: 14px;
  bottom: 12px;
  right: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.02em;
  pointer-events: none;
}

.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: clamp(60px, 8vw, 100px) 0 40px;
  border-top: 1px solid var(--line);
}
.prev-next a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 0;
  transition: opacity 0.2s var(--ease);
}
.prev-next a:hover { opacity: 0.7; }
.pn-next {
  text-align: right;
  align-items: flex-end;
}
.pn-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.back-home {
  display: inline-block;
  color: var(--accent);
  padding: 12px 0 80px;
  font-size: 15px;
  transition: color 0.2s var(--ease);
}
.back-home:hover { color: #6ab7ff; }

/* Make featured / signature stages clickable */
a.featured-stage,
a.case-stage {
  display: block;
  cursor: pointer;
}
.featured-caption h2 a,
.case-caption h3 a {
  color: inherit;
  transition: color 0.2s var(--ease);
}
.featured-caption h2 a:hover,
.case-caption h3 a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .grid-drama { grid-template-columns: repeat(3, 1fr); }
  .grid-drama .tile:nth-child(1),
  .grid-drama .tile:nth-child(6),
  .grid-drama .tile:nth-child(11) {
    grid-column: span 3;
  }
  .grid-commercial { grid-template-columns: repeat(2, 1fr); }
  .grid-commercial .tile:nth-child(1) {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .pill-bar { display: block; }
  .featured-caption {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .featured-caption p { justify-self: start; }
  .case-caption { grid-template-columns: 1fr; gap: 20px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .exp-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cat-head,
  .section-head {
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
  }
  .grid-games { grid-template-columns: repeat(2, 1fr); }
  .grid-games .tile:nth-child(1) {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  .prev-next {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .pn-next {
    text-align: left;
    align-items: flex-start;
    border-top: 1px solid var(--line);
    margin-top: 8px;
  }
}

@media (max-width: 560px) {
  :root {
    --fs-body: 17px;
  }
  .nav-cta { font-size: 12px; }
  .hero-title { letter-spacing: -0.035em; }
  .case-caption h3 { font-size: 28px; }
  .contact-secondary { gap: 24px; }
  .grid-drama { grid-template-columns: repeat(2, 1fr); }
  .grid-drama .tile:nth-child(1),
  .grid-drama .tile:nth-child(6),
  .grid-drama .tile:nth-child(11) {
    grid-column: span 2;
  }
  .grid-games { grid-template-columns: 1fr; }
  .grid-games .tile:nth-child(1) {
    grid-column: span 1;
  }
  .grid-commercial { grid-template-columns: 1fr; }
  .grid-commercial .tile:nth-child(1) {
    grid-column: span 1;
  }
  .tile-title { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal,
  .tile { opacity: 1; transform: none; }
}

/* Hotspots on plan images --------------------------------- */
.g-item-plan {
  column-span: all;
  -webkit-column-span: all;
  margin-bottom: clamp(14px, 1.8vw, 22px);
}
.g-item-plan > img { width: 100%; }

.hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  container-type: inline-size;
}
.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(36px, 6cqi, 72px);
  height: clamp(36px, 6cqi, 72px);
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
}
.hotspot:hover,
.hotspot:focus-visible {
  z-index: 10;
}
.hs-dot {
  width: clamp(18px, 3cqi, 36px);
  height: clamp(18px, 3cqi, 36px);
  border-radius: 50%;
  background: #ff9500;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 clamp(5px, 0.8cqi, 10px) rgba(255, 149, 0, 0.24), 0 2px 10px rgba(0, 0, 0, 0.35);
  opacity: 0.35;
  transition: transform 0.2s var(--ease, ease), box-shadow 0.2s var(--ease, ease), opacity 0.2s var(--ease, ease);
  animation: hs-pulse 2.4s ease-in-out infinite;
}
.hotspot:hover .hs-dot,
.hotspot:focus-visible .hs-dot {
  transform: scale(1.15);
  opacity: 1;
  box-shadow: 0 0 0 clamp(8px, 1.2cqi, 14px) rgba(255, 149, 0, 0.32), 0 4px 14px rgba(0, 0, 0, 0.45);
}
.hotspot:focus-visible { outline: none; }

.hs-preview {
  position: absolute;
  top: calc(100% + 12px);
  left: calc(50% - 2px);
  width: 45cqi;
  max-width: 420px;
  min-width: 160px;
  background: #0f0f11;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: scale(0.94);
  transform-origin: top left;
  transition: opacity 0.2s var(--ease, ease), transform 0.2s var(--ease, ease);
  pointer-events: none;
  z-index: 2;
}
.hs-preview img {
  width: 100%;
  height: auto;
  display: block;
}
.hs-caption {
  display: block;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #f5f5f7;
  padding: 8px 12px;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hotspot:hover .hs-preview,
.hotspot:focus-visible .hs-preview {
  opacity: 1;
  transform: scale(1);
}
.hotspot.flip-x .hs-preview {
  left: auto;
  right: calc(50% - 2px);
  transform-origin: top right;
}
.hotspot.flip-y .hs-preview {
  top: auto;
  bottom: calc(100% + 12px);
  transform-origin: bottom left;
}
.hotspot.flip-x.flip-y .hs-preview {
  transform-origin: bottom right;
}

@keyframes hs-pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(255, 149, 0, 0.18), 0 2px 10px rgba(0, 0, 0, 0.35); }
  50%      { box-shadow: 0 0 0 16px rgba(255, 149, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.35); }
}

@media (max-width: 700px) {
  .hs-caption { font-size: 11px; padding: 6px 10px; }
  .hs-preview { width: 55cqi; }
}
