/* Shared frame, type and keyboard navigation */
:root {
  color-scheme: light;
  --ink: #292724;
  --muted: #68645e;
  --line: #e6e3de;
  --gutter: clamp(1rem, 4.8vw, 5rem);
  --frame-width: 90rem;
  --work-width: 68rem;
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #fff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
h1,
h2,
p,
figure,
dl,
dd,
ul {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}

.frame {
  width: 100%;
  max-width: var(--frame-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.visually-hidden,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 3;
  top: 0.75rem;
  left: var(--gutter);
  padding: 0.6rem 1rem;
  color: white;
  background: var(--ink);
}
.splash {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: clamp(1.6rem, 4vw, 2.75rem);
  font-weight: 700;
  pointer-events: none;
  animation: reveal-page 650ms ease-out both;
}
@keyframes reveal-page {
  0%,
  24% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  .splash {
    display: none;
    animation: none;
  }
}

/* Header and footer stay in normal document flow, including on short landscape screens. */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem 2rem;
  padding-top: clamp(1.25rem, 3.8vw, 3.8rem);
  padding-top: max(clamp(1.25rem, 3.8vw, 3.8rem), env(safe-area-inset-top));
}
.brand {
  display: grid;
  gap: 0.3rem;
  width: fit-content;
  padding-block: 0.25rem;
}
.brand-mark {
  font-size: clamp(1.6rem, 2.6vw, 2.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.studio-name {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.035em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem clamp(0.8rem, 3vw, 3.4rem);
}
.site-nav a {
  display: inline-flex;
  min-width: 2.75rem;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  letter-spacing: 0.035em;
  line-height: 1.25;
  white-space: nowrap;
}
.nav-kind::before {
  content: "(";
}
.nav-kind::after {
  content: ")";
}
.nav-translation {
  display: none;
}
.site-nav a[aria-current],
.site-nav a:hover,
.site-footer a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.38em;
}
.app-shell {
  flex: 1;
  min-width: 0;
  padding-top: clamp(1.75rem, 4.5vw, 4.75rem);
}
.app-shell:focus {
  outline: none;
}
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.15rem 1.5rem;
  padding-top: clamp(3rem, 7vw, 7rem);
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.site-footer a,
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* Desktop archive: one work per row, with the original composition visible in full. */
.project-feed,
.project-detail,
.studio-page {
  max-width: var(--work-width);
  margin-inline: auto;
}
.project-feed {
  display: grid;
  gap: clamp(3rem, 6.5vw, 6.5rem);
}
.project-card,
.project-lead {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
}
.project-card {
  min-width: 0;
}
.project-caption h2 {
  margin-bottom: 0.4rem;
  font-size: clamp(1.1rem, 1.55vw, 1.55rem);
  line-height: 1.4;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.year,
.english-title,
.project-meta {
  color: var(--muted);
}
.year {
  font-size: 0.875rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
@media (hover: hover) {
  .project-card:hover h2 {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
  }
}

.artwork {
  --art-limit: min(76vh, 48rem);
  --art-limit: min(76svh, 48rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  place-items: center;
}
.artwork img {
  width: 100%;
  height: auto;
  max-height: var(--art-limit);
  object-fit: contain;
}
.artwork img[width] {
  max-width: min(100%, calc(var(--art-limit) * var(--image-ratio)));
}
.artwork img:not([width]) {
  aspect-ratio: auto 3 / 4;
}

/* Project detail: cover, bilingual reading columns and a gallery in source order. */
.project-profile {
  min-width: 0;
}
.back-link {
  gap: 0.45rem;
  width: fit-content;
  color: var(--muted);
  font-size: 0.875rem;
}
.back-link:hover,
.contact-list a:hover,
.notice a:hover {
  text-decoration: underline;
}
.project-profile h1,
.studio-page h1 {
  font-size: clamp(1.55rem, 2.45vw, 2.55rem);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.english-title {
  margin-top: 0.35rem;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.65;
}
.project-notes {
  border-top: 1px solid var(--line);
  margin-block: clamp(2.5rem, 6vw, 6rem);
  padding-top: clamp(1.5rem, 3.4vw, 3.2rem);
}
.descriptions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 5.5vw, 5.5rem);
}
.prose,
.studio-copy {
  max-width: 68ch;
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.prose p + p,
.studio-copy p + p {
  margin-top: 1em;
}
.prose:lang(zh-CN) {
  line-height: 1.85;
}
.credits {
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: clamp(1.25rem, 3.4vw, 3.5rem);
}
.gallery-wide {
  grid-column: 1 / -1;
}
.gallery .artwork {
  --art-limit: min(88vh, 54rem);
  --art-limit: min(88svh, 54rem);
}
.project-lead + .gallery {
  margin-top: 2.5rem;
}
.detail-end {
  margin-top: clamp(1.5rem, 3vw, 3rem);
}

/* Studio, contact and route status pages. */
.studio-page {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: start;
  gap: clamp(1.25rem, 4vw, 4rem);
}
.studio-page h1 span {
  color: var(--muted);
  font-size: 0.65em;
  white-space: nowrap;
}
.contact-list {
  margin-top: 1.8rem;
}
.contact-list div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 0.6fr) minmax(0, 1.4fr);
  gap: 0.4rem 1rem;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding-block: 0.8rem;
}
.contact-list dt {
  color: var(--muted);
  font-size: 0.875rem;
}
.contact-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  font-size: 1rem;
  line-height: 1.6;
}
.notice button {
  min-height: 2.75rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--line);
  background: white;
}

/* Let the text stack before a reading column becomes too narrow. */
@media (max-width: 47.99rem) {
  .descriptions,
  .gallery,
  .studio-page {
    grid-template-columns: minmax(0, 1fr);
  }
  .descriptions {
    gap: 1.5rem;
  }
  .gallery {
    gap: 1.5rem;
  }
}
@media (max-width: 43.99rem) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }
  .site-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 4.25rem), 1fr));
    gap: 0;
    border-block: 1px solid var(--line);
  }
  .site-nav a {
    flex-direction: column-reverse;
    gap: 0.2rem;
    min-height: 3.2rem;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
  }
  .site-nav a [lang="en"] {
    font-size: 0.6875rem;
  }
  .site-nav a[aria-current] {
    text-decoration: none;
    box-shadow: inset 0 -2px var(--ink);
  }
  .nav-kind::before,
  .nav-kind::after {
    content: none;
  }
  .nav-translation {
    display: inline;
  }
  .app-shell {
    padding-top: 1.25rem;
  }
  .project-card,
  .project-lead {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
  }
  .project-card .artwork {
    grid-row: 1;
  }
  .project-card,
  .project-detail,
  .studio-page {
    max-width: 34rem;
    margin-inline: auto;
  }
  .project-caption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
  }
  .project-caption h2 {
    margin: 0;
  }
  .year {
    flex: none;
  }
  .project-profile .back-link {
    margin-top: -0.5rem;
  }
  .project-meta {
    margin-top: 0.45rem;
  }
}
@media (max-width: 43.99rem) and (orientation: portrait) {
  .artwork img,
  .artwork img[width] {
    max-width: 100%;
    max-height: none;
  }
}
@media (max-width: 23rem) {
  .contact-list div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
@media (orientation: landscape) and (max-height: 32rem) {
  .site-header {
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }
  .app-shell {
    padding-top: 1rem;
  }
  .artwork,
  .gallery .artwork {
    --art-limit: max(8rem, calc(100vh - 6rem));
    --art-limit: max(8rem, calc(100svh - 6rem));
  }
}
@media (orientation: landscape) and (min-width: 32rem) and (max-width: 43.99rem) and (max-height: 32rem) {
  .site-header {
    display: flex;
    gap: 0.5rem 1rem;
  }
  .site-nav {
    flex: 1 1 14rem;
  }
  .project-card,
  .project-lead {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  }
  .project-card .artwork {
    grid-row: auto;
  }
  .project-caption {
    display: block;
  }
}
