/* Small custom overrides on top of Tailwind CDN.
   Palette: bg #FAFAF7, ink #1A1A1A, accent shu vermillion #B7282E.
*/

:root {
  --bg: #FAFAF7;
  --ink: #1A1A1A;
  --ink-soft: #4A4A48;
  --line: #E6E4DC;
  --line-soft: #EFEDE5;
  --accent: #B7282E;
  --accent-soft: #F4E4E4;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}

[lang="jp"] body,
body.lang-jp {
  font-family: "Noto Sans JP", "Inter", system-ui, sans-serif;
}

.font-serif-jp {
  font-family: "Noto Serif JP", serif;
  font-weight: 500;
}

.text-ink { color: var(--ink); }
.text-ink-soft { color: var(--ink-soft); }
.text-accent { color: var(--accent); }
.bg-accent { background-color: var(--accent); }
.bg-accent-soft { background-color: var(--accent-soft); }
.border-line { border-color: var(--line); }
.border-line-soft { border-color: var(--line-soft); }

.hairline { border-top: 1px solid var(--line); }
.hairline-bottom { border-bottom: 1px solid var(--line); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border-radius: 2px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover {
  background: #962024;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink-soft);
}

.chip-accent {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
}

.chip-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.grade-badge {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: white;
}
.grade-A { background: #2D6A4F; }
.grade-B { background: #588157; }
.grade-C { background: #B08968; }
.grade-D { background: #BC6C25; }
.grade-E { background: #9E2A2B; }
.grade-pending {
  background: transparent;
  color: var(--ink-soft);
  border: 1px dashed var(--ink-soft);
  font-weight: 400;
}

.grade-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.grade-row:last-child { border-bottom: none; }
.grade-row.active {
  font-weight: 500;
  color: var(--ink);
}
.grade-row:not(.active) {
  color: var(--ink-soft);
  opacity: 0.55;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--ink-soft);
}

.listing-photo {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  display: block;
}

.gallery-hero {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
  display: block;
  border-radius: 4px;
}

.thumb {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  display: block;
  border-radius: 2px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.thumb:hover { opacity: 1; }
.thumb.active {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Horizontal thumbnail strip below the hero — holds every photo and scrolls
   sideways when they overflow the row. */
.thumb-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.thumb-strip .thumb {
  flex: 0 0 auto;
  width: 7rem;
}
.thumb-strip::-webkit-scrollbar { height: 8px; }
.thumb-strip::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
.thumb-strip::-webkit-scrollbar-track { background: transparent; }

/* Gallery navigation — the hero stage holds the prev/next chevrons and a
   position counter so the full photo set is reachable by click, button, or
   arrow key as well as the thumbnail strip. */
.gallery-stage { position: relative; }
.gallery-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: background 0.15s ease;
}
.gallery-nav:hover { background: #fff; }
.gallery-prev { left: 0.6rem; }
.gallery-next { right: 0.6rem; }
.gallery-counter {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* Honest staleness note under the "contact the town" link. */
.source-caveat {
  margin-top: 0.75rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* Floor plan section (Phase 6d). Plans render on white so the line-art reads
   clearly; we contain rather than cover so nothing gets cropped. */
.floorplan-frame {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 0.5rem;
  transition: box-shadow 0.15s ease;
}
.floorplan-frame:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.floorplan-img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
}
.floorplan-tag {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}
.floorplan-pdf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 1.25rem 1.5rem;
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}

.divider {
  height: 1px;
  background: var(--line);
  width: 100%;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.95rem;
}
.spec-row:last-child { border-bottom: none; }
.spec-row .label { color: var(--ink-soft); }
.spec-row .value { color: var(--ink); font-weight: 500; }

.subsidy-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
  gap: 1rem;
}
.subsidy-row:last-child { border-bottom: none; }
.subsidy-row .amount {
  font-family: "Inter", system-ui;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  white-space: nowrap;
}
.subsidy-row .amount.muted { color: var(--ink-soft); font-weight: 400; }

.condition-list li {
  position: relative;
  padding-left: 1.25rem;
  padding-block: 0.4rem;
  color: var(--ink);
}
.condition-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.95rem;
  width: 0.5rem;
  height: 1px;
  background: var(--accent);
}

.map-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, #EEEAE0 0%, #DDD7C6 100%);
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}
.map-placeholder svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  z-index: 60;
  transition: transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.toast.visible { transform: translateX(-50%) translateY(0); }

.mobile-sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--line);
  padding: 0.75rem 1rem;
  display: none;
  z-index: 40;
}
@media (max-width: 768px) {
  .mobile-sticky-cta { display: block; }
  body.has-sticky-cta { padding-bottom: 5rem; }
}

.lang-jp .en-only,
.lang-en .jp-only { display: none; }

.tile-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

/* a refined accent rule used on section headings */
.heading-bar {
  display: inline-block;
  width: 2rem;
  height: 2px;
  background: var(--accent);
  margin-bottom: 1rem;
}

input[type="text"], input[type="email"], textarea, select {
  border: 1px solid var(--line);
  background: white;
  padding: 0.7rem 0.85rem;
  border-radius: 2px;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.15s ease;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
}

.fade-in { animation: fade 0.4s ease both; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------------
   Enrichment-data visuals — risk profile, market context, around-the-property.
   --------------------------------------------------------------------------- */

/* Severity colour scale used across landslide / flood / tsunami / farmland /
   building-era chips, card flags, etc. Read-out tiers:
     red    — material warning
     yellow — caveat worth surfacing
     mid    — flood-rank middle band
     low    — flood-rank lowest band
     clean  — no signal at this point (positive)
     pos    — positive lifestyle signal (within-3km coast, walkable station)
     rising — land value appreciating (rare in akiya territory)
*/
.chip-red    { background:#FDECEE; border-color:#F2C9CD; color:#9E2A2B; }
.chip-yellow { background:#FBF3DC; border-color:#EBDDA6; color:#7A5B0F; }
.chip-mid    { background:#FBE7D6; border-color:#EFCDA5; color:#7B3B0E; }
.chip-low    { background:#FAF1E4; border-color:#EBDDC0; color:#6A4E1C; }
.chip-clean  { background:#E8F1EA; border-color:#C8DACB; color:#2D6A4F; }
.chip-pos    { background:#E5EFE8; border-color:#BFD6C5; color:#1F5238; }
.chip-rising { background:#E2EBE2; border-color:#BCD0BD; color:#2D6A4F; }

/* Risk profile section: label / colour-chip / one-line summary, rule-bound rows */
.risk-grid { border-top: 1px solid var(--line-soft); }
.risk-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  column-gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.risk-row .risk-label {
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 500;
}
.risk-row .risk-summary {
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: right;
  max-width: 60ch;
  line-height: 1.35;
}
.risk-row .risk-chip {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
}
.risk-chip.risk-red    { background: #B7282E; }
.risk-chip.risk-yellow { background: #E5B042; }
.risk-chip.risk-mid    { background: #C57930; }
.risk-chip.risk-low    { background: #D9B57C; }
.risk-chip.risk-clean  { background: #6A8C72; }

/* Seismic mini-chart: stacked horizontal probability bars. */
.seismic-block { display: flex; flex-direction: column; gap: 0.5rem; }
.prob-row {
  display: grid;
  grid-template-columns: 12rem 1fr 3.5rem;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}
.prob-label { color: var(--ink); }
.prob-track {
  height: 0.55rem;
  background: #EEEAE0;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.prob-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.prob-value {
  font-family: "Inter", system-ui;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink-soft);
}

/* Market-context cards. */
.market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.market-card {
  border: 1px solid var(--line);
  background: white;
  border-radius: 4px;
  padding: 1rem 1.25rem;
}
.market-card-wide { grid-column: 1 / -1; }

.trend-pill {
  display: inline-block;
  font-size: 0.95rem;
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  font-weight: 500;
}
.trend-clean    { background:#E8F1EA; color:#2D6A4F; }
.trend-yellow   { background:#FBF3DC; color:#7A5B0F; }
.trend-rising   { background:#E5EFE8; color:#1F5238; }

.delta-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 1.05rem;
  font-weight: 500;
}
.delta-pct {
  margin-left: auto;
  padding: 0.15rem 0.6rem;
  border-radius: 2px;
  font-weight: 600;
  font-family: "Inter", system-ui;
  font-variant-numeric: tabular-nums;
}
.delta-low     { background:#FDECEE; color:#9E2A2B; }
.delta-neutral { background:#EEEAE0; color:#4A4A48; }
.delta-high    { background:#FBF3DC; color:#7A5B0F; }

/* Around-the-property: station / coastline / schools. */
.around-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.around-card {
  border: 1px solid var(--line);
  background: white;
  border-radius: 4px;
  padding: 1rem 1.25rem;
}
.around-card-wide { grid-column: 1 / -1; }

.school-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.school-cell {
  border: 1px solid var(--line-soft);
  background: #FAFAF7;
  border-radius: 2px;
  padding: 0.7rem 0.85rem;
}
.school-pos     { border-color:#BFD6C5; background:#F1F6F2; }
.school-neutral { border-color:#E6E4DC; }
.school-far     { border-color:#EBDDC0; background:#FCF7EC; }

/* Data sources expandable. */
.sources-details {
  border-top: 1px solid var(--line-soft);
  padding-top: 1.25rem;
}
.sources-details summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.sources-details summary::-webkit-details-marker { display: none; }
.sources-list {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.sources-list li {
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--line-soft);
}
.sources-list li:last-child { border-bottom: none; }

@media (max-width: 600px) {
  .risk-row { grid-template-columns: 1fr auto; column-gap: 0.5rem; }
  .risk-row .risk-summary {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 0.25rem;
  }
  .prob-row { grid-template-columns: 1fr 1fr 3rem; gap: 0.5rem; }
  .market-grid, .around-grid { grid-template-columns: 1fr; }
  .school-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Honest-unknown UI treatment — the platform's "we don't pretend; we have a
   process" principle. Two variants:
     .unknown-pill  — inline, compact (spec rows, school cells, around-grid)
     .unknown-block — block-level greyed card with [Ask team to verify] stub
                       (preview of the Phase 7+ team-curation workflow)
   --------------------------------------------------------------------------- */

.unknown-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  border-radius: 2px;
  border: 1px dashed var(--line);
  background: #F3F1E9;
  color: var(--ink-soft);
  font-weight: 400;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
}
.unknown-pill::before {
  content: "◯";
  font-size: 0.6rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.unknown-block {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  border: 1px dashed var(--line);
  background: #F6F4EC;
  border-radius: 4px;
}
.unknown-block .unknown-icon {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px dashed var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-top: 0.05rem;
}
.unknown-block .unknown-icon::before {
  content: "?";
}
.unknown-block .unknown-body {
  flex: 1 1 auto;
}
.unknown-block .unknown-label {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.ask-team-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 2px;
  border: 1px solid var(--ink-soft);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ask-team-btn:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Utilities strip (gas / water / sewer). */
.util-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.util-cell {
  border: 1px solid var(--line-soft);
  background: #FAFAF7;
  border-radius: 2px;
  padding: 0.7rem 0.85rem;
}
@media (max-width: 600px) {
  .util-grid { grid-template-columns: 1fr; }
}

/* Lifecycle banner — surfaces non-active source states (under negotiation, etc.) */
.lifecycle-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  border-radius: 2px;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}
.lifecycle-banner .lifecycle-dot {
  flex: 0 0 auto;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-top: 0.35rem;
}
.lifecycle-under_negotiation {
  background: #FBF3DC;
  color: #6E4B00;
  border-left: 3px solid #E5B042;
}
.lifecycle-under_negotiation .lifecycle-dot { background: #E5B042; }
.lifecycle-price_changed {
  background: #E8F1EA;
  color: #1F5238;
  border-left: 3px solid #6A8C72;
}
.lifecycle-price_changed .lifecycle-dot { background: #6A8C72; }
.lifecycle-withdrawn,
.lifecycle-sold,
.lifecycle-source_404 {
  background: #FDECEE;
  color: #6E2024;
  border-left: 3px solid #B7282E;
}
.lifecycle-withdrawn .lifecycle-dot,
.lifecycle-sold .lifecycle-dot,
.lifecycle-source_404 .lifecycle-dot { background: #B7282E; }

/* Risk row tier for unknown era. */
.risk-chip.risk-unknown {
  background: transparent;
  border: 1px dashed var(--ink-soft);
}

/* Homepage data-depth strip — one tile per enrichment layer. */
.data-layer-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.7rem;
  row-gap: 0.15rem;
  align-items: center;
  border: 1px solid var(--line);
  background: white;
  border-radius: 4px;
  padding: 0.9rem 1rem;
  transition: border-color 0.15s ease;
}
.data-layer-tile:hover { border-color: var(--ink-soft); }
.dl-badge {
  grid-row: 1 / span 2;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
}
.dl-badge.dl-red    { background:#B7282E; }
.dl-badge.dl-yellow { background:#E5B042; }
.dl-badge.dl-mid    { background:#C57930; }
.dl-badge.dl-clean  { background:#6A8C72; }
.dl-badge.dl-pos    { background:#3F6F4D; }
.dl-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
}
.dl-source {
  font-size: 0.72rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* Phase 6e — Joanna's narrative hook, sits above the photo gallery. */
.story-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 1.4rem 1.7rem;
}
.story-text {
  font-family: "Noto Serif JP", Georgia, serif;
  font-size: 1.18rem;
  line-height: 1.62;
  color: var(--ink);
  letter-spacing: 0.005em;
}
.story-byline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
}
/* The attribution rule replaces a typographic dash (no dash characters). */
.story-mark {
  display: inline-block;
  width: 1.5rem;
  height: 0;
  border-top: 1px solid var(--ink-soft);
}
.story-draft {
  font-style: normal;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  background: var(--line-soft);
  border: 1px solid var(--line);
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
}

/* Phase 6f — "Subsidies you may qualify for". Full-width, below the story. */
.subsidy-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.5rem 1.7rem 1.6rem;
}
.subsidy-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.subsidy-title {
  font-family: "Noto Serif JP", Georgia, serif;
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--ink);
}
.subsidy-sub {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
  max-width: 46rem;
  line-height: 1.5;
}
.subsidy-total {
  text-align: right;
  white-space: nowrap;
}
.subsidy-total span {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}
.subsidy-total strong {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.subsidy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.9rem;
}
.subsidy-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.subsidy-card.match-unlikely { opacity: 0.72; }
.subsidy-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}
.subsidy-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--ink);
}
.subsidy-issuer {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}
.subsidy-amount {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 0.55rem;
}
.subsidy-amount-formula {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.45;
  margin-top: 0.55rem;
}
.subsidy-cond {
  margin-top: 0.7rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}
.subsidy-cond .cond-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}
.subsidy-cond ul {
  list-style: disc;
  padding-left: 1.05rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.45;
}
.subsidy-cond-failed .cond-label { color: var(--accent); }
.subsidy-source {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.subsidy-source:hover { text-decoration: underline; }
.subsidy-freshness {
  margin-top: 1.1rem;
  font-size: 0.74rem;
  color: var(--ink-soft);
  line-height: 1.5;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.8rem;
}
.subsidy-empty {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-top: 0.6rem;
}
/* Match badge — small pill, color-keyed to confidence. */
.match-badge {
  flex-shrink: 0;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.match-badge.match-definite { background: #1f6f43; color: #fff; border-color: #1f6f43; }
.match-badge.match-likely { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.match-badge.match-conditional { background: var(--line-soft); color: var(--ink-soft); }
.match-badge.match-unlikely { background: #fff; color: var(--ink-soft); }

/* --- Catalogue: photo tiles, placeholders, skeletons, pagination ----------- */

.card-photo {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  display: block;
}
.card-photo-empty,
.gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: radial-gradient(120% 120% at 50% 0%, #F3F1E9 0%, #E8E5DB 100%);
  color: var(--ink-soft);
}
.gallery-empty { aspect-ratio: 16 / 10; border-radius: 4px; }
.ph-mark {
  font-family: "Noto Serif JP", serif;
  font-size: 2rem;
  font-weight: 600;
  color: #C9C3B2;
  line-height: 1;
}
.gallery-empty .ph-mark { font-size: 3rem; }
.gallery-empty-label {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  max-width: 22rem;
  text-align: center;
  padding: 0 1rem;
}

/* Loading skeletons */
.skeleton,
.sk-line {
  position: relative;
  overflow: hidden;
  background: #EEECE4;
}
.skeleton { aspect-ratio: 4 / 3; width: 100%; display: block; }
.sk-line { height: 0.7rem; border-radius: 3px; margin-bottom: 0.6rem; }
.sk-w-30 { width: 30%; }
.sk-w-50 { width: 50%; }
.sk-w-80 { width: 80%; }
.skeleton::after,
.sk-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Pagination disabled state */
#listings-pagination .btn[disabled] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Team strip initials tiles (no external avatar dependency) */
.team-initials {
  font-family: "Noto Serif JP", serif;
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #C9C3B2;
}

/* Folded subsidy panel — collapsed by default so the property leads */
.subsidy-details summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.subsidy-details summary::-webkit-details-marker { display: none; }
.subsidy-details summary h2 { display: inline; margin-right: 0.5rem; }
.subsidy-details summary:hover .subsidy-title { color: var(--accent); }
.subsidy-teaser-line {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.subsidy-teaser-line strong { color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Maps (Leaflet, vendored). Two surfaces: the full-page browse map (clustered
   pins) and the embedded location map on the listing detail page. Tiles are the
   muted CartoDB Positron basemap; everything else is local.
   --------------------------------------------------------------------------- */

/* Pin the map below the sticky site header (z-30) and toast (z-60), and adopt
   the catalogue's type + a warm placeholder while tiles load. */
.leaflet-container {
  font: inherit;
  background: #EDEAE0;
  z-index: 0;
}
.leaflet-container a { color: var(--accent); }
.leaflet-control-attribution {
  font-size: 0.62rem;
  background: rgba(255, 255, 255, 0.8);
}

/* Brand pin — a dot, not a teardrop (honest about centroid-level precision). */
.akiya-pin { background: transparent; border: 0; }
.akiya-pin-dot {
  display: block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(40, 30, 20, 0.5);
}

/* Cluster bubble — accent-tinted to match the pins, sized by count in map.js. */
.akiya-cluster { background: transparent; }
.akiya-cluster-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(183, 40, 46, 0.86);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(40, 30, 20, 0.4);
}

/* Popup card (a single clickable link through to the listing). */
.leaflet-popup-content-wrapper {
  border-radius: 6px;
  padding: 0;
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(40, 30, 20, 0.18);
}
.leaflet-popup-content {
  margin: 0;
  width: 210px !important;
  line-height: 1.4;
}
.map-popup {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border-radius: 6px;
  overflow: hidden;
}
.map-popup-photo {
  width: 100%;
  height: 116px;
  object-fit: cover;
  display: block;
}
.map-popup-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #F3F1E9 0%, #E8E5DB 100%);
}
.map-popup-empty .ph-mark { font-size: 1.6rem; }
.map-popup-body { display: block; padding: 0.55rem 0.75rem 0.7rem; }
.map-popup-place {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-bottom: 0.1rem;
}
.map-popup-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
}
.map-popup-price {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 0.3rem;
}
.map-popup-cta {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
}
.map-popup:hover .map-popup-cta { text-decoration: underline; }

/* Full-page browse map (map.html): header is 4rem (h-16); the map fills the rest. */
.map-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem);
}
.map-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.map-subhead .map-subhead-sub {
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: 52rem;
  margin-top: 0.15rem;
}
#map-status {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.map-status-count { display: block; white-space: nowrap; }
.map-status-note {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.map-status-note:hover { color: var(--accent); }
#map-browse {
  flex: 1 1 auto;
  min-height: 0;
  background: #EDEAE0;
}

/* Embedded location map on the listing detail page. */
.location-map {
  height: 360px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #EDEAE0;
}
.location-note {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.location-empty {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.55;
  border: 1px dashed var(--line);
  background: #F6F4EC;
  border-radius: 4px;
  padding: 0.95rem 1.1rem;
}
@media (max-width: 600px) {
  .location-map { height: 280px; }
  .map-subhead { padding: 0.75rem 1rem; }
}

/* ===========================================================================
   Browse directory (listings.html + listings.js)
   A Booking.com-style surface: a sticky filter rail, a sortable toolbar, and a
   results column that switches between a card grid and a detail-rich list.
   Built on the same tokens/cards as the rest of the catalogue.
   =========================================================================== */

.browse-wrap {
  max-width: 84rem;
  margin: 0 auto;
  padding: 1.75rem 1rem 4rem;
}
@media (min-width: 640px) {
  .browse-wrap { padding-left: 1.5rem; padding-right: 1.5rem; }
}

.browse-subhead { margin-bottom: 1.5rem; }
.browse-subhead h1 { font-size: 1.6rem; font-weight: 500; line-height: 1.2; }
.browse-subhead p {
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  max-width: 52rem;
  line-height: 1.5;
}

.browse-layout { display: block; }
@media (min-width: 1024px) {
  .browse-layout {
    display: grid;
    grid-template-columns: 16.5rem minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }
}

/* --- Filter rail ----------------------------------------------------------- */
.browse-filters {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}
@media (min-width: 1024px) {
  .browse-filters {
    position: sticky;
    top: 5rem; /* clears the 4rem sticky header + breathing room */
    max-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
  }
}

.filters-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.filters-head .filters-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-right: auto;
}
.filters-clear {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  width: auto;
}
.filters-clear:hover { text-decoration: underline; }
.filters-clear[hidden] { display: none; }
.filters-close {
  display: none;
  background: transparent;
  border: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  width: auto;
  padding: 0.1rem 0.3rem;
}

.filters-body {
  padding: 0.4rem 1.1rem 1rem;
  overflow-y: auto;
}
@media (min-width: 1024px) {
  .filters-body { flex: 1 1 auto; min-height: 0; }
}

.filter-group {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.filter-group:last-child { border-bottom: none; }
.filter-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.55rem;
}
.filter-group select + select { margin-top: 0.5rem; }

.range-pair {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.range-pair input { width: 100%; }
.range-sep { color: var(--ink-soft); flex: 0 0 auto; }

.filter-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.32rem 0;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
}
.filter-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.filters-apply {
  display: none;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #fff;
}

/* --- Results column -------------------------------------------------------- */
.browse-results { min-width: 0; }

.browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar-left { display: flex; align-items: center; gap: 0.85rem; }
.toolbar-right { display: flex; align-items: center; gap: 0.6rem; }
.results-count {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.results-count .results-count-sub {
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-left: 0.4rem;
}

.filters-trigger { display: none; }
.filters-trigger .filters-trigger-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.02rem 0.4rem;
  font-variant-numeric: tabular-nums;
}

.sort-label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.sort-select { width: auto; min-width: 11rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  flex: 0 0 auto;
}
.view-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.6rem;
  background: #fff;
  color: var(--ink-soft);
  border: 0;
  cursor: pointer;
  width: auto;
}
.view-toggle button + button { border-left: 1px solid var(--line); }
.view-toggle button.active { background: var(--ink); color: var(--bg); }
.view-toggle svg { width: 1.1rem; height: 1.1rem; }

/* Active-filter chips (removable) */
.active-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.active-chips:empty { display: none; }
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.4rem 0.22rem 0.7rem;
  font-size: 0.78rem;
  color: var(--ink);
}
.active-chip button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  width: auto;
  padding: 0 0.15rem;
}
.active-chip button:hover { color: var(--accent); }

/* Results: grid reuses the catalogue card grid; list is the detail-rich view. */
.results-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
}
@media (min-width: 640px) { .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .results-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.results-list { display: flex; flex-direction: column; gap: 1rem; }

.listing-row {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.listing-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--ink-soft);
}
.listing-row-photo {
  position: relative;
  min-height: 12rem;
  background: radial-gradient(120% 120% at 50% 0%, #F3F1E9 0%, #E8E5DB 100%);
}
.listing-row-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.row-photo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.listing-row-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1.05rem 1.25rem;
}
.row-place { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 0.15rem; }
.row-title { font-weight: 500; font-size: 1.02rem; line-height: 1.3; margin-bottom: 0.5rem; }
.row-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.55rem; }
.row-specs { font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.listing-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  text-align: right;
  white-space: nowrap;
}
.row-price { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-persqm { font-size: 0.76rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-top: 0.1rem; }
.row-cta { font-size: 0.82rem; color: var(--accent); font-weight: 500; margin-top: 0.75rem; }
.listing-row:hover .row-cta { text-decoration: underline; }

@media (max-width: 640px) {
  .listing-row { grid-template-columns: 1fr; }
  .listing-row-photo { min-height: 0; aspect-ratio: 16 / 10; }
  .listing-row-body { grid-template-columns: 1fr; }
  .listing-row-side {
    align-items: flex-start;
    text-align: left;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 0.25rem;
  }
  .row-cta { margin-top: 0; }
}

.results-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-soft);
}
.results-empty .results-empty-title { font-size: 1.05rem; color: var(--ink); margin-bottom: 0.4rem; }

#results-pagination .btn[disabled] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* --- Mobile: filter rail becomes an off-canvas drawer ---------------------- */
.filters-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 45;
}
@media (max-width: 1023px) {
  .filters-trigger { display: inline-flex; }
  .browse-filters {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(23rem, 90vw);
    border-radius: 0;
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  }
  .browse-filters.is-open { transform: translateX(0); }
  .filters-body { flex: 1 1 auto; min-height: 0; }
  .filters-close { display: inline-flex; }
  .filters-apply { display: block; }
  .filters-backdrop.is-open { opacity: 1; visibility: visible; }
  body.filters-locked { overflow: hidden; }
}
