@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');

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Noto Serif TC", "Songti SC", Georgia, serif;
  font-size: 17px;
  line-height: 1.78;
  color: #1a1a1a;
  background-color: #fafaf8;
  background-image:
    radial-gradient(circle at 18% 26%, rgba(26, 26, 26, .055) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(0deg, rgba(26, 26, 26, .032) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(74, 74, 74, .026) 0 1px, transparent 1px 7px);
  background-attachment: fixed;
  letter-spacing: .015em;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px dashed #1a1a1a;
  outline-offset: 3px;
}

/* 页头：品牌行 + 菜单行 */
.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 8px 18px 0;
  background: #fafaf8;
  border-bottom: 1px solid #1a1a1a;
  box-shadow: 0 2px 0 rgba(26, 26, 26, .1);
}

.brandrow {
  padding: 2px 0 4px;
  border-bottom: 1px dashed rgba(74, 74, 74, .5);
}

.site-brand {
  display: inline-block;
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .2em;
  color: #1a1a1a;
  text-decoration: none;
  padding: 6px 2px;
  transform: rotate(-.7deg);
}

.site-brand::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 9px;
  border: 2px solid #1a1a1a;
  border-radius: 60% 40% 55% 45%;
  background: #fafaf8;
  transform: translateY(1px) rotate(14deg);
}

.site-nav {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}

.site-nav p {
  display: flex;
  gap: 2px;
  margin: 0;
  white-space: nowrap;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
  font-weight: 500;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 10px;
  color: #4a4a4a;
  text-decoration: none;
  border: 1px solid transparent;
  transition: color .16s steps(2, end), border-color .16s steps(2, end), transform .16s steps(2, end);
}

.site-nav a::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 7px;
  background: #1a1a1a;
  opacity: .7;
  transform: rotate(45deg) skew(-6deg, -6deg);
}

.site-nav a:hover {
  color: #1a1a1a;
  border-color: #1a1a1a;
  transform: rotate(-.9deg);
}

/* 主体骨架：左侧目录 + 右侧内容 */
main {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: 0 44px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 22px 64px;
}

.rail {
  grid-column: 1;
  grid-row: 1 / span 3;
  align-self: start;
  position: sticky;
  top: 128px;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
}

.rail-t {
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: .22em;
}

.rail-t::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 7px;
  background: repeating-linear-gradient(90deg, #1a1a1a 0 8px, transparent 8px 13px);
}

.rail-links {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.rail-links a {
  display: block;
  min-height: 40px;
  padding: 8px 0;
  color: #4a4a4a;
  text-decoration: none;
  border-bottom: 1px dashed rgba(74, 74, 74, .4);
}

.rail-links a:hover {
  color: #1a1a1a;
  transform: translateX(3px);
}

/* 首屏拼贴 */
.hero {
  grid-column: 2;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "a copy"
    "b copy";
  gap: 8px 26px;
  min-height: 45vh;
  padding: 6px 0 18px;
  border-bottom: 3px double #1a1a1a;
}

.hero-ghost {
  position: absolute;
  right: -8px;
  bottom: -10px;
  z-index: 0;
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
  font-size: clamp(54px, 10.5vw, 142px);
  line-height: .82;
  letter-spacing: -.05em;
  color: rgba(26, 26, 26, .075);
  white-space: nowrap;
  pointer-events: none;
}

.snap {
  margin: 0;
  padding: 8px 8px 5px;
  background: #fff;
  border: 1px solid #1a1a1a;
  outline: 1px solid rgba(26, 26, 26, .3);
  outline-offset: 3px;
  border-radius: 0;
  z-index: 1;
}

.snap.a {
  grid-area: a;
  width: 84%;
  justify-self: start;
  align-self: start;
  transform: rotate(-2.6deg);
}

.snap.b {
  grid-area: b;
  width: 66%;
  justify-self: end;
  align-self: end;
  transform: rotate(2.2deg);
  z-index: 2;
}

.snap-img {
  display: block;
  width: 100%;
  filter: grayscale(1) contrast(1.08);
}

.snap-fill {
  display: block;
  aspect-ratio: 4 / 3;
  background: repeating-linear-gradient(45deg, #ededea 0 6px, #fafaf8 6px 12px);
}

figcaption {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
  letter-spacing: .12em;
  color: #4a4a4a;
  padding: 5px 2px 0;
}

.hero-copy {
  grid-area: copy;
  align-self: center;
  text-align: right;
  padding-left: 4px;
  z-index: 3;
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 3.3vw, 39px);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: .01em;
}

.hero h1::after {
  content: "";
  display: block;
  width: 62px;
  height: 5px;
  margin: 14px 0 0 auto;
  background: #1a1a1a;
  clip-path: polygon(0 44%, 100% 0, 96% 100%, 3% 68%);
}

/* 正文纸面 */
.paper {
  grid-column: 2;
  max-width: 74ch;
  padding-top: 24px;
  overflow-wrap: anywhere;
}

.paper > h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.3;
  letter-spacing: .02em;
}

.paper > h2::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 10px;
  border: 2px solid #1a1a1a;
  background: repeating-linear-gradient(45deg, #1a1a1a 0 2px, #fafaf8 2px 4px);
  transform: rotate(-9deg) translateY(-2px);
}

.subtitle {
  margin: 0 0 22px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #4a4a4a;
  color: #4a4a4a;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

.paper section[id] {
  padding: 34px 0 10px;
  border-top: 1px dashed rgba(74, 74, 74, .55);
  scroll-margin-top: 134px;
}

.paper section[id]:first-of-type {
  border-top: 0;
  padding-top: 6px;
}

.paper h2 {
  margin: 0 0 14px;
  font-size: clamp(21px, 2.2vw, 26px);
  line-height: 1.34;
}

.paper h2::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 9px;
  background: #1a1a1a;
  transform: rotate(45deg) translateY(-2px);
}

.paper h3 {
  margin: 26px 0 10px;
  font-size: 19px;
  line-height: 1.5;
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 700;
}

.paper p {
  margin: 0 0 16px;
}

.paper ul,
.paper ol {
  margin: 0 0 18px;
  padding-left: 1.4em;
}

.paper li {
  margin: 0 0 8px;
}

.paper li::marker {
  color: #4a4a4a;
}

.paper a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-bottom: 1px solid rgba(26, 26, 26, .35);
}

.paper a:hover {
  background: rgba(26, 26, 26, .06);
}

.paper strong {
  font-weight: 700;
  background: linear-gradient(transparent 62%, rgba(26, 26, 26, .14) 62%);
}

.paper blockquote {
  margin: 22px 0;
  padding: 12px 18px;
  border-left: 4px solid #1a1a1a;
  background: rgba(26, 26, 26, .035);
  color: #4a4a4a;
  transform: rotate(-.25deg);
}

.paper blockquote p:last-child {
  margin-bottom: 0;
}

.paper table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 16px;
}

.paper th,
.paper td {
  border: 1px dotted #4a4a4a;
  padding: 8px 10px;
  text-align: left;
}

.paper th {
  background: rgba(26, 26, 26, .05);
  font-family: "Noto Sans TC", sans-serif;
}

.paper figure {
  margin: 22px 0;
  border: 1px solid #1a1a1a;
  padding: 7px;
  background: #fff;
  transform: rotate(.5deg);
}

/* 页脚：两栏 */
footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 26px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 22px 34px;
  border-top: 3px double #1a1a1a;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
}

footer .fbrand {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-weight: 700;
  letter-spacing: .18em;
}

footer .flinks {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 14px;
  margin: 0;
}

footer .flinks a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 4px 6px;
  color: #4a4a4a;
  text-decoration: none;
  border-bottom: 1px dashed #4a4a4a;
}

footer .flinks a:hover {
  color: #1a1a1a;
  border-bottom-style: solid;
}

footer small {
  grid-column: 1;
  grid-row: 2;
  color: #4a4a4a;
  font-size: 16px;
}

.to-top {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  background: #fafaf8;
  color: #1a1a1a;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 16px;
  text-decoration: none;
  border: 1px solid #1a1a1a;
  transform: rotate(-1.2deg);
}

.to-top:hover {
  background: #1a1a1a;
  color: #fafaf8;
}

/* 入场与轮换 */
.js .rail-links a,
.js .paper section[id] {
  opacity: 0;
  transform: translateY(9px);
  transition: opacity .26s steps(3, end), transform .26s steps(3, end);
  transition-delay: calc(var(--i, 0) * 60ms);
}

.js .rail-links a.in,
.js .paper section[id].in {
  opacity: 1;
  transform: none;
}

.js .rail-links a.in:hover {
  transform: translateX(3px);
}

.hero .snap {
  transition: transform .5s steps(4, end);
}

.hero.flip .snap.a {
  transform: rotate(2.2deg) translateY(-8px);
  z-index: 2;
}

.hero.flip .snap.b {
  transform: rotate(-2.4deg) translateY(8px);
  z-index: 1;
}

/* 断点 */
@media (max-width: 820px) {
  main {
    display: flex;
    flex-direction: column;
    padding: 18px 16px 56px;
  }

  .rail {
    position: static;
    order: 3;
    margin-top: 26px;
  }

  .rail-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }

  .hero {
    order: 1;
    grid-template-areas:
      "a b"
      "copy copy";
    gap: 6px 14px;
    min-height: 0;
    padding-bottom: 16px;
  }

  .snap.a {
    width: 88%;
    transform: rotate(-2deg);
  }

  .snap.b {
    width: 88%;
    justify-self: end;
    align-self: start;
    margin-top: 14px;
    transform: rotate(2deg);
  }

  .hero-copy {
    grid-area: copy;
    text-align: left;
    padding-top: 16px;
  }

  .hero h1::after {
    margin-left: 0;
  }

  .paper {
    order: 2;
    max-width: none;
  }

  .paper section[id] {
    scroll-margin-top: 128px;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 20px 16px 30px;
  }

  footer .flinks {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
  }

  footer small {
    grid-row: 3;
  }
}

@media (max-width: 420px) {
  .hero-ghost {
    font-size: 52px;
  }

  .site-brand {
    letter-spacing: .14em;
  }
}

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

  .js .rail-links a,
  .js .paper section[id] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero .snap,
  .site-nav a,
  .rail-links a {
    transition: none;
  }
}

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