/* bakeries-page overrides — palette + fonts inherited from /styles.css.
 * Tokens: --primary (#FF52E5) · --primary-dark (#ca27b2) · --ink · --grey · etc.
 * The bakeries page is a sub-section of seoulcrushing.com and uses its
 * brand palette directly. Pink/magenta is the "doom" signal — chain
 * saturation is a domestic-pressure indicator, so the marker color is
 * --primary by design choice, not arbitrarily. */

html:has(body.bakeries-page),
body.bakeries-page {
  height: auto;
  min-height: 100vh;
  max-height: none;
  overflow: auto;
}

body.bakeries-page {
  background: #fafafa;
  color: var(--ink);
  font-family: 'Source Sans 3', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.bakeries-page #page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 28px 56px;
}

/* Header */
.bakeries-page header {
  margin-bottom: 22px;
}

.bakeries-page header h1 {
  font-family: 'Bagel Fat One', cursive;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Dek under H1 — plain-English framing line. Replaces the old mono stat
 * strip. Sits in the visual register of body type, not display. */
.bakeries-page header .dek {
  max-width: 720px;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--grey);
  margin: 0;
}


/* Choropleth tooltip */
.bakeries-page .leaflet-tooltip {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--grey-lighter);
  border-radius: 3px;
  font-family: 'Source Sans 3', 'Noto Sans KR', sans-serif;
  font-size: 12px;
  padding: 5px 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-weight: 500;
}

.bakeries-page .leaflet-tooltip strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.bakeries-page .leaflet-tooltip-top:before {
  border-top-color: var(--grey-lighter);
}

/* Map */
.bakeries-page #map-section {
  margin-bottom: 28px;
}

.bakeries-page #map {
  height: 70vh;
  min-height: 520px;
  background: #f3f3f3;
  border: 1px solid var(--grey-lighter);
  color: var(--grey);
  font-size: 13px;
  font-family: inherit;
}

/* Methodology */
.bakeries-page .methodology {
  max-width: 720px;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--ink);
}

.bakeries-page .methodology p {
  margin: 0 0 8px;
}

.bakeries-page .methodology strong {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Methodology — structured rows matching the panel's pattern.
 * Sources / Terms render as definition lists (key in mono, value in body
 * type). "Reading" stays as prose because it's editorial narrative, not
 * key-value data. */
.bakeries-page .meth-label {
  font-family: 'Bagel Fat One', cursive;
  font-weight: 400;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 22px 0 8px;
}

.bakeries-page .meth-label:first-of-type {
  margin-top: 0;
}

.bakeries-page .meth-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 14px;
  row-gap: 5px;
  margin: 0 0 6px;
}

.bakeries-page .meth-list dt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--grey);
  letter-spacing: 0.03em;
  padding-top: 2px;
  white-space: nowrap;
}

.bakeries-page .meth-list dd {
  font-size: 13px;
  color: var(--ink);
  margin: 0;
  line-height: 1.55;
}

.bakeries-page .meth-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--grey);
  margin: 18px 0 0;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.bakeries-page .methodology > p {
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 6px;
}

.bakeries-page .methodology a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-decoration-color: var(--grey-lighter);
  text-underline-offset: 2px;
}

.bakeries-page .methodology a:hover {
  text-decoration-color: var(--primary-dark);
}

/* Leaflet popup */
.bakeries-page .leaflet-popup-content {
  font-family: 'Source Sans 3', 'Noto Sans KR', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  margin: 10px 14px;
  color: var(--ink);
}

.bakeries-page .leaflet-popup-content .name {
  font-family: 'Bagel Fat One', cursive;
  font-weight: 400;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: -0.01em;
}

.bakeries-page .leaflet-popup-content .gu {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
}

.bakeries-page .leaflet-popup-content .addr {
  color: var(--grey);
  font-size: 11px;
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.4;
}

.bakeries-page .leaflet-container {
  background: #f3f3f3;
  font-family: inherit;
}

/* Kill the browser's default rectangular focus outline on SVG paths
 * (Leaflet polygons + circle markers). The polygon's own stroke change
 * on hover is the focus indicator we want — not a bounding-box rectangle. */
.bakeries-page .leaflet-interactive,
.bakeries-page .leaflet-interactive:focus,
.bakeries-page .leaflet-interactive:focus-visible {
  outline: none;
}

/* Baguette emoji marker — shown when zoomed in past the threshold.
 * At low zoom, dot density is the story (overlapping = saturation).
 * At high zoom, individual stores can stand alone — emoji adds the bite. */
.bakeries-page .pb-emoji {
  background: transparent;
  border: none;
  text-align: center;
  font-size: 18px;
  line-height: 22px;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Zone label markers — shown at overview zoom, Bagel Fat One navy */
.zone-lbl-icon {
  overflow: visible !important;
  background: none !important;
  border: none !important;
}

.zone-lbl-wrap {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.zone-lbl {
  font-family: 'Bagel Fat One', cursive;
  font-size: 13px;
  font-weight: 400;
  color: #0a1f3d;
  white-space: nowrap;
  cursor: pointer;
  letter-spacing: -0.01em;
  text-shadow:
    -1.5px -1.5px 0 rgba(255,255,255,0.9),
     1.5px -1.5px 0 rgba(255,255,255,0.9),
    -1.5px  1.5px 0 rgba(255,255,255,0.9),
     1.5px  1.5px 0 rgba(255,255,255,0.9),
     0 0 6px rgba(255,255,255,0.7);
  transition: color 0.12s;
}

.zone-lbl:hover {
  color: var(--primary-dark);
}

/* Zone side panel */
.bakeries-page #map-section {
  position: relative;
  /* Clip the slide-away panel: .zone-panel--hidden uses translateX/Y(100%),
     which only hides it if the overflow is clipped here. Without this the
     "hidden" panel leaks into the page's right margin on wide screens. */
  overflow: hidden;
}

.zone-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  border-left: 1px solid var(--grey-lighter);
  z-index: 1001;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 18px 20px 20px;
  transform: translateX(0);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.zone-panel--hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.zp-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--grey);
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
}

.zp-close:hover {
  color: var(--ink);
}

.zp-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
  padding-right: 24px;
}

.zp-name {
  font-family: 'Bagel Fat One', cursive;
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.01em;
}

.zp-gu {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.zp-lede-block {
  margin: 0 0 14px;
  flex: 1;
}

.zp-lede-block p {
  font-family: 'Source Sans 3', 'Noto Sans KR', sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.55;
  margin: 0 0 9px;
}

.zp-lede-block p:last-child {
  margin-bottom: 0;
}

/* Data block — now sits ABOVE the lede in panel order. The lede block
 * adds its own top spacing; this block sits flush under the head. */
.zp-data {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 14px;
  border-top: 1px solid var(--grey-lighter);
  border-bottom: 1px solid var(--grey-lighter);
  padding: 8px 0 2px;
}

.zp-row {
  display: flex;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  padding: 5px 0;
  border-bottom: 1px dotted var(--grey-lighter);
}

.zp-row:last-child {
  border-bottom: none;
}

/* Wider key column to fit the new labels ("BAKERY SIGNAL" / "STREET MIX").
 * Uppercased + slightly tighter letter-spacing keeps them readable at 10px. */
.zp-key {
  color: var(--grey);
  min-width: 86px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  padding-top: 1px;
}

.zp-val {
  color: var(--ink);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.zp-row--accent .zp-val {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Secondary line within a value cell (e.g. top업종 under the 상권 tag) */
.zp-sub {
  color: var(--grey);
  font-size: 10.5px;
  display: inline-block;
  margin-top: 2px;
}

/* Subtle inline note (e.g. "across N 법정동") */
.zp-subtle {
  color: var(--grey);
  font-size: 10px;
  font-weight: 400;
}

/* Strong inline emphasis — e.g. 10yr ×N when N ≥ 2.0 ("doubled in a decade"
 * is the gentrification-velocity signal). Visual cue without changing the
 * data structure. */
.zp-strong {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Responsive */
@media (max-width: 640px) {
  .bakeries-page #page {
    padding: 24px 18px 40px;
  }
  .bakeries-page header h1 {
    font-size: 40px;
  }
  .bakeries-page header .tagline {
    font-size: 15px;
  }
  .bakeries-page #map {
    height: 60vh;
    min-height: 400px;
  }
  /* Bottom sheet on mobile */
  .zone-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55%;
    border-left: none;
    border-top: 1px solid var(--grey-lighter);
    transform: translateY(0);
    border-radius: 10px 10px 0 0;
  }
  .zone-panel--hidden {
    transform: translateY(100%);
  }
}
