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

:root {
  --ink: #172623;
  --ink-soft: #3b4a44;
  --teal: #5cc6b0;
  --teal-deep: #2f8f7f;
  --sand: #d4c4a8;
  --sand-lt: #efe4d0;
  --bg: #f7f0e5;
  --paper: #fbf6ee;
  --clay: #c67b5c;
  --olive: #6b7b3c;
  --line: rgba(23, 38, 35, 0.16);
  --r1: 4px;
  --r2: 14px;
  --r3: 26px 8px 26px 8px;
  --shadow: 0 12px 30px -22px rgba(23, 38, 35, 0.65);
  --serif: "EB Garamond", "Songti SC", Georgia, serif;
  --sans: "Lato", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --pad: clamp(1rem, 5vw, 3rem);
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 400;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

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

a { color: var(--teal-deep); }

:focus-visible {
  outline: 2px solid var(--teal-deep);
  outline-offset: 2px;
}

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

/* --- header --- */
.site-head {
  position: relative;
  z-index: 40;
  background: linear-gradient(180deg, rgba(247, 240, 229, 0.98), rgba(247, 240, 229, 0.84));
}

.head-top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.7rem var(--pad);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.nav-a { justify-self: start; }
.nav-b { justify-self: end; }

.nav p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.nav-b p { justify-content: flex-end; }

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink-soft);
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.28s ease-out, color 0.28s ease-out, border-color 0.28s ease-out;
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--teal);
  border-color: var(--teal-deep);
  color: #0c1d19;
}

.brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.3rem 0.5rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.65rem);
  letter-spacing: 0.09em;
  text-decoration: none;
}

.brand .mark {
  width: 0.6em;
  height: 0.6em;
  border-radius: 54% 46% 62% 38%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(92, 198, 176, 0.22);
}

.anchors {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.45rem var(--pad) 0.55rem;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 240, 229, 0.92);
  backdrop-filter: blur(7px);
}

.anchors p {
  flex: 1 1 auto;
  margin: 0;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.anchors p::-webkit-scrollbar { display: none; }

.anchors p a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.3rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(212, 196, 168, 0.45);
  color: var(--ink-soft);
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.28s ease-out, color 0.28s ease-out;
}

.anchors p a:hover,
.anchors p a:focus-visible {
  background: var(--sand);
  color: var(--ink);
}

.contact {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  background: var(--teal);
  color: #0c1d19;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px -14px rgba(23, 38, 35, 0.9);
}

/* --- hero --- */
.hero {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.6rem;
  padding: clamp(2rem, 6vw, 3.5rem) var(--pad) clamp(2rem, 5vw, 3rem);
  background:
    radial-gradient(120% 70% at 4% 0%, rgba(212, 196, 168, 0.5), transparent 62%),
    radial-gradient(90% 60% at 100% 46%, rgba(92, 198, 176, 0.18), transparent 68%);
}

.hero-copy {
  max-width: 44rem;
  text-align: left;
}

.hero-copy h1 {
  margin: 0 0 0.7rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 1.35rem + 3.2vw, 3.5rem);
  line-height: 1.16;
  letter-spacing: 0.01em;
}

.lede {
  margin: 0 0 1.1rem;
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.78;
}

.hero-jump {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-jump a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.35rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 1rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  transition: background 0.28s ease-out;
}

.hero-jump a:first-child {
  background: var(--teal);
  border-color: var(--teal-deep);
  color: #0c1d19;
  font-weight: 700;
}

.hero-jump a:hover { background: var(--sand); }

.hero-fig {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 21 / 9;
  border-radius: var(--r3);
  background:
    linear-gradient(140deg, rgba(212, 196, 168, 0.85), rgba(92, 198, 176, 0.4) 60%, rgba(198, 123, 92, 0.5));
  box-shadow: 0 26px 50px -34px rgba(23, 38, 35, 0.85);
}

.hero-fig img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  will-change: transform;
}

.hero-badges {
  position: absolute;
  top: 24%;
  right: var(--pad);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  max-width: 15rem;
}

.hero-badges a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(23, 38, 35, 0.12);
  background: rgba(251, 246, 238, 0.86);
  color: var(--ink-soft);
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 10px 22px -18px rgba(23, 38, 35, 0.9);
  animation: badgeTurn 20s ease-out infinite;
}

.hero-badges a:nth-child(2) { animation-delay: 4s; }
.hero-badges a:nth-child(3) { animation-delay: 8s; }
.hero-badges a:nth-child(4) { animation-delay: 12s; }
.hero-badges a:nth-child(5) { animation-delay: 16s; }

.hero-badges a:hover {
  background: var(--teal);
  color: #0c1d19;
}

@keyframes badgeTurn {
  0%, 14% { transform: translateX(-6px); background: rgba(92, 198, 176, 0.9); color: #0c1d19; }
  20%, 100% { transform: translateX(0); }
}

/* --- shell --- */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) var(--pad);
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(1.2rem, 3vw, 2.4rem);
  align-items: start;
}

.rail {
  position: sticky;
  top: 4.6rem;
  padding: 1rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--r2) var(--r1) var(--r2) var(--r1);
  background: rgba(239, 228, 208, 0.72);
  box-shadow: var(--shadow);
}

.rail h2 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.rail hr {
  margin: 0 0 0.7rem;
  border: 0;
  border-top: 1px solid var(--line);
}

.rail-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.15rem;
}

.rail-list a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.2rem 0.35rem;
  border-radius: var(--r1);
  color: var(--ink-soft);
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.25s ease-out, color 0.25s ease-out;
}

.rail-list a:hover {
  background: rgba(92, 198, 176, 0.25);
  color: var(--ink);
}

.rail-list .num {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--teal-deep);
  min-width: 1.7em;
}

/* --- prose --- */
.prose {
  min-width: 0;
  max-width: 70ch;
  padding: clamp(1.2rem, 3vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.prose [id] { scroll-margin-top: 5.5rem; }

.prose > div + div {
  margin-top: 2.2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.prose h2 {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.45rem, 1.15rem + 1.1vw, 2rem);
  line-height: 1.28;
  letter-spacing: 0.015em;
}

.prose h3 {
  margin: 1.4rem 0 0.5rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.35;
}

.prose hr {
  margin: 0 0 1rem;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose p { margin: 0 0 1rem; }

.prose a {
  color: var(--teal-deep);
  text-underline-offset: 0.2em;
}

.prose ul,
.prose ol { padding-left: 1.35rem; }

.prose li { margin: 0.35rem 0; }

.prose figure { margin: 1.4rem 0; }

.prose figure img { border-radius: var(--r1); }

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--r1) var(--r1) 0;
  background: rgba(92, 198, 176, 0.13);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 1rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.prose th { background: rgba(212, 196, 168, 0.35); }

.prose code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* --- footer --- */
.site-foot {
  margin-top: clamp(2rem, 6vw, 4rem);
  padding: clamp(2rem, 5vw, 3rem) var(--pad) 1.2rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  background: linear-gradient(180deg, #26332e, #172623);
  color: #efe7da;
}

.site-foot div { min-width: 0; }

.site-foot h2 {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: #f5ecdf;
}

.site-foot hr {
  margin: 0 0 0.85rem;
  border: 0;
  border-top: 1px solid rgba(239, 231, 218, 0.26);
}

.f-logo {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  letter-spacing: 0.1em;
  color: #fff;
}

.f-kw {
  margin: 0;
  color: rgba(239, 231, 218, 0.72);
  font-size: 1rem;
}

.f-nav nav p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.f-nav a,
.f-contact a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.25rem 0.7rem;
  border: 1px solid rgba(239, 231, 218, 0.24);
  border-radius: 999px;
  color: #efe7da;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.25s ease-out, color 0.25s ease-out;
}

.f-nav a:hover,
.f-contact a:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #0f211d;
}

.f-contact p { margin: 0; }

.f-contact a {
  background: rgba(92, 198, 176, 0.18);
  border-color: rgba(92, 198, 176, 0.55);
}

.sub-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-form input {
  flex: 1 1 8rem;
  min-height: 42px;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(239, 231, 218, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7f0e5;
  font-family: inherit;
  font-size: 1rem;
}

.sub-form input::placeholder { color: rgba(239, 231, 218, 0.62); }

.sub-form button {
  min-height: 42px;
  padding: 0.4rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #0f211d;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.foot-base {
  grid-column: 1 / -1;
  margin-top: 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(239, 231, 218, 0.2);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.2rem;
  text-align: center;
}

.foot-base p {
  margin: 0;
  font-size: 1rem;
  color: rgba(239, 231, 218, 0.72);
}

.foot-base code {
  font-family: ui-monospace, Menlo, monospace;
  color: var(--sand);
}

/* --- back to top --- */
.totop {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(23, 38, 35, 0.2);
  background: rgba(251, 246, 238, 0.94);
  color: var(--ink);
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 12px 24px -18px rgba(23, 38, 35, 0.9);
}

.totop:hover { background: var(--teal); }

/* --- motion --- */
.js .rise {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.js .rise.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-badges a { animation: none; }
  .js .rise { opacity: 1; transform: none; transition: none; }
  .hero-fig img { transform: none; }
}

/* --- responsive --- */
@media (max-width: 62rem) {
  .nav-a,
  .nav-b { display: none; }
  .head-top { grid-template-columns: 1fr; justify-items: center; }
}

@media (max-width: 56rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; }
  .rail-list { grid-template-columns: 1fr 1fr; }
  .hero { min-height: auto; padding-top: 1.6rem; }
  .hero-badges {
    position: static;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }
  .site-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 34rem) {
  .hero-fig { aspect-ratio: 4 / 3; }
  .rail-list { grid-template-columns: minmax(0, 1fr); }
  .totop { right: 0.7rem; bottom: 0.7rem; }
}

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