@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --cream: #fff0dc;
  --muted: #f2ddc9;
  --peach: #f2bf94;
  --rule: rgb(255 224 188 / .32);
  --card-ink: #38261f;
  --card-muted: #563e34;
  --paper: #fbf8f3;
  --paper-rule: #d6cabe;
  --display: "Instrument Serif", "Songti SC", "Noto Serif SC", SimSun, serif;
}

* { box-sizing: border-box; }

body {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(ellipse at 0% 38%, rgb(200 153 125 / .16), transparent 47%),
    radial-gradient(ellipse at 100% 72%, rgb(162 136 146 / .13), transparent 48%),
    linear-gradient(180deg, #d9c5b5, #f2ebe3 34rem, #f6f1eb);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

body::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  content: "";
  height: min(100%, max(780px, 100svh));
  background:
    linear-gradient(90deg, rgb(43 24 20 / .42), rgb(48 27 28 / .20) 43%, transparent 76%),
    linear-gradient(180deg, rgb(37 22 20 / .31), transparent 34%),
    url("assets/gallery/portfolio-maple-veranda.webp") center 48% / cover no-repeat;
  filter: saturate(.87);
  mask-image: linear-gradient(#000 55%, transparent 100%);
}

.project-page::before {
  height: clamp(440px, 58svh, 560px);
  mask-image: linear-gradient(#000 52%, transparent);
}

.portfolio-leaves {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.project-page .portfolio-leaves { opacity: .60; }

.portfolio-leaf {
  position: absolute;
  top: 0;
  left: var(--leaf-x);
  width: var(--leaf-size);
  aspect-ratio: 1;
  background: url("assets/gallery/portfolio-maple-leaf.webp") center / contain no-repeat;
  opacity: 0;
  animation: leaf-fall var(--leaf-duration) linear var(--leaf-delay) infinite;
}

.portfolio-leaf:nth-child(4n + 2) { filter: hue-rotate(12deg) brightness(1.1); }
.portfolio-leaf:nth-child(4n + 3) { filter: hue-rotate(-8deg) saturate(.92); }
.portfolio-leaves.is-paused .portfolio-leaf { animation-play-state: paused; }

@keyframes leaf-fall {
  0% { transform: translate3d(0, -7vh, 0) rotate(var(--leaf-angle)) rotateY(-26deg); opacity: 0; }
  12%, 84% { opacity: var(--leaf-opacity); }
  32% { transform: translate3d(calc(var(--leaf-drift) * .34 + 16px), 27vh, 0) rotate(calc(var(--leaf-angle) + 65deg)) rotateY(54deg); }
  65% { transform: translate3d(calc(var(--leaf-drift) * .65 - 12px), 64vh, 0) rotate(calc(var(--leaf-angle) + 152deg)) rotateY(-49deg); }
  100% { transform: translate3d(var(--leaf-drift), 107vh, 0) rotate(calc(var(--leaf-angle) + 245deg)) rotateY(27deg); opacity: 0; }
}

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--peach); outline-offset: 5px; }

.shell {
  width: min(calc(100% - clamp(40px, 9vw, 144px)), 1240px);
  margin-inline: auto;
}

.work-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
  gap: 12px;
}

.portfolio-heading p, .project-lead {
  text-shadow: 0 1px 7px rgb(32 20 27 / .85);
}

.work-motion {
  margin-inline-start: auto;
  padding: 7px 11px;
  color: var(--cream);
  background: rgb(54 31 24 / .42);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.work-motion:not(.work-button):hover { background: rgb(54 31 24 / .68); }
.work-motion:focus-visible { outline: 2px solid var(--peach); outline-offset: 3px; }

.work-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 15px;
  color: #fff4e5;
  background: linear-gradient(165deg, #83432e, #50261c);
  border: 1px solid #693823;
  border-radius: 8px;
  box-shadow: 0 4px 9px rgb(71 34 22 / .24), inset 0 1px rgb(255 227 192 / .28);
  font: inherit;
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: #b16c4055;
  transition: transform .18s ease-out, filter .18s ease-out, box-shadow .18s ease-out;
}

.work-button--secondary {
  color: #5c2b1f;
  background: linear-gradient(165deg, #fdf0df, #edc9a5);
  border-color: #a87754;
  box-shadow: 0 3px 8px rgb(84 45 29 / .14), inset 0 1px rgb(255 250 238 / .7);
}

.work-button--plum {
  background: linear-gradient(165deg, #654858, #412b3b);
  border-color: #503547;
}

.work-button[hidden] { display: none; }
.work-button:focus-visible { outline: 2px solid #8b461f; outline-offset: 3px; }
.work-actions .work-button { font-size: .82rem; }
.work-actions .work-button:focus-visible { outline-color: #ffe5bd; }

@media (hover: hover) {
  .work-button:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 7px 13px rgb(71 34 22 / .28), inset 0 1px rgb(255 227 192 / .42);
  }
}

.work-button:active {
  filter: brightness(.94);
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgb(71 34 22 / .26);
}

.portfolio-main {
  display: grid;
  grid-template-columns: minmax(0, 636px);
  gap: clamp(30px, 5vh, 52px);
  padding-block: clamp(24px, 5vh, 64px) clamp(48px, 8vh, 88px);
}

h1, h2, p { margin: 0; }

.portfolio-heading h1, .project-main h1 {
  font: 600 clamp(58px, 8vw, 112px)/1.06 var(--display);
  letter-spacing: .045em;
  text-shadow: 0 4px 30px rgb(36 19 25 / .48);
}

.portfolio-heading p, .project-lead {
  margin-top: 17px;
  color: var(--cream);
  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.7;
}

.portfolio-heading h1 {
  font-size: clamp(52px, 7.2vw, 96px);
}

.portfolio-heading p { color: var(--muted); }

.project-list {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-card {
  display: grid;
  grid-template-columns: clamp(64px, 8vw, 96px) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(13px, 2vw, 24px);
  min-height: 106px;
  padding-inline-end: clamp(14px, 2vw, 24px);
  color: var(--card-ink);
  text-decoration: none;
  background: linear-gradient(128deg, #f2ddc4, #e0bfa3 88%);
  border: 1px solid rgb(255 228 197 / .73);
  border-radius: 5px 14px 14px 5px;
  box-shadow: 0 7px 19px rgb(39 23 28 / .36), inset 0 1px rgb(255 242 220 / .48);
  transition: transform .26s ease, border-color .26s ease, box-shadow .26s ease;
}

.project-card--store { --mark: #dcb394; --accent: #633923; }
.project-card--spark { --mark: #cfbdc3; --accent: #574150; }
.project-card--location { --mark: #d8bb99; --accent: #5d4028; }

.project-managed-cover { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.project-managed-description { white-space: pre-line; }
.project-managed-description p + p { margin-top: .85em; }


.project-card:hover, .project-card:focus-visible {
  transform: translateX(4px);
  border-color: #ffe5c9;
  box-shadow: 0 9px 24px rgb(36 20 25 / .47), inset 0 1px rgb(255 242 220 / .68);
}

.project-card h2, .project-in-progress h2 {
  font: 600 clamp(23px, 2.6vw, 35px)/1.12 var(--display);
}

.project-card h2:lang(en) {
  font-size: clamp(27px, 3.2vw, 41px);
  font-weight: 400;
}

.project-copy {
  padding-block: 16px;
  overflow-wrap: anywhere;
}

.project-card p, .project-in-progress p {
  margin-top: 7px;
  color: var(--card-muted);
  font-size: 15px;
  line-height: 1.65;
}

.project-in-progress {
  margin-top: 10px;
  padding: clamp(21px, 3vw, 31px);
  color: var(--card-ink);
  background: var(--paper);
  border: 1px dashed var(--paper-rule);
  border-radius: 5px 14px 14px 5px;
}

.project-action {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 13px;
}

.project-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--mark);
  font-size: 18px;
  transition: background .26s ease, color .26s ease;
}

.project-card:hover .project-arrow, .project-card:focus-visible .project-arrow {
  color: var(--cream);
  background: var(--accent);
}

.project-mark {
  display: grid;
  align-self: stretch;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(135deg, rgb(255 239 214 / .29), transparent 75%), var(--mark);
  border-radius: 4px 0 0 4px;
  border-right: 1px solid rgb(94 59 58 / .17);
}

.project-art {
  position: relative;
  width: 44px;
  height: 36px;
}

.project-art::before, .project-art::after, .project-art i {
  position: absolute;
  content: "";
}

.project-art--store::before {
  inset: 11px 7px 3px;
  border: 1px solid currentColor;
  border-radius: 0 0 2px 2px;
}

.project-art--store::after {
  inset: 4px 3px auto;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 3px 3px 1px 1px;
  background: repeating-linear-gradient(90deg, transparent 0 8px, currentColor 8px 9px);
}

.project-art--store i {
  inset: 20px auto 4px 18px;
  width: 10px;
  border: 1px solid currentColor;
  border-bottom: 0;
}

.project-art--spark::before {
  inset: 4px 7px 3px;
  border: 1px solid currentColor;
  border-radius: 8px;
}

.project-art--spark::after {
  inset: 11px 15px 10px;
  background: currentColor;
  clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
}

.project-art--location::before {
  inset: 4px 10px 8px;
  border: 1px solid currentColor;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

.project-art--location::after {
  top: 12px;
  left: 18px;
  width: 6px;
  height: 6px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.project-main {
  max-width: 1020px;
  padding-block: clamp(26px, 6vw, 82px) 56px;
}

.project-main h1 { font-size: clamp(44px, 8vw, 98px); }
.project-main h1:lang(en) { font-weight: 400; letter-spacing: 0; }
.project-lead { max-width: 34em; }
.detail-section {
  margin-top: clamp(36px, 5vw, 60px);
  padding: clamp(16px, 3vw, 30px);
}

.detail-section, .project-links {
  color: var(--card-ink);
  background: var(--paper);
  border: 1px solid var(--paper-rule);
  border-radius: 10px;
  box-shadow: 0 9px 26px rgb(68 43 33 / .065);
}

.detail-section h2 { margin-bottom: 15px; font-size: clamp(20px, 2.5vw, 30px); }

.detail-section p, .case-features, .case-flow, .case-stack {
  color: var(--card-muted);
  line-height: 1.75;
}

.case-features, .case-flow {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-inline-start: 1.4em;
}

.case-features strong, .case-stack dt, .case-review h3 { color: var(--card-ink); }
.case-flow li::marker { color: #75442c; font-weight: 600; }

.detail-section .case-note {
  margin-top: 18px;
  padding-inline-start: 13px;
  border-inline-start: 2px solid var(--paper-rule);
  font-size: .92rem;
}

.case-figure { min-width: 0; margin: 0; }

.case-figure img, .case-figure video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.case-figure video { aspect-ratio: 16 / 9; background: #211719; }
.case-figure figcaption { margin-top: 9px; color: var(--card-muted); font-size: .9rem; line-height: 1.55; }

.store-gallery { position: relative; }
.store-gallery .case-figure a { position: relative; display: block; }
.store-gallery .case-figure a::after {
  content: "查看大图 ↗";
  position: absolute;
  inset: 9px 10px auto auto;
  padding: 5px 9px;
  color: #fff4e5;
  background: #50261c;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgb(61 29 20 / .3);
  font-size: .75rem;
  line-height: 1.35;
  pointer-events: none;
  transition: background-color .18s ease-out, transform .18s ease-out;
}
.store-gallery .case-figure a:hover::after,
.store-gallery .case-figure a:focus-visible::after { background: #83432e; }
.store-gallery .case-figure a:active::after { transform: translateY(1px); }

.store-gallery .case-figure img {
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #f5eee5;
}

.store-gallery figure:not([hidden]) + figure:not([hidden]) { margin-top: 16px; }

.store-gallery-controls {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  aspect-ratio: 16 / 9;
  align-items: center;
  justify-content: space-between;
  padding-inline: clamp(8px, 1.6vw, 18px);
  pointer-events: none;
}

.store-gallery-controls[hidden], .store-gallery-status[hidden] { display: none; }

.store-gallery-controls button {
  width: clamp(44px, 5vw, 54px);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  pointer-events: auto;
}

.store-gallery-controls button::before {
  width: 9px;
  height: 9px;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
  content: "";
  transform: translateX(-2px) rotate(45deg);
}
.store-gallery-controls [data-gallery-step="-1"]::before {
  transform: translateX(2px) rotate(-135deg);
}
.store-gallery-controls button:focus-visible { outline: 3px solid #fff4e5; outline-offset: -6px; }

.store-gallery-status {
  display: table;
  margin: 12px auto 0;
  padding: 4px 11px;
  color: #633a29;
  background: #f3e4d2;
  border-radius: 999px;
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}

.case-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24%);
  gap: 18px;
  align-items: start;
  margin-top: 24px;
}

.case-gallery figure:last-child { max-width: 240px; }

.case-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }

.case-figure :is(a, video):focus-visible { outline: 2px solid #75442c; outline-offset: 3px; }

.case-reports {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.case-reports .work-button { display: block; }
.case-reports span {
  display: block;
  margin-top: 6px;
  color: #674333;
  font-weight: 400;
  font-size: .86rem;
  line-height: 1.55;
}

.case-stack {
  display: grid;
  grid-template-columns: minmax(7em, 9em) minmax(0, 1fr);
  gap: 12px 16px;
  margin: 0;
}

.case-stack dt { font-weight: 650; }
.case-stack dd { margin: 0; }
.case-review + .case-review { margin-top: 19px; padding-top: 19px; border-top: 1px solid #ddcbb8; }
.case-review h3 { margin: 0 0 5px; font-size: 1.05rem; line-height: 1.55; }

.project-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 56px;
  padding: 12px;
}

@media (max-width: 780px) {
  body::before {
    height: min(100%, max(620px, 78svh));
    background-position: center, center, 66% 48%;
  }
  .portfolio-leaf { width: calc(var(--leaf-size) * .86); }
  .portfolio-leaf:nth-child(n + 13) { display: none; }
  .case-gallery, .case-reports { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .work-back { font-size: 12px; white-space: nowrap; }
  .work-motion { padding-inline: 8px; }
  .project-card { gap: 11px; }
  .project-action-label { display: none; }
  .project-card p, .project-in-progress p { font-size: 14px; }
  .case-stack { grid-template-columns: 1fr; gap: 3px; }
  .case-stack dd + dt { margin-top: 8px; }
}

@media (prefers-reduced-motion: no-preference) {
  .work-reveal { opacity: 0; }
  .work-reveal.is-in { opacity: 1; animation: work-entrance 1.5s cubic-bezier(.24, .55, .32, 1); }
  .work-reveal:focus-within { opacity: 1 !important; }

  @keyframes work-entrance {
    from { opacity: 0; transform: translateY(26px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-leaves, .work-motion { display: none; }
  .project-card, .project-arrow, .work-button, .store-gallery .case-figure a::after { transition: none; }
  .project-card:hover, .project-card:focus-visible,
  .work-button:hover, .work-button:active, .store-gallery .case-figure a:active::after { transform: none; }
}
