/* ============================================================================
   styles.css — 手取り計算の見た目
   ダークモードは使わず、常にライトテーマで表示します。
   ========================================================================== */

/* --- ベース --- */
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

  /* 常にライトテーマで表示する（配色はこの1ブロックだけで決まる） */
  :root {
    color-scheme: light;
    --bg: #F6F7F9;
    --paper: #FFFFFF;
    --ink: #1F2328;
    --ink-2: #5F6570;
    --ink-3: #8A9099;
    --line: #E3E6EA;
    --line-soft: #EEF0F3;
    --field: #FFFFFF;
    --accent: #2D6AE0;
    --accent-hover: #1F57C4;
    --accent-ink: #FFFFFF;
    --ring: rgba(45,106,224,.18);
    --net: #2D6AE0;
    --social: #0C8F72;
    --tax: #BE6B14;
    --card-shadow: 0 1px 2px rgba(31,35,40,.04), 0 1px 3px rgba(31,35,40,.06);
    --lift: 0 1px 2px rgba(31,35,40,.06), 0 8px 20px -10px rgba(31,35,40,.18);
    --sans: "Roboto", "Noto Sans JP", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  }
  * { box-sizing: border-box; }

  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    padding-inline: 20px;
    padding-block: clamp(40px, 9vw, 88px);
  }

  .wrap {
    max-width: 620px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
  }

  /* ---------- header ---------- */
  .masthead { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .masthead h1 {
    margin: 0;
    font-size: clamp(30px, 8vw, 40px);
    font-weight: 500;
    letter-spacing: -.01em;
    line-height: 1.2;
  }
  .masthead .sub { margin: 0; color: var(--ink-2); font-size: 15px; text-wrap: balance; }
  .badge {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--ink-2);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 12px;
  }

  /* ---------- input card ---------- */
  .card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    padding: clamp(20px, 5vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 22px;
  }

  .f { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
  .f > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }

  .inputbox {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 62px;
    padding: 0 18px;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 14px;
    transition: border-color .15s, box-shadow .15s;
  }
  .inputbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
  .inputbox input {
    flex: 1;
    min-width: 0;
    font-family: var(--sans);
    font-size: 30px;
    font-weight: 400;
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    background: none;
    border: none;
    padding: 0;
    -moz-appearance: textfield;
  }
  .inputbox input:focus { outline: none; }
  .inputbox input::-webkit-outer-spin-button,
  .inputbox input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .inputbox .suffix { font-size: 15px; color: var(--ink-2); flex: none; }

  .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

  .sel { position: relative; }
  .sel::after {
    content: "";
    position: absolute;
    right: 15px; top: 50%;
    width: 7px; height: 7px;
    border-right: 1.5px solid var(--ink-3);
    border-bottom: 1.5px solid var(--ink-3);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
  }
  .sel select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 46px;
    padding: 0 34px 0 14px;
    font-family: var(--sans);
    font-size: 15px;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
  }
  .sel select:hover { border-color: var(--ink-3); }
  .sel select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }

  .calc {
    align-self: center;
    height: 54px;
    min-width: 200px;
    padding: 0 40px;
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: .02em;
    color: var(--accent-ink);
    background: var(--accent);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s, box-shadow .2s, transform .12s;
  }
  .calc:hover { background: var(--accent-hover); box-shadow: var(--lift); }
  .calc:active { transform: translateY(1px); }
  .calc:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

  /* ---------- results ---------- */
  .results { display: flex; flex-direction: column; gap: 28px; }
  .results.reveal { animation: rise .38s cubic-bezier(.22,.61,.36,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  .result-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--card-shadow);
    padding: clamp(24px, 5vw, 36px) clamp(18px, 4vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 28px;
  }

  .hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .hero .cap { font-size: 13px; font-weight: 500; color: var(--ink-2); }
  .hero .big {
    font-size: clamp(46px, 14vw, 68px);
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -.025em;
    font-variant-numeric: tabular-nums;
  }
  .hero .big .yen { font-size: .34em; font-weight: 400; color: var(--ink-2); margin-left: 6px; letter-spacing: 0; }
  .hero .meta { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: 6px; }
  .hero .meta b { font-weight: 500; color: var(--ink); }

  /* breakdown bar + legend */
  .viz { display: flex; flex-direction: column; gap: 14px; }
  .bar { display: flex; gap: 3px; height: 12px; }
  .seg {
    min-width: 3px;
    border-radius: 999px;
    transition: flex-grow .5s cubic-bezier(.22,.61,.36,1);
  }
  .seg[data-k="net"] { background: var(--net); }
  .seg[data-k="social"] { background: var(--social); }
  .seg[data-k="tax"] { background: var(--tax); }

  .legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; }
  .legend li { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); }
  .legend b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
  .dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
  .dot[data-k="net"] { background: var(--net); }
  .dot[data-k="social"] { background: var(--social); }
  .dot[data-k="tax"] { background: var(--tax); }

  /* detail table */
  .table-scroll { overflow-x: auto; }
  table.detail { width: 100%; border-collapse: collapse; font-size: 14.5px; }
  table.detail th, table.detail td { padding: 11px 8px; text-align: right; white-space: nowrap; }
  table.detail thead th {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ink-3);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  table.detail thead th:first-child { text-align: left; }
  table.detail th[scope="row"] { text-align: left; font-weight: 400; }
  table.detail th:first-child, table.detail td:first-child { padding-left: 2px; }
  table.detail th:last-child, table.detail td:last-child { padding-right: 2px; }
  table.detail td { font-variant-numeric: tabular-nums; }
  table.detail td.yearly { color: var(--ink-2); }
  table.detail tr.group th[scope="row"] { font-weight: 500; }
  table.detail tr.group > * { border-top: 1px solid var(--line-soft); }
  table.detail tr.sub th[scope="row"] { padding-left: 18px; color: var(--ink-2); font-size: 13.5px; }
  table.detail tr.sub td { color: var(--ink-2); font-size: 13.5px; }
  table.detail tr.sub > * { padding-block: 8px; }
  table.detail tr.total > * { border-top: 1.5px solid var(--line); padding-top: 14px; }
  table.detail tr.total th[scope="row"] { font-weight: 700; }
  table.detail tr.total td { font-weight: 500; font-size: 16px; }
  .chip { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 8px; vertical-align: 1px; }
  .chip[data-k="none"] { background: transparent; }
  .chip[data-k="net"] { background: var(--net); }
  .chip[data-k="social"] { background: var(--social); }
  .chip[data-k="tax"] { background: var(--tax); }

  /* ---------- notes ---------- */
  details.notes {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 4px 22px;
  }
  details.notes summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    padding: 14px 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
  }
  details.notes summary::-webkit-details-marker { display: none; }
  details.notes summary::before {
    content: "";
    width: 7px; height: 7px;
    border-right: 1.5px solid var(--ink-3);
    border-bottom: 1.5px solid var(--ink-3);
    transform: rotate(-45deg);
    transition: transform .2s;
    flex: none;
  }
  details.notes[open] summary::before { transform: rotate(45deg); }
  details.notes summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
  .notes-body { padding: 4px 0 20px; display: flex; flex-direction: column; gap: 16px; }
  .notes-body h3 { margin: 0 0 4px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
  .notes-body ul { margin: 0; padding-left: 1.2em; font-size: 13px; color: var(--ink-2); line-height: 1.8; }
  .notes-body a { color: var(--accent); text-underline-offset: 2px; }
  .applied { font-size: 13px; color: var(--ink-2); margin: 0; font-variant-numeric: tabular-nums; }
  .srclist { list-style: none !important; margin: 0; padding: 0 !important; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
  .updated { font-size: 12px; color: var(--ink-3); margin: 8px 0 0; }
  .disclaimer { font-size: 12.5px; color: var(--ink-3); text-align: center; margin: 0; line-height: 1.7; }

  @media (max-width: 520px) {
    .grid3 { grid-template-columns: 1fr 1fr; }
    .grid3 .f:first-child { grid-column: 1 / -1; }
    .calc { align-self: stretch; }
    table.detail { font-size: 13.5px; }
    table.detail th, table.detail td { padding: 10px 4px; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, .results.reveal { animation-duration: .001s !important; transition-duration: .001s !important; }
  }

/* ---------- footer ---------- */
.foot { text-align: center; }
.foot p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* ボタンの見た目をリンクにも使う（404ページ） */
a.calc { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.center { text-align: center; margin: 0; }
