.portfolio-overview {
  background: var(--we-bg-paper);
}

body.page-work .portfolio-overview::after {
  content: "";
  display: none;
  height: 0;
  background: var(--we-bg-black);
}

.case-panel {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 96px var(--we-section-pad-x);
}

.panel-dark,
.panel-black {
  background: var(--we-bg-black);
  color: white;
}

.panel-paper {
  background: var(--we-bg-paper);
}

.panel-white {
  background: var(--we-bg-white);
}

.panel-soft-gray {
  background: var(--we-bg-soft-gray);
}

.panel-stone {
  background: var(--we-bg-stone);
}

.case-panel[data-project="kamosu-card"] {
  background: #E0DEDC;
}

.panel-mist {
  background: var(--we-bg-mist);
}

.case-link,
.case-link:hover,
.case-link:focus-visible {
  display: block;
  border-bottom: none;
}

.case-link > img {
  display: block;
  width: 100%;
  height: auto;
  transition:
    opacity var(--we-dur-med) var(--we-ease-flow),
    transform var(--we-dur-med) var(--we-ease-flow);
}

.case-link:focus-visible > img {
  opacity: 0.9;
}

.hero-panel {
  min-height: 100vh;
  min-height: 100svh;
}

.hero-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
}

.hero-device {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: min(24vw, 340px);
  min-width: 220px;
  max-height: 82vh;
  height: auto;
  object-fit: contain;
  transform: translate(-50%, -50%);
  user-select: none;
  -webkit-user-drag: none;
}

.panel-kicker {
  position: absolute;
  z-index: 2;
  bottom: 32px;
  color: rgba(255, 255, 255, 0.64);
  font-family: var(--we-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
}

.panel-kicker-left {
  left: var(--we-section-pad-x);
}

.panel-kicker-right {
  right: var(--we-section-pad-x);
}

.card-panel {
  min-height: 100vh;
  min-height: 100svh;
  align-content: center;
}

.card-stage {
  position: relative;
  width: min(58vw, 640px);
  min-height: 390px;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.card-glow {
  position: absolute;
  z-index: 0;
  width: min(54vw, 620px);
  aspect-ratio: 894 / 985;
  background: url("/Background.png") center / contain no-repeat;
  opacity: 0.34;
}

.card-text-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: var(--we-text-tertiary);
}

.card-whisper {
  position: absolute;
  margin: 0;
}

.card-whisper {
  font-family: var(--we-font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: rgba(92, 86, 80, 0.48);
}

.card-whisper-top {
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  font-family: "Noto Serif JP", serif;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.card-link {
  position: relative;
  z-index: 2;
  width: min(18vw, 190px);
  min-width: 128px;
}

.laptop-panel {
  min-height: 92vh;
}

.laptop-link {
  width: min(73.1vw, 1037px);
  justify-self: center;
}

.laptop-art {
  object-fit: contain;
}

.flowith-art {
  opacity: 0.78;
}

.case-panel[data-project="flowith"] {
  padding-left: 0;
  padding-right: 0;
  background: #FAFAFA;
}

.case-panel[data-project="flowith"] .laptop-link {
  width: 100vw;
  max-width: none;
}

.case-panel[data-project="flowith"] .laptop-art {
  width: 100%;
  max-width: none;
}

.case-panel[data-project="design-as-illumination"] {
  min-height: 118vh;
}

.browser-stack-panel {
  min-height: 165vh;
  align-content: center;
  gap: 88px;
}

.browser-art {
  width: min(54.4vw, 624px);
}

.browser-art-bottom {
  transform: none;
}

.image-panel {
  min-height: 100vh;
  min-height: 100svh;
  padding: 88px var(--we-section-pad-x);
}

.full-bleed-link {
  width: 100%;
}

.full-width-art {
  width: 100%;
}

.sune-ui-link {
  width: min(42vw, 680px);
}

.sune-ui-art {
  width: 100%;
}

.phone-card-panel {
  min-height: 92vh;
}

.case-panel[data-project="flowith"],
.case-panel[data-project="nijimu"] {
  min-height: 118vh;
}

@media (min-width: 901px) {
  .case-panel[data-project="flowith"] {
    display: block;
    min-height: auto;
    padding: 0;
    background: #FAFAFA;
  }

  .case-panel[data-project="flowith"] .flowith-art {
    opacity: 1;
  }
}

.phone-card-link {
  width: min(27.2vw, 368px);
  min-width: 208px;
}

.phone-card-art {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-panel {
  min-height: 116vh;
  padding-top: 150px;
  padding-bottom: 150px;
}

.gallery-stack {
  width: min(48vw, 620px);
  display: grid;
  gap: 42px;
}

.gallery-item img {
  width: 100%;
}

.composition-panel {
  min-height: 108vh;
  padding-bottom: calc(var(--we-section-pad-y) * 1.2);
}

.composition-link {
  width: min(44vw, 640px);
}

.case-panel.dark-wall-panel {
  min-height: 100vh;
  min-height: 100svh;
  padding: 0;
}

.dark-wall-panel .full-bleed-link {
  display: block;
  width: 100%;
  height: 100vh;
  height: 100svh;
}

.dark-wall-panel .wall-art {
  width: 100%;
  height: 100vh;
  height: 100svh;
  max-width: none;
  object-fit: cover;
}

.lab-panel {
  min-height: 130vh;
  min-height: 130svh;
  place-items: center;
  padding: 0;
}

.lab-link {
  width: min(66vw, calc(86svh * 1.196));
  max-width: none;
}

.lab-art {
  width: 100%;
  max-width: none;
  max-height: 86svh;
  object-fit: contain;
}

@media (max-width: 900px) {
  .case-panel {
    min-height: 82vh;
    padding: 72px var(--we-section-pad-x);
  }

  .hero-panel {
    min-height: 100vh;
  }

  .hero-device {
    width: 58vw;
    min-width: 190px;
  }

  .card-panel {
    min-height: 100vh;
    min-height: 100svh;
  }

  .card-stage {
    width: min(84vw, 520px);
    min-height: 340px;
  }

  .card-glow {
    width: min(78vw, 460px);
  }

  .card-link {
    width: 36vw;
  }

  .lab-link {
    width: min(84vw, calc(82svh * 1.196));
    max-width: none;
  }

  .lab-panel {
    min-height: 100vh;
    min-height: 100svh;
    padding: 0;
  }

  .browser-art {
    width: 80%;
  }

  .laptop-link {
    width: 85%;
  }

  .browser-stack-panel {
    min-height: 124vh;
    gap: 36px;
  }

  .browser-art-bottom {
    transform: none;
  }

  .phone-card-link {
    width: 38.4vw;
  }

  .sune-ui-link {
    width: min(70vw, 520px);
  }

  .case-panel[data-project="flowith"],
  .case-panel[data-project="design-as-illumination"],
  .case-panel[data-project="nijimu"] {
    min-height: 104vh;
  }

  .case-panel.dark-wall-panel {
    min-height: 100vh;
    min-height: 100svh;
    padding: 0;
  }

  .gallery-stack {
    width: min(72vw, 420px);
    gap: 26px;
  }

  .composition-link {
    width: min(72vw, 420px);
  }
}

@media (max-width: 560px) {
  .case-panel {
    padding: 64px 24px;
  }

  .panel-kicker-left {
    left: 24px;
  }

  .panel-kicker-right {
    right: 24px;
  }

  .hero-device {
    width: 68vw;
  }

  .card-stage {
    width: 100%;
    min-height: 300px;
  }

  .card-whisper-top {
    top: -104px;
  }

  .card-link {
    width: 42vw;
  }

  .phone-card-link {
    width: 52.8vw;
    min-width: 0;
  }

  .sune-ui-link {
    width: 82vw;
  }

  .gallery-stack,
  .composition-link {
    width: 78vw;
  }
}

@media (max-width: 700px) {
  .case-panel {
    min-height: clamp(560px, 76svh, 680px);
    padding: clamp(48px, 7svh, 64px) 24px;
  }

  .case-panel[data-project="kamosu-card"] {
    min-height: 100vh;
    min-height: 100svh;
  }

  .case-panel[data-project="kamosu-card"] .card-glow {
    width: max(100vw, calc(100svh * 894 / 985));
  }

  .hero-panel {
    min-height: 92svh;
  }

  .hero-device {
    width: min(64vw, 264px);
    min-width: 0;
    max-height: 68svh;
  }

  .card-stage {
    min-height: clamp(260px, 46svh, 340px);
  }

  .card-whisper-top {
    top: -24px;
  }

  .card-link {
    width: min(46vw, 178px);
  }

  .laptop-panel,
  .case-panel[data-project="design-as-illumination"],
  .case-panel[data-project="flowith"] {
    min-height: clamp(520px, 72svh, 620px);
    background: #FAFAFA;
  }

  .laptop-link {
    width: min(calc(100vw - 48px), 420px);
  }

  .browser-stack-panel {
    min-height: clamp(640px, 92svh, 800px);
    gap: 24px;
  }

  .browser-art {
    width: min(88vw, 420px);
  }

  .image-panel {
    min-height: clamp(560px, 76svh, 700px);
  }

  .sune-ui-link {
    width: min(76vw, 330px);
  }

  .phone-card-panel,
  .case-panel[data-project="nijimu"] {
    min-height: clamp(600px, 82svh, 740px);
  }

  .phone-card-link {
    width: min(52.8vw, 232px);
    min-width: 0;
  }

  .gallery-panel {
    min-height: auto;
    padding-top: clamp(76px, calc(9svh + 20px), 92px);
    padding-bottom: clamp(92px, calc(10svh + 20px), 116px);
  }

  .gallery-stack {
    width: min(84vw, 360px);
    gap: 20px;
  }

  .composition-panel {
    min-height: clamp(500px, 68svh, 620px);
    padding-bottom: clamp(60px, 9.6svh, 84px);
  }

  .composition-link {
    width: min(84vw, 360px);
  }

  .dark-wall-panel {
    min-height: 70vh;
    min-height: 70svh;
    padding: 0;
  }

  .dark-wall-panel .full-bleed-link {
    height: auto;
    min-height: 0;
  }

  .dark-wall-panel .wall-art {
    width: 100vw;
    height: auto;
    max-width: none;
    object-fit: contain;
  }

  .lab-panel {
    min-height: 100vh;
    min-height: 100svh;
    padding: 0;
  }

  .lab-link {
    width: min(84vw, calc(82svh * 1.196));
    max-width: none;
  }
}

@media (max-width: 700px) {
  body.page-work .portfolio-overview::after {
    height: 0;
  }
}

@media (hover: none) and (pointer: coarse) {
  .case-link {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .case-link:active > img {
    opacity: 0.9;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
  }
}

/* Scroll reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition:
    opacity 900ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 900ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.reveal--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  will-change: auto;
}

.lab-link.reveal {
  transform: translateY(36px) scale(0.985);
  transition:
    opacity 1000ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 1000ms cubic-bezier(0.16, 1, 0.3, 1);
}

.lab-link.reveal.reveal--visible {
  transform: translateY(0) scale(1);
}

.hero-device.reveal {
  transform: translate(-50%, calc(-50% + 24px)) scale(0.98);
}

.hero-device.reveal.reveal--visible {
  transform: translate(-50%, -50%) scale(1);
}

.card-whisper-top.reveal {
  transform: translate(-50%, 24px) scale(0.985);
}

.card-whisper-top.reveal.reveal--visible {
  transform: translateX(-50%) scale(1);
}

@media (max-width: 700px) {
  .hero-device.reveal {
    transform: translate(-50%, calc(-50% + 14px)) scale(0.98);
  }

  .card-whisper-top.reveal {
    transform: translate(-50%, 14px) scale(0.985);
  }

  .lab-link.reveal {
    transform: translateY(22px) scale(0.99);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hero-device.reveal,
  .card-whisper-top.reveal {
    opacity: 1;
    transform: none;
    transition: none;
    will-change: auto;
  }

  .hero-device.reveal {
    transform: translate(-50%, -50%);
  }

  .card-whisper-top.reveal {
    transform: translateX(-50%);
  }
}

/* ---------- HOMEPAGE NAV PROJECT STATE (added) ---------- */
.site-identity {
  position: relative;
  min-width: min(54vw, 520px);
  min-height: 18px;
}

.site-project-mark {
  position: absolute;
  inset: 0 auto auto 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: max-content;
  max-width: min(62vw, 760px);
  border-bottom: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 260ms var(--we-ease-flow),
    transform 260ms var(--we-ease-flow);
}

.site-mark {
  display: block;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 260ms var(--we-ease-flow),
    transform 260ms var(--we-ease-flow);
}

.site-header.is-project-active .site-mark {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.site-header.is-project-active .site-project-mark {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.site-project-title {
  flex: 0 0 auto;
  font-family: var(--we-font-display);
  font-size: inherit;
  font-style: normal;
  font-weight: 450;
  line-height: 1;
  white-space: nowrap;
}

.site-project-tags {
  flex: 0 1 auto;
  overflow: hidden;
  color: inherit;
  font-family: var(--we-font-mono);
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: .13em;
  line-height: 1;
  opacity: .62;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .site-identity {
    min-width: calc(100vw - 144px);
    max-width: calc(100vw - 144px);
  }

  .site-project-mark {
    display: grid;
    gap: 6px;
    max-width: 100%;
    font-size: 12px;
  }

  .site-project-title {
    max-width: 100%;
    overflow: hidden;
    font-size: inherit;
    text-overflow: ellipsis;
  }

  .site-project-tags {
    max-width: 100%;
    font-size: 8px;
    letter-spacing: .04em;
  }
}
