:root {
  --ink: #15120d;
  --muted: #71695d;
  --paper: #f4efe5;
  --paper-2: #fffaf0;
  --card: rgba(255, 250, 240, 0.9);
  --line: rgba(21, 18, 13, 0.14);
  --ember: #e95f2a;
  --gold: #d6a138;
  --jade: #176f5b;
  --blue: #2452a6;
  --violet: #6c46a7;
  --shadow: 0 22px 70px rgba(70, 45, 18, 0.16);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(233, 95, 42, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 15%, rgba(23, 111, 91, 0.16), transparent 24rem),
    linear-gradient(135deg, #f8f0df 0%, #efe4d0 48%, #f6efe3 100%);
  font-family: "Iowan Old Style", "Songti SC", "Hiragino Mincho ProN", Georgia, serif;
  line-height: 1.65;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.32;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(21,18,13,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21,18,13,0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code, pre, .mono {
  font-family: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  background: var(--ink);
  color: var(--paper-2);
  padding: 10px 14px;
  border-radius: 999px;
  z-index: 20;
}
.skip-link:focus { top: 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: rgba(244, 239, 229, 0.78);
  border-bottom: 1px solid var(--line);
}
.navbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  letter-spacing: -0.04em;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--paper-2);
  border-radius: 14px;
  background: conic-gradient(from 210deg, var(--ember), var(--gold), var(--jade), var(--blue), var(--ember));
  box-shadow: 0 12px 28px rgba(233, 95, 42, 0.28);
}
.navlinks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.navlinks a {
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font: 700 14px/1.1 "Avenir Next", "PingFang SC", sans-serif;
}
.navlinks a:hover,
.navlinks a[aria-current="page"] {
  color: var(--ink);
  background: rgba(255, 250, 240, 0.72);
  border-color: var(--line);
}

.hero {
  position: relative;
  padding: clamp(44px, 7vw, 92px) 0 44px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: clamp(28px, 5vw, 68px);
  align-items: center;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(233, 95, 42, 0.25);
  background: rgba(255, 250, 240, 0.72);
  color: #8f3c1d;
  font: 800 13px/1 "Avenir Next", "PingFang SC", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
h1, h2, h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.055em;
}
h1 { font-size: clamp(46px, 8vw, 102px); max-width: 10ch; }
h2 { font-size: clamp(32px, 5vw, 62px); }
h3 { font-size: clamp(22px, 3vw, 34px); }
.lede {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2.3vw, 24px);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 10px 24px rgba(21,18,13,0.08);
  font: 900 14px/1 "Avenir Next", "PingFang SC", sans-serif;
}
.button.primary {
  border-color: transparent;
  background: var(--ink);
  color: var(--paper-2);
}
.button:hover { transform: translateY(-1px); }

.hero-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255,250,240,0.92), rgba(255,250,240,0.58));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(233,95,42,0.18);
}
.hero-card img {
  position: relative;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
}
.hero-card .caption {
  position: relative;
  margin: 16px 6px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font: 700 13px/1.4 "Avenir Next", "PingFang SC", sans-serif;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 34px 0 0;
}
.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,250,240,0.72);
}
.stat strong { display: block; font-size: 30px; line-height: 1; letter-spacing: -0.04em; }
.stat span { color: var(--muted); font: 800 12px/1.2 "Avenir Next", "PingFang SC", sans-serif; }

.section {
  padding: clamp(38px, 6vw, 78px) 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}
.section-head p { max-width: 620px; margin: 0; color: var(--muted); font-size: 18px; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: 0 14px 40px rgba(21,18,13,0.08);
  overflow: hidden;
}
.card.pad { padding: 22px; }
.card-media { padding: 12px 12px 0; }
.card-media img { border-radius: 18px; border: 1px solid var(--line); background: white; }
.card-body { padding: 18px 20px 20px; }
.card h3 { font-size: 25px; margin-bottom: 10px; }
.card p { margin: 0; color: var(--muted); }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(21,18,13,0.06);
  color: var(--muted);
  font: 800 12px/1 "Avenir Next", "PingFang SC", sans-serif;
}
.tag.hot { background: rgba(233,95,42,0.12); color: #9e3f1d; }

.ribbon-list {
  display: grid;
  gap: 12px;
}
.ribbon {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,250,240,0.74);
}
.ribbon-index {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--ink);
  color: var(--paper-2);
  font-weight: 900;
}
.ribbon h3 { font-size: 22px; margin-bottom: 4px; }
.ribbon p { margin: 0; color: var(--muted); }

.template-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.side-panel {
  position: sticky;
  top: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,250,240,0.82);
  box-shadow: 0 14px 38px rgba(21,18,13,0.08);
}
.search {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.65);
  color: var(--ink);
  font: 800 14px/1 "Avenir Next", "PingFang SC", sans-serif;
}
.filter-list { display: grid; gap: 8px; margin-top: 12px; }
.filter-list a {
  padding: 10px 12px;
  border-radius: 13px;
  color: var(--muted);
  font: 800 13px/1.2 "Avenir Next", "PingFang SC", sans-serif;
}
.filter-list a:hover { background: rgba(21,18,13,0.06); color: var(--ink); }
.template-stack { display: grid; gap: 20px; }
.template-card {
  scroll-margin-top: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255,250,240,0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.template-top {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.8fr);
  gap: 20px;
  padding: 22px;
}
.template-top img { border-radius: 20px; border: 1px solid var(--line); background: white; }
.template-copy h2 { font-size: clamp(27px, 4vw, 46px); margin-bottom: 12px; }
.template-copy p { margin: 0; color: var(--muted); font-size: 17px; }
.template-bullets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.template-bullets div { padding: 18px; border-right: 1px solid var(--line); }
.template-bullets div:last-child { border-right: 0; }
.template-bullets b { display: block; margin-bottom: 5px; font: 900 13px/1 "Avenir Next", "PingFang SC", sans-serif; }
.template-bullets span { color: var(--muted); font-size: 15px; }
.codebox {
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: #17130f;
  color: #fff3d9;
}
.codebox .copy-row {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
pre {
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: #17130f;
  color: #fff3d9;
  font-size: 13px;
  line-height: 1.55;
}

.timeline {
  display: grid;
  gap: 14px;
  counter-reset: step;
}
.timeline .step {
  position: relative;
  padding: 22px 22px 22px 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,250,240,0.78);
}
.timeline .step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 22px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--ember);
  color: white;
  font-weight: 900;
}
.copy-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.copy-btn {
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.08);
  color: #fff3d9;
  cursor: pointer;
  font: 800 12px/1 "Avenir Next", "PingFang SC", sans-serif;
}

.footer {
  margin-top: 46px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 800 13px/1.4 "Avenir Next", "PingFang SC", sans-serif;
}
.footer .shell { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.reveal { animation: rise 0.7s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 920px) {
  .hero-grid, .template-layout, .template-top { grid-template-columns: 1fr; }
  .side-panel { position: relative; top: 0; }
  .grid.three, .grid.two, .stats { grid-template-columns: 1fr; }
  .template-bullets { grid-template-columns: 1fr; }
  .template-bullets div { border-right: 0; border-bottom: 1px solid var(--line); }
  .template-bullets div:last-child { border-bottom: 0; }
  h1 { max-width: 100%; }
}
@media (max-width: 620px) {
  .navbar { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .navlinks { justify-content: flex-start; }
  .ribbon { grid-template-columns: 44px 1fr; }
  .ribbon .tag { grid-column: 2; width: max-content; }
}
