/* 家で作るものの分量計算 共通スタイル
   外部ライブラリ・Webフォントは使わない（表示を速くするため） */

:root {
  --bg: #fbfaf7;
  --card: #ffffff;
  --text: #2b2a28;
  --muted: #6b675f;
  --line: #e4e0d6;
  --accent: #6b8f3e;      /* ぬか・野菜の緑 */
  --accent-dark: #4f6d2b;
  --accent-soft: #eef4e4;
  --warn-bg: #fff6e0;
  --warn-text: #7a5200;
  --warn-line: #f0c96b;
  --err-bg: #fdeceb;
  --err-text: #a3281f;
  --err-line: #eba59f;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
}

a { color: var(--accent-dark); }
a:hover { text-decoration: none; }

img { max-width: 100%; height: auto; }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- ヘッダー・フッター ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.site-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.9rem;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent-dark); }

.site-footer {
  margin-top: 48px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* ---------- 本文 ---------- */
main { padding-top: 16px; }

h1 { font-size: 1.5rem; line-height: 1.4; margin: 12px 0 8px; }
h2 {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 36px 0 12px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
}
h3 { font-size: 1.05rem; margin: 24px 0 8px; }

.lead { color: var(--muted); margin: 0 0 16px; }

.breadcrumb { font-size: 0.8rem; color: var(--muted); margin: 0; }
.breadcrumb a { color: var(--muted); }

.pr-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.notice {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.92rem;
  margin: 16px 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}

/* ---------- 表 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  font-size: 0.9rem;
  background: var(--card);
}
th, td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
th { background: #f4f1ea; font-weight: 700; }
td.num { text-align: right; white-space: nowrap; }

/* ---------- トップのメニュー ---------- */
.category { margin: 24px 0; }
.tool-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tool-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.tool-list a { font-weight: 700; }
.tool-list .desc { display: block; font-size: 0.88rem; color: var(--muted); }
.tool-list .soon { color: var(--muted); font-weight: 700; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1.6;
  padding: 0 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  background: #eeeae0;
  color: var(--muted);
  font-weight: 400;
}
.badge.open { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- 計算ツール ---------- */
.tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  overflow-x: auto;
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  background: #f4f1ea;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 0.88rem;
  line-height: 1.4;
  font-family: inherit;
  cursor: pointer;
}
.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.panel[hidden] { display: none; }

.field { margin: 0 0 14px; }
.field label, .field .label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.field .hint { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input {
  flex: 1 1 auto;
  width: 100%;
  max-width: 220px;
  font-size: 1.1rem;           /* 16px以上でiPhoneの自動拡大を防ぐ */
  padding: 10px 12px;
  border: 1px solid #cfc9bb;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}
.input-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.input-row .unit { color: var(--muted); }
.input-row input.is-error { border-color: var(--err-text); background: var(--err-bg); }
.input-row input.is-warn { border-color: var(--warn-line); background: var(--warn-bg); }

.radio-group { display: grid; gap: 6px; }
.radio-group label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
}
.radio-group input { margin-top: 6px; }

.result {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 8px;
}
.result dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.result dt { color: var(--muted); font-size: 0.9rem; align-self: center; }
.result dd { margin: 0; font-size: 1.05rem; font-weight: 700; text-align: right; }
.result dd.big { font-size: 1.5rem; color: var(--accent-dark); }
.result .sub { font-size: 0.82rem; color: var(--muted); margin: 8px 0 0; }

.msg { border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; margin: 8px 0 0; }
.msg:empty { display: none; }
.msg.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }
.msg.err { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-line); }

/* ---------- FAQ ---------- */
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 0;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 8px 0 0; }

.sources { font-size: 0.88rem; padding-left: 1.2em; }
.sources li { margin-bottom: 6px; word-break: break-all; }

/* ---------- 広告枠（今は空。中身が空のあいだは表示されない） ---------- */
.ad-slot {
  margin: 24px 0;
  text-align: center;
  min-height: 0;
}
.ad-slot:empty { display: none; }
.ad-slot::before {
  content: "広告";
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 4px;
}

@media (min-width: 640px) {
  h1 { font-size: 1.75rem; }
  .card { padding: 20px 24px; }
  .tab { font-size: 0.95rem; }
}
