/* MaterialSum — mobile-first, lightweight */
:root {
  --brand: #0e7c66;
  --brand-dark: #0a5d4d;
  --bg: #fbfaf7;
  --card: #ffffff;
  --ink: #1c2b29;
  --muted: #5d6f6c;
  --line: #e3e7e5;
  --accent: #f4a259;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  overflow-wrap: break-word;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--brand) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M9 20h14v3H9zM12 9h3v9h-3zM17 12h3v6h-3z" fill="white"/></svg>') center/14px no-repeat; }
.site-header nav ul { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 0; }
.site-header nav a { display: inline-block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 0.92rem; min-height: 44px; line-height: 28px; }
.site-header nav a:hover { background: #eef4f2; color: var(--brand-dark); }

/* breadcrumbs */
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 16px 0 4px; padding: 0; font-size: 0.85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }

/* headings & intro */
h1 { font-size: 1.7rem; line-height: 1.25; margin: 8px 0 8px; }
.intro { color: var(--muted); margin: 0 0 16px; }

/* calculator card */
.calculator { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(20, 40, 35, 0.05); }
.calc-top { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.unit-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.unit-btn { border: 0; background: transparent; padding: 8px 14px; font-size: 0.9rem; cursor: pointer; color: var(--muted); min-height: 40px; }
.unit-btn.is-active { background: var(--brand); color: #fff; font-weight: 600; }

.calc-group { border: 0; padding: 0; margin: 0 0 6px; }
.calc-group legend { font-weight: 600; font-size: 0.95rem; padding: 0; margin-bottom: 8px; }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.field label, .field .label-text { display: block; font-size: 0.84rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field-full { grid-column: 1 / -1; }
.input-row { display: flex; align-items: center; gap: 6px; background: #f6f8f7; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; min-height: 46px; }
.input-row:focus-within { border-color: var(--brand); background: #fff; }
.input-row input { flex: 1; border: 0; background: transparent; padding: 10px 0; font-size: 1rem; width: 100%; min-width: 0; outline: none; color: var(--ink); }
.prefix { color: var(--muted); }
.unit { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.hint { color: var(--muted); font-size: 0.78rem; }
select { width: 100%; min-height: 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f6f8f7; font-size: 0.95rem; color: var(--ink); }
select:focus { outline: 2px solid var(--brand); outline-offset: 1px; background: #fff; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); padding: 9px 14px; border-radius: 8px; cursor: pointer; background: #f6f8f7; min-height: 44px; }
.radio-pill:has(input:checked) { border-color: var(--brand); background: #eaf4f1; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--brand); }

/* results */
.results { margin-top: 16px; border-top: 2px solid var(--brand); padding-top: 14px; }
.results-empty { color: var(--muted); font-size: 0.95rem; }
.results-primary { font-size: 1.15rem; margin: 0 0 10px; }
.results-primary strong { color: var(--brand-dark); font-size: 1.3rem; }
.results-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.results-table th, .results-table td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.results-table th { font-weight: 500; color: var(--muted); white-space: normal; }

/* content sections */
.content-block { margin: 28px 0; }
.content-block h2 { font-size: 1.25rem; margin: 0 0 10px; }
.howto { margin: 0; padding-left: 20px; }
.howto li { margin: 6px 0; }
.formula { background: #f2f5f4; border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: 0.95rem; }
.disclaimer { background: #fdf6ec; border: 1px solid #f0e2c8; padding: 10px 14px; border-radius: 8px; font-size: 0.88rem; color: #6a5836; }

/* tool cards */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tool-card { display: flex; flex-direction: column; gap: 3px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; text-decoration: none; color: var(--ink); min-height: 76px; }
.tool-card:hover { border-color: var(--brand); box-shadow: 0 2px 6px rgba(14, 124, 102, 0.12); }
.tool-name { font-weight: 600; font-size: 0.98rem; color: var(--brand-dark); }
.tool-desc { font-size: 0.84rem; color: var(--muted); line-height: 1.45; }

/* faq */
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 0; margin: 8px 0; }
.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 0.95rem; list-style-position: inside; }
.faq details p { margin: 0; padding: 0 14px 12px; color: var(--muted); font-size: 0.92rem; }

/* home */
.home-hero { padding: 28px 0 6px; }
.home-hero h1 { font-size: 2.1rem; margin: 0 0 4px; }
.tagline { font-size: 1.15rem; color: var(--brand-dark); font-weight: 600; margin: 0 0 6px; }
.supporting { color: var(--muted); margin: 0 0 18px; }
.search-wrap { max-width: 460px; }
#tool-search { width: 100%; padding: 12px 14px; font-size: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-height: 48px; }
#tool-search:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.no-results { color: var(--muted); }
.cat-desc { color: var(--muted); margin: 0 0 10px; }

/* error + content pages */
.error-page { padding: 40px 0; }
.btn { display: inline-block; background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.content-page { padding: 8px 0 24px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0; background: var(--card); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { font-size: 1.05rem; color: var(--ink); }
.footer-tag { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-footer nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; padding: 4px 0; display: inline-block; }
.footer-legal { margin-top: 16px; }
.footer-legal p { color: var(--muted); font-size: 0.8rem; margin: 0; }

/* ad slots (hidden placeholders for future monetization) */
.ad-slot { display: none; }

@media (max-width: 480px) {
  h1 { font-size: 1.45rem; }
  .home-hero h1 { font-size: 1.7rem; }
  .fields-grid { grid-template-columns: 1fr 1fr; }
  .field-full { grid-column: 1 / -1; }
  .results-primary { font-size: 1.05rem; }
  .results-primary strong { font-size: 1.15rem; }
}
@media (max-width: 360px) {
  .fields-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
}
@media (min-width: 769px) {
  .wrap { padding: 0 24px; }
}
