
:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-alt: #eefbf3;
  --text: #16211b;
  --muted: #5d6f65;
  --border: #dde7e1;
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-soft: #dcfce7;
  --accent: #0f766e;
  --shadow: 0 10px 30px rgba(22, 33, 27, 0.06);
  --radius: 18px;
  --max: 1280px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--text); background: linear-gradient(180deg,#f8fbf9 0%,#f3f7f5 100%); line-height: 1.55; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }
img, svg { max-width: 100%; }
.container { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.88); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(221,231,225,.8); }
.header-inner { display: flex; align-items: center; gap: 14px; padding: 12px 0; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 14px; box-shadow: 0 8px 20px rgba(34,197,94,.25); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.03em; color: #173022; }
.brand-name span { color: var(--primary); }
.brand-sub { font-size: 0.72rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; margin-top: 2px; }
.nav-toggle { display: none; margin-left: auto; width: 44px; height: 44px; border: 1px solid var(--border); background: #fff; border-radius: 12px; cursor: pointer; padding: 10px; flex-direction: column; justify-content: center; gap: 5px; }
.nav-toggle span { display: block; height: 2px; background: #334155; border-radius: 2px; transition: .2s; }
.main-nav { display: flex; align-items: center; gap: 1px; margin-left: auto; min-width: 0; flex-wrap: nowrap; }
.nav-link, .dd-toggle { appearance: none; border: 0; background: transparent; padding: 9px 10px; border-radius: 10px; color: #334155; font: 600 0.88rem/1 Inter, sans-serif; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.brand { min-width: 0; }
.nav-link:hover, .dd-toggle:hover, .nav-item.open .dd-toggle { background: #f0faf4; color: var(--primary-dark); }
.nav-link.active, .dd-toggle.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-link-accent { color: var(--primary-dark); }
.dd-chev { transition: transform .2s; opacity: .7; }
.nav-item.open .dd-chev { transform: rotate(180deg); }
.nav-item { position: relative; }
.dd-panel { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(6px); width: min(560px, calc(100vw - 32px)); max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 20px 50px rgba(15,23,42,.12); padding: 18px; opacity: 0; visibility: hidden; transition: .2s ease; z-index: 120; }
.nav-item.open .dd-panel { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
/* keep within viewport */
.nav-item:last-child .dd-panel, .nav-item:nth-last-child(2) .dd-panel { left: auto; right: 0; transform: translateY(6px); }
.nav-item:last-child.open .dd-panel, .nav-item:nth-last-child(2).open .dd-panel { transform: translateY(0); }
.dd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid #edf2ef; }
.dd-title { font-size: 1rem; font-weight: 800; color: #1a2e24; }
.dd-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.dd-cat { font-size: 0.82rem; font-weight: 700; color: var(--primary-dark); background: var(--primary-soft); padding: 7px 12px; border-radius: 999px; white-space: nowrap; }
.dd-cat:hover { background: #bbf7d0; color: #166534; }
.dd-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; max-height: min(60vh, 420px); overflow: auto; padding-right: 2px; }
.dd-link { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; color: var(--text); transition: .15s; }
.dd-link:hover { background: #f6fbf8; color: var(--primary-dark); }
.dd-link-title { font-size: 0.88rem; font-weight: 600; line-height: 1.3; }
.dd-link-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

/* Hero and general */
.hero { padding: 52px 0 28px; }
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 24px; align-items: stretch; }
.hero-card, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-card { padding: 36px; background: linear-gradient(180deg,#fff 0%,#fbfefd 100%); }
.eyebrow { display: inline-flex; padding: 6px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 0.78rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 16px; }
h1,h2,h3,h4 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); letter-spacing: -0.02em; }
p { margin: 0 0 14px; }
.lead { font-size: 1.08rem; color: #41554b; max-width: 68ch; }
.hero-accent { color: var(--primary); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px; font-weight: 700; border: 1px solid transparent; cursor: pointer; font: inherit; transition: .15s; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(22,163,74,.2); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; padding: 24px; }
.stat { padding: 18px; border-radius: 14px; background: #f8fbf9; border: 1px solid #e4efe8; }
.stat strong { display: block; font-size: 1.6rem; color: #166534; }
.stat span { color: var(--muted); font-size: 0.9rem; }
.section { padding: 24px 0; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
.section-head p { color: var(--muted); max-width: 70ch; margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.category-card, .tool-card { padding: 22px; }
.category-card h3, .tool-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.category-card p, .tool-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 14px; }
.meta { display: inline-flex; font-size: 0.75rem; font-weight: 700; color: #166534; background: #ecfdf5; padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.tool-link { font-weight: 700; }
.search-bar { display: flex; gap: 10px; margin-top: 22px; }
.search-bar input { flex: 1; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border); font: inherit; }
.search-bar input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #bbf7d0; border-color: #4ade80; }
.breadcrumbs { font-size: 0.88rem; color: var(--muted); padding: 20px 0 0; }
.breadcrumbs a { color: var(--muted); }
.page-hero { padding: 28px 0 18px; }
.page-hero .card { padding: 30px; }
.calc-layout { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); gap: 20px; padding: 10px 0 24px; }
.calc-panel, .content-panel { padding: 24px; }
.panel-title { font-size: 1.1rem; margin-bottom: 16px; }
.fields { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; font-size: 0.93rem; }
.field .help { font-size: 0.82rem; color: var(--muted); }
.input-wrap { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.input-wrap span { padding: 0 12px; display: inline-flex; align-items: center; color: var(--muted); background: #f8fafc; border-right: 1px solid var(--border); font-size: 0.9rem; }
.input-wrap span.suffix { border-right: 0; border-left: 1px solid var(--border); }
.input-wrap input, .input-wrap select { border: 0; width: 100%; padding: 12px 13px; font: inherit; min-width: 0; background: #fff; }
.field > input, .field > select, .field > textarea { width: 100%; padding: 12px 13px; font: inherit; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.calc-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.results { display: grid; gap: 12px; }
.result-item { padding: 14px 16px; background: #f7fcf9; border: 1px solid #d7ede0; border-radius: 12px; }
.result-item .label { color: var(--muted); font-size: 0.84rem; margin-bottom: 4px; }
.result-item .value { font-size: 1.3rem; font-weight: 800; color: #102219; word-break: break-word; }
.result-item.text .value { font-size: 1rem; font-weight: 650; }
.note { font-size: 0.86rem; color: var(--muted); margin-top: 12px; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; padding-bottom: 24px; }
.content-panel h2 { font-size: 1.2rem; margin-bottom: 12px; }
.content-panel ul, .content-panel ol { margin: 0; padding-left: 20px; color: #334155; }
.content-panel li + li { margin-top: 8px; }
.formula { background: #16251d; color: #e5f3eb; padding: 16px; border-radius: 12px; overflow-x: auto; font-family: Consolas, "Courier New", monospace; font-size: 0.92rem; line-height: 1.7; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { background: #f8fafc; color: #334155; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }
.faq details { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fff; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { margin: 10px 0 0; color: #334155; }
.related-links { display: flex; flex-wrap: wrap; gap: 10px; }
.related-links a { padding: 8px 12px; border-radius: 999px; background: #ecfdf5; color: #166534; font-weight: 600; font-size: 0.88rem; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* Footer */
.site-footer { margin-top: 32px; padding: 44px 0 20px; background: #121a16; color: #c7d4cd; }
.footer-top { display: grid; grid-template-columns: 300px 1fr; gap: 36px; }
.footer-brand-wrap .brand-name { color: #f3fbf6; }
.footer-brand-wrap .brand-sub { color: #96a89d; }
.footer-tagline { margin: 16px 0; color: #a8b8af; max-width: 32ch; font-size: 0.95rem; }
.footer-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-pill { font-size: 0.75rem; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.18); }
.footer-cols { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 24px 20px; }
.footer-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.site-footer h4 { color: #f3fbf6; font-size: 0.88rem; margin: 0; }
.footer-cat-link { font-size: 0.74rem; font-weight: 700; color: #86efac; white-space: nowrap; }
.footer-cat-link:hover { color: #bbf7d0; }
.footer-links { display: flex; flex-direction: column; gap: 4px; }
.footer-links a { color: #aebdb5; font-size: 0.84rem; padding: 2px 0; }
.footer-links a:hover { color: #fff; transform: translateX(2px); display: inline-block; }
.footer-bottom { border-top: 1px solid rgba(148,163,184,.14); margin-top: 32px; padding-top: 16px; font-size: 0.86rem; color: #91a199; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-bottom-links { display: inline-flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.footer-bottom a { color: #91a199; }
.footer-bottom a:hover { color: #fff; }
.footer-built { color: #c7d4cd; padding-left: 14px; border-left: 1px solid rgba(148,163,184,.2); }
.footer-built strong { color: #86efac; font-weight: 700; }

/* Scientific calc */
.sci-calc { display: grid; gap: 10px; }
.sci-display { width: 100%; padding: 14px; font: 600 1.2rem/1.2 Consolas, monospace; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
.sci-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.sci-grid button { padding: 12px 8px; border: 1px solid var(--border); background: #fff; border-radius: 10px; font: 600 0.95rem Inter,sans-serif; cursor: pointer; }
.sci-grid button:hover { background: #f1f5f9; }
.sci-grid .op { background: #ecfdf5; color: #166534; }
.sci-grid .eq { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 1100px) {
  .main-nav { gap: 0; }
  .nav-link, .dd-toggle { padding: 10px 8px; font-size: 0.87rem; }
  .footer-top { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 1180px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 12px 16px 20px; flex-direction: column; align-items: stretch; gap: 2px; box-shadow: 0 20px 40px rgba(0,0,0,.08); max-height: calc(100vh - 72px); overflow: auto; z-index: 120; }
  .main-nav.open { display: flex; }
  .nav-item { width: 100%; position: static; }
  .nav-link, .dd-toggle { width: 100%; justify-content: space-between; padding: 12px; font-size: 0.95rem; }
  .dd-panel, .nav-item:last-child .dd-panel, .nav-item:nth-last-child(2) .dd-panel { position: static !important; left: auto !important; right: auto !important; width: 100% !important; max-height: 0; padding: 0 12px; opacity: 1 !important; visibility: visible !important; overflow: hidden; border: 0; box-shadow: none; background: #f8fbf9; border-radius: 12px; transform: none !important; transition: max-height .25s ease, padding .25s ease, margin .25s ease; }
  .nav-item.open .dd-panel { max-height: 70vh; padding: 12px; margin: 2px 0 6px; }
  .dd-grid { grid-template-columns: 1fr; max-height: 50vh; overflow: auto; }
  .grid-4, .footer-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .calc-layout, .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .grid-3, .grid-2, .grid-4, .content-grid, .stats, .footer-cols { grid-template-columns: 1fr; }
  .hero-card, .page-hero .card, .calc-panel, .content-panel, .category-card, .tool-card { padding: 20px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .search-bar { flex-direction: column; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .footer-built { border-left: 0; padding-left: 0; }
  .brand-name { font-size: 1.3rem; }
}
@media print {
  .site-header, .site-footer, .calc-actions .btn-secondary, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

.dd-grid::-webkit-scrollbar { width: 8px; }
.dd-grid::-webkit-scrollbar-thumb { background: #d1ddd6; border-radius: 8px; }
.dd-grid::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 1024px){ .site-header { position: sticky; } .main-nav{z-index:99;} }
