/* ================================
   水災事業停止損失額シミュレーター - style.css

   「なんでも屋じゃない総務」（public/assets/css/style.css）と
   デザイントークン（色・角丸・シャドウ・フォント）を統一する。
   このアプリはFastAPIの独立サブシステムのためCSSファイル自体は共有せず、
   値だけをこちらにも定義している（CLAUDE.md参照）。
   ================================ */

:root {
  --color-bg: #ffffff;
  --color-surface: #F7F7F9;
  --color-surface-strong: #F1F1F4;
  --color-text: #1C1C1E;
  --color-text-muted: #4B4B50;
  --color-text-faint: #747478;
  --color-accent: #FFC629;
  --color-accent-dark: #E8A800;
  --color-accent-soft: rgba(255, 198, 41, 0.16);
  --color-accent-pale: #FFF6DD;
  --color-danger: #E0524C;
  --color-danger-dark: #B23A34;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(28, 28, 30, 0.04), 0 2px 10px rgba(28, 28, 30, 0.05);
  --shadow-md: 0 8px 24px rgba(28, 28, 30, 0.08);

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro JP", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --container-width: 1120px;
  --gutter: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

/* サイト本体（public/assets/css/style.css）と同じ.containerの定義。
   width・余白の感覚を統一するため、幅の値自体もそちらに合わせている。 */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 700px) {
  :root {
    --gutter: 32px;
  }
}

@media (min-width: 1200px) {
  :root {
    --gutter: 40px;
  }
}

/* ---------- ヘッダー ---------- */
/* サイト本体のassets/html/header.htmlと同じ見た目・構成。このアプリは独立した
   FastAPIサブシステムのためheader.html自体は読み込まず、同じHTML構造・CSSを
   ここに直接持たせている（CLAUDE.md参照）。リンク先はサイト本体の実ドメイン
   （https://www.soumu-heart.com）への絶対URLとする。 */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  transition: box-shadow 0.3s var(--ease);
}

.site-header.is-scrolled {
  box-shadow: 0 1px 0 rgba(28, 28, 30, 0.06), 0 6px 20px rgba(28, 28, 30, 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.logo img {
  height: 28px;
  width: auto;
}

.logo-text {
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.nav a:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.nav .nav-cta {
  background: var(--color-accent);
  color: var(--color-text);
  font-weight: 600;
  margin-left: 8px;
}

.nav .nav-cta:hover {
  background: var(--color-accent-dark);
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 899px) {
  .nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(14px);
    flex-direction: column;
    align-items: stretch;
    padding: 12px var(--gutter) 24px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }

  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav a {
    padding: 14px 12px;
    text-align: center;
  }

  .nav .nav-cta {
    margin: 8px 0 0;
  }
}

@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }
}

/* ---------- パンくずリスト ---------- */

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-faint);
}

.breadcrumb-list li {
  display: flex;
  align-items: center;
}

.breadcrumb-list li:not(:last-child)::after {
  content: "\203A";
  margin: 0 8px;
  color: var(--color-text-faint);
}

.breadcrumb-list a {
  color: var(--color-text-muted);
  transition: color 0.2s var(--ease);
}

.breadcrumb-list a:hover {
  color: var(--color-text);
}

.breadcrumb-list li[aria-current] {
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- ツール本体（サイト本体の.article-wrap・article-title・article-lead・card-tagと揃える） ---------- */

.tool-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 700px) {
  .tool-wrap {
    padding: 48px 0 16px;
  }
}

.card-tag {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 6vw, 38px);
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.tool-lead {
  margin: 0;
  font-size: clamp(16px, 4vw, 18px);
  line-height: 1.9;
  color: var(--color-text-muted);
}

/* ---------- フォームカード ---------- */

.simulator-form {
  background: linear-gradient(var(--color-bg), var(--color-bg)) padding-box,
    linear-gradient(155deg, var(--color-accent), var(--color-surface-strong) 45%) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
}

@media (min-width: 700px) {
  .simulator-form {
    padding: 36px 32px;
  }
}

.address-search {
  position: relative;
}

.address-search label,
.form-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.address-search input,
.form-field select,
.form-field input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-surface-strong);
  border-radius: var(--radius-sm);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

/* 住所入力のプレースホルダーは狭い画面では入力欄より長くなるため、
   途中で切れたまま止まらず「…」で省略されるようにする */
.address-search input {
  text-overflow: ellipsis;
}

.address-search input:focus,
.form-field select:focus,
.form-field input[type="number"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}

.suggestion-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}

.suggestion-item:hover {
  background: var(--color-accent-soft);
}

.form-field {
  margin-top: 20px;
}

/* 従業者数は直接入力のみとし、ブラウザ標準の上下矢印（スピンボタン）は非表示にする */
.form-field input[type="number"] {
  -moz-appearance: textfield;
}

.form-field input[type="number"]::-webkit-outer-spin-button,
.form-field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-color 0.25s var(--ease);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 住所・業種・従業者数がすべて確定するまでは非活性を示す */
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
  background: var(--color-accent);
}

.field-error {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--color-danger-dark);
}

/* ---------- 結果 ---------- */

.result-area {
  margin-top: 24px;
  padding: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
}

@media (min-width: 700px) {
  .result-area {
    padding: 28px;
  }
}

.result-error {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-danger-dark);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
}

.result-row + .result-row {
  border-top: 1px solid var(--color-surface-strong);
}

.result-label {
  font-size: 13px;
  color: var(--color-text-muted);
}

.result-value {
  font-size: 15px;
  font-weight: 700;
}

/* 損失額は結果の中で最も目立たせる */
.result-loss {
  margin-top: 16px;
  padding: 20px;
  text-align: center;
  background: var(--color-accent-pale);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.result-loss-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.result-loss-value {
  display: block;
  margin-top: 6px;
  font-size: clamp(24px, 7vw, 30px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-accent-dark);
}

.result-note {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-note li {
  position: relative;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--color-text-faint);
}

.result-note li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* ---------- 算定根拠。結果（損失額）より目立たないよう、装飾は控えめにする ---------- */

.calc-basis {
  margin-top: 20px;
  border-top: 1px solid var(--color-surface-strong);
  padding-top: 16px;
}

.calc-basis summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent-dark);
  list-style: none;
}

.calc-basis summary::-webkit-details-marker {
  display: none;
}

.calc-basis summary::after {
  content: "▾";
  margin-left: 4px;
  font-size: 11px;
}

.calc-basis[open] summary::after {
  content: "▴";
}

.calc-basis-body {
  margin-top: 16px;
}

.calc-basis-section {
  margin-top: 24px;
}

.calc-basis-section:first-child {
  margin-top: 16px;
}

.calc-basis-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 800;
}

.calc-basis-section p {
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.calc-formula {
  padding: 16px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  line-height: 1.9;
  color: var(--color-text);
}

.calc-basis-case {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.calc-basis-case-label {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.calc-basis-case-formula {
  margin: 0;
  font-size: 13px;
  line-height: 1.9;
  color: var(--color-text);
}

.calc-basis-table-scroll {
  margin-top: 8px;
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.calc-basis-table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.calc-basis-table th,
.calc-basis-table td {
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.calc-basis-table thead th {
  background: var(--color-surface-strong);
  font-weight: 700;
  color: var(--color-text);
}

.calc-basis-table tbody td {
  background: var(--color-bg);
}

.calc-basis-table tbody tr:nth-child(even) td {
  background: var(--color-surface);
}

/* 今回の計算で実際に使われた行 */
.calc-basis-table tr.current-row td {
  background: var(--color-accent-soft);
  font-weight: 700;
}

.calc-basis-sources {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calc-basis-sources li {
  position: relative;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.calc-basis-sources li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* ---------- シミュレーター後の説明・FAQ（サイト本体の.article-body・.faq-gridと同じ見た目） ---------- */

.tool-seo-body {
  margin-top: 12px;
  padding-top: 32px;
  border-top: 1px solid var(--color-surface-strong);
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-size: 16px;
  line-height: 1.95;
  color: var(--color-text);
}

.tool-seo-body h2 {
  margin: 14px 0 0;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tool-seo-body h2:first-child {
  margin-top: 0;
}

.tool-seo-body p {
  margin: 0;
}

.tool-seo-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-seo-body li {
  position: relative;
  padding-left: 24px;
  font-size: 15px;
}

.tool-seo-body li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

.tool-seo-body a {
  color: var(--color-accent-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 700px) {
  .faq-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.faq-item {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
}

.faq-q {
  display: flex;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 8px;
}

.faq-q::before {
  content: "Q";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-surface-strong);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 800;
}

.faq-a {
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-muted);
  margin: 0;
}

.faq-a::before {
  content: "A";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent-dark);
  font-size: 12px;
  font-weight: 800;
}

/* ---------- フッター ---------- */
/* サイト本体のassets/html/footer.htmlと同じ見た目・構成。リンク先はヘッダーと同様、
   サイト本体の実ドメインへの絶対URLとする。SNSリンクはこのツール単体では
   案内する情報がないため省略する。 */

.site-footer {
  background: var(--color-surface);
  margin-top: 64px;
  padding: 48px 0 32px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.footer-brand img {
  height: 22px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-nav a {
  font-size: 13px;
  color: var(--color-text-muted);
  transition: color 0.2s var(--ease);
}

.footer-nav a:hover {
  color: var(--color-text);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  padding-top: 24px;
}

.footer-copy {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-faint);
}

@media (min-width: 700px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .footer-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}
