/* Homepage. Night, then paper. The field is drawn by assets/field.js. */

:root {
  color-scheme: light;
  --ink: #1c1916;
  --ink-soft: #5c564e;
  --paper: #f3eee4;
  --paper-2: #f7f3ec;
  --line: rgba(28, 25, 22, 0.16);
  --brass: #a06a32;
  --brass-soft: #8a6230;
  --night: #0c0f12;
  --cream: #f3eee4;
  --sky: #f4efe6;
  --sky-ink: #1c1916;
  --hero-soft: #5c564e;
  --hero-fade: linear-gradient(to top, rgba(244, 239, 230, .94) 0%, rgba(244, 239, 230, .62) 30%, rgba(244, 239, 230, 0) 62%);
  --plate: #e7e0d4;
  --hover: #efe4d2;
  --eq: rgba(28, 25, 22, 0.07);
  --foot-bg: #efe8dc;
  --foot-ink: #5c564e;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

[data-theme="night"] {
  color-scheme: dark;
  --ink: #f4efe6;
  --ink-soft: #d2c8b8;
  --paper: #0c0f12;
  --paper-2: #151b21;
  --line: rgba(244, 239, 230, 0.16);
  --brass: #e4d2b0;
  --brass-soft: #e4d2b0;
  --sky: #0c0f12;
  --sky-ink: #f4efe6;
  --hero-soft: #e7e0d4;
  --hero-fade: linear-gradient(to top, rgba(12, 15, 18, .92) 0%, rgba(12, 15, 18, .5) 28%, rgba(12, 15, 18, 0) 58%);
  --plate: #1a2128;
  --hover: #1c242c;
  --eq: rgba(244, 239, 230, 0.06);
  --foot-bg: #0c0f12;
  --foot-ink: #d2c8b8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --ink: #f4efe6;
    --ink-soft: #d2c8b8;
    --paper: #0c0f12;
    --paper-2: #151b21;
    --line: rgba(244, 239, 230, 0.16);
    --brass: #e4d2b0;
    --brass-soft: #e4d2b0;
    --sky: #0c0f12;
    --sky-ink: #f4efe6;
    --hero-soft: #e7e0d4;
    --hero-fade: linear-gradient(to top, rgba(12, 15, 18, .92) 0%, rgba(12, 15, 18, .5) 28%, rgba(12, 15, 18, 0) 58%);
    --plate: #1a2128;
    --hover: #1c242c;
    --eq: rgba(244, 239, 230, 0.06);
    --foot-bg: #0c0f12;
    --foot-ink: #d2c8b8;
  }
}

* { box-sizing: border-box; }

html { scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
}

a { color: inherit; text-underline-offset: .18em; }
a:hover { color: var(--brass); }
:focus-visible { outline: 2px solid var(--brass-soft); outline-offset: 3px; }
::selection { background: rgba(196, 165, 116, 0.35); color: var(--ink); }

.skip {
  position: absolute;
  left: .6rem;
  top: .5rem;
  z-index: 5;
  padding: .35rem .6rem;
  background: var(--cream);
  color: var(--night);
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

.sky {
  position: relative;
  min-height: 100svh;
  color: var(--sky-ink);
  background:
    radial-gradient(ellipse at 62% 36%, rgba(196, 140, 70, 0.2), transparent 52%),
    radial-gradient(ellipse at 18% 78%, rgba(120, 100, 70, 0.08), transparent 42%),
    var(--sky);
  overflow: hidden;
}
[data-theme="night"] .sky {
  background:
    radial-gradient(ellipse at 62% 36%, rgba(232, 206, 156, 0.22), transparent 52%),
    radial-gradient(ellipse at 18% 78%, rgba(120, 142, 150, 0.14), transparent 42%),
    var(--sky);
}

#field, .sky .still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.sky .still { color: color-mix(in srgb, var(--sky-ink) 55%, transparent); }
.js .sky .still { display: none; }

.hero {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 5.5rem max(1.25rem, calc((100% - min(110rem, 100% - 2.5rem)) / 2)) 2.6rem;
  background: var(--hero-fade);
}

.kicker {
  margin: 0 0 .6rem;
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brass);
}

.hero h1 {
  margin: 0;
  max-width: 11ch;
  font-weight: 500;
  font-size: clamp(3.1rem, 8.4vw, 6.6rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
}

.zh-name {
  margin: .85rem 0 0;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  letter-spacing: .18em;
}

.lede {
  max-width: 40rem;
  margin: 1.15rem 0 0;
  color: var(--hero-soft);
  font-size: 1.12rem;
}

.hero nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1.35rem;
  margin-top: 1.5rem;
}

.hero nav a {
  color: var(--sky-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--brass);
  font-size: 1.2rem;
  padding-bottom: .08em;
}
.hero nav a.quiet {
  border-bottom-color: transparent;
  font-size: 1rem;
  color: var(--hero-soft);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: .22em;
}
.hero nav a:hover { color: var(--brass); }

.pdfs {
  margin: .85rem 0 0;
  font-family: var(--sans);
  font-size: .92rem;
  color: var(--hero-soft);
}
.pdfs a { color: inherit; }

.wrap {
  max-width: min(110rem, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 0 clamp(1.15rem, 4vw, 2.5rem);
}

.read { position: relative; padding: 4.5rem 0 3rem; overflow: hidden; }
.read h2, .marks h2, .drawings h2 {
  margin: 0 0 .4rem;
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
}
.note { margin: 0 0 1.6rem; max-width: 36rem; color: var(--ink-soft); }

.equations {
  position: absolute;
  left: 0;
  right: 0;
  top: 1.2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
  font-size: clamp(2.8rem, 8vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--eq);
  pointer-events: none;
  user-select: none;
}
.read .wrap { position: relative; z-index: 1; }

.doors {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  position: relative;
}
.doors a {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: 10.5rem;
  padding: 1.35rem 1.1rem 1.2rem;
  color: inherit;
  text-decoration: none;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}
.doors .lang { font-family: var(--sans); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brass); }
.doors .title { font-size: clamp(1.55rem, 2.5vw, 2.05rem); line-height: 1.2; }
.doors .act { margin-top: auto; font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); }
.doors a:hover { background: var(--hover); color: inherit; }
.doors a:hover .act { color: var(--brass); }

.marks { padding: 1rem 0 3.5rem; }
.timeline {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 7.2rem 4.75rem minmax(0, 1fr);
  gap: .35rem 1rem;
  align-items: start;
  padding: 0 0 1.65rem;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(7.2rem + 1rem + 2.375rem);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline .when {
  font-variant-numeric: tabular-nums;
  font-family: var(--sans);
  font-size: .92rem;
  color: var(--brass);
  padding-top: .35rem;
}
.plate, .glyph {
  width: 4.75rem;
  height: 4.75rem;
  position: relative;
  z-index: 1;
  background: var(--plate);
}
.plate {
  object-fit: cover;
  border-radius: 2px;
}
.glyph {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink);
  background: var(--paper-2);
}
.glyph svg { width: 2.35rem; height: 2.35rem; }
.timeline h3 { margin: .15rem 0 .2rem; font-size: 1.18rem; font-weight: 500; line-height: 1.3; }
.timeline p { margin: 0; color: var(--ink-soft); font-size: 1rem; }

.drawings {
  padding: 1rem 0 4rem;
  border-top: 1px solid var(--line);
}
.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.4rem;
}
.gallery figure {
  margin: 0;
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(196, 165, 116, 0.18), transparent 60%),
    var(--paper-2);
  border: 1px solid var(--line);
}
.gallery svg { width: 100%; height: auto; display: block; color: var(--ink); }
.gallery figcaption { margin-top: auto; padding-top: .9rem; color: var(--ink-soft); }
.gallery strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: .15rem; }

.foot {
  background: var(--foot-bg);
  color: var(--foot-ink);
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.4rem;
  font-family: var(--sans);
  font-size: .92rem;
}
.foot a { color: var(--ink); }
.foot p { margin: .3rem 0; }

.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--ink);
  padding: 0;
  cursor: pointer;
}
.theme-toggle .sun { display: none; }
[data-theme="night"] .theme-toggle .moon { display: none; }
[data-theme="night"] .theme-toggle .sun { display: block; }
.theme-toggle:hover { color: var(--brass); }
.theme-float {
  position: fixed;
  top: .85rem;
  right: max(.8rem, calc((100% - min(110rem, 100% - 2.5rem)) / 2));
  z-index: 30;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}
[data-theme="night"] body {
  background-color: var(--paper);
  background-image:
    radial-gradient(1.2px 1.2px at 12% 70%, rgba(244, 239, 230, .45), transparent),
    radial-gradient(1px 1px at 80% 84%, rgba(228, 210, 176, .55), transparent),
    radial-gradient(1px 1px at 46% 92%, rgba(244, 239, 230, .28), transparent);
}

@media (min-width: 800px) {
  .doors { grid-template-columns: 1fr 1fr 1fr; }
  .doors a { border-top: 1px solid var(--line); border-left: 1px solid var(--line); min-height: 13rem; }
  .doors li:first-child a { border-left: none; }
  .gallery { grid-template-columns: 1.1fr .9fr .9fr; align-items: stretch; }
}

@media (min-width: 1400px) {
  .hero h1 { font-size: clamp(4.4rem, 6.4vw, 8.5rem); max-width: 12ch; }
  .doors a { min-height: 16rem; padding: 2rem 1.7rem; }
  .doors .title { font-size: clamp(1.8rem, 2.2vw, 2.4rem); }
  .gallery { gap: 2rem; }
  .timeline li { grid-template-columns: 9.5rem 6rem minmax(0, 1fr); }
  .timeline li::before { left: calc(9.5rem + 1rem + 3rem); }
  .plate, .glyph { width: 6rem; height: 6rem; }
  .timeline p { max-width: 46rem; }
}

@media (max-width: 640px) {
  .hero { padding-top: 4rem; }
  .hero h1 { max-width: none; }
  .timeline li {
    grid-template-columns: 4.25rem minmax(0, 1fr);
    gap: .55rem .75rem;
  }
  .timeline .when { grid-column: 1 / -1; padding-top: 0; }
  .timeline li::before { left: 2.1rem; top: 1.7rem; }
  .plate, .glyph { width: 4.25rem; height: 4.25rem; }
  .equations { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
