@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&family=Noto+Serif+TC:wght@400;500;600;700&display=swap');

:root {
  --ink: #16130F;
  --clay: #D9573F;
  --paper: #F2ECE1;
  --card: #FAF6EE;
  --card-alt: #E9E0D0;
  --line: rgba(22, 19, 15, .16);
  --serif: "Noto Serif TC", Georgia, "Songti SC", serif;
  --sans: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --r: 18px;
  --bar-h: 140px;
  --pad: 1.25rem;
  --wrap: 78rem;
}

@media (min-width: 900px) {
  :root { --bar-h: 84px; --pad: 2.25rem; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-bottom: calc(var(--bar-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 400 1.0625rem/1.75 var(--sans);
  color: var(--ink);
  background: var(--paper);
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(22, 19, 15, .3) 1px, transparent 1px);
  background-size: 17px 17px;
  opacity: .38;
}

main { position: relative; z-index: 1; display: block; }

img { max-width: 100%; height: auto; }

a { color: var(--clay); text-underline-offset: .22em; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: var(--paper);
  background: var(--ink);
  isolation: isolate;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
  background: radial-gradient(circle at 30% 20%, rgba(217, 87, 63, .45), transparent 65%), var(--ink);
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(168deg, rgba(22, 19, 15, .28) 0%, rgba(22, 19, 15, .82) 58%, rgba(22, 19, 15, .97) 100%);
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(.3) contrast(1.06);
  will-change: transform;
  animation: drift 26s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.12) translate3d(0, -2%, 0); }
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(rgba(242, 236, 225, .55) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .42;
  mix-blend-mode: screen;
}

.hero-in {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 64rem;
  padding: 5rem var(--pad) calc(var(--bar-h) + 3.5rem);
  text-align: left;
}

.hero-h1 {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.7rem, 10vw, 6.4rem);
  line-height: 1.02;
  letter-spacing: -.025em;
  background: linear-gradient(104deg, var(--paper) 18%, var(--clay) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-h1 .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(.5em) rotate(7deg);
  animation: rise .72s cubic-bezier(.2, .7, .2, 1) forwards;
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

.hero-lead {
  margin: 0 0 1.75rem;
  max-width: 40rem;
  font-size: 1.0625rem;
  line-height: 1.8;
  color: rgba(242, 236, 225, .82);
}

.hero-cue {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-height: 44px;
  padding: .4rem 0;
  font-size: .9rem;
  letter-spacing: .22em;
  color: var(--paper);
  text-decoration: none;
}

.cue-line {
  display: block;
  width: 3.4rem;
  height: 1px;
  background: var(--clay);
  transform-origin: left center;
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  0%, 100% { transform: scaleX(.35); opacity: .5; }
  50% { transform: scaleX(1); opacity: 1; }
}

/* ---------- document grid ---------- */

.doc {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2rem var(--pad) 4rem;
  counter-reset: sec;
}

@media (min-width: 900px) {
  .doc {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 1fr);
    column-gap: 3rem;
    padding-top: 3.5rem;
  }
}

/* ---------- aside ---------- */

.rail {
  margin-bottom: 2rem;
}

@media (min-width: 900px) {
  .rail {
    grid-column: 1;
    grid-row: 1 / span 40;
    align-self: start;
    position: sticky;
    top: 2rem;
    margin-bottom: 0;
    border-left: 2px solid var(--ink);
    padding-left: 1rem;
  }
}

.eyebrow {
  display: block;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .3em;
  color: var(--clay);
  margin-bottom: .15rem;
}

.rail-h {
  margin: 0 0 .9rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .16em;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.toc::-webkit-scrollbar { display: none; }

@media (min-width: 900px) {
  .toc { display: block; overflow: visible; }
}

.toc a {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .25rem .6rem;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: .92rem;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, padding-left .2s ease;
}

.toc a:hover, .toc a:focus-visible { background: var(--ink); color: var(--paper); }

@media (min-width: 900px) {
  .toc a { padding: .2rem .4rem; white-space: normal; }
  .toc a:hover, .toc a:focus-visible { padding-left: .8rem; }
}

.toc-n {
  font-family: var(--serif);
  font-size: .74rem;
  letter-spacing: .1em;
  color: var(--clay);
  min-width: 1.4rem;
}

.toc a:hover .toc-n { color: var(--clay); }

/* ---------- content sections ---------- */

.doc > section {
  counter-increment: sec;
  scroll-margin-top: 1.5rem;
  background: var(--card);
  border-radius: var(--r);
  padding: clamp(1.4rem, 3.4vw, 2.75rem);
  margin-bottom: 1.1rem;
  overflow: hidden;
}

.doc > section:nth-of-type(3n + 2) { background: var(--card-alt); }
.doc > section:nth-of-type(3n) { background: #fff; }

.doc > section::before {
  content: counter(sec, decimal-leading-zero);
  display: block;
  font-family: var(--serif);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .3em;
  color: var(--clay);
  margin-bottom: .6rem;
}

.doc > section small {
  display: block;
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .26em;
  color: var(--clay);
  margin-bottom: .35rem;
}

.doc > section h2 {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.55rem, 4.6vw, 2.5rem);
  line-height: 1.22;
  letter-spacing: -.015em;
}

.doc > section h3 {
  margin: 1.9rem 0 .6rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.4;
}

.doc > section p {
  margin: 0 0 1.05rem;
  max-width: 44rem;
}

.doc > section p:last-child { margin-bottom: 0; }

.doc > section ul,
.doc > section ol {
  margin: 0 0 1.1rem;
  padding-left: 1.3rem;
  max-width: 44rem;
}

.doc > section li { margin-bottom: .45rem; }

.doc > section blockquote {
  margin: 1.2rem 0;
  padding: .2rem 0 .2rem 1.1rem;
  border-left: 3px solid var(--clay);
  font-family: var(--serif);
  color: rgba(22, 19, 15, .82);
}

.doc > section strong { font-weight: 700; }

.doc > section a:hover { color: var(--ink); }

/* ---------- reveal ---------- */

.pre {
  opacity: 0;
  transform: translateY(26px);
}

.in {
  opacity: 1;
  transform: none;
  transition: opacity .62s ease, transform .74s cubic-bezier(.2, .7, .2, 1);
}

/* ---------- bottom bar ---------- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand find"
    "links links";
  gap: .3rem .7rem;
  align-items: center;
  padding: .45rem .9rem calc(.45rem + env(safe-area-inset-bottom, 0px));
  background: rgba(22, 19, 15, .97);
  color: var(--paper);
  border-top: 1px solid rgba(242, 236, 225, .16);
  backdrop-filter: blur(9px);
}

@media (min-width: 900px) {
  .bar {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand links find";
    padding-left: var(--pad);
    padding-right: var(--pad);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .04em;
  color: inherit;
  text-decoration: none;
}

.brand .mark { width: 26px; height: 26px; border-radius: 9px; object-fit: cover; display: block; }
.bar .brand { grid-area: brand; }

.links {
  grid-area: links;
  list-style: none;
  display: flex;
  gap: .1rem;
  margin: 0;
  padding: 0 0 .1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.links::-webkit-scrollbar { display: none; }

@media (min-width: 900px) {
  .links { justify-content: flex-start; padding-bottom: 0; }
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  min-height: 44px;
  padding: .5rem .62rem;
  border-radius: 12px;
  font-size: .93rem;
  color: rgba(242, 236, 225, .9);
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.links a:hover, .links a:focus-visible {
  background: var(--clay);
  color: #fff;
  transform: translateY(-2px);
}

.links svg {
  width: 15px;
  height: 15px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .75;
}

.find {
  grid-area: find;
  display: flex;
  align-items: center;
  gap: .25rem;
  min-height: 48px;
  padding: .2rem .2rem .2rem .75rem;
  border-radius: 999px;
  background: rgba(242, 236, 225, .11);
}

.find-in {
  width: 5.4rem;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--paper);
  font: inherit;
  font-size: .92rem;
  -webkit-appearance: none;
}

.find-in::placeholder { color: rgba(242, 236, 225, .58); }

@media (min-width: 900px) {
  .find-in { width: 8.5rem; }
}

.find-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 .55rem;
  border: 0;
  border-radius: 999px;
  background: var(--clay);
  color: #fff;
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}

/* ---------- footer ---------- */

.foot {
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  padding: 2.75rem var(--pad) 1.5rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 34px 34px 0 0;
}

.foot-row {
  display: grid;
  gap: 1.9rem;
  max-width: var(--wrap);
  margin: 0 auto;
}

@media (min-width: 800px) {
  .foot-row {
    grid-template-columns: 1.1fr 1.5fr .7fr;
    align-items: start;
    gap: 2.5rem;
  }
}

.foot .brand { font-size: 1.15rem; }

.foot-brand { display: grid; gap: 1.2rem; }

.sub-lab {
  display: block;
  font-size: .72rem;
  letter-spacing: .3em;
  color: var(--clay);
  margin-bottom: .45rem;
}

.sub-row { display: flex; gap: .4rem; }

.sub-row input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: .4rem .8rem;
  border: 1px solid rgba(242, 236, 225, .28);
  border-radius: 12px;
  background: rgba(242, 236, 225, .06);
  color: var(--paper);
  font: inherit;
  font-size: .92rem;
}

.sub-row input::placeholder { color: rgba(242, 236, 225, .5); }

.sub-row button {
  flex: none;
  min-height: 44px;
  padding: .4rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--clay);
  color: #fff;
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
  transition: transform .2s ease;
}

.sub-row button:hover { transform: translateY(-2px); }

.foot-nav dl {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1.1rem;
  margin: 0;
}

.foot-nav dt {
  font-family: var(--serif);
  font-size: .72rem;
  letter-spacing: .16em;
  color: var(--clay);
  padding-top: .95rem;
}

.foot-nav dd { margin: 0; }

.foot-nav dd a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .15rem 0;
  color: rgba(242, 236, 225, .9);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}

.foot-nav dd a:hover, .foot-nav dd a:focus-visible {
  color: #fff;
  border-color: var(--clay);
}

.foot-meta { display: grid; gap: .3rem; }

.foot-note {
  margin: 0;
  font-size: .86rem;
  letter-spacing: .12em;
  color: rgba(242, 236, 225, .55);
}

.foot-base {
  max-width: var(--wrap);
  margin: 2rem auto 0;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(242, 236, 225, .16);
  text-align: center;
}

.copy {
  margin: 0;
  font-size: .82rem;
  letter-spacing: .1em;
  color: rgba(242, 236, 225, .55);
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-img { animation: none; }
  .cue-line { animation: none; transform: scaleX(1); }
  .hero-h1 .ch { animation: none; opacity: 1; transform: none; }
  .pre { opacity: 1; transform: none; }
  .links a:hover, .sub-row button:hover { transform: none; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
