:root {
  --canvas: #f7f1ed;
  --ink: #1b1a18;
  --body: #625d5a;
  --quiet: #8a8380;
  --accent: #76577f;
  --accent-deep: #5d4566;
  --surface: rgba(255, 252, 250, 0.88);
  --line: rgba(75, 59, 77, 0.14);
  --header-h: 68px;
  --page-x: clamp(28px, 4.4vw, 76px);
  --deck-w: min(64vw, 960px);
  --radius: 20px;
  --case-card-h: min(440px, 74dvh);
  --case-distance: 100px;
  font-family: "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; background: var(--canvas); }
body { margin: 0; min-width: 320px; overflow-x: clip; background: var(--canvas); color: var(--ink); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
button, a { font: inherit; }
a { color: inherit; }
img, video { display: block; }

.site-header {
  position: fixed;
  z-index: 60;
  inset: 0 0 auto;
  height: var(--header-h);
  padding: 0 var(--page-x);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid rgba(56, 48, 47, 0.08);
  background: rgba(247, 241, 237, 0.9);
  backdrop-filter: blur(16px);
}
.wordmark, .contact-link, .site-header nav a { text-decoration: none; }
.wordmark { justify-self: start; font-size: 15px; font-weight: 750; }
.site-header nav { display: flex; gap: clamp(24px, 3vw, 46px); }
.site-header nav a { color: var(--quiet); font-size: 14px; font-weight: 650; }
.site-header nav a.is-current { color: var(--ink); }
.contact-link { justify-self: end; padding-bottom: 4px; border-bottom: 1px solid currentColor; font-size: 14px; font-weight: 700; }

.portrait-media {
  position: fixed;
  z-index: 0;
  inset: var(--header-h) 0 0;
  overflow: clip;
  pointer-events: none;
}
.portrait-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: var(--canvas);
  transform: translateX(12%) scale(0.96);
  transform-origin: center;
  opacity: 0;
  transition: opacity 240ms ease;
}
.portrait-video.is-ready { opacity: 1; }
.portrait-fade {
  position: fixed;
  z-index: 1;
  inset: var(--header-h) 0 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--canvas) 0%, rgba(247, 241, 237, 0.96) 48%, rgba(247, 241, 237, 0.2) 68%, rgba(247, 241, 237, 0) 82%);
}

main { position: relative; z-index: 2; overflow-x: clip; }
.cases-intro {
  min-height: clamp(360px, 44dvh, 430px);
  padding: clamp(104px, 12.5vh, 128px) var(--page-x) 24px;
  display: flex;
  align-items: flex-start;
}
.intro-copy { width: min(62vw, 900px); }
.section-meta { margin: 0 0 22px; color: var(--accent); font-size: 16px; font-weight: 750; letter-spacing: 0.04em; }
.section-meta span { color: var(--quiet); font-weight: 650; }
.intro-copy h1 { max-width: 850px; margin: 0; font-size: clamp(48px, 5.3vw, 82px); line-height: 0.98; letter-spacing: -0.065em; }
.intro-lead { max-width: 770px; margin: 32px 0 0; color: var(--body); font-size: clamp(18px, 1.35vw, 23px); line-height: 1.65; }

.stack-track { position: relative; margin-top: -72px; overflow-anchor: none; }
.stack-viewport {
  position: relative;
  z-index: 3;
  padding: 20dvh var(--page-x) 24dvh;
  overflow: visible;
}
.project-deck {
  position: relative;
  width: var(--deck-w);
  height: auto;
  isolation: isolate;
}
.project-sheet {
  --body-opacity: 1;
  --body-shift: 0px;
  position: relative;
  height: var(--case-card-h);
  margin: 30px 0;
  z-index: var(--stack-z, 1);
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #fffefd 0%, #fffaf7 58%, #f7efec 100%);
  box-shadow:
    inset 0 1px 0 rgba(111, 84, 116, 0.16),
    inset 1px 0 0 rgba(111, 84, 116, 0.1),
    0 -8px 28px rgba(64, 45, 67, 0.055);
  transform: translate3d(0, 0, 0);
  transform-origin: center top;
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
}
.stack-end { width: 100%; height: 1px; }
.sheet-tab {
  width: 100%;
  height: 52px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: center;
  border: 0;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
  background: rgba(255, 252, 250, 0.64);
  box-shadow: inset 0 -1px 0 rgba(111, 84, 116, 0.08);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 180ms ease, color 180ms ease;
}
.sheet-tab span { color: var(--accent); font-size: 13px; font-weight: 800; }
.sheet-tab strong { overflow: hidden; font-size: 16px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.sheet-tab:focus-visible { outline: 3px solid rgba(118, 87, 127, 0.3); outline-offset: -3px; }
.sheet-tab:disabled { color: inherit; cursor: default; opacity: 1; }
.project-sheet.is-current-progress .sheet-tab { background: transparent; cursor: default; }
.project-sheet:not(.is-current-progress) .sheet-tab:hover { background: rgba(250, 245, 243, 0.94); color: var(--accent-deep); }
.sheet-body {
  height: calc(100% - 52px);
  padding: 24px 28px 30px;
  display: grid;
  grid-template-columns: minmax(220px, 34%) 1fr;
  gap: clamp(24px, 2.6vw, 40px);
  opacity: var(--body-opacity);
  transform: translate3d(0, var(--body-shift), 0);
  pointer-events: none;
}
.project-sheet.is-current-progress .sheet-body { pointer-events: auto; }
.case-visual {
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 400px;
  min-width: 0;
  aspect-ratio: 4 / 5;
  margin: 0;
  align-self: start;
  justify-self: start;
  overflow: hidden;
  border-radius: 16px;
  background: #f3f1f2;
}
.case-visual img { width: 100%; height: 100%; object-fit: cover; }
.case-placeholder {
  background:
    linear-gradient(145deg, rgba(118, 87, 127, 0.12), rgba(255, 252, 250, 0.48) 58%),
    #f1ebee;
}
.case-copy { position: relative; min-width: 0; min-height: 0; align-self: stretch; padding: 6px 0 30px; }
.case-tags { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 16px; color: var(--accent); font-size: 12px; font-weight: 760; letter-spacing: 0.04em; }
.case-copy h2 { margin: 0; font-size: clamp(31px, 2.35vw, 42px); line-height: 1.08; letter-spacing: -0.045em; white-space: nowrap; }
.case-statement { margin: 20px 0 28px; color: var(--body); font-size: clamp(16px, 1.15vw, 19px); font-weight: 540; line-height: 1.58; white-space: nowrap; }
.case-evidence { display: grid; grid-template-columns: 1fr; gap: 18px; }
.case-evidence p { margin: 0; padding-top: 13px; border-top: 1px solid var(--line); color: var(--body); font-size: 13px; line-height: 1.58; white-space: nowrap; }
.case-evidence span { display: block; margin-bottom: 7px; color: var(--quiet); font-size: 11px; font-weight: 760; letter-spacing: 0.08em; }
.case-detail-entry {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: not-allowed;
  opacity: 0.72;
  user-select: none;
}
.case-detail-entry > span { font-size: 14px; line-height: 1; }

@media (max-width: 1180px) {
  :root { --deck-w: min(69vw, 820px); }
  .intro-copy { width: min(67vw, 790px); }
  .sheet-body { grid-template-columns: minmax(190px, 34%) 1fr; gap: 22px; }
  .case-evidence { gap: 16px; }
}

@media (max-width: 980px) and (min-width: 761px) {
  .case-copy h2 { font-size: 30px; white-space: normal; text-wrap: balance; }
  .case-statement { margin-top: 18px; white-space: normal; text-wrap: balance; }
  .case-evidence p { white-space: normal; }
}

@media (max-width: 760px) {
  :root { --header-h: 60px; --page-x: 20px; --radius: 18px; }
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { display: none; }
  .portrait-media { position: absolute; top: var(--header-h); right: 0; bottom: auto; left: 0; height: 54dvh; }
  .portrait-video { top: 0; height: 100%; width: 145vw; left: -22vw; object-position: center top; transform: none; }
  .portrait-fade { position: absolute; top: var(--header-h); height: 58dvh; background: linear-gradient(180deg, rgba(247,241,237,0) 34%, var(--canvas) 92%); }
  .cases-intro { min-height: 82dvh; padding-top: 52dvh; padding-bottom: 72px; align-items: flex-end; }
  .intro-copy { width: 100%; }
  .section-meta { margin-bottom: 14px; font-size: 14px; }
  .intro-copy h1 { max-width: 11em; font-size: clamp(39px, 12.5vw, 58px); }
  .intro-lead { margin-top: 20px; font-size: 16px; line-height: 1.65; }
  .stack-track { min-height: auto; margin-top: 0; }
  .stack-viewport { position: relative; height: auto; padding: 0 var(--page-x) 36px; overflow: visible; }
  .project-deck { width: 100%; height: auto; min-height: 0; display: grid; gap: 18px; }
  .project-sheet {
    --body-opacity: 1 !important;
    --body-shift: 0px !important;
    position: relative;
    inset: auto;
    margin: 0;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    height: auto !important;
    pointer-events: auto;
    border: 1px solid rgba(111, 84, 116, 0.12);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
  }
  .sheet-tab { height: 58px; padding: 0 20px; grid-template-columns: 36px 1fr; cursor: default; }
  .sheet-body { height: auto; padding: 20px; display: grid; grid-template-columns: 1fr; gap: 22px; opacity: 1; transform: none; pointer-events: auto; }
  .case-visual { width: 100%; max-width: 100%; height: auto; max-height: none; aspect-ratio: 4 / 5; }
  .case-copy { padding: 0; }
  .case-copy h2 { font-size: clamp(30px, 9vw, 40px); white-space: normal; text-wrap: balance; }
  .case-statement { max-width: 100%; margin: 18px 0 24px; font-size: 16px; white-space: normal; text-wrap: balance; }
  .case-evidence { grid-template-columns: 1fr; gap: 16px; }
  .case-evidence p { white-space: normal; }
  .case-detail-entry { position: static; margin-top: 18px; }
  .stack-end { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .stack-track { min-height: auto; margin-top: 0; }
  .stack-viewport { position: relative; height: auto; padding-bottom: 36px; overflow: visible; }
  .project-deck { height: auto; min-height: 0; display: grid; gap: 18px; }
  .project-sheet {
    --body-opacity: 1 !important;
    --body-shift: 0px !important;
    position: relative;
    inset: auto;
    margin: 0;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    height: auto !important;
    pointer-events: auto;
    border: 1px solid rgba(111, 84, 116, 0.12);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: none;
  }
  .sheet-body { height: auto; opacity: 1; transform: none; pointer-events: auto; }
  .stack-end { display: none; }
}

@media print {
  .site-header, .portrait-video, .portrait-fade { display: none !important; }
  .cases-intro { min-height: auto; padding: 24px 0; }
  .stack-track, .stack-viewport, .project-deck { min-height: auto; height: auto; }
  .stack-viewport { position: static; padding: 0; overflow: visible; }
  .project-deck { display: grid; gap: 20px; }
  .project-sheet { position: static; height: auto !important; margin: 0; transform: none !important; filter: none !important; opacity: 1 !important; page-break-inside: avoid; }
  .stack-end { display: none; }
  .sheet-body { --body-opacity: 1; height: auto; opacity: 1; transform: none; pointer-events: auto; }
}
