@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../fonts/source-sans-3-regular.ttf") format("truetype");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("../fonts/source-sans-3-semibold.ttf") format("truetype");
}

:root {
  --paper: #f8f6f0;
  --ink: #202821;
  --sage: #4f7a45;
  --muted: #73766e;
  --rule: rgb(145 145 129 / 24%);
  --secondary: #5d675e;
  --service-text: #5d675e;
  --soft-rule: rgb(145 145 129 / 18%);
  --number: #818779;
  --frame: #fbfaf6;
  --selection: rgb(79 122 69 / 20%);
  --button-hover: rgb(79 122 69 / 10%);
  --header-height: 88px;
  --footer-height: 56px;
  --art-clearance: 120px;
  --service-columns: 44px minmax(140px, 1fr) minmax(80px, .5fr) minmax(0, 2fr) 28px;
  --service-gap: 24px;
  /* 与博客 mock 的背景图层、网格及根字号一致。 */
  --page-background-art:
    radial-gradient(circle at 12% 8%, rgb(124 154 110 / 13%), transparent 28rem),
    radial-gradient(circle at 74% 12%, rgb(199 190 158 / 14%), transparent 30rem),
    radial-gradient(circle at 92% 26%, rgb(151 167 127 / 10%), transparent 34rem),
    linear-gradient(180deg, rgb(255 252 244 / 52%), transparent 32rem);
  --grid-color: rgb(102 125 91 / 5%);
  color-scheme: light;
  /* 英文字体不含汉字，中文自动使用后面的系统宋体／仿宋。 */
  --font: "Source Sans 3", "SimSun", "宋体", "Songti SC", "STSong", "FangSong", "仿宋", serif;
}

:root[data-theme="dark"] {
  --paper: #111713;
  --ink: #f0efe8;
  --sage: #9abb8d;
  --muted: #a9b0a3;
  --rule: rgb(128 148 121 / 20%);
  --secondary: #c3c9bd;
  --service-text: #c3c9bd;
  --soft-rule: rgb(128 148 121 / 16%);
  --number: #a1ad96;
  --frame: #222d25;
  --selection: rgb(151 185 138 / 28%);
  --button-hover: rgb(126 166 112 / 15%);
  --page-background-art:
    radial-gradient(circle at 12% 8%, rgb(95 132 82 / 15%), transparent 28rem),
    radial-gradient(circle at 74% 12%, rgb(142 126 92 / 8%), transparent 30rem),
    radial-gradient(circle at 92% 26%, rgb(112 138 101 / 9%), transparent 34rem),
    linear-gradient(180deg, rgb(29 39 31 / 28%), transparent 32rem);
  --grid-color: rgb(125 147 116 / 5%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  font-size: 18px;
  background: var(--paper);
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--page-background-art), linear-gradient(var(--paper), var(--paper));
  color: var(--ink);
  font-family: var(--font);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 86%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 7px;
}

::selection {
  background: var(--selection);
  color: var(--ink);
}

.page {
  max-width: 1920px;
  width: calc(100% - 96px);
  margin: 0 auto;
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height);
}

.site-header {
  height: var(--header-height);
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
}

.page-viewport {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  overflow-anchor: none;
  scrollbar-width: none;
  outline: none;
}

.panel {
  height: 100%;
  min-width: 0;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  scrollbar-width: none;
}

.page-viewport::-webkit-scrollbar,
.panel::-webkit-scrollbar,
.services-list::-webkit-scrollbar {
  display: none;
}

.theme-control {
  position: relative;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--sage);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease;
}

.theme-toggle:hover {
  background: var(--button-hover);
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .moon, .theme-toggle .system {
  display: none;
}

[data-theme-preference="dark"] .theme-toggle .sun, [data-theme-preference="system"] .theme-toggle .sun {
  display: none;
}

[data-theme-preference="dark"] .theme-toggle .moon, [data-theme-preference="system"] .theme-toggle .system {
  display: block;
}

.theme-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 20;
  width: 174px;
  padding: 9px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 6px 24px #0000001a;
}

.theme-panel fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--ink);
  font: 15px/1.5 var(--font);
  cursor: pointer;
}

.theme-option:hover, .theme-option:focus-within {
  background: var(--button-hover);
}

.theme-option input {
  margin: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--sage);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  align-self: center;
}

.brand-icon-dark {
  display: none;
}

[data-theme="dark"] .brand-icon-light {
  display: none;
}

[data-theme="dark"] .brand-icon-dark {
  display: block;
}

.wordmark strong {
  font-family: var(--font);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.35px;
}

.wordmark span {
  color: var(--sage);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.5;
  border-left: 1px solid var(--rule);
  padding-left: 12px;
}

.arrow {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .22s ease;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  gap: clamp(28px, 2.2vw, 42px);
  align-items: safe center;
  padding: 32px 24px;
}

h1 {
  font-size: clamp(56px, min(8.35vw, 15dvh), 156px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
}

h1 span {
  display: block;
  white-space: nowrap;
}

h1 .sage {
  color: var(--sage);
}

.intro {
  font-size: clamp(20px, 1.65vw, 26px);
  line-height: 1.65;
  color: var(--secondary);
  margin: 32px 0 0;
}

.intro > span {
  display: block;
}

.intro .phrase {
  display: inline-block;
}

.bookplate {
  --art-inset: 32px;
  margin: 0;
  width: min(660px, calc(100% - var(--art-inset)), max(100px, calc((100dvh - var(--header-height) - var(--footer-height) - var(--art-clearance)) * .88)));
  justify-self: center;
}

.print {
  padding: 12px;
  background: var(--frame);
  box-shadow: 0 5px 15px #3f372019, 0 1px 4px #3f37200c;
  transform: rotate(3deg);
}

.print img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1209 / 1300;
  object-fit: cover;
}

figcaption {
  color: var(--muted);
  text-align: center;
  font-size: 18px;
  margin-top: 30px;
  letter-spacing: .05em;
}

.site-footer {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font: 16px/1.6 var(--font);
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 30;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  font-size: 16px;
}

.skip-link:focus {
  top: 16px;
}

@media (max-width: 1000px) {
  .hero {
    gap: 28px;
    padding-inline: 12px;
  }
  h1 {
    font-size: 7.6vw;
  }
  .intro {
    font-size: 18px;
    margin-top: 24px;
  }
}

@media (max-width: 800px) {
  :root {
    --header-height: 78px;
    --service-columns: 28px minmax(100px, .9fr) minmax(60px, .5fr) minmax(0, 1.8fr) 22px;
    --service-gap: 16px;
  }
  .page {
    width: calc(100% - 48px);
  }
  .wordmark strong {
    font-size: 24px;
  }
  .wordmark span {
    font-size: 19px;
  }
  .brand-icon {
    width: 34px;
    height: 34px;
  }
  .hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    padding: 36px 8px 34px;
  }
  h1 {
    font-size: clamp(36px, 7.3vw, 58px);
    line-height: 1.24;
    letter-spacing: -.04em;
  }
  .intro {
    font-size: 16px;
    margin-top: 24px;
  }
  .bookplate {
    --art-inset: 10px;
  }
  .print {
    padding: 8px;
  }
  figcaption {
    font-size: 14px;
    margin-top: 18px;
    letter-spacing: 0;
  }
  .site-footer {
    font-size: 13px;
  }
}

@media (max-width: 520px) {
  :root {
    --header-height: 72px;
    --footer-height: 48px;
    --service-columns: 20px minmax(48px, .7fr) minmax(36px, .5fr) minmax(0, 1.6fr) 18px;
    --service-gap: 8px;
  }
  .page {
    width: calc(100% - 40px);
  }
  .wordmark {
    gap: 9px;
  }
  .wordmark strong {
    font-size: 22px;
  }
  .wordmark span {
    font-size: 17px;
    padding-left: 9px;
  }
  .brand-icon {
    width: 30px;
    height: 30px;
  }
  .hero {
    padding: 32px 0 30px;
    gap: 16px;
  }
  h1 {
    font-size: clamp(26px, 8.2vw, 42px);
  }
  .intro {
    font-size: 15px;
    line-height: 1.75;
    margin-top: 18px;
  }
  .print {
    padding: 5px;
  }
  figcaption {
    font-size: 12px;
    line-height: 1.5;
    margin-top: 14px;
  }
  .site-footer {
    font-size: 12px;
  }
}

.places {
  display: flex;
  align-items: safe center;
  padding: 36px 24px;
}

.places-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  max-height: 100%;
}

.places-heading {
  flex-shrink: 0;
  padding: 0 0 24px;
}

.places-heading h2 {
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

.services-list {
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}

.services-list:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: -2px;
}

.service-link {
  display: grid;
  grid-template-columns: var(--service-columns);
  align-items: center;
  justify-items: center;
  text-align: center;
  gap: var(--service-gap);
  /* 行高随字号同步缩放，多行简介由内容撑开。 */
  min-height: 4.8em;
  padding: .9em 0;
  border-top: 1px solid var(--soft-rule);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.6;
  transition: color .22s ease;
}

.service-link:hover {
  color: var(--sage);
}

.service-link:hover .arrow {
  transform: translate(3px, -3px);
}

.service-number {
  align-self: center;
  color: var(--number);
  font-variant-numeric: tabular-nums;
}

.service-name {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.service-category {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.service-description {
  font-weight: 400;
  color: var(--service-text);
  overflow-wrap: anywhere;
}

.empty-message, .no-script {
  color: var(--muted);
  font: 15px/1.8 var(--font);
  padding: 15px 0 28px;
  margin: 0;
}

.no-script a {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .places {
    padding: 32px 8px;
  }
  .places-heading h2 {
    font-size: 32px;
  }
  .service-link {
    font-size: 18px;
  }
  .service-link .arrow {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 520px) {
  .places {
    padding: 24px 0;
  }
  .places-heading {
    padding: 0 0 18px;
  }
  .places-heading h2 {
    font-size: 28px;
  }
  .service-link {
    font-size: 16px;
  }
  .service-link .arrow {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 360px) {
  .intro {
    font-size: 14px;
  }
}

@media (max-width: 699px) {
  html {
    font-size: 17px;
  }
}

@media (max-height: 520px) {
  :root {
    --header-height: 60px;
    --footer-height: 52px;
    --art-clearance: 90px;
  }
  .hero {
    padding-block: 16px;
  }
  h1 {
    font-size: clamp(24px, min(6.9vw, 9dvh), 54px);
  }
  .intro {
    font-size: 14px;
    line-height: 1.6;
    margin-top: 12px;
  }
  .print {
    padding: 5px;
  }
  figcaption {
    font-size: 12px;
    margin-top: 12px;
  }
  .places {
    padding-block: 16px;
  }
  .places-heading {
    padding-bottom: 8px;
  }
  .places-heading h2 {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}
