/* ===================================================================
   期待値ナビ — 콘텐츠 스타일 (계산기 폼, 결과 카드, 테이블, CSS 차트)
   =================================================================== */

/* === Card === */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(16,16,20,.04), 0 4px 12px rgba(16,16,20,.03);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}

/* === Calculator Form === */
.calc-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full { grid-column: 1 / -1; }

.field label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.field .hint {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
}

.field input[type="number"],
.field select {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

.field input[type="number"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.18);
}

.field input.invalid {
  border-color: #d93025;
  background: #fdf3f2;
}

.field-error {
  font-size: 0.78rem;
  color: #d93025;
  min-height: 1.2em;
}

/* 설정1~6 프리셋 버튼 */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.preset-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  border: 1px solid var(--gold-light);
  border-radius: 999px;
  background: var(--gold-bg);
  color: var(--gold-dark);
  cursor: pointer;
  transition: background 0.15s;
}

.preset-btn:hover { background: var(--gold-light); }

/* 선택된 필터 */
.preset-btn.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--gold);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* === Result === */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.result-tile {
  background: var(--gold-bg);
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.result-tile .label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.result-tile .value {
  display: block;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-all;
}

.result-tile .unit {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

/* 손익 부호 색상 — 결과 타일과 테이블 셀 양쪽에 적용 */
.plus  { color: #157347; }
.minus { color: #d93025; }
td.num.plus, td.num.minus { font-weight: 700; }

/* === Table === */
/*
  스크롤 가능한 표는 모바일에서 "더 있다"는 신호가 없으면 잘린 줄 모른다.
  배경 그라디언트 4장을 겹쳐 좌우 끝에 그림자를 만든다. 스크롤이 끝에
  닿으면 흰 그라디언트가 그림자를 덮어 자동으로 사라진다. JS 불필요.
*/
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to left,  #fff 30%, rgba(255,255,255,0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.18), rgba(0,0,0,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), rgba(0,0,0,0)) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* 좌측 항목명은 스크롤해도 남아 있어야 어느 행인지 알 수 있다 */
.table-scroll .data-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 480px;
}

table.data-table th,
table.data-table td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: center;
}

table.data-table th {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

table.data-table tbody tr:nth-child(even) { background: #fafafa; }
table.data-table tbody tr:hover { background: var(--gold-bg); }

table.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* === CSS 막대 차트 (외부 라이브러리 없음) === */
.bar-chart { display: flex; flex-direction: column; gap: 8px; }

.bar-row {
  display: grid;
  grid-template-columns: 190px 1fr 104px;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.bar-row .bar-label {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.bar-track {
  position: relative;
  height: 20px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 4px;
}

.bar-fill.negative { background: linear-gradient(90deg, #d93025, #e8776d); }

.bar-row .bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* 손익분기 기준선 */
.bar-track.zero-based::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--zero, 0%);
  width: 1px;
  background: #999;
}

/* === Callout === */
.callout {
  border-left: 4px solid var(--gold);
  background: var(--gold-bg);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  margin: 16px 0;
}

.callout.warn {
  border-left-color: #e8a33d;
  background: #fdf6e9;
}

.callout strong { color: var(--ink); }

/* === FAQ === */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.faq-q::before {
  content: "Q. ";
  color: var(--gold-dark);
}

.faq-a {
  font-size: 0.9rem;
  color: var(--text);
}

.faq-a::before {
  content: "A. ";
  font-weight: 700;
  color: var(--muted);
}

/* === 機種比較テーブル === */
.cmp-table th:first-child {
  background: var(--ink-soft);
  min-width: 132px;
}

.cmp-table thead th a { color: #fff; text-decoration: underline; }

.cmp-table td { vertical-align: top; }

/* 같은 행에서 가장 좋은 값 */
.is-best {
  position: relative;
  font-weight: 700;
}

.is-best::after {
  content: "★";
  font-size: 0.7em;
  margin-left: 3px;
  color: var(--gold-dark);
  vertical-align: super;
}

/* === 2열 비교 (설정狙い vs 天井狙い 등) === */
.compare-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compare-2 .card { margin-bottom: 0; }

/* === 手順リスト === */
ol.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}

ol.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 46px;
  font-size: 0.92rem;
  line-height: 1.85;
}

ol.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
}

/* 마지막 항목을 뺀 나머지는 세로선으로 이어 흐름을 보이게 */
ol.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 36px;
  bottom: 4px;
  width: 2px;
  background: var(--gold-light);
}

ol.steps li strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

/* === 用語集 === */
.term-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  margin-bottom: 10px;
  scroll-margin-top: 72px;
}

.term-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.term-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.term-kana {
  font-size: 0.75rem;
  color: var(--muted);
}

.term-body {
  font-size: 0.9rem;
  line-height: 1.85;
}

.term-links {
  margin-top: 8px;
  font-size: 0.82rem;
}

input[type="search"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 100%;
  background: #fff;
  color: var(--text);
}

input[type="search"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.18);
}

/* === Home hero === */
.hero {
  text-align: center;
  padding: 40px 16px 24px;
}

.hero h1 {
  font-size: 1.9rem;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: .03em;
}

.hero h1 .accent { color: var(--gold); }

.hero p {
  color: var(--muted);
  font-size: 0.95rem;
}

.hero-main {
  padding: 48px 16px 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.hero-main h1 { font-size: 2.3rem; }

.hero-main .hero-lead {
  font-size: 1.05rem;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 10px;
}

.hero-main .hero-sub {
  font-size: 0.88rem;
  max-width: 34em;
  margin: 0 auto;
  line-height: 1.9;
}

/* === 目的別カード === */
.purpose-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.purpose-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.purpose-card:hover {
  text-decoration: none;
  border-color: var(--gold);
  box-shadow: 0 4px 14px rgba(201,162,39,.18);
  transform: translateY(-1px);
}

.purpose-icon { font-size: 1.6rem; line-height: 1; }

.purpose-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.purpose-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}

.purpose-go {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-dark);
  margin-top: 4px;
}

/* === 機種カード === */
.machine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.machine-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  text-decoration: none;
  color: var(--text);
  transition: background .15s, box-shadow .15s;
}

.machine-card:hover {
  text-decoration: none;
  background: var(--gold-bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.machine-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.4;
}

.machine-card-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.machine-card-wari {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
}

.machine-card-wari .k { font-size: 0.72rem; color: var(--muted); }
.machine-card-wari .v {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-dark);
}

/* 랭킹 순번 */
.rank-no {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 6px;
  flex-shrink: 0;
}

/* === サイト方針 === */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.policy-item {
  background: var(--gold-bg);
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  padding: 16px;
}

.policy-item h3 {
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 6px;
}

.policy-item p {
  font-size: 0.83rem;
  line-height: 1.8;
  color: var(--text);
}

.link-row { display: flex; flex-wrap: wrap; gap: 18px; }

/* === Responsive === */
@media (max-width: 768px) {
  .calc-form { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .compare-2 { grid-template-columns: 1fr; }
  ol.steps li { padding-left: 40px; font-size: 0.88rem; }
  .purpose-grid { grid-template-columns: 1fr; }
  .policy-grid { grid-template-columns: 1fr; }
  .machine-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-main { padding: 32px 16px 24px; }
  .hero-main h1 { font-size: 1.75rem; }
  .card { padding: 16px; }
  /* 모바일에서는 기종명이 길어 3열로는 좁으므로 라벨을 위로 뺀다 */
  .bar-row {
    grid-template-columns: 1fr 88px;
    font-size: 0.8rem;
    gap: 4px 8px;
  }
  .bar-row .bar-label { grid-column: 1 / -1; }
  .hero h1 { font-size: 1.5rem; }
}

/* ===================================================================
   タッチ操作向けの調整
   common.css より後に読み込まれるこのファイルに置くこと。
   common.css 側に書くと content.css の既定値に上書きされる。
   本文中のテキストリンクは対象外（文章の流れが崩れるため）。
   =================================================================== */
@media (hover: none) and (pointer: coarse) {
  .preset-btn { padding: 9px 14px; }
  .jump-row a { padding: 8px 12px; }
  .site-logo { padding: 6px 0; }
  .site-nav a { padding: 14px 24px; }

  /* 16px 未満だと iOS Safari が入力時に自動ズームする */
  .field input[type="number"],
  .field select,
  input[type="search"] { padding: 12px; font-size: 16px; }
}
