:root {
  color-scheme: light;
  --paper: #fbf7ef;
  --surface: #fffdf8;
  --surface-2: #f1eadc;
  --ink: #17201a;
  --muted: #5d685f;
  --line: #d9cfbd;
  --forest: #1f5d43;
  --moss: #728a52;
  --copper: #a46035;
  --red: #8a3340;
  --gold: #c7973f;
  --night: #16201a;
  --blue: #2d5f73;
  --max: 1180px;
  --shadow: 0 16px 46px rgba(23, 32, 26, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.58;
}

a {
  color: inherit;
  text-decoration-color: rgba(31, 93, 67, 0.38);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--forest);
  text-decoration-color: currentColor;
}

img {
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(217, 207, 189, 0.88);
  background: rgba(251, 247, 239, 0.95);
  backdrop-filter: blur(18px);
}

.nav {
  width: min(100% - 32px, var(--max));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
  font-weight: 800;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 82vh;
  display: grid;
  align-items: center;
  padding: 76px 20px 84px;
  color: #fffaf0;
  background: var(--night);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -10% -12%;
  z-index: -2;
  background-image: url("https://raw.githubusercontent.com/TotoBa/CaiLama/main/img/logo-big.png");
  background-repeat: no-repeat;
  background-position: center 44%;
  background-size: min(980px, 132vw);
  opacity: 0.11;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 168px;
  z-index: -1;
  border-top: 1px solid rgba(255, 250, 240, 0.12);
  background: rgba(255, 250, 240, 0.04);
}

.hero-inner,
.page-hero-inner,
.section-inner {
  width: min(100%, var(--max));
  margin: 0 auto;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 52px;
  align-items: center;
}

.hero-logo {
  width: min(360px, 76vw);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 26px 50px rgba(0, 0, 0, 0.34));
}

.eyebrow {
  margin: 0 0 12px;
  color: #dbc58a;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.2rem, 8vw, 7rem);
  font-weight: 950;
}

h2 {
  font-size: clamp(2rem, 4.6vw, 3.45rem);
  font-weight: 920;
}

h3 {
  font-size: 1.24rem;
}

.lead {
  width: min(100%, 820px);
  margin: 22px 0 0;
  color: rgba(255, 250, 240, 0.86);
  font-size: clamp(1.08rem, 2vw, 1.42rem);
}

.page-lead {
  max-width: 860px;
  color: rgba(255, 250, 240, 0.86);
  font-size: clamp(1.02rem, 1.8vw, 1.28rem);
}

.hero-actions,
.button-row {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid rgba(255, 250, 240, 0.28);
  border-radius: 8px;
  color: #fffaf0;
  background: rgba(255, 250, 240, 0.1);
  font-weight: 850;
  text-decoration: none;
}

.button.primary {
  border-color: #dbc58a;
  color: #1c2119;
  background: #dbc58a;
}

.button.light {
  border-color: var(--forest);
  color: var(--forest);
  background: transparent;
}

.page-hero {
  padding: 76px 20px 66px;
  color: #fffaf0;
  background: var(--night);
}

main {
  background: var(--paper);
}

section {
  padding: 72px 20px;
}

.band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.section-head {
  max-width: 820px;
  margin-bottom: 30px;
}

.section-head p,
.muted {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

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

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

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

.card,
.repo-card,
.metric,
.step,
.doc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(23, 32, 26, 0.06);
}

.card,
.repo-card,
.doc-card {
  padding: 22px;
}

.card h3,
.repo-card h3,
.doc-card h3 {
  margin-bottom: 10px;
}

.card p,
.repo-card p,
.doc-card p,
.step p,
.metric p {
  margin: 0;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  margin-bottom: 14px;
  border-radius: 999px;
  color: #fffaf0;
  background: var(--forest);
  font-size: 0.78rem;
  font-weight: 900;
}

.tag.copper {
  background: var(--copper);
}

.tag.red {
  background: var(--red);
}

.tag.blue {
  background: var(--blue);
}

.tag.moss {
  background: var(--moss);
}

.repo-card {
  min-height: 255px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.repo-card ul,
.rich-list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.repo-card li,
.rich-list li {
  margin: 7px 0;
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 8px;
}

.diagram {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.flow-node {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.flow-node strong {
  display: block;
  margin-bottom: 8px;
}

.arrow {
  color: var(--copper);
  font-weight: 950;
  font-size: 1.5rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.step {
  min-height: 192px;
  padding: 20px;
  border-left: 4px solid var(--gold);
  border-radius: 0 8px 8px 0;
}

.step strong {
  display: block;
  margin-bottom: 10px;
}

.split {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 24px;
  align-items: start;
}

pre {
  margin: 0;
  padding: 22px;
  overflow-x: auto;
  border-radius: 8px;
  color: #f8f0dc;
  background: #151916;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

p code,
li code,
td code {
  padding: 0.08em 0.34em;
  border: 1px solid rgba(217, 207, 189, 0.85);
  border-radius: 5px;
  color: #233328;
  background: #f7efe0;
  font-size: 0.92em;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink);
  background: #f5eedf;
}

td {
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

.footer {
  padding: 34px 20px;
  color: rgba(255, 250, 240, 0.78);
  background: var(--night);
}

.footer .section-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.footer a {
  color: #fffaf0;
}

@media (max-width: 980px) {
  .hero-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .split,
  .timeline {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    text-align: center;
  }

  .lead,
  .hero-actions {
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
  }

  .flow {
    grid-template-columns: 1fr;
  }

  .arrow {
    transform: rotate(90deg);
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  section {
    padding: 56px 16px;
  }

  .hero,
  .page-hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .button-row,
  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  pre {
    font-size: 0.82rem;
  }
}
