/* Hand-written replacement for the old Tailwind build. Light + dark themes. */
:root {
  --bg: #f9fafb; --fg: #111827; --muted: #6b7280; --card: #ffffff; --line: #e5e7eb;
  --nav: #ffffff; --foot: #f3f4f6; --input: #ffffff; --accent: #3b82f6; --accent-hover: #2563eb;
  --error: #b91c1c; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}
.dark {
  --bg: #1f2937; --fg: #e5e7eb; --muted: #9ca3af; --card: #374151; --line: #4b5563;
  --nav: #111827; --foot: #111827; --input: #4b5563; --error: #fca5a5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
html.dark { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--fg); transition: background-color .3s, color .3s;
}
main { flex: 1; padding: 2rem 1rem; }
.container { max-width: 64rem; margin: 0 auto; }
a { color: var(--accent); }
h1 { font-size: 1.9rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { max-width: 38rem; margin: 0 auto 1.5rem; }

/* nav */
.nav { background: var(--nav); box-shadow: var(--shadow); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .75rem 1rem; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--fg); text-decoration: none; }
.brand:hover, .nav-links a:hover, .footer a:hover { text-decoration: underline; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: var(--fg); text-decoration: none; }
.theme-btn { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: .35rem; padding: .15rem .6rem; cursor: pointer; }
.menu-btn { display: none; background: none; border: 0; color: var(--fg); font-size: 1.4rem; cursor: pointer; }
@media (max-width: 767px) {
  .menu-btn { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding-top: .75rem; gap: .6rem; }
  .nav-links.open { display: flex; }
}

/* calculator */
.calc { max-width: 28rem; margin: 0 auto; }
.card { background: var(--card); border-radius: .75rem; box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; transition: background-color .3s; }
.form { display: flex; flex-direction: column; gap: .8rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }
.form input, .form select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: .35rem;
  background: var(--input); color: var(--fg); width: 100%;
}
.units { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.units legend { font-weight: 500; padding: 0; margin-bottom: .25rem; }
.form .unit-opt { flex-direction: row; align-items: center; gap: .35rem; font-weight: 400; cursor: pointer; }
.form .unit-opt input { width: auto; }
.height { display: flex; flex-direction: column; gap: .25rem; }
.field-label { font-weight: 500; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.form .inline { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
.hint { font-size: .78rem; color: var(--muted); font-weight: 400; }
.btn { font: inherit; background: var(--accent); color: #fff; border: 0; border-radius: .35rem; padding: .6rem; margin-top: .25rem; cursor: pointer; }
.btn:hover { background: var(--accent-hover); }
.error { color: var(--error); margin: 0; font-size: .9rem; }
.warn { margin: .5rem 0 0; padding: .5rem .6rem; border-radius: .35rem; background: #fef3c7; color: #78350f; }
.dark .warn { background: #78350f; color: #fef3c7; }
.results { margin-top: 1.25rem; }
.row { display: flex; justify-content: space-between; align-items: center; padding: .3rem 0; font-size: .95rem; }
.row + .row { border-top: 1px solid var(--line); }
.label { display: inline-flex; align-items: center; }
.value { text-align: right; }
.strong { font-weight: 700; }
.macro { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: .3rem 0; }
.macro span { text-align: right; }
.water { display: flex; justify-content: space-between; margin: 0; }

/* info tooltip */
.info {
  position: relative; margin-left: .4rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 1px solid var(--muted); background: none; color: var(--muted);
  font: italic 600 .7rem/1 Georgia, serif; cursor: pointer; padding: 0;
}
.info.open::after {
  content: attr(data-tip); position: absolute; left: 1.5rem; top: -.25rem; z-index: 20; width: 14rem;
  padding: .5rem; border-radius: .35rem; background: #1f2937; color: #fff; text-align: left;
  font: 400 .78rem/1.4 system-ui, sans-serif; box-shadow: var(--shadow);
}

/* prose pages */
.prose { max-width: 42rem; margin: 2.5rem auto 0; }
.prose h2 { margin-top: 1.6rem; font-size: 1.3rem; }
.prose h3 { margin: 1.2rem 0 .3rem; font-size: 1.05rem; }
main > .prose:first-child { margin-top: 0; }

/* footer */
.footer { background: var(--foot); padding: 1.5rem 1rem; text-align: center; }
.footer a { color: var(--fg); text-decoration: none; }
.footer p { margin: .4rem 0; }
