/* Engawa design tokens (Figma Design System) + legacy aliases.
   Accent updated to brand vermillion #bf4232 (matches ident.svg).
*/

:root {
  /* Core surface / ink (Figma Engawa Design System) */
  --page: #fcf6ec;
  --raised: #fdf9f6;
  --sunken: #f8f1e6;
  --on-page: #221e1a;
  --on-page-alt: #48443f;
  --outline: #e1dacd;
  --accent: #bf4232;
  --primary-600: #bf4232;
  --inverse: #221e1a;
  --on-accent: #fdf9f6;
  --accent-soft: #f4e4e4;

  /* Spacing (Figma Spacing collection) */
  --space-none: 0;
  --space-xs: 4px;
  --space-sm: 8px;
  /* 12px retained for legacy chrome (drawer gaps); Figma radius-md is separate */
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-4xl: 64px;

  /* Corners */
  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Font families */
  --font-display: "Shippori Mincho", "Noto Serif JP", serif;
  --font-body: "Hanken Grotesk", "Inter", "Noto Sans JP", system-ui, sans-serif;

  /*
   * Typography fluid min→max (Figma text styles, size/lineHeight):
   *   display/large     min 56/68   max 80/96
   *   headline/large    min 42/50.4 max 56/68
   *   headline/small    min 30/36   max 36/44
   *   title/medium      min 24/36   max 28/42
   *   body/large        min 18/28   max 20/30
   *   body/medium       min 16/24   max 18/28
   *   label/medium      max 18/24   (no min variant)
   *   overline/default  min 14/20   max 14/20
   * Prefer preferred viewport width so min hits on small screens, max on desktop.
   */
  --text-display-large-size: clamp(3.5rem, 2.2rem + 4vw, 5rem); /* 56→80 */
  --text-display-large-line: clamp(4.25rem, 2.6rem + 5vw, 6rem); /* 68→96 */
  --text-display-large-tracking: -0.04em;
  --text-headline-large-size: clamp(2.625rem, 1.85rem + 2.4vw, 3.5rem); /* 42→56 */
  --text-headline-large-line: clamp(3.15rem, 2.2rem + 2.9vw, 4.25rem); /* 50.4→68 */
  --text-headline-large-tracking: -0.02em;
  --text-headline-small-size: clamp(1.875rem, 1.5rem + 1.15vw, 2.25rem); /* 30→36 */
  --text-headline-small-line: clamp(2.25rem, 1.8rem + 1.4vw, 2.75rem); /* 36→44 */
  --text-headline-small-tracking: -0.01em;
  --text-title-medium-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.75rem); /* 24→28 */
  --text-title-medium-line: clamp(2.25rem, 1.9rem + 1vw, 2.625rem); /* 36→42 */
  --text-body-large-size: clamp(1.125rem, 1.05rem + 0.25vw, 1.25rem); /* 18→20 */
  --text-body-large-line: clamp(1.75rem, 1.6rem + 0.4vw, 1.875rem); /* 28→30 */
  --text-body-medium-size: clamp(1rem, 0.9rem + 0.3vw, 1.125rem); /* 16→18 */
  --text-body-medium-line: clamp(1.5rem, 1.35rem + 0.45vw, 1.75rem); /* 24→28 */
  --text-overline-size: 0.875rem; /* 14 */
  --text-overline-line: 1.25rem; /* 20 */
  --text-label-medium-size: 1.125rem; /* 18 */
  --text-label-medium-line: 1.5rem; /* 24 */
  --text-label-medium-tracking: -0.04em;

  /* Typography: label/medium (Shippori Mincho SemiBold 18/24 -4%) */
  --font-label-medium-family: var(--font-display);
  --font-label-medium-size: var(--text-label-medium-size);
  --font-label-medium-line: var(--text-label-medium-line);
  --font-label-medium-weight: 600;
  --font-label-medium-tracking: -0.72px;

  /* Layout */
  --page-max: 1680px;
  --page-gutter: var(--space-xl); /* 24 */

  /* Sticky header: mobile 16+40+16 = 72; desktop 24+64+24 = 112 */
  --site-header-height: 72px;

  /* Legacy aliases — existing pages keep working */
  --bg: var(--page);
  --ink: var(--on-page);
  --ink-soft: var(--on-page-alt);
  --line: var(--outline);
  --line-soft: #efede5;
  --paper-tint: #EDE6D8;
  --paper-card: #FBF8F1;
  --accent-ink: #8C1D22;
}

@media (min-width: 1024px) {
  :root {
    --site-header-height: 112px;
  }}

html {
  scroll-behavior: smooth;
}

body {
  /* A faint fibrous washi grain over the warm paper base — low-opacity SVG
     turbulence so it reads as texture, never as pattern. */
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-body), "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;
}

/* Display type: headings and any opted-in element take the mincho serif so the
   pages read as a guidebook, not a sans dashboard. Body copy stays humanist
   sans for readability. HTML adds the Zen Old Mincho Google Fonts link. */
h1, h2, .display-serif {
  font-family: "Zen Old Mincho", "Noto Serif JP", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

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

/* Engawa brand mark (Figma Design System → Logo) */
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  line-height: 0;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  overflow: visible;
}
.site-logo:hover {
  opacity: 0.88;
}
.site-logo-img {
  display: block;
  height: 1.75rem;
  width: auto;
}
.site-logo-img.logo-footer {
  height: 2rem;
}

/*
 * Logo — designer-exported SVGs only (no CSS composition).
 *   mobile  <1024: logo-small-engawa.svg  133×40
 *   desktop ≥1024: logo-regular-full.svg  322×64
 */
.site-logo--header {
  gap: 0;
  align-items: center;
  overflow: visible;
  flex-shrink: 0;
  line-height: 0;
}
.site-logo-lockup {
  display: block;
  width: auto;
  max-width: none;
  flex-shrink: 0;
  object-fit: contain;
}
/* Mobile default: compact, no .house */
.site-logo-lockup--full {
  display: none;
  height: 64px;
  width: 322px;
}
.site-logo-lockup--sm {
  display: block;
  height: 40px;
  width: 133px;
}
.site-logo-lockup--footer {
  display: block;
  height: 40px;
  width: auto;
}
@media (min-width: 1024px) {
  .site-logo-lockup--full {
    display: block;
    height: 64px;
    width: 322px;
  }
  .site-logo-lockup--sm {
    display: none;
  }
  .site-logo-lockup--footer {
    height: 48px;
    width: auto;
  }
}

/* label/medium — Shippori Mincho nav typography */
.label-medium {
  font-family: var(--font-label-medium-family);
  font-size: var(--font-label-medium-size);
  font-weight: var(--font-label-medium-weight);
  line-height: var(--font-label-medium-line);
  letter-spacing: var(--font-label-medium-tracking);
}

/* ========== Header / Navigation (Figma 62:633) ========== */
/*
 * Header chrome is full-bleed (edge → edge).
 * Content lives in .site-header-bar, locked at max-width 1440.
 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* Full-width hairline — not on the 1440 container */
  border-bottom: 1px solid var(--outline);
  transition: box-shadow 0.25s ease, background 0.25s ease;
}
.site-header.is-scrolled {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--on-page) 4%, transparent),
              0 8px 24px color-mix(in srgb, var(--on-page) 4%, transparent);
  background: color-mix(in srgb, var(--page) 96%, transparent);
}

/* Inner container — Figma HeaderContainer max 1680, 24 gutter */
.site-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--space-lg) var(--space-xl); /* 16 vertical mobile, 24 side */
  min-height: 72px;
  box-sizing: border-box;
}
@media (min-width: 1024px) {
  .site-header-bar {
    padding: var(--space-xl); /* 24 all sides */
    min-height: 112px;
  }
}
.site-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm); /* 8 mobile: burger + logo */
  min-width: 0;
}
@media (min-width: 1024px) {
  .site-header-left {
    gap: var(--space-2xl); /* 32 logo → left nav */
  }
}
.site-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
@media (min-width: 1024px) {
  .site-header-right {
    gap: var(--space-xl); /* 24 between right link group and actions */
  }
}

/* Two Navigation groups (Figma): left = browse, right = secondary */
.site-nav {
  display: none;
  align-items: center;
  gap: var(--space-xl); /* NavigationSlot gap 24 */
}
.site-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm); /* 8 mobile between wishlist + lang */
}
@media (min-width: 1024px) {
  .site-nav {
    display: flex;
  }
  .site-nav-actions {
    gap: var(--space-xl); /* 24 desktop */
  }
}

/* NavigationLink + sumi-e brush */
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  color: var(--on-page);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 6px; /* room for brush under label */
}
.nav-link .nav-link-label {
  position: relative;
  z-index: 1;
}
/*
 * Brush underline — constant thickness regardless of label width.
 *
 * Stretching the brush SVG to fit "Map" vs "Research" thins/fattens the stroke.
 * Correct approach:
 *   1. Fixed-height bar (4px) painted with currentColor
 *   2. Brush SVG used as a MASK at natural aspect (auto 100%), tiled on X
 *      so long labels get more stroke, never a squashed one
 *   3. clip-path wipe L→R = sumi-e paint reveal (not scaleX)
 *   4. Spans label + Figma overhangs (-11 / -6)
 */
.nav-link-brush {
  position: absolute;
  left: -11px;
  right: -6px;
  bottom: 1px;
  height: 4px; /* locked stroke weight — never changes with label width */
  pointer-events: none;
  opacity: 0;
  /* Always accent (not currentColor — hover text is ink, which made the brush black) */
  background-color: var(--accent);
  /* paint reveal: start fully clipped from the right */
  clip-path: inset(0 100% 0 0);
  -webkit-clip-path: inset(0 100% 0 0);
  /* mask = brush silhouette; tile X, never stretch Y or squash X */
  -webkit-mask-image: url("brand/nav-brush.svg");
  mask-image: url("brand/nav-brush.svg");
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  -webkit-mask-position: left center;
  mask-position: left center;
  -webkit-mask-size: auto 100%;
  mask-size: auto 100%;
}
.nav-link-brush img {
  display: none; /* legacy markup; brush is CSS mask now */
}
.nav-link.is-active {
  color: var(--accent);
}
.nav-link.is-active .nav-link-brush {
  opacity: 1;
  clip-path: inset(0 0 0 0);
  -webkit-clip-path: inset(0 0 0 0);
}
@media (min-width: 1024px) {
  .nav-link-brush {
    transition:
      clip-path 0.42s cubic-bezier(0.22, 1, 0.36, 1),
      -webkit-clip-path 0.42s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.12s ease;
  }
  .nav-link:hover:not(.is-active) .nav-link-brush,
  .nav-link:focus-visible:not(.is-active) .nav-link-brush {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    -webkit-clip-path: inset(0 0 0 0);
  }
  .nav-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
  }
}

/* NavigationIconButton — 40×40 circle, glyph centered in 24 slot */
.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--on-page);
  text-decoration: none;
  flex-shrink: 0;
  line-height: 0;
}
.nav-icon-btn-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline);
  background: transparent;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: visible; /* never clip the glyph */
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-icon-btn:hover .nav-icon-btn-ring,
.nav-icon-btn:focus-visible .nav-icon-btn-ring {
  background: var(--sunken);
  border-color: transparent;
}
.nav-icon-btn:focus-visible {
  outline: none;
}
.nav-icon-btn:focus-visible .nav-icon-btn-ring {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 24×24 icon slot; glyph itself is ~14px, centered */
.nav-icon-btn-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: inherit;
  line-height: 0;
}
.nav-icon-btn-glyph img,
.nav-icon-btn-glyph svg {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.nav-icon-btn-glyph--heart img,
.nav-icon-btn-glyph--heart svg {
  width: 15px;
  height: 14px;
}
.nav-icon-btn-label {
  font-family: var(--font-label-medium-family);
  font-size: var(--font-label-medium-size);
  font-weight: var(--font-label-medium-weight);
  line-height: var(--font-label-medium-line);
  letter-spacing: var(--font-label-medium-tracking);
  color: var(--accent);
  white-space: nowrap;
}
.nav-icon-btn-label[hidden] {
  display: none !important;
}
.nav-icon-btn.is-filled {
  color: var(--accent);
}
.nav-icon-btn.is-filled .nav-icon-btn-glyph svg path {
  fill: currentColor;
  stroke: none;
}

/*
 * Burger ↔ cross — SVG rects (14×8), equal bars, never clipped.
 */
.burger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px; /* square hit area; glyph is 8px tall centered */
  line-height: 0;
  overflow: visible;
}
.burger-icon-svg {
  display: block;
  width: 14px;
  height: 8px;
  overflow: visible;
}
.burger-bar {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Morph to X around icon center (y=4 in the 8px viewBox) */
.site-header.is-drawer-open .burger-bar--top {
  transform: translateY(3.25px) rotate(45deg);
  transform-box: fill-box;
  transform-origin: center;
}
.site-header.is-drawer-open .burger-bar--bot {
  transform: translateY(-3.25px) rotate(-45deg);
  transform-box: fill-box;
  transform-origin: center;
}

.nav-menu-toggle {
  display: inline-flex;
}
@media (min-width: 1024px) {
  .nav-menu-toggle {
    display: none !important;
  }
}

/*
 * NavigationDrawer — out-of-flow under the bar so it never inflates
 * header height (was causing ~106px mobile chrome).
 */
.site-nav-drawer {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 29;
  background: var(--raised);
  border-bottom: 1px solid var(--outline);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}
.site-header.is-drawer-open .site-nav-drawer {
  max-height: 80vh;
  opacity: 1;
  pointer-events: auto;
}
.site-nav-drawer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
}
/* Drawer: no hover paint; active brush still shows via .is-active (instant) */
.site-nav-drawer .nav-link-brush {
  transition: none;
}
@media (min-width: 1024px) {
  .site-nav-drawer {
    display: none !important;
  }
}

body.nav-drawer-open {
  overflow: hidden;
}

/* ========== Footer (injected by chrome.js — styles in engawa-ds.css) ========== */
/* Legacy class hooks kept so older markup does not flash unstyled. */
.site-footer {
  border-top: none;
  background: var(--sunken);
  margin-top: 0;
}
.site-footer-inner {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: 0;
}
.site-footer-link {
  color: var(--on-page-alt);
  text-decoration: none;
}
.site-footer-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;}

.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); }
/* `accent` is a bespoke CSS var, not a Tailwind theme colour, so `border-accent`
   is not a compiled utility (like .text-accent / .bg-accent above) and lives here. */
.border-accent { border-color: var(--accent); }
.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: #9a3528;
}

.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: var(--paper-card);
  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(60, 45, 30, 0.08);
  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;
}

/* SSR property-page gallery (backend/webapp/templates/listing.html). The static
   HTML has no gallery controller, so it renders a plain big hero + a thumbnail
   strip; the shared lightbox (lightbox.js) supplies click-to-zoom and gallery
   navigation without any page-specific JS. */
.ssr-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.ssr-thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.ssr-thumb {
  width: 6.5rem;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  border: 1px solid var(--line);
}

/* Shared image lightbox — full-screen zoom for hero, gallery thumbs, and floor
   plans on BOTH the SSR pages and the JS-rendered property page. Tokens only. */
.ew-zoomable {
  cursor: zoom-in;
}
/* SPA thumbnails opt into the lightbox group (so it can walk the full set) but
   a thumb CLICK swaps the hero, not opens the lightbox, so keep the pointer. */
.thumb.ew-zoomable {
  cursor: pointer;
}
body.ew-lightbox-open {
  overflow: hidden;
}
.ew-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: rgba(35, 32, 28, 0.88);
  backdrop-filter: blur(2px);
}
.ew-lightbox[hidden] {
  display: none;
}
.ew-lightbox-img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.ew-lightbox-close,
.ew-lightbox-nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  color: var(--ink);
  background: var(--bg);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease;
}
.ew-lightbox-close:hover,
.ew-lightbox-nav:hover {
  background: #fff;
}
.ew-lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
}
.ew-lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}
.ew-lightbox-nav[hidden] {
  display: none;
}
.ew-lightbox-prev {
  left: 1rem;
}
.ew-lightbox-next {
  right: 1rem;
}

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

/* A tapered sumi-e brush stroke rather than a flat rule: an ink-toned SVG that
   thins to nothing at both ends. */
.divider {
  height: 6px;
  width: 100%;
  border: 0;
  background: center / 100% 100% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='6' viewBox='0 0 600 6' preserveAspectRatio='none'%3E%3Cpath d='M2 3 Q150 1 300 3 T598 3' stroke='%2323201C' stroke-width='1.6' fill='none' stroke-linecap='round' opacity='0.45'/%3E%3C/svg%3E");
}

.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 short tapered vermillion brush mark above section headings — a hand-inked
   accent rather than a machined 2px rule. */
.heading-bar {
  display: inline-block;
  width: 2.25rem;
  height: 7px;
  margin-bottom: 1rem;
  background: left center / 100% 100% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='7' viewBox='0 0 120 7' preserveAspectRatio='none'%3E%3Cpath d='M2 4 Q40 1 70 3.5 T118 3' stroke='%23B7282E' stroke-width='3.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

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: var(--paper-card);
  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: var(--paper-card);
  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(--paper-card);
}
.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; }
/* Muted Japanese original beneath an English headline in the popup (the
   copyable Maps string / demoted JP-only title). */
.map-popup-place-jp {
  display: block;
  font-size: 0.68rem;
  color: var(--ink-soft);
  line-height: 1.3;
  margin-top: 0.05rem;
}

/* Shared "demoted Japanese original" line: an English headline leads, the
   Japanese sits beneath as a small muted copyable alt (station / school /
   flood-river / JP-only title). English UI only — the JP UI leads in Japanese
   and never emits this. */
.jp-alt {
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.35;
  margin-top: 0.1rem;
}

/* Full-page browse map (map.html): fills viewport below sticky header. */
.map-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--site-header-height));
}
.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: var(--page-max);
  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: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 4px;
}
@media (min-width: 1024px) {
  .browse-filters {
    position: sticky;
    top: calc(var(--site-header-height) + 1rem);
    max-height: calc(100vh - var(--site-header-height) - 2rem);
    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: var(--paper-card);
  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(60, 45, 30, 0.08);
  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;
}
/* Save toggle overlaid on the list-view row photo. The photo <img> is absolutely
   positioned (inset:0), so the save button needs its own absolute placement +
   stacking context to sit above it (mirrors the grid card's top-3/right-3). */
.row-save {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
}
.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-title:has(+ .row-subtitle) { margin-bottom: 0.1rem; }
.row-subtitle { font-size: 0.8rem; color: var(--ink-soft); 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; }
}

/* ===========================================================================
   Sumi-e chrome additions — photo placeholder, save button, enquiry modal.
   =========================================================================== */

/* Quiet paper tile for the no-photo case (replaces the lone kanji placeholder).
   A muted washi surface with a short centred caption; the JS agent drops the
   copy in. */
.no-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  min-height: 7rem;
  background:
    repeating-linear-gradient(135deg, rgba(90, 83, 73, 0.03) 0 6px, transparent 6px 12px),
    var(--paper-tint);
  color: var(--ink-soft);
  border-radius: inherit;
}
.no-photo-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-align: center;
  max-width: 16rem;
  padding: 0 0.75rem;
  line-height: 1.35;
}

/* Save (heart) toggle — an ink hairline outline that fills with vermillion
   once the listing is saved. */
.save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
  background: rgba(251, 248, 241, 0.9);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.save-btn svg { width: 1.05rem; height: 1.05rem; }
.save-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.save-btn:active { transform: scale(0.94); }
.save-btn.saved {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.save-btn.saved svg { fill: currentColor; }

/* Header "saved" affordance: a heart + live count linking to the saved view.
   Muted ink at rest; vermillion (filled heart) once at least one home is saved. */
.saved-count-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}
.saved-count-link svg { width: 1.1rem; height: 1.1rem; }
.saved-count-link:hover { color: var(--accent); }
.saved-count-link.has-saved { color: var(--accent); }
.saved-count-link.has-saved svg { fill: currentColor; }

/* "Saved homes only" filter check + heart glyph in the browse filter rail. */
.filter-check-saved { align-items: center; font-weight: 500; }
.filter-check-saved .filter-heart {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--accent);
  flex: 0 0 auto;
}
.filter-check-saved input:checked ~ .filter-heart { fill: currentColor; }

/* Per-browser caveat shown atop the saved view. */
.saved-caveat {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
}

/* Enquiry / contact modal (ew- = Engawa web). JS renders the overlay + card;
   these styles keep it on-brand: paper card, hairline fields, vermillion CTA. */
.ew-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(35, 32, 28, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.ew-modal.is-open { opacity: 1; visibility: visible; }
body.ew-modal-locked { overflow: hidden; }

.ew-modal-card {
  position: relative;
  width: min(30rem, 100%);
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.75rem 1.75rem 1.9rem;
  box-shadow: 0 18px 50px rgba(35, 32, 28, 0.22);
  transform: translateY(8px);
  transition: transform 0.2s ease;
}
.ew-modal.is-open .ew-modal-card { transform: translateY(0); }
.ew-modal-card h2 { font-size: 1.35rem; line-height: 1.25; margin-bottom: 0.35rem; }
.ew-modal-card .ew-modal-sub {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.ew-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ew-modal-close:hover { background: var(--paper-tint); color: var(--ink); }

.ew-field { margin-bottom: 1rem; }
.ew-field:last-of-type { margin-bottom: 1.25rem; }
.ew-field label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.ew-field input,
.ew-field textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 3px;
}
.ew-field textarea { min-height: 6.5rem; resize: vertical; line-height: 1.5; }

.ew-modal-card .btn-accent { width: 100%; }
.ew-modal-note {
  margin-top: 0.85rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.5;
  text-align: center;
}

/* Next-steps agent cards (Stage 3 brokerability). Honest contact details only;
   stacked links so a missing field just drops out rather than leaving a gap. */
.agent-card { background: var(--surface, #fff); }
.agent-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.agent-contact-link {
  font-size: 0.85rem;
  color: var(--accent);
  word-break: break-word;
}
.agent-contact-link:hover { color: var(--accent-ink); }
