:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #262422;
  --stone: #f2f0ec;
  --rule: #dcd8d1;
  --muted: #6d6862;
  --slate: #34586f;
  --slate-soft: #e6edf1;
  --wet: #e9eff2;
  --wood: #f7f2ea;
  --caution: #8a5a1c;
  --serif: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.8 var(--sans); }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--slate); outline-offset: 2px; }

.masthead { display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--rule); }
.brand { margin: 0; font: 700 18px/1 var(--serif); letter-spacing: .12em; }
.brand span { margin-left: 12px; font: 500 13px/1 var(--sans); letter-spacing: .06em; color: var(--muted); }
.demo-mark { margin: 0; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; font-size: 12px; color: var(--muted); }

main { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* 入力 */
.intake { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 5vw, 72px); padding: clamp(32px, 6vw, 72px) 0 clamp(32px, 5vw, 56px); align-items: start; }
.intake h1 { margin: 0 0 20px; font: 500 clamp(30px, 4.2vw, 46px)/1.35 var(--serif); letter-spacing: .02em; }
.nb { display: inline-block; }
.intake-copy p { margin: 0; max-width: 30em; color: var(--muted); }
.intake-form { background: var(--stone); border-radius: 6px; padding: clamp(20px, 3vw, 32px); display: grid; gap: 20px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
legend small { margin-left: 8px; font-weight: 400; color: var(--muted); font-size: 12px; }
.land { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.land legend { grid-column: 1 / -1; float: left; width: 100%; }
.land label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.unit-field { display: flex; align-items: baseline; gap: 6px; font-size: 14px; color: var(--ink); }
.unit-field input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); font-size: 18px; font-variant-numeric: tabular-nums; }
.land-area { grid-column: 1 / -1; margin: 4px 0 0; font-size: 14px; }
.land-area output { font-weight: 700; font-variant-numeric: tabular-nums; }
.note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choices span { display: inline-block; padding: 7px 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); font-size: 14px; cursor: pointer; }
.choices input:checked + span { background: var(--slate); border-color: var(--slate); color: #fff; }
.choices input:focus-visible + span { outline: 2px solid var(--slate); outline-offset: 2px; }
.primary { justify-self: start; padding: 13px 32px; border: 0; border-radius: 4px; background: var(--ink); color: #fff; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.primary:hover { background: var(--slate); }
.secondary { display: inline-block; padding: 9px 18px; border: 1px solid var(--ink); border-radius: 4px; background: var(--paper); font-size: 14px; text-decoration: none; cursor: pointer; }
.secondary:hover { background: var(--stone); }

/* 結果 */
.results { padding: 40px 0 24px; border-top: 1px solid var(--rule); scroll-margin-top: 12px; }
.results-head { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; align-items: end; margin-bottom: 28px; }
.results-head h2 { margin: 0; font: 500 clamp(24px, 3vw, 32px)/1.4 var(--serif); }
.results-head p { grid-column: 1; margin: 0; color: var(--muted); font-size: 14px; }
.results-head .secondary { grid-column: 2; grid-row: 1 / span 2; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); }
.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--paper); animation: rise .5s ease both; animation-delay: calc(var(--i) * 90ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.card-hit { position: absolute; inset: 0; z-index: 2; border: 0; background: transparent; cursor: pointer; border-radius: 6px; }
.card:hover { border-color: var(--ink); }
.card-photo { position: relative; aspect-ratio: 3 / 2; background: var(--stone); overflow: hidden; }
.card-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.letter { position: absolute; left: 0; top: 0; padding: 8px 14px; background: var(--paper); font: 700 15px/1 var(--serif); letter-spacing: .1em; }
.card-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 18px 20px; flex: 1; }
.card h3 { margin: 0; font: 500 19px/1.5 var(--serif); }
.spec { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 14px; color: var(--muted); }
.spec strong { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.fit { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.fit li { padding-left: 18px; position: relative; }
.fit li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 5px; border-left: 2px solid var(--slate); border-bottom: 2px solid var(--slate); transform: rotate(-45deg); }
.fit li.caution { color: var(--caution); }
.fit li.caution::before { width: 7px; height: 7px; border: 0; border-radius: 50%; background: var(--caution); transform: none; top: .6em; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: auto; }
.thumbs img { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; border-radius: 2px; }
.ref { margin: -6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.more { align-self: flex-end; font-size: 13px; font-weight: 700; border-bottom: 1px solid currentColor; }
.shortfall { margin: 28px 0 0; padding: 16px 20px; background: var(--stone); border-radius: 6px; display: grid; gap: 4px; font-size: 14px; }

/* 間取り図 */
.plans { display: grid; gap: 8px; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); }
.plans-3 { --n: 3; }
.plan { margin: 0; }
.plan-frame { background: #fbfaf8; border: 1px solid #ece9e4; border-radius: 3px; aspect-ratio: 4 / 5; display: flex; }
.plan-frame .plan-svg { width: 100%; height: 100%; }
.plan figcaption { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.plan-svg { display: block; width: 100%; height: auto; aspect-ratio: auto; }
.room { stroke: #8e8982; stroke-width: 28; stroke-linejoin: miter; fill: #fff; }
.r-ldk { fill: var(--wood); }
.r-wet { fill: var(--wet); }
.r-stairs { fill: #ebe8e3; }
.r-store { fill: #f3f1ed; }
.r-hall { fill: #faf9f7; }
.r-balcony { fill: none; stroke-dasharray: 90 70; }
.r-parking { fill: #f0efec; }
.treads { stroke: #aaa49c; stroke-width: 16; fill: none; }
.shell { fill: none; stroke: var(--ink); stroke-width: 90; stroke-linejoin: miter; }
.parking { fill: none; stroke: #9a958e; stroke-width: 26; stroke-dasharray: 120 90; }
.lbl { font-family: var(--sans); font-weight: 500; fill: var(--ink); }
.lbl-sub { fill: var(--muted); font-weight: 400; }

/* 詳細 */
.detail { padding: 24px 0 32px; scroll-margin-top: 12px; }
.detail-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.back { border: 0; background: none; padding: 6px 0; font-size: 14px; cursor: pointer; border-bottom: 1px solid currentColor; }
.detail-switch { display: flex; gap: 6px; }
.detail-switch button { min-width: 64px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); font-family: var(--serif); font-weight: 700; cursor: pointer; }
.detail-switch [aria-current] { background: var(--ink); color: #fff; border-color: var(--ink); }
.detail-head { max-width: 46em; padding: 28px 0 24px; }
.detail-letter { margin: 0 0 4px; font: 700 15px/1 var(--serif); letter-spacing: .1em; color: var(--slate); }
.detail-head h2 { margin: 0 0 14px; font: 500 clamp(26px, 3.4vw, 38px)/1.4 var(--serif); }
.lead { margin: 0 0 14px; }
.tags { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 2px 12px; background: var(--slate-soft); border-radius: 999px; font-size: 13px; color: var(--slate); }
.gallery { display: grid; gap: 8px; }
.gallery-main { margin: 0; position: relative; }
.gallery-main img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: var(--stone); }
.gallery-main figcaption { position: absolute; left: 12px; bottom: 12px; padding: 2px 10px; background: rgba(255,255,255,.92); border-radius: 2px; font-size: 13px; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.gallery-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 3px; background: none; cursor: pointer; overflow: hidden; }
.gallery-thumbs button[aria-pressed="true"] { border-color: var(--ink); }
.gallery-thumbs img { aspect-ratio: 3 / 2; width: 100%; object-fit: cover; }
.credit { margin: 0; font-size: 12px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(24px, 4vw, 56px); padding-top: 36px; }
.detail .plan-frame { aspect-ratio: auto; }
.detail h3 { margin: 0 0 12px; font: 500 20px/1.4 var(--serif); }
.detail-data h3 + * { margin-bottom: 28px; }
.data { margin: 0; border-top: 1px solid var(--ink); }
.data div { display: grid; grid-template-columns: 11em 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.data dt { color: var(--muted); }
.data dd { margin: 0; font-variant-numeric: tabular-nums; }
.edit-link { margin-top: 4px; }

.disclaimer { margin: 24px 0 48px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }
.disclaimer p { margin: 0 0 4px; }
.print-pages { display: none; }

@media (max-width: 960px) {
  .intake { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; max-width: 560px; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .results-head { grid-template-columns: 1fr; }
  .results-head .secondary { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 12px; }
  .gallery-thumbs { grid-template-columns: repeat(3, 1fr); }
  .data div { grid-template-columns: 1fr; gap: 0; }
  .plans-3 { --n: 3; }
}
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

/* 印刷：A4横で1案1ページ */
@page { size: A4 landscape; margin: 12mm; }
@media print {
  body { font-size: 11pt; }
  .masthead, main { display: none !important; }
  .print-pages { display: block; }
  .pp { page-break-after: always; break-after: page; }
  .pp:last-child { page-break-after: auto; break-after: auto; }
  .pp h1 { margin: 6mm 0 2mm; font: 500 24pt/1.3 var(--serif); }
  .pp h2 { margin: 0 0 2mm; font: 500 17pt/1.4 var(--serif); }
  .pp .letter { position: static; padding: 0; font: 700 11pt/1 var(--serif); color: var(--slate); margin: 0 0 2mm; }
  .pp-meta { margin: 0 0 6mm; color: var(--muted); }
  .pp-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .pp-compare img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: 3mm; }
  .pp-compare h2 { font-size: 13pt; }
  .pp-compare p { margin: 0; font-size: 10pt; }
  .pp-photos { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3mm; margin: 3mm 0; }
  .pp-photos img { width: 100%; height: 52mm; object-fit: cover; }
  .pp-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 8mm; align-items: start; }
  .pp .lead { margin: 0; font-size: 10pt; }
  .pp .data div { padding: 1.4mm 0; font-size: 9pt; grid-template-columns: 9em 1fr; }
  .pp .plan-svg { max-height: 62mm; }
  .pp-note { margin: 4mm 0 0; font-size: 8pt; color: var(--muted); }
  .pp-cover .pp-note { margin-top: 8mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.edit-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
button.edit-link { font-family: inherit; }
