:root {
  --bg: #ffffff;
  --fg: #000000;
  --divider: #000000;
  --placeholder: #e0e0e0;
  --gallery-w: min(40vw, 480px);
  --gallery-w-portrait: min(36vw, 420px);
  /* landscape long edge ≈ portrait short-edge height (~640) */
  --gallery-w-landscape: min(68vw, 640px);
  --page-pad: clamp(48px, 8vw, 96px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Arial, sans-serif; /* system font only */
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25; /* 12×1.25 = 15, baseline module */
  letter-spacing: normal;
  text-transform: lowercase;
}

/* no decorative styling; keep focus on data */
.wrap {
  min-height: 100vh;
}

.site-header,
.main,
.site-footer {
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
}

.site-header {
  padding-top: 24px;
}

.site-header__left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.site-header__row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-nav {
  display: flex;
  gap: 12px;
  align-self: auto;
}

a {
  color: var(--fg);
  text-decoration: none; /* underline only on hover */
}

a:hover {
  text-decoration: underline;
}

.divider {
  border-top: 1px solid var(--divider);
  margin: 24px 0; /* header rule only */
  overflow: hidden; /* prevent margin-collapsing edge cases */
}

.main {
  padding-top: 0;
  padding-bottom: 0;
}

.page-section.is-hidden {
  display: none;
}

/* generic hidden state */
.is-hidden {
  display: none !important;
}

/* language switch: html[data-lang="cn"] shows cn, hides en */
.lang-en {
  display: inline;
}
.lang-cn {
  display: none;
}
html[data-lang="cn"] .lang-en {
  display: none;
}
html[data-lang="cn"] .lang-cn {
  display: inline;
}

.project-row {
  cursor: default;
}

.project-name-trigger {
  cursor: pointer;
}

.project-name-trigger:hover {
  text-decoration: underline;
}

.project-name-trigger.is-active {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gallery {
  margin-top: 24px;
}

.site-title {
  display: inline-block;
  margin-top: 0;
  cursor: pointer;
  font-weight: 400;
  color: #0000ff;
}

.site-title:hover {
  text-decoration: underline;
  text-decoration-color: #0000ff;
}

/* modular atlas: fixed px sizes, 12px-based irregular margins */
.atlas {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  margin-top: 24px;
}

.atlas-item {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: var(--atlas-w, 240px);
  max-width: calc(100% - 72px);
  margin: var(--atlas-mt, 0) var(--atlas-mr, 12px) var(--atlas-mb, 24px) var(--atlas-ml, 0);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  line-height: 1.25;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
  min-height: 120px;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.atlas-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  pointer-events: none;
}

/* single-image gallery — left-aligned archive figure */
.gallery-figure {
  width: var(--gallery-w);
  max-width: 100%;
  margin-left: 0;
  margin-right: auto;
}

.gallery-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  margin-left: 0;
  cursor: pointer;
}

.gallery-meta {
  margin-top: 12px; /* figure → meta */
  margin-left: 0;
  width: 100%;
  max-width: 100%;
  text-align: left;
  color: var(--fg);
  white-space: normal;
  line-height: 1.25;
}

.overlay-line {
  margin: 0;
  line-height: 1.25;
}

.studio-intro {
  margin: 0;
}

.studio-gap {
  height: 24px;
  margin: 0;
}

.studio-contact {
  margin: 0;
}

.studio-contact > div {
  margin: 0;
}

.site-footer {
  padding: 24px var(--page-pad) var(--page-pad) var(--page-pad);
}

.project-list {
  display: block;
  white-space: normal;
}

.project-sep {
  cursor: default;
}

.studio-block {
  margin-top: 24px;
}


/* mobile: tighter pad; atlas keeps desktop-like small scatter (not full-bleed) */
/* mobile: tighter pad; denser small atlas scatter (~3 cols), not full-bleed */
@media (max-width: 768px) {
  :root {
    --page-pad: 16px;
    --gallery-w: 100%;
    --gallery-w-portrait: 100%;
    --gallery-w-landscape: 100%;
  }

  .atlas-item {
    /* ~1/3 of desktop --atlas-w; hard edges */
    width: calc(var(--atlas-w, 240px) * 0.33) !important;
    max-width: calc((100% - 32px) / 3);
    margin-left: min(var(--atlas-ml, 0px), 24px) !important;
    margin-right: min(var(--atlas-mr, 12px), 8px) !important;
    margin-bottom: 12px !important;
    min-height: 56px;
  }
}
