:root {
  --bg: #ffffff;
  --ink: #050505;
  --muted: #5e5e5e;
  --line: #090909;
  --soft: #f2f2f2;
  --pink: #ec4aa8;
  --lime: #d9ff35;
  --blue: #68c2e9;
  --paper: #f6ede8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

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

button {
  color: inherit;
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar {
  position: fixed;
  top: 72px;
  right: 5vw;
  left: 5vw;
  z-index: 20;
  display: grid;
  grid-template-columns: 80px 1fr 100px;
  align-items: start;
  pointer-events: none;
}

.menu-button,
.site-logo,
.social-links a,
.sort-toggle,
.sort-panel button {
  pointer-events: auto;
}

.menu-button {
  display: grid;
  gap: 6px;
  width: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-button span {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--ink);
}

.site-logo {
  justify-self: center;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.site-logo img {
  display: block;
  width: 98px;
  height: 84px;
  object-fit: contain;
}

body.logo-hidden .site-logo {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.social-links {
  display: flex;
  justify-content: end;
  gap: 14px;
}

.social-links a {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 4px solid var(--ink);
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.side-menu {
  position: fixed;
  top: 168px;
  left: 5vw;
  z-index: 18;
  width: 220px;
}

.side-menu nav {
  display: grid;
  gap: 7px;
}

.side-menu a {
  display: block;
  width: max-content;
  font-size: clamp(32px, 3.1vw, 50px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.side-menu a.is-active {
  color: var(--bg);
  -webkit-text-stroke: 2px var(--ink);
  text-stroke: 2px var(--ink);
}

body:not(.menu-open) .side-menu {
  display: none;
}

.page-shell {
  min-height: 100vh;
}

.page {
  display: none;
  min-height: 100vh;
  padding: 280px 5vw 70px calc(5vw + 170px);
}

.page.is-active {
  display: block;
}

.page-work {
  padding-top: 314px;
}

.sort-wrap {
  position: fixed;
  top: 228px;
  right: 5vw;
  z-index: 17;
  width: min(360px, 28vw);
}

.sort-toggle {
  display: flex;
  width: 100%;
  min-height: 47px;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border: 4px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
}

.sort-toggle span:last-child {
  font-size: 30px;
  line-height: 1;
}

.sort-panel {
  display: grid;
  max-height: 0;
  overflow: hidden;
  border-right: 4px solid var(--line);
  border-bottom: 4px solid var(--line);
  border-left: 4px solid var(--line);
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
}

.sort-panel.is-open {
  max-height: 260px;
  opacity: 1;
  pointer-events: auto;
}

.sort-panel button {
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 800;
}

.sort-panel button:last-child {
  border-bottom: 0;
}

.sort-panel button.is-active,
.sort-panel button:hover {
  background: var(--ink);
  color: var(--bg);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 40px 46px;
}

.work-card {
  display: grid;
  gap: 14px;
}

.work-open,
.work-text-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.work-open:hover + .work-text-open h2,
.work-text-open:hover h2 {
  color: var(--muted);
}

.work-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.48 / 1;
  overflow: hidden;
  background: var(--soft);
}

.work-thumb::before,
.work-thumb::after {
  position: absolute;
  content: "";
}

.work-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
  text-transform: uppercase;
}

.work-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.page-detail {
  padding-top: 260px;
}

.detail-back {
  margin: 0 0 42px;
  padding: 10px 22px;
  border: 4px solid var(--ink);
  background: var(--bg);
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-back:hover {
  background: var(--ink);
  color: var(--bg);
}

.detail-layout {
  display: grid;
  gap: 44px;
}

.detail-head {
  max-width: 980px;
}

.detail-head p {
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.35;
}

.detail-head p:first-child {
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-head h1 {
  margin: 0 0 24px;
  font-size: clamp(48px, 7vw, 110px);
  font-weight: 900;
  line-height: 0.92;
  text-transform: uppercase;
}

.detail-intro {
  display: grid;
  gap: 18px;
  max-width: 860px;
  margin-top: 22px;
}

.detail-head .detail-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.35;
  text-transform: none;
}

.case-study {
  display: grid;
  gap: 92px;
  margin-top: 24px;
}

.case-section {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 38px;
  align-items: start;
}

.case-copy {
  position: sticky;
  top: 132px;
  display: grid;
  gap: 14px;
}

.detail-head .case-url {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-transform: none;
}

.case-copy span {
  width: fit-content;
  border: 3px solid var(--ink);
  padding: 5px 10px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.case-copy h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 48px);
  font-weight: 900;
  line-height: 0.98;
  text-transform: uppercase;
}

.case-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
}

.case-figure {
  display: flex;
  min-height: min(62vw, 620px);
  align-items: center;
  justify-content: center;
  margin: 0;
  background: transparent;
}

.case-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.case-closing {
  max-width: 780px;
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  text-transform: none;
}

.detail-gallery {
  position: relative;
}

.detail-image {
  display: flex;
  aspect-ratio: 1.48 / 1;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.detail-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-image .work-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1.48 / 1;
  object-fit: cover;
}

.detail-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.detail-dot {
  display: block;
  width: 8px;
  height: 8px;
  border: 2px solid var(--ink);
  background: var(--bg);
}

.detail-dot.is-active {
  background: var(--ink);
}

.detail-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 4px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transform: translateY(-50%);
}

.detail-arrow::before {
  display: block;
  width: 9px;
  height: 9px;
  border-top: 4px solid currentColor;
  border-left: 4px solid currentColor;
  content: "";
}

.detail-arrow-prev {
  left: -46px;
}

.detail-arrow-prev::before {
  transform: translateX(2px) rotate(-45deg);
}

.detail-arrow-next {
  right: -46px;
}

.detail-arrow-next::before {
  transform: translateX(-2px) rotate(135deg);
}

.detail-arrow:hover {
  background: var(--ink);
  color: var(--bg);
}

.detail-arrow[hidden] {
  display: none;
}

.thumb-collage {
  background:
    radial-gradient(circle at 22% 44%, var(--pink) 0 11px, transparent 12px),
    radial-gradient(circle at 75% 16%, var(--pink) 0 8px, transparent 9px),
    radial-gradient(circle at 86% 70%, var(--pink) 0 10px, transparent 11px),
    linear-gradient(135deg, #f9d8df 0 46%, #fff 46% 60%, #f7aabd 60%);
}

.thumb-collage::before {
  inset: 17% 28%;
  border: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.88);
  transform: rotate(-4deg);
}

.thumb-collage::after {
  inset: 33% 38%;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.thumb-map-chunhe {
  background: url("assets/map-chunhe-1.jpg") center / cover;
}

.thumb-phone {
  background: #fff url("assets/phone-garden-cover.jpg") center / contain no-repeat;
}

.thumb-phone::before {
  display: none;
}

.thumb-phone::after {
  display: none;
}

.thumb-case {
  background: #fff url("assets/blue-case-study-cover.jpg") center / cover no-repeat;
}

.thumb-case::before {
  display: none;
}

.thumb-monster {
  background: #fff url("assets/pink-signal-cover.jpg") center / cover no-repeat;
}

.thumb-monster::before {
  display: none;
}

.thumb-pattern {
  background: #fff url("assets/container-pattern-cover.jpg") center / cover no-repeat;
}

.thumb-pattern::before {
  display: none;
}

.thumb-omikuji {
  background: #fff url("assets/yanaka-omikuji-04.png") center / contain no-repeat;
}

.thumb-omikuji::before {
  display: none;
}

.thumb-portrait {
  background: linear-gradient(120deg, #ffffff, #f6f6f6);
}

.thumb-portrait::before {
  top: 16%;
  left: 37%;
  width: 34%;
  height: 68%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 52% 44%, #111 0 4px, transparent 5px),
    radial-gradient(circle at 62% 62%, #e7dcbc 0 10px, transparent 11px),
    linear-gradient(#f3d7c8, #f7ece6);
  box-shadow: -42px -16px 0 -20px #efefef, 32px 26px 0 -14px #e9e9e9;
}

.thumb-studio {
  background: url("assets/studio-visual.png") center / cover;
}

.thumb-grid {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1px),
    #f7f5ef;
  background-size: 22px 22px;
}

.thumb-grid::before {
  top: 22%;
  left: 16%;
  width: 68%;
  height: 48%;
  border: 4px solid var(--ink);
  background: linear-gradient(90deg, var(--lime) 0 33%, var(--pink) 33% 66%, var(--blue) 66%);
}

.page-profile,
.page-contact {
  padding-top: 342px;
}

.profile-intro {
  display: grid;
  grid-template-columns: minmax(440px, 0.95fr) 310px;
  gap: 12vw;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
}

.profile-intro h1 {
  max-width: 900px;
  margin: 0 0 24px;
  font-size: clamp(25px, 2vw, 34px);
  font-weight: 900;
  line-height: 1.45;
}

.profile-intro p {
  max-width: 940px;
  margin: 0;
  font-size: clamp(20px, 1.6vw, 27px);
  line-height: 1.45;
}

.people-card {
  display: grid;
  justify-items: center;
  gap: 24px;
}

.people-label {
  justify-self: start;
  min-width: 135px;
  padding: 10px 22px;
  border: 4px solid var(--ink);
  text-align: center;
  font-size: 22px;
  font-weight: 900;
}

.portrait {
  width: 212px;
  height: 212px;
  border-radius: 50%;
  object-fit: cover;
}

.people-card h2,
.people-card p {
  justify-self: start;
  width: 100%;
  margin: 0;
}

.people-card h2 {
  font-size: 22px;
}

.people-card p {
  font-size: 20px;
  line-height: 1.32;
}

.profile-statement {
  max-width: 820px;
  margin: 108px 0 0 8vw;
}

.profile-statement span {
  display: block;
  margin-bottom: 24px;
  font-size: 34px;
}

.profile-statement p {
  margin: 0;
  font-size: clamp(40px, 4.2vw, 70px);
  font-weight: 900;
  line-height: 1.34;
}

.page-contact {
  display: none;
}

.page-contact.is-active {
  display: grid;
  grid-template-columns: minmax(380px, 0.85fr) minmax(260px, 400px);
  gap: 12vw;
  align-items: end;
}

.contact-copy h1 {
  max-width: 960px;
  margin: 0 0 30px;
  font-size: clamp(42px, 5vw, 82px);
  font-weight: 900;
  line-height: 1.08;
  text-transform: uppercase;
}

.contact-copy p {
  max-width: 720px;
  margin: 0;
  font-size: 25px;
  line-height: 1.4;
}

.contact-links {
  display: grid;
  gap: 16px;
  font-style: normal;
}

.contact-links a,
.contact-links button {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: 4px solid var(--ink);
  background: var(--bg);
  font-size: 23px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.contact-links a:hover,
.contact-links button:hover {
  background: var(--ink);
  color: var(--bg);
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(255, 255, 255, 0.82);
}

.qr-modal[hidden] {
  display: none;
}

.qr-card {
  position: relative;
  width: min(330px, 66vw);
  background: var(--bg);
}

.qr-card img {
  display: block;
  width: 100%;
  height: auto;
}

.qr-close {
  position: absolute;
  top: -46px;
  right: 0;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 4px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.qr-close:hover {
  background: var(--ink);
  color: var(--bg);
}

.wechat-link .label-hover {
  display: none;
}

.wechat-link:hover .label-default {
  display: none;
}

.wechat-link:hover .label-hover {
  display: inline;
}

@media (max-width: 980px) {
  .topbar {
    top: 26px;
    right: 24px;
    left: 24px;
    grid-template-columns: 44px 1fr 70px;
  }

  .site-logo img {
    width: 68px;
    height: 58px;
  }

  .social-links {
    gap: 8px;
  }

  .social-links a {
    width: 30px;
    height: 30px;
    border-width: 3px;
    font-size: 16px;
  }

  .side-menu {
    position: relative;
    top: 0;
    left: 0;
    width: auto;
    padding: 104px 24px 20px;
    background: rgba(255, 255, 255, 0.94);
  }

  .side-menu nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .side-menu a {
    font-size: 30px;
  }

  .page,
  .page-work,
  .page-detail,
  .page-profile,
  .page-contact {
    padding: 34px 24px 52px;
  }

  .sort-wrap {
    position: static;
    width: 100%;
    margin-bottom: 28px;
  }

  .work-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .profile-intro,
  .page-contact.is-active {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .profile-statement {
    margin: 64px 0 0;
  }

  .detail-arrow-prev {
    left: 10px;
  }

  .detail-arrow-next {
    right: 10px;
  }

  .case-study {
    gap: 56px;
  }

  .case-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .case-copy {
    position: static;
  }

  .case-figure {
    min-height: 0;
  }
}
