:root {
  --paper:      #faf8f3;
  --paper-2:    #f3f0e8;
  --ink:        #201913;
  --ink-soft:   #4d443a;
  --muted:      #837868;
  --line:       #e8e3d8;
  --line-soft:  #f0ece3;
  --accent:     #c4392b;
  --accent-deep:#a72c20;
  --on-accent:  #fbf6ee;
  --shadow:     rgba(54, 38, 22, .14);
  --maxw:       39rem;
  --ease:       cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #15120e;
    --paper-2:    #1d1812;
    --ink:        #ece3d4;
    --ink-soft:   #c4baa8;
    --muted:      #8f8676;
    --line:       #332c22;
    --line-soft:  #29231b;
    --accent:     #e36658;
    --accent-deep:#f08475;
    --on-accent:  #15120e;
    --shadow:     rgba(0, 0, 0, .55);
  }
}

* {
  box-sizing: border-box;
  text-autospace: normal;
}

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.95;
  letter-spacing: .006em;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[lang="zh"] body {
  font-family: "Noto Serif SC", "Noto Serif", "Songti SC", "Source Han Serif SC", "Source Han Serif", serif;
}

html[lang="en"] body {
  font-family: "Noto Serif", "Noto Serif SC", "Songti SC", "Source Han Serif SC", "Source Han Serif", serif;
}

/* film grain atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}
@media (prefers-color-scheme: dark) { body::before { opacity: .07; } }

::selection { background: var(--accent); color: var(--on-accent); }

.wrap {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 4.5vw, 3.5rem) 1.5rem 4rem;
}

.masthead { margin-bottom: clamp(2.6rem, 6vw, 4rem); }

.meta {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: .75rem;
  margin-bottom: clamp(1.3rem, 3.5vw, 2rem);
  border-bottom: 1px solid var(--line);
  font-size: .8rem;
  line-height: 1.4;
}
.kicker {
  margin: 0 0 .5rem;
  color: var(--accent);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .26em;
}
.lang {
  margin: 0;
  white-space: nowrap;
  letter-spacing: .14em;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(2.25rem, 8.5vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -.015em;
}
.dek {
  max-width: 33rem;
  margin: 1.5rem 0 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent);
  font-size: 1.16rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

main { font-feature-settings: "liga" 1; }

p { margin: 1.35rem 0; }
.lead { font-size: 1.16rem; }

strong {
  font-weight: 700;
  color: var(--accent-deep);
}

a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 42%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: text-decoration-color .2s var(--ease),
              text-decoration-thickness .2s var(--ease),
              color .2s var(--ease);
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

hr {
  border: 0;
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: visible;
  margin: clamp(2.8rem, 7vw, 4rem) 0;
}
hr::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--accent);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 6px var(--paper);
}

figure {
  margin: clamp(2rem, 5vw, 3rem) 0;
  padding: 1.1rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 18px 40px -28px var(--shadow);
}
figure img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}
.cover-site { max-height: 340px; width: auto; }
.molecule-comparison { width: 600px; }

figcaption {
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
  line-height: 1.7;
  color: var(--muted);
}
figcaption { font-style: normal; }

.figure--quote figcaption {
  position: relative;
  padding-left: 1rem;
  border-top: 0;
  border-left: 2px solid var(--line);
  margin-top: 1rem;
}

@media (min-width: 760px) {
  .figure--wide {
    width: calc(100% + 5rem);
    margin-left: -2.5rem;
  }
}

.guide { margin: clamp(2rem, 5vw, 3rem) 0; }

h2 {
  margin: 0 0 1.1rem;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -.01em;
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  margin: .4rem 0 .2rem;
  padding: .72em 1.15em;
  background: var(--paper-2);
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-deep);
  text-decoration: none;
  box-shadow: 0 12px 30px -22px var(--shadow);
  transition: background .22s var(--ease), color .22s var(--ease),
              transform .22s var(--ease), box-shadow .22s var(--ease);
}
.tool::after { content: "↗"; font-size: .95em; line-height: 1; }
.tool:hover {
  background: var(--accent);
  color: var(--on-accent);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -20px var(--shadow);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 1.7rem 0 0;
  padding: 0;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.9rem;
  margin: 1.15rem 0;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .18em;
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 50%;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1;
}

.aside {
  margin: 1.9rem 0 0;
  padding: .1rem 0 .1rem 1.15rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
}

.credits-toggle {
  font: inherit;
  color: var(--accent-deep);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 42%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: text-decoration-color .2s var(--ease),
              text-decoration-thickness .2s var(--ease), color .2s var(--ease);
}
.credits-toggle:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.credits {
  margin-top: clamp(2.8rem, 7vw, 4rem);
  padding-top: clamp(2.8rem, 7vw, 4rem);
  border-top: 1px solid var(--line);
  font-size: .94rem;
  line-height: 1.85;
  color: var(--ink-soft);
}
.credits[hidden] { display: none; }
.credits:not([hidden]) { animation: rise .55s var(--ease) both; }
.credits p { margin: .7rem 0; }
.credits h3 {
  margin: 0 0 1rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .2em;
  color: var(--accent);
  text-transform: uppercase;
}
.credits h4 {
  margin: 1.6rem 0 .4rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .8rem;
  align-items: center;
  margin-top: clamp(2.8rem, 7vw, 4rem);
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
  color: var(--muted);
}
footer .sep { color: var(--line); }

@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 600px) {
  html { font-size: 17px; }
  .cover-site { max-height: 280px; }
  .wrap { padding-left: 1.25rem; padding-right: 1.25rem; }
}
