:root {
  --paper: #f4efe6;
  --paper-deep: #e7dfd0;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #5e584e;
  --pine: #1b4332;
  --pine-soft: #2d6a4f;
  --gold: #9a7432;
  --line: #ddd4c4;
  --tax: #8d3d2c;
  --shadow: 0 16px 40px rgba(48, 36, 16, 0.08);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
}
a { color: var(--pine); }
img { max-width: 100%; }
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: white;
  padding: 0.5rem 0.8rem;
  z-index: 20;
}
.skip:focus { top: 1rem; }

.topnote {
  background: var(--pine);
  color: #f3efe4;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.45rem 1rem;
}
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(244, 239, 230, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner, .wrap { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 4.2rem; }
.brand { font-family: var(--serif); font-weight: 620; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--gold); }
nav { display: flex; gap: 0.9rem; margin-left: auto; align-items: center; }
nav a { color: var(--ink); text-decoration: none; font-size: 0.95rem; }
nav a[aria-current="page"] { color: var(--pine); font-weight: 650; }
.lang { border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.7rem; text-decoration: none; color: var(--ink); }
.menu-btn {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font: inherit;
}

.hero { padding: 3.5rem 0 2rem; }
.hero h1, .page-head h1, .prose h2, .card h2, .result h2 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.12;
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); margin: 0 0 1rem; max-width: 14ch; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 42rem; }
.hero-grid, .calc-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1.5rem; align-items: start; }
.stack > * + * { margin-top: 1rem; }
.card, .result, .prose, .tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card, .result { padding: 1.25rem; }
.card h2, .result h2 { margin: 0 0 0.8rem; font-size: 1.45rem; }
label { display: block; font-size: 0.92rem; font-weight: 600; margin: 0.8rem 0 0.3rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #cfc6b6;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 8rem; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.check { display: flex; gap: 0.55rem; align-items: center; margin-top: 0.9rem; font-weight: 600; }
.check input { width: auto; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.25rem 0 0; }
.net { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3rem); margin: 0.2rem 0; color: var(--pine); }
.lines { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.lines li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.tax { color: var(--tax); }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding-bottom: 3rem; }
.tool { padding: 1.1rem 1.15rem 1.2rem; text-decoration: none; color: inherit; display: block; }
.tool:hover { border-color: var(--pine-soft); }
.tool strong { display: block; font-family: var(--serif); font-size: 1.35rem; font-weight: 560; margin-bottom: 0.35rem; }
.tool span { color: var(--muted); }
.page-head { padding: 2.2rem 0 0.4rem; }
.page-head h1 { font-size: clamp(2rem, 4vw, 3.3rem); margin: 0 0 0.6rem; max-width: 18ch; }
.calc-layout { padding-bottom: 1rem; }
.result { position: sticky; top: 5.4rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose { padding: 1.4rem 1.5rem 1.6rem; margin: 1.2rem 0 2.5rem; }
.prose h2 { font-size: 1.7rem; margin: 1.4rem 0 0.4rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.1rem 0 0.3rem; }
.sources { font-size: 0.92rem; }
.note {
  background: #f7f1e2;
  border-left: 4px solid var(--gold);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}
footer { border-top: 1px solid var(--line); padding: 2rem 0 2.6rem; color: var(--muted); font-size: 0.92rem; }
.footer-grid { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-grid a { color: var(--muted); }
.banner {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: #f6f1e7;
  padding: 0.9rem 1.2rem;
  z-index: 15;
}
.banner p { margin: 0; max-width: 46rem; }
.banner button, button.primary {
  font: inherit;
  background: #f3efe4;
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
}
button.ghost { background: transparent; color: #f6f1e7; border: 1px solid #8a8172; }
.adslot { margin: 1rem 0; text-align: center; }
.error { color: var(--tax); font-size: 0.9rem; min-height: 1.2rem; }

@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    padding: 0.8rem 1rem 1rem;
  }
  nav.open { display: flex; }
  .hero-grid, .calc-layout, .tools, .row { grid-template-columns: 1fr; }
  .result { position: static; }
  .banner { flex-direction: column; align-items: stretch; }
}
