:root {
  --ink: #14110d;
  --muted: #6c6254;
  --paper: #f4efe3;
  --surface: #fffaf0;
  --deep: #211713;
  --line: #d9c8aa;
  --gold: #b78633;
  --cinnabar: #8f2b1e;
  --jade: #24705a;
  --blue: #1f4b6e;
  --shadow: 0 20px 70px rgba(38, 23, 9, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 8%, rgba(183, 134, 51, 0.18), transparent 28rem),
    linear-gradient(90deg, rgba(20, 17, 13, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 17, 13, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 42px 42px, 42px 42px, auto;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.62;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 1.12rem;
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--deep);
  color: #f7d895;
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.astro-shell,
.section,
.page-main,
.article-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.astro-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(520px, 1.2fr);
  gap: 42px;
  align-items: center;
  padding: 58px 0 52px;
}

.hero-copy {
  position: relative;
  padding: 22px 0;
}

.hero-copy::before {
  content: "";
  position: absolute;
  width: min(38vw, 380px);
  aspect-ratio: 1;
  top: 16px;
  left: -34px;
  border: 1px solid rgba(183, 134, 51, 0.42);
  border-radius: 50%;
  box-shadow: inset 0 0 0 48px rgba(143, 43, 30, 0.05), inset 0 0 0 96px rgba(31, 75, 110, 0.04);
  pointer-events: none;
}

.kicker,
.post-meta,
.panel-label {
  margin: 0 0 12px;
  color: var(--cinnabar);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.16;
}

h1 {
  position: relative;
  max-width: 680px;
  margin-bottom: 22px;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: clamp(3.4rem, 7vw, 7.4rem);
  font-weight: 560;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 560;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.lead {
  position: relative;
  max-width: 620px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: clamp(1.06rem, 2vw, 1.22rem);
}

.fine-print {
  position: relative;
  max-width: 620px;
  margin-bottom: 0;
  color: #7b7062;
  font-size: 0.92rem;
}

.calculator {
  border: 1px solid rgba(80, 54, 25, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.96), rgba(244, 239, 227, 0.86)),
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(183, 134, 51, 0.08) 34px 35px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.birth-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.72);
}

.birth-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.date-field {
  grid-column: span 2;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.date-selects {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr 0.85fr;
  gap: 8px;
}

.date-selects label {
  gap: 4px;
}

.date-selects label span {
  color: #8a7b66;
  font-size: 0.72rem;
}

.birth-form input,
.birth-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--ink);
}

.custom-city-field[hidden] {
  display: none;
}

.birth-map {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(70px, 0.82fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  background: rgba(255, 250, 240, 0.72);
}

.map-canvas {
  position: relative;
  height: 58px;
  border: 1px solid rgba(80, 54, 25, 0.22);
  border-radius: 4px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(36, 112, 90, 0.18), transparent 42%),
    linear-gradient(315deg, rgba(31, 75, 110, 0.16), transparent 46%),
    rgba(244, 239, 227, 0.98);
}

.map-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(20, 17, 13, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 17, 13, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
}

.map-pin {
  position: absolute;
  width: 12px;
  height: 12px;
  left: 50%;
  top: 50%;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 0 0 5px rgba(143, 43, 30, 0.18);
  transform: translate(-50%, -50%);
}

.map-label,
.map-coords {
  display: block;
}

.map-label {
  color: var(--ink);
  font-weight: 800;
}

.map-coords {
  color: var(--muted);
  font-size: 0.78rem;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--deep);
  border-radius: 4px;
  padding: 9px 18px;
  background: var(--deep);
  color: #f7d895;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  background: #34231d;
}

.text-link {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--cinnabar);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.chart-board {
  padding: 18px;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.pillar {
  min-height: 178px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.84);
  overflow: hidden;
}

.pillar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.pillar-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 8px;
  padding: 12px 8px;
}

.stem,
.branch {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1;
}

.branch {
  color: var(--cinnabar);
}

.pillar-foot {
  min-height: 34px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 12px;
}

.reading-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 250, 240, 0.78);
}

.reading-panel.wide {
  grid-column: 1 / -1;
}

.reading-panel h2 {
  margin-bottom: 8px;
  color: var(--cinnabar);
  font-size: clamp(2rem, 4vw, 3rem);
}

.reading-panel p:last-child {
  margin-bottom: 0;
}

.element-bars {
  display: grid;
  gap: 9px;
}

.element-row {
  display: grid;
  grid-template-columns: 32px 1fr 28px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.element-track {
  height: 10px;
  border: 1px solid rgba(80, 54, 25, 0.18);
  border-radius: 999px;
  background: rgba(20, 17, 13, 0.05);
  overflow: hidden;
}

.element-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.element-fill.wood {
  background: var(--jade);
}

.element-fill.fire {
  background: var(--cinnabar);
}

.element-fill.earth {
  background: var(--gold);
}

.element-fill.metal {
  background: #7b7f83;
}

.element-fill.water {
  background: var(--blue);
}

.reading-lines {
  display: grid;
  gap: 10px;
}

.reading-line {
  margin: 0;
  color: var(--muted);
}

.reading-line strong {
  color: var(--ink);
}

.section {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 22px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.method-grid article,
.post-row,
.archive-item {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.method-grid p,
.post-row p,
.archive-item p,
.article p,
.archive-hero p {
  color: var(--muted);
}

.page-main {
  padding: 72px 0 96px;
}

.archive-hero {
  margin-bottom: 36px;
}

.archive-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.filter-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.filter-button.active {
  border-color: var(--deep);
  background: var(--deep);
  color: #f7d895;
}

.archive-list {
  border-top: 1px solid var(--line);
}

.archive-item {
  border-bottom: 1px solid var(--line);
  padding-top: 0;
}

.archive-item a {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding: 26px 0;
}

.article-main {
  padding: 72px 0 104px;
}

.article {
  max-width: 760px;
}

.article-header {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.article .dek {
  color: var(--muted);
  font-size: 1.22rem;
}

.article h2 {
  margin: 42px 0 14px;
  font-size: 1.7rem;
}

.site-footer {
  width: min(1180px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
}

.site-footer a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 980px) {
  .astro-shell {
    grid-template-columns: 1fr;
  }

  .birth-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header,
  .site-footer,
  .astro-shell,
  .section,
  .page-main,
  .article-main {
    width: calc(100% - 32px);
  }

  .site-header {
    min-height: auto;
    padding: 16px 0;
    align-items: flex-start;
  }

  .site-nav {
    gap: 12px;
    font-size: 0.88rem;
  }

  .astro-shell {
    min-height: auto;
    padding: 42px 0 38px;
  }

  .hero-copy::before {
    width: 260px;
    left: -64px;
  }

  .birth-form,
  .pillar-grid,
  .analysis-grid,
  .method-grid,
  .section-head,
  .archive-item a {
    grid-template-columns: 1fr;
  }

  .date-field {
    grid-column: auto;
  }

  .pillar {
    min-height: 142px;
  }

  .pillar-body {
    grid-template-columns: 90px 90px;
    justify-content: center;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 4.6rem);
  }
}
