/* ureru（仮称） — 荷札と帳場の美術方向。
   紙（クラフト）と墨、二つの行き先＝売る（朱）／手放す（苔）だけを色で示す。 */

:root {
  --paper: #efe6d4;
  --paper-hi: #fbf6ea;
  --ink: #1d2330;
  --ink-2: #474c57;
  --rule: #c9bda4;
  --sell: #a93714;      /* 文字用の朱（紙上で4.5:1以上） */
  --sell-fill: #ef6a3a;
  --keep: #3f5c3a;      /* 文字用の苔 */
  --keep-fill: #a9c49b;
  --focus: #1f5fbf;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --measure: 34rem;
}

* { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  font: 400 1rem/1.75 var(--sans);
  font-feature-settings: "palt" 1;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.35; margin: 0; }

.skip {
  position: absolute; left: -999px; top: 0; padding: .5rem 1rem;
  background: var(--ink); color: var(--paper-hi); z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

.muted { color: var(--ink-2); }

/* ---- 見出し帯 ---- */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 72rem; margin: 0 auto; padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--ink);
}
.brand { display: inline-flex; }
.brand img { display: block; height: 26px; width: auto; }
.status-note { margin: 0; font-size: .8125rem; color: var(--ink-2); letter-spacing: .04em; }

main { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }

/* ---- メインパネル ---- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 27rem);
  gap: 3.5rem;
  align-items: center;
  padding: 3.5rem 0 4rem;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  margin: 0 0 1rem; font-size: .875rem; letter-spacing: .12em; color: var(--sell);
  font-weight: 600;
}
.kicker::before { content: ""; display: inline-block; width: 1.75rem; height: 2px; background: var(--sell); vertical-align: middle; margin-right: .6rem; }

.hero h1 { font-size: clamp(2rem, 4.2vw, 3.25rem); letter-spacing: .02em; }

.lead { max-width: var(--measure); margin: 1.5rem 0 2rem; font-size: 1.0625rem; color: var(--ink-2); }

.route { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; max-width: var(--measure); }
.route li { display: flex; align-items: center; gap: .85rem; font-weight: 600; }
.route-no {
  flex: none; display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem;
  border: 2px solid var(--ink); border-radius: 50%; font: 600 .9rem/1 var(--serif);
}
.route li:last-child .route-no { border-color: var(--keep); color: var(--keep); }

/* 札：左向きの荷札。外枠（墨）と紙面を同じ形で重ね、斜め辺まで線を通す */
.tag-wrap { filter: drop-shadow(6px 8px 0 rgba(29, 35, 48, .14)); }
.tag {
  --notch: 2.2rem;
  background: var(--ink);
  padding: 2px;
  clip-path: polygon(var(--notch) 0, 100% 0, 100% 100%, var(--notch) 100%, 0 50%);
}
.tag-body {
  position: relative;
  background: var(--paper-hi);
  padding: 2rem 1.75rem 1.5rem 3.25rem;
  clip-path: polygon(calc(var(--notch) - 1px) 0, 100% 0, 100% 100%, calc(var(--notch) - 1px) 100%, 0 50%);
}
.tag-hole {
  position: absolute; left: 1.2rem; top: 50%; width: 1rem; height: 1rem; margin-top: -.5rem;
  border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink);
}
.tag-title {
  font-size: 1.125rem; padding-bottom: .75rem; margin-bottom: 1rem;
  border-bottom: 1px dashed var(--ink);
}

.field { border: 0; margin: 0 0 1.25rem; padding: 0; min-width: 0; }
.field legend { padding: 0; margin-bottom: .5rem; font-weight: 700; font-size: .9375rem; }
.legend-sub { font-weight: 400; font-size: .8125rem; color: var(--ink-2); margin-left: .35rem; }

.item-list { display: grid; }
.item-opt input, .chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.item-opt label {
  display: flex; align-items: baseline; justify-content: space-between; gap: .75rem;
  min-height: 44px; padding: .55rem .25rem .55rem 1.9rem; position: relative; cursor: pointer;
  border-bottom: 1px solid var(--rule);
}
.item-opt label::before { /* 記入欄の丸 */
  content: ""; position: absolute; left: .2rem; top: .9rem; width: 1rem; height: 1rem;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--paper-hi);
}
.item-opt input:checked + label::before { background: var(--ink); box-shadow: inset 0 0 0 3px var(--paper-hi); }
.item-opt input:checked + label .item-name { font-weight: 700; }
.item-opt input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -1px; }
.item-name { font-size: 1rem; }
.item-hint { font-size: .75rem; color: var(--ink-2); text-align: right; }

.state-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip label {
  display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .8rem;
  border: 1.5px solid var(--ink); border-radius: 2px; cursor: pointer; font-size: .875rem;
  background: var(--paper-hi);
}
.chip label::before { content: "□"; margin-right: .4rem; font-family: var(--sans); }
.chip input:checked + label { background: var(--ink); color: var(--paper-hi); }
.chip input:checked + label::before { content: "■"; }
.chip input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

.tag-foot { margin: .5rem 0 0; font-size: .8125rem; color: var(--ink-2); }

/* ---- 共通見出し ---- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.5rem; margin-bottom: 1rem; }
.section-head h2, .before h2 { font-size: 1.625rem; }

/* ---- 照合表 ---- */
.ledger { padding: 3.5rem 0; border-bottom: 1px solid var(--rule); }
.ledger:focus { outline: none; }
.ledger-subject { margin: 0; font-weight: 700; }
.ledger-note { max-width: 46rem; margin: 0 0 1.75rem; font-size: .875rem; color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
.ledger-table { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--paper-hi); border: 2px solid var(--ink); }
.ledger-table th, .ledger-table td { text-align: left; vertical-align: top; padding: .9rem 1rem; border-top: 1px solid var(--rule); }
.ledger-table thead th { border-top: 0; border-bottom: 2px solid var(--ink); background: var(--paper); }
.ledger-table thead th:first-child, .ledger-table tbody th { width: 11.5rem; }
.ledger-table tbody th { font-size: .875rem; font-weight: 700; background: var(--paper); }
.ledger-table td + td, .ledger-table th + td, .ledger-table thead th + th { border-left: 1px solid var(--rule); }
.op-name { display: block; font: 600 1.125rem/1.3 var(--serif); }
.op-course { display: block; font-size: .75rem; color: var(--ink-2); font-weight: 400; }

.cell-text { margin: 0; font-size: .9375rem; }
.cell-text.is-unknown { color: var(--ink-2); }
.cell-summary { display: block; margin-bottom: .35rem; font-size: .9375rem; color: var(--ink); }
.cite { white-space: nowrap; font-size: .8125rem; }
.cite a + a { margin-left: .4rem; }

/* 査定印 */
.stamp {
  display: inline-block; padding: .3rem .75rem; font: 700 .9375rem/1.3 var(--serif);
  border: 2px solid currentColor; border-radius: 3px; transform: rotate(-2deg);
  letter-spacing: .04em;
}
.stamp-conditional { color: var(--keep); }
.stamp-conditional::before { content: "○ "; }
.stamp-unknown { color: var(--ink-2); border-style: dashed; }
.stamp-unknown::before { content: "？ "; }
.stamp-excluded { color: var(--sell); }
.stamp-excluded::before { content: "× "; }

.reasons, .unverified { margin: 0; padding: 0; list-style: none; font-size: .875rem; display: grid; gap: .5rem; }
.reason { padding-left: .75rem; border-left: 3px solid var(--keep-fill); }
.reason.is-unknown { border-left-style: dashed; border-left-color: var(--ink-2); color: var(--ink-2); }
.reason.is-excluded { border-left-color: var(--sell-fill); }
.reason-tag { display: inline-block; margin-right: .4rem; padding: 0 .35rem; font-size: .75rem; border: 1px solid currentColor; }
.unverified li { color: var(--ink-2); }
.unverified li::before { content: "未確認："; font-weight: 700; }

/* ---- 送る前に ---- */
.before { padding: 3.5rem 0; border-bottom: 1px solid var(--rule); }
.before h2 { margin-bottom: 1.5rem; }
.before-list { margin: 0; padding: 0; list-style: none; counter-reset: b; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); }
.before-list li { counter-increment: b; padding: 1.25rem 1.5rem 0 0; }
.before-list li + li { padding-left: 1.5rem; border-left: 1px solid var(--rule); }
.before-list h3 { font-size: 1.125rem; margin-bottom: .5rem; }
.before-list h3::before { content: counter(b, cjk-ideographic) "　"; color: var(--sell); }
.before-list p { margin: 0; font-size: .9375rem; color: var(--ink-2); }

/* ---- 分かれ道：自治体へ ---- */
.junction { padding: 3.5rem 0 4rem; }
.junction h2 { color: var(--keep); }
.junction h2::before { content: ""; display: inline-block; width: 1.4rem; height: 3px; background: var(--keep-fill); vertical-align: middle; margin-right: .6rem; transform: rotate(35deg); }
.junction-note { max-width: 46rem; margin: 0 0 1.5rem; color: var(--ink-2); }
.junction-form { display: grid; grid-template-columns: auto minmax(0, 16rem) auto minmax(0, 16rem); gap: .75rem 1rem; align-items: center; }
.junction-form label { font-weight: 700; font-size: .9375rem; }
select {
  font: inherit; color: var(--ink); min-height: 44px; padding: .4rem .6rem; width: 100%;
  border: 2px solid var(--ink); border-radius: 2px; background: var(--paper-hi);
}
select:disabled { color: var(--ink-2); border-color: var(--rule); }
.junction-result { margin-top: 1.5rem; }
.junction-lead { font-weight: 700; margin: 0 0 .75rem; }
.disposal-links { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; max-width: 40rem; }
.disposal-links a {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center; min-height: 48px;
  padding: .6rem 1rem; text-decoration: none; background: var(--paper-hi);
  border: 2px solid var(--keep); border-left-width: 8px;
}
.disposal-links a:hover .dl-site { text-decoration: underline; }
.dl-name { font-weight: 700; }
.dl-site { font-size: .8125rem; color: var(--keep); white-space: nowrap; }
.dl-site::after { content: " →"; }
.muni-top { font-size: .9375rem; }
.junction-cover { margin: 1.5rem 0 0; font-size: .8125rem; color: var(--ink-2); }

/* ---- 奥付 ---- */
.colophon { background: var(--ink); color: var(--paper-hi); padding: 3rem 1.5rem; }
.colophon > section { max-width: 72rem; margin: 0 auto; }
.colophon > section + section { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid #4a5162; }
.colophon h2 { font-size: 1.125rem; margin-bottom: 1rem; }
.colophon h3 { font: 700 .9375rem/1.5 var(--sans); margin: 1rem 0 .25rem; }
.colophon ul { margin: 0; padding-left: 1.2rem; font-size: .875rem; }
.colophon a { color: var(--paper-hi); }
.colophon .muted { color: #c8ccd6; font-size: .8125rem; }

/* ---- 狭い画面 ---- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 2.25rem; }
  .before-list { grid-template-columns: 1fr; }
  .before-list li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); margin-top: 1.25rem; }
  .junction-form { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .masthead { padding: 1rem; flex-wrap: wrap; gap: .25rem 1rem; }
  .status-note { font-size: .75rem; }
  main { padding: 0 1rem; }
  .hero h1 { font-size: 1.875rem; }
  .lead { font-size: .9375rem; margin-top: 1rem; }
  /* 札は上向きにし、穴を上に */
  .tag { --notch: 1.6rem; clip-path: polygon(0 var(--notch), 50% 0, 100% var(--notch), 100% 100%, 0 100%); }
  .tag-body { padding: 2.6rem 1rem 1.25rem; clip-path: polygon(0 calc(var(--notch) - 1px), 50% 0, 100% calc(var(--notch) - 1px), 100% 100%, 0 100%); }
  .tag-hole { left: 50%; top: 1.05rem; margin: 0 0 0 -.5rem; }
  .route { display: none; }
  .lead { margin-bottom: 0; }
  .hero { gap: 1.75rem; padding-top: 1.75rem; }
  .kicker { margin-bottom: .6rem; }
  .item-hint { display: none; }

  /* 照合表は業者ごとに縦積み */
  .ledger-table, .ledger-table tbody, .ledger-table tr, .ledger-table td, .ledger-table th { display: block; width: auto !important; }
  .ledger-table thead { display: none; }
  .ledger-table tbody th { border-top: 2px solid var(--ink); }
  .ledger-table tbody tr:first-child th { border-top: 0; }
  .ledger-table td { border-left: 0 !important; }
  .ledger-table td::before { content: attr(data-op); display: block; font: 600 .8125rem/1.4 var(--serif); color: var(--ink-2); margin-bottom: .25rem; }
  .section-head h2, .before h2 { font-size: 1.375rem; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Public comparison flow */
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.primary, .secondary { display: inline-flex; justify-content: center; align-items: center; gap: .8rem; min-height: 50px; padding: .8rem 1.3rem; border: 2px solid var(--sell); border-radius: 4px; font-weight: 700; line-height: 1.45; }
.primary { color: #fff; background: var(--sell); box-shadow: 0 3px 0 #70240d; }
.primary:hover { background: #872a0e; }
.secondary { color: var(--ink); border-color: var(--rule); background: var(--paper-hi); }
.secondary:hover { border-color: var(--ink); }
.hero { grid-template-columns: 1fr 1fr; gap: 2.5rem; padding: 3.5rem 0; }
.hero h1 { font-size: clamp(2rem, 3.5vw, 2.8rem); }
.hero .lead { font-size: 1rem; margin: 1.25rem 0 1.5rem; }
.hero-cta { font-size: 1.125rem; padding: 1rem 1.6rem; }
.cta-note { margin: .8rem 0 1.25rem; font-size: .8125rem; color: var(--ink-2); }
.hero-steps { font-size: .75rem; margin: 0; color: var(--ink-2); }
.hero-steps span { margin: 0 .3rem; }
.hero-visual { margin: 0; }
.hero-visual img { display: block; width: 100%; height: auto; border-radius: 42% 42% 4px 4px / 12% 12% 4px 4px; border-bottom: 3px solid var(--sell); }
.hero-visual figcaption { font-family: var(--serif); margin-top: .75rem; font-size: .9375rem; }
.hero-visual figcaption span { display: block; color: var(--ink-2); font: .6875rem var(--sans); margin-top: .3rem; }
.wizard { max-width: 48rem; margin: 2rem auto; scroll-margin-top: 1rem; }
.progress { display: flex; list-style: none; padding: 0; margin: 0 0 1.5rem; gap: .5rem; }
.progress li { flex: 1; padding: .6rem .2rem; text-align: center; font-size: .875rem; border-bottom: 3px solid var(--rule); color: var(--ink-2); }
.progress li[aria-current] { color: var(--sell); font-weight: 700; border-color: var(--sell); }
.step-panel { background: var(--paper-hi); border: 1px solid var(--rule); border-top: 4px solid var(--sell); padding: 2rem; }
.step-panel h2 { font-size: 1.75rem; }
.step-panel > p { color: var(--ink-2); }
.step-panel .item-list { margin: .5rem 0 1.5rem; }
.step-panel .item-opt label { min-height: 56px; align-items: center; }
.step-panel .item-opt label::before { top: 1.1rem; }
.step-panel .chip label { min-height: 48px; }
.step-panel .state-list { display: grid; gap: .65rem; }
.step-panel .chip label { display: flex; }
#operation-list .chip label::before { content: '○'; }
#operation-list .chip input:checked + label::before { content: '●'; }
.required { color: var(--sell); font-size: .75rem; margin-left: .5rem; }
.step-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.form-error, .error-box { color: #842b11 !important; background: #fff0e8; border-left: 4px solid #a93714; padding: .75rem 1rem; }
.error-box { margin: 1rem 0; }
.edit-conditions { margin-bottom: 1.5rem; }
#compare { scroll-margin-top: 1.25rem; padding-top: 1rem; }
@media(max-width:900px) {
 .hero { gap: 1.5rem; }
 .hero h1 { font-size: 2rem; }
}
@media(max-width:640px) {
 .hero { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.5rem 0 2rem; }
 .hero h1 { font-size: 1.75rem; }
 .hero .kicker { font-size: .75rem; margin-bottom: .6rem; }
 .hero .lead { font-size: .875rem; margin: .75rem 0 1rem; }
 .hero-cta { width: 100%; min-height: 54px; padding: .8rem; font-size: 1rem; }
 .cta-note { font-size: .75rem; margin: .65rem 0; }
 .hero-steps { font-size: .6875rem; }
 .hero-visual img { max-height: 210px; object-fit: cover; border-radius: 4px; }
 .hero-visual figcaption { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; margin-top: .35rem; }
 .hero-visual figcaption span { font-size: .625rem; margin-top: 0; }
 .wizard { margin: 1rem 0; }
 .progress { margin-bottom: 1rem; }
 .step-panel { padding: 1.25rem 1rem; }
 .step-panel h2 { font-size: 1.4rem; }
 .step-actions { flex-direction: column-reverse; gap: .75rem; }
 .step-actions button { width: 100%; }
 .step-panel .item-name { font-size: .9375rem; }
}

.colophon summary { cursor: pointer; font-weight: 700; min-height: 44px; }
