:root {
  --white: #ffffff;
  --off: #f7f6f3;
  --ink: #111010;
  --ink2: #3d3b38;
  --ink3: #7a7772;
  --border: #e5e2db;
  --red: #d94f3d;
  --red-lt: #fdf1f0;
  --jade: #2a7d5f;
  --jade-lt: #eef7f3;
  --r: 12px;
  --r-lg: 20px;
  --nav-h: 64px;
  --legal-max: 760px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: var(--white);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a {
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(217, 79, 61, 0.35);
  transition: border-color 0.15s, color 0.15s;
}

a:hover {
  border-bottom-color: var(--red);
  color: #c03d2d;
}

/* —— Nav —— */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: none;
}

.nav-brand:hover {
  color: var(--ink);
  border-bottom: none;
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
}

.nav-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.nav-tld {
  color: var(--red);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink2);
  text-decoration: none;
  border-bottom: none;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: var(--off);
  color: var(--ink);
}

.nav-links a.current {
  background: var(--red-lt);
  color: var(--red);
}

/* —— Legal content —— */
.legal {
  max-width: var(--legal-max);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 32px) 2rem 4rem;
}

.legal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red-lt);
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 1rem;
}

.legal h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.legal .meta,
.legal-meta {
  font-size: 0.82rem;
  color: var(--ink3);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.55;
}

.legal .meta b,
.legal-meta b {
  color: var(--ink2);
  font-weight: 600;
}

.legal h2 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2.25rem 0 0.75rem;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.legal h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 1.35rem 0 0.5rem;
}

.legal p,
.legal li {
  font-size: 0.9rem;
  line-height: 1.72;
  color: var(--ink2);
  margin-bottom: 0.85rem;
}

.legal ul,
.legal ol {
  margin: 0 0 1rem 1.2rem;
}

.legal li {
  margin-bottom: 0.4rem;
}

.legal strong,
.legal b {
  color: var(--ink);
  font-weight: 700;
}

.legal code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8em;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  color: var(--ink);
}

/* TOC */
.toc {
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.25rem 1rem;
  margin: 0 0 2rem;
}

.toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 0.75rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 1;
}

@media (min-width: 640px) {
  .toc ol {
    columns: 2;
    column-gap: 1.5rem;
  }
}

.toc li {
  break-inside: avoid;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
  color: var(--ink2);
}

.toc a {
  font-weight: 500;
  border-bottom: none;
  color: var(--ink2);
}

.toc a:hover {
  color: var(--red);
}

/* Glance / note boxes */
.box,
.legal-note {
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
  margin: 1.15rem 0 1.5rem;
}

.box ul {
  margin-bottom: 0;
}

.box li,
.legal-note {
  font-size: 0.85rem;
  color: var(--ink2);
  line-height: 1.65;
}

.box-jade {
  background: var(--jade-lt);
  border-color: rgba(42, 125, 95, 0.25);
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--white);
}

.legal table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0;
}

.legal th,
.legal td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink2);
  line-height: 1.5;
}

.legal th {
  background: var(--off);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.legal tr:last-child td {
  border-bottom: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: calc(var(--legal-max) + 4rem);
  margin: 0 auto;
}

.foot-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-bottom: none;
}

.foot-brand:hover {
  color: var(--ink);
  border-bottom: none;
}

.foot-dot {
  color: var(--red);
}

.foot-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  flex-wrap: wrap;
}

.foot-links a {
  font-size: 0.77rem;
  color: var(--ink3);
  text-decoration: none;
  border-bottom: none;
  font-weight: 500;
}

.foot-links a:hover {
  color: var(--red);
}

.foot-links a.current {
  color: var(--ink);
  font-weight: 600;
}

.foot-copy {
  font-size: 0.7rem;
  color: var(--ink3);
}

@media (max-width: 680px) {
  .site-nav {
    padding: 0 1.1rem;
  }

  .nav-name {
    display: none;
  }

  .nav-links a {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
  }

  .legal {
    padding: calc(var(--nav-h) + 24px) 1.15rem 3rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 1.15rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --white: #121110;
    --off: #1c1b19;
    --ink: #f3f1ec;
    --ink2: #c9c5bd;
    --ink3: #8a8680;
    --border: #2e2c28;
    --red: #e86a58;
    --red-lt: #2a1a17;
    --jade: #3a9e78;
    --jade-lt: #15241e;
  }

  .site-nav {
    background: rgba(18, 17, 16, 0.92);
  }

  .nav-icon {
    background: var(--ink);
    color: var(--white);
  }

  .legal th {
    background: var(--off);
  }
}
