/* Hallmark · nunokeisan-site (布計算) · utilitarian measuring-tool design:
   生成りの紙面に墨色の文字、罫線と寸法線で組み、チャコ色の赤は標識だけに使う。
   装飾ではなく、裁断表と型紙の寸法図の精度で質感を作る。
   改訂（2026-11-21）: 素朴に寄りすぎたため、洋裁の道具と素材に根ざした意匠を足した。
   メジャーの目盛り帯（ヘッダー下と結果の縁）、縫い目風の破線（見出し・区切り）、
   型紙の方眼（配置図の地）、ごく薄い織り目（ページの地）、織りネーム風のサイト名。
   いずれも題材の道具・素材そのもので、意味のない装飾は足していない。
   改訂（2026-11-22）: ヘッダーにチャコの三角の印（サイト名の横）と、
   目盛り帯への10cmごとの数字を足した。どちらも洋裁の道具そのものの記号。 */
/* このサイトの色・書体はすべて下のトークン経由で使う。トークンの外に直値を置かない。 */

:root {
  --paper: #faf7f0;
  --surface: #fffdf8;
  --ink: #2a251e;
  --ink-soft: #5d5545;
  --line: #d9d0bf;
  --line-strong: #a89a7d;
  --accent: #9e3b2c;
  --accent-ink: #84301f;
  --piece-fill: #ece1cb;
  --rest-fill: #f4efe3;
  --tape: #f2e9d2;
  --tick: #8a7c5f;
  --grid-soft: rgba(168, 154, 125, 0.16);
  --grid-strong: rgba(168, 154, 125, 0.32);
  --weave: rgba(42, 37, 30, 0.025);
  --error: #b3261e;
  --focus: #9e3b2c;
  --font-body: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", YuGothic,
    "Noto Sans JP", "Meiryo", sans-serif;
  --radius-s: 4px;
  --radius-m: 6px;
  --measure: 44rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background-color: var(--paper);
  /* 布の織り目: 経糸・緯糸を思わせるごく薄い格子。模様ではなく地の質感として敷く */
  background-image:
    repeating-linear-gradient(0deg, var(--weave) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, var(--weave) 0 1px, transparent 1px 3px);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 16px;
}

/* ヘッダー（小さく留める） */
.site-header {
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}

/* メジャーの目盛り帯: ヘッダーの下縁に、テープメジャーの目盛りを敷く。
   左端の赤い爪（テープの先端金具）だけチャコ色で示す。
   目盛りは 8px=1cm・80px=10cm のリピートで、数字（0,10,20,…）は同じ80px間隔に
   揃えた SVG を最上層に敷く（リピートせず左から続ける。色は --tick と同値だが、
   データURI内の SVG は CSS 変数を読めないため直値で持つ） */
.site-header::after {
  content: "";
  display: block;
  height: 13px;
  background-color: var(--tape);
  border-top: 1px solid var(--line);
  background-image:
    linear-gradient(90deg, var(--accent) 0 6px, transparent 6px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
  background-size: 100% 100%, 80px 11px, 40px 7px, 8px 4px;
  background-position: bottom left;
  background-repeat: no-repeat, repeat-x, repeat-x, repeat-x;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 20px;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* サイト名は織りネーム（布に縫い付けるブランドラベル）の字組みにする:
   墨地に生成りの文字、内側に縫い目の破線を回す */
.site-name {
  position: relative;
  font-size: 19px;
  font-weight: 700;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  letter-spacing: 0.18em;
  padding: 5px 14px 6px 16px;
  border-radius: 2px;
}

.site-name::after {
  content: "";
  position: absolute;
  inset: 2.5px;
  border: 1px dashed rgba(250, 247, 240, 0.55);
  border-radius: 1px;
  pointer-events: none;
}

.site-name:hover {
  background: var(--accent-ink);
}


.site-tagline {
  font-size: 13px;
  color: var(--ink-soft);
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent-ink);
  text-decoration: underline;
}

/* 見出し */
/* h1 の下にはチャコで引いた印付けの線を一本だけ置く */
h1 {
  font-size: 24px;
  line-height: 1.4;
  margin: 24px 0 10px;
  padding-bottom: 9px;
  overflow-wrap: break-word;
  min-width: 0;
  background-image: linear-gradient(90deg, var(--accent) 0 64px, transparent 64px);
  background-size: 100% 3px;
  background-position: bottom left;
  background-repeat: no-repeat;
}

/* 見出しの下線は縫い目の破線にする */
h2 {
  font-size: 18px;
  line-height: 1.5;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px dashed var(--line-strong);
}

h2 .h2-mark {
  color: var(--accent);
  margin-right: 8px;
}

.lead {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 15px;
}

/* 計算機 */
.calc {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  padding: 20px 16px 8px;
  margin-bottom: 28px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.field .field-note {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field-input {
  display: flex;
  align-items: stretch;
  max-width: 240px;
}

.field-input input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 8px 12px;
  font: inherit;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
}

.field-input .unit {
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 15px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.field-input input[aria-invalid="true"] {
  border-color: var(--error);
  border-width: 2px;
}

.field-error {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--error);
}

:focus {
  outline: none;
}

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

/* 結果 */
.result {
  border-top: 2px solid var(--ink);
  margin-top: 4px;
  padding-top: 10px;
}

/* 結果ブロックの上縁にも小さな目盛りを置き、測って出す結果であることを示す */
.result::before {
  content: "";
  display: block;
  height: 9px;
  margin-bottom: 12px;
  background-color: var(--tape);
  background-image:
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
  background-size: 80px 8px, 8px 4px;
  background-position: bottom left;
  background-repeat: repeat-x;
}

.result-status {
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.result-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 4px;
}

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

.result-main .result-value {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.result-main .result-unit {
  font-size: 18px;
  font-weight: 700;
}

.result-main .result-mark {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}

/* 配置図は型紙用紙の上に描く: 薄い方眼（5cm相当の細線と25cm相当の太線）を地に敷く */
.diagram {
  margin: 14px 0 6px;
  padding: 14px 12px 10px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px),
    linear-gradient(var(--grid-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-soft) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
}

.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}

.diagram figcaption {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.breakdown {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 4px;
}

.breakdown th,
.breakdown td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  vertical-align: baseline;
}

.breakdown th {
  text-align: left;
  font-weight: 400;
  color: var(--ink-soft);
  width: 55%;
}

.breakdown td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.premises {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.premises .premises-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
}

.premises ul {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--ink-soft);
}

.note-pattern {
  font-size: 14px;
  margin: 12px 0 16px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

/* 配置図（SVG）。寸法線はテーマ色、パーツ境界は実線、余り幅は破線で示す */
.diagram .svg-fabric {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.diagram .svg-piece {
  fill: var(--piece-fill);
  stroke: var(--ink-soft);
  stroke-width: 1;
}

.diagram .svg-rest {
  fill: var(--rest-fill);
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.diagram .svg-dim {
  stroke: var(--accent);
  stroke-width: 1;
}

.diagram .svg-text {
  fill: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* 商品導線の置き場（ASP承認後にリンクを設置する） */
/* 導線の置き場は、しつけ縫いのように破線の枠で「まだ仮付け」と示す */
.affiliate-slot {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-m);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 28px;
}

.affiliate-slot h2 {
  border-bottom: none;
  padding-bottom: 0;
  font-size: 16px;
}

.affiliate-slot p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

/* 説明セクション */
.doc-section {
  margin-bottom: 32px;
}

.doc-section p,
.doc-section li {
  font-size: 15px;
}

.doc-section ul,
.doc-section ol {
  padding-left: 22px;
}

.formula {
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 15px;
}

/* 広告枠の予約（広告コード未設置。高さだけ先に確保し、読み込み時のずれを防ぐ） */
.ad-slot {
  min-height: 110px;
  margin: 0 0 32px;
}

/* フッター */
.site-footer {
  border-top: 2px dashed var(--line-strong);
  margin-top: 8px;
  padding: 18px 0 28px;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.site-footer a {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer .copyright {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

/* 仮置きページの明示 */
.placeholder-banner {
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  margin: 20px 0;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
}

.info-table th,
.info-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 4px;
  font-size: 15px;
  text-align: left;
  vertical-align: top;
}

.info-table th {
  width: 34%;
  color: var(--ink-soft);
  font-weight: 400;
}

a {
  color: var(--accent-ink);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none;
    transition: none;
  }
}

@media (min-width: 640px) {
  .calc {
    padding: 24px 24px 10px;
  }

  .field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 28px;
  }

  .ad-slot {
    min-height: 120px;
  }
}
