/* こそだておかね計算室
   母子手帳の記録欄のように「日付ごとに書きこむ」をモチーフにする。
   藤(fuji)を基調に、もらえるお金・できごとの印に若葉(wakaba)を使う。 */
:root {
  --paper: #fdfcfb;
  --sheet: #ffffff;
  --ink: #2b2733;
  --muted: #625c6e;
  --rule: #ddd6e8;
  --fuji: #5b4b9a;
  --fuji-ink: #ffffff;
  --fuji-soft: #f4f1fa;
  --wakaba: #5e8c3a;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17151b;
    --sheet: #1f1c25;
    --ink: #ebe7f1;
    --muted: #aaa3b6;
    --rule: #3b3546;
    --fuji: #b3a6e6;
    --fuji-ink: #1c1730;
    --fuji-soft: #272235;
    --wakaba: #9cc77a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.9; }
a { color: var(--fuji); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--fuji); outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

header.site { border-bottom: 1px solid var(--rule); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 14px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { text-decoration: none; color: var(--fuji); font-weight: 700; font-size: 19px; letter-spacing: .06em; }
nav.top { display: flex; gap: 18px; font-size: 14px; }
nav.top a { color: var(--muted); text-decoration: none; }
nav.top a:hover { color: var(--fuji); text-decoration: underline; }

.crumbs { font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.crumbs a { color: var(--muted); }
h1, h2, h3 { font-weight: 700; letter-spacing: .03em; }
h1 { font-size: clamp(24px, 4.6vw, 30px); line-height: 1.5; margin: 10px 0 8px; }
h2 { font-size: 20px; line-height: 1.5; margin: 44px 0 12px; }
h3 { font-size: 17px; margin: 26px 0 6px; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 36em; }
article p, article li { max-width: 36em; }

.hero { padding: 36px 0 6px; }
.hero h1 { font-size: clamp(26px, 5.6vw, 38px); line-height: 1.45; margin: 0 0 12px; max-width: 15em; }
.hero p { color: var(--muted); margin: 0; max-width: 34em; }

/* 入力欄 */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; padding: 22px; margin: 20px 0; }
.tool label { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 5px; }
.tool .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.tool input, .tool select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--fuji-soft); color: var(--ink); }
.tool input:focus { outline: 2px solid var(--fuji); outline-offset: 0; border-color: var(--fuji); }
.tool input[type="checkbox"] { width: auto; accent-color: var(--fuji); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 12px; }
.checks label, .tool label.chk { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; font-size: 15px; }
button { font: inherit; font-weight: 700; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--fuji); background: var(--fuji); color: var(--fuji-ink); cursor: pointer; margin: 14px 8px 0 0; }
button.sub, button.del { background: transparent; color: var(--fuji); }
button.del { font-size: 13px; padding: 4px 12px; margin-top: 6px; }
.kid { border-bottom: 1px dashed var(--rule); padding-bottom: 12px; }

/* 見せ場:日付順のタイムライン(母子手帳の記録欄のように、日付と内容を並べる) */
ol.timeline { list-style: none; margin: 22px 0 4px; padding: 0 0 0 4px; position: relative; }
ol.timeline::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: var(--rule); }
ol.timeline li { position: relative; padding: 0 0 18px 34px; }
ol.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--sheet); border: 3px solid var(--wakaba); }
ol.timeline time { display: block; font-size: 14px; color: var(--wakaba); font-weight: 700; font-variant-numeric: tabular-nums; }
ol.timeline b { display: block; font-size: 17px; line-height: 1.5; }
ol.timeline span { display: block; color: var(--muted); font-size: 15px; line-height: 1.7; }

/* 計算結果 */
#out:not(:has(.timeline)) { margin-top: 20px; }
#out .big { font-size: clamp(30px, 7vw, 40px); font-weight: 700; color: var(--wakaba); line-height: 1.3; margin: 2px 0 12px; font-variant-numeric: tabular-nums; }
#out > div:first-child { font-size: 14px; color: var(--muted); }
#out table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#out td { padding: 7px 2px; border-bottom: 1px solid var(--rule); font-size: 15px; }
#out td.n { text-align: right; }
#out p { font-size: 15px; color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
table.data th, table.data td { border-bottom: 1px solid var(--rule); padding: 8px; text-align: left; vertical-align: top; }
table.data tr:first-child th { color: var(--muted); font-size: 14px; border-bottom: 2px solid var(--fuji); }
.note { background: var(--fuji-soft); border-radius: 12px; padding: 10px 16px; font-size: 14px; margin: 24px 0; color: var(--muted); }

.promo { border: 1px solid var(--rule); border-radius: 14px; background: var(--sheet); padding: 14px 18px; margin: 20px 0; }
.promo .tag { display: inline-block; font-size: 12px; color: var(--muted); border: 1px solid var(--rule); border-radius: 6px; padding: 0 6px; }
.promo strong { display: block; font-size: 17px; margin-top: 4px; }
.promo p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.promo ul.aff { list-style: none; margin: 10px 0 0; padding: 0; }
.promo ul.aff li { border-top: 1px solid var(--rule); padding: 8px 0; font-size: 14px; }
.promo ul.aff a { font-weight: 700; display: block; }
.promo ul.aff span { color: var(--muted); }

/* ツール・記事の一覧 */
.index { list-style: none; margin: 8px 0 0; padding: 0; }
.index li { border-bottom: 1px solid var(--rule); }
.index li:first-child { border-top: 1px solid var(--rule); }
.index a { display: block; padding: 13px 4px; text-decoration: none; color: var(--ink); }
.index b { display: block; color: var(--fuji); }
.index a:hover b { text-decoration: underline; }
.index span { color: var(--muted); font-size: 15px; }

details { border-bottom: 1px solid var(--rule); padding: 10px 2px; }
details:first-of-type { border-top: 1px solid var(--rule); }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 8px 0 2px; color: var(--muted); }
footer.site { margin-top: 56px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); }
footer.site .wrap { padding-top: 18px; padding-bottom: 28px; }
footer.site a { color: var(--muted); margin-right: 14px; display: inline-block; }
@media (max-width: 560px) { .sheet { padding: 16px 14px; } }
