/* BrightFuture 家族のお金の計算室
   方向: 家計簿の「罫線」と、結果に引く「蛍光ペン」。落ち着いた紺青と、うすい青磁色の紙。 */

:root {
  color-scheme: light dark;
  --paper: #f3f6f4;
  --sheet: #ffffff;
  --ink: #1d2b33;
  --muted: #4b5a60;
  --sea: #24566b;
  --sea-strong: #193f4f;
  --line: #b7c4c0;
  --rule: #d9e2df;
  --marker: #f6d35b;
  --error: #9b2c1f;
  --serif: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  --sans: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121a1e;
    --sheet: #1a2429;
    --ink: #e4ebe9;
    --muted: #a9b8bc;
    --sea: #8cc4d6;
    --sea-strong: #b5dbe7;
    --line: #4a5b61;
    --rule: #2c3a40;
    --marker: #7a6213;
    --error: #ff9c8a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

a {
  color: var(--sea);
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--sea-strong);
}

:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 2px;
}

.wrap {
  width: min(100% - 2rem, 40rem);
  margin-inline: auto;
}

/* ヘッダー */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--sheet);
}
.site-header .wrap {
  padding-block: 0.75rem;
}
.site-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
  padding-block: 0.25rem;
}
.site-name small {
  display: block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

main {
  padding-block: 2rem 3rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.45;
  font-weight: 700;
  text-wrap: balance;
  word-break: auto-phrase;
}
h1 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.1rem);
  margin: 0 0 1rem;
}
h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 0.75rem;
}
h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.5rem;
}
p {
  margin: 0 0 1rem;
}
.lead {
  font-size: 1.125rem;
  color: var(--muted);
}

/* トップ: ツールの一覧。家計簿の行のように罫線で区切る */
.hero {
  padding-block: 0.5rem 1.5rem;
}
.hero h1 {
  font-size: clamp(1.8rem, 1.3rem + 2.5vw, 2.5rem);
}
.promise {
  border-inline-start: 4px solid var(--sea);
  padding: 0.25rem 0 0.25rem 1rem;
  margin-block: 1.5rem;
}
.tool-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 2px solid var(--ink);
}
.tool-list li {
  border-bottom: 1px solid var(--line);
}
.tool-list a {
  display: block;
  padding: 1.1rem 0.25rem;
  text-decoration: none;
  color: var(--ink);
}
.tool-list a:hover .tool-name,
.tool-list a:focus-visible .tool-name {
  text-decoration: underline;
}
.tool-name {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--sea);
}
.tool-when {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ツールの紙 */
.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1rem 1.5rem;
  margin-block: 1.5rem;
}
@media (min-width: 40rem) {
  .sheet {
    padding: 1.75rem 2rem 2rem;
  }
}

.sheet > h2:first-child {
  margin-top: 0;
}

fieldset {
  border: 0;
  border-top: 2px solid var(--ink);
  margin: 0 0 1.75rem;
  padding: 0.75rem 0 0;
  min-width: 0;
}
legend {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0 0.5rem 0 0;
}
.group-note {
  font-size: 0.95rem;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-block-end: 1.25rem;
}
.field label {
  font-weight: 700;
}
.req {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}
.hint {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

input[type="text"] {
  font: inherit;
  font-size: max(1.125rem, 1em);
  font-variant-numeric: tabular-nums;
  width: 100%;
  max-width: 18rem;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  color: var(--ink);
  background: var(--sheet);
  border: 2px solid var(--muted);
  border-radius: 4px;
}
input[aria-invalid="true"] {
  border-color: var(--error);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-block-end: 1.25rem;
}
.check input {
  inline-size: 1.4rem;
  block-size: 1.4rem;
  margin: 0.25rem 0 0;
  accent-color: var(--sea);
  flex: none;
}

button[type="submit"] {
  font: inherit;
  font-weight: 700;
  font-size: 1.125rem;
  min-height: 3.25rem;
  width: 100%;
  max-width: 18rem;
  padding: 0.5rem 1.5rem;
  color: #fff;
  background: var(--sea);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
button[type="submit"]:hover {
  background: var(--sea-strong);
}
button[type="submit"]:disabled {
  background: var(--line);
  color: var(--ink);
  cursor: not-allowed;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button[type="submit"] {
    color: #10191d;
  }
}

/* 結果: 家計簿の罫線と蛍光ペン */
output {
  display: block;
  margin-top: 1.5rem;
}
output:empty {
  display: none;
}
.result {
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
}
.result-lead {
  margin: 0;
}
.big {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 3vw, 2.75rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  margin: 0.25rem 0 1rem;
}
.result-lead .big {
  font-size: 1.6rem;
}
.marker {
  background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 92%, transparent 92%);
  padding-inline: 0.15em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (prefers-reduced-motion: no-preference) {
  .marker {
    background-size: 100% 100%;
    background-repeat: no-repeat;
    animation: draw 0.6s ease-out both;
  }
  @keyframes draw {
    from {
      background-size: 0% 100%;
    }
  }
}
.slip {
  margin: 0 0 1rem;
  background-image: repeating-linear-gradient(transparent 0 calc(2.6rem - 1px), var(--rule) calc(2.6rem - 1px) 2.6rem);
}
.slip div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  min-height: 2.6rem;
  padding-block: 0.4rem;
}
.slip dt {
  font-size: 0.95rem;
}
.slip dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.note {
  font-size: 0.95rem;
  color: var(--muted);
}
.error {
  color: var(--error);
  font-weight: 700;
  margin: 0;
}

.noscript {
  border: 2px solid var(--error);
  padding: 0.75rem 1rem;
  border-radius: 4px;
}

.disclaimer {
  font-weight: 700;
  border-block: 1px solid var(--line);
  padding-block: 0.75rem;
}

.notes {
  padding-inline-start: 1.25rem;
}
.notes li {
  margin-block-end: 0.5rem;
}

/* 広告（アフィリエイト）の表示。広告だとすぐわかるように、小さな枠つきの印にする */
.pr-note {
  font-size: 0.85rem;
  color: var(--muted);
}
.pr {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  padding-inline: 0.35em;
  border: 1px solid var(--muted);
  border-radius: 3px;
  color: var(--muted);
  vertical-align: 0.1em;
}

.sources {
  font-size: 0.9rem;
  color: var(--muted);
}
.sources h2 {
  font-size: 1.05rem;
}
.sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sources li {
  padding-block: 0.4rem;
  border-bottom: 1px dashed var(--line);
}
.sources .checked {
  display: block;
}

/* フッター */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 1.5rem 2.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.site-footer a {
  display: inline-block;
  padding-block: 0.4rem;
}
