:root {
  --kindred-pink: #f23883;
  --kindred-pink-deep: #d81f5b;
  --kindred-pink-soft: #ffd6e7;
  --kindred-ink: #101014;
  --kindred-ink-soft: #2a2930;
  --kindred-paper: #fffafc;
  --kindred-muted: #6d6870;
  --kindred-line: rgba(16, 16, 20, 0.16);
  --kindred-map-line: rgba(255, 255, 255, 0.16);
  --kindred-good: #62d9aa;
  --kindred-warn: #ffd166;
  --kindred-radius-sm: 10px;
  --kindred-radius-md: 16px;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--kindred-pink-deep);
  outline-offset: 3px;
}

:where(button, select, input) {
  min-height: 44px;
}

.journal-primary-button,
.featured-stage-action,
.tip-button,
.dialog-submit {
  background: var(--kindred-ink);
  color: var(--kindred-paper);
}

:is(.journal-primary-button, .featured-stage-action, .tip-button, .dialog-submit):disabled {
  color: rgba(255, 250, 252, 0.58);
  opacity: 0.68;
}

.featured-stage-contribute {
  min-height: 44px;
  margin-top: 8px;
  padding: 0 14px;
  color: var(--kindred-ink);
  border: 1px solid var(--kindred-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.research-city-status .dialog-submit { width: 100%; }

.journal-pink,
.journal-section-heading span,
.featured-stage-kicker,
.city-directory-copy em {
  color: var(--kindred-pink-deep);
}

/* Device-local library: public POI identifiers only; no account or location. */
.journal-device-library {
  margin: 0;
  padding: clamp(28px, 4vw, 52px) clamp(18px, 5vw, 72px);
  background: var(--kindred-paper);
  border-block: 1px solid var(--kindred-line);
}

.home-shell.journal-home.is-city-map .journal-device-library {
  display: none !important;
}

.device-library-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.device-library-heading h2 {
  max-width: 620px;
  margin: 4px 0 0;
  font-size: clamp(28px, 4.2vw, 58px);
  line-height: 0.95;
  text-transform: uppercase;
}

.device-library-heading p,
.device-library-privacy {
  margin: 0;
  color: var(--kindred-muted);
  font-size: 13px;
}

.device-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.device-library-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--kindred-line);
  border-radius: var(--kindred-radius-md);
  background: white;
}

.device-library-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.device-library-panel h3 {
  margin: 0;
  font-size: 18px;
}

.device-library-list {
  display: grid;
  gap: 8px;
}

.device-library-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  width: 100%;
  min-height: 56px;
  padding: 9px 12px;
  color: var(--kindred-ink);
  text-align: left;
  border: 1px solid var(--kindred-line);
  border-radius: var(--kindred-radius-sm);
  background: var(--kindred-paper);
}

.device-library-item strong { align-self: end; }
.device-library-item small { grid-column: 1; color: var(--kindred-muted); }
.device-library-item span { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 18px; }
.device-library-empty { margin: 8px 0; color: var(--kindred-muted); }
.device-library-share { padding: 0 12px; border: 1px solid var(--kindred-line); border-radius: 999px; background: white; }

/* Search hierarchy and status chips. */
.search-result-item {
  position: relative;
  grid-template-columns: 64px minmax(0, 1fr);
}

.search-featured-badge {
  display: block;
  width: max-content;
  max-width: 62px;
  margin-top: 4px;
  padding: 2px 5px;
  color: #9a164f;
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(255, 95, 168, 0.18);
}

.search-result-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.search-result-item > .search-result-chips {
  grid-column: 2;
  grid-row: 3;
  width: 100%;
  max-width: 100%;
  align-self: start;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: none;
}

.search-result-chip,
.poi-row-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  color: var(--kindred-ink-soft);
  font-size: 11px;
  font-style: normal;
  line-height: 1.2;
  border: 1px solid var(--kindred-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.search-result-chip.is-open,
.poi-row-status.is-open { border-color: rgba(98, 217, 170, 0.7); background: rgba(98, 217, 170, 0.2); }
.search-result-chip.is-closed,
.poi-row-status.is-closed { color: #785423; border-color: rgba(255, 209, 102, 0.65); background: rgba(255, 209, 102, 0.18); }
.search-no-result-action { margin: 8px 12px 12px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--kindred-pink); color: #fff; }

/* Map discovery controls. The original five POI types stay separate below. */
.home-shell.is-city-map .city-map-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 8px 0 6px;
}

.home-shell.is-city-map .city-time-filters {
  display: flex;
  min-width: 0;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.home-shell.is-city-map .city-time-filters::-webkit-scrollbar { display: none; }

.home-shell.is-city-map :is(.city-time-filter, .city-budget-filter select, .city-map-view-switch button) {
  min-height: 44px;
  padding: 0 13px;
  color: rgba(255, 255, 255, 0.74);
  white-space: nowrap;
  border: 1px solid var(--kindred-map-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.home-shell.is-city-map :is(.city-time-filter.is-active, .city-map-view-switch button.is-active) {
  color: #12090d;
  border-color: var(--kindred-pink);
  background: var(--kindred-pink);
}

.home-shell.is-city-map .city-budget-filter select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.home-shell.is-city-map .city-map-view-switch {
  display: none;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--kindred-map-line);
  border-radius: 999px;
}

.home-shell.is-city-map .city-map-view-switch button { min-width: 72px; border: 0; }

.home-shell.is-city-map .type-filter-bar {
  position: relative;
  padding-inline: 0;
  -webkit-mask-image: none;
  mask-image: none;
}

.home-shell.is-city-map .poi-row {
  min-height: 56px;
}

.home-shell.is-city-map .poi-row > em {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.poi-detail-loading {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.poi-glance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.poi-glance > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--kindred-map-line);
  border-radius: var(--kindred-radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

.poi-glance small { display: block; margin-bottom: 3px; color: rgba(255, 255, 255, 0.58); font-size: 11px; }
.poi-glance strong { display: block; overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.poi-glance .is-open strong { color: var(--kindred-good); }
.poi-glance .is-closed strong { color: var(--kindred-warn); }

.poi-quick-actions {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(44px, .7fr));
  gap: 8px;
  margin-bottom: 12px;
}

.poi-quick-actions button,
.poi-quick-actions a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  color: #fff;
  text-decoration: none;
  border: 1px solid var(--kindred-map-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.poi-quick-actions .is-primary { color: #160910; border-color: var(--kindred-pink); background: var(--kindred-pink); }
.poi-detail-more > summary { min-height: 44px; cursor: pointer; color: rgba(255, 255, 255, 0.8); }

.home-shell.is-city-map .poi-community-actions button {
  min-width: 0;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: keep-all;
}

.home-shell.is-city-map .poi-community-actions button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-shell.is-city-map .poi-community-actions button svg {
  flex: 0 0 auto;
}

/* Structured contribution UI and explicit photo policy. */
.tip-dialog form > label:not(.tip-city-field),
.tip-photo-policy {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.tip-dialog :is(input, select, textarea) {
  width: 100%;
  box-sizing: border-box;
}

.tip-photo-policy {
  padding: 11px;
  border: 1px solid var(--kindred-line);
  border-radius: var(--kindred-radius-sm);
}

.tip-photo-policy label { display: flex; align-items: flex-start; gap: 8px; }
.tip-photo-policy input { width: 20px; min-height: 20px; margin-top: 2px; }
.tip-photo-policy p { margin: 7px 0; color: var(--kindred-muted); font-size: 12px; }

@media (min-width: 768px) and (max-width: 1024px) {
  .home-shell.is-city-map .city-map-view-switch { display: flex; }
  .home-shell.is-city-map .city-map-layout { min-height: 58vh; grid-template-columns: 1fr !important; }
  .home-shell.is-city-map[data-city-view="map"] .poi-detail-card { display: none; }
  .home-shell.is-city-map[data-city-view="list"] .local-map-card { display: none; }
  .home-shell.is-city-map[data-city-view="list"] .city-map-layout { min-height: auto; }
  .home-shell.is-city-map[data-city-view="list"] .poi-detail-card {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 58vh;
    margin: 0 !important;
  }
  .home-shell.is-city-map[data-city-view="list"] .poi-strip {
    display: block !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 96px;
    margin: 0 !important;
  }
}

@media (min-width: 768px) {
  .home-shell.is-city-map .city-map-view {
    grid-template-rows: 62px 52px 44px minmax(0, 1fr) 96px !important;
  }
}

@media (max-width: 767px) {
  .home-shell.journal-home:not(.is-city-map) .journal-sticker-stage {
    height: 198px !important;
    min-height: 198px !important;
  }

  .device-library-heading { display: block; }
  .device-library-privacy { margin-top: 8px; }
  .device-library-grid { grid-template-columns: 1fr; }

  .home-shell.is-city-map .city-map-view {
    grid-template-rows: auto auto 44px minmax(0, 1fr) 96px !important;
  }

  .home-shell.is-city-map .city-map-tools {
    margin-inline: -2px;
  }

  .home-shell.is-city-map .city-map-view-switch { display: none; }
  .home-shell.is-city-map .city-map-layout { overflow: visible; }
  .home-shell.is-city-map.has-selected-poi .city-map-layout { z-index: 10; }
  .home-shell.is-city-map .search-results {
    position: fixed !important;
    top: 60px !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
  }
  .home-shell.is-city-map .city-time-filters { padding-inline: 2px; }
  .home-shell.is-city-map .type-filter-bar.has-overflow.is-scroll-start {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 34px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 34px), transparent 100%);
  }
  .home-shell.is-city-map .type-filter-bar.has-overflow:not(.is-scroll-start):not(.is-scroll-end) {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 34px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 34px), transparent 100%);
  }
  .home-shell.is-city-map .type-filter-bar.has-overflow.is-scroll-end {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 100%);
  }
  .home-shell.is-city-map .type-filter { font-size: 11px; }
  .home-shell.is-city-map .type-filter small { font-size: 10px; }
  .home-shell.is-city-map .wanted-list-button {
    min-height: 44px;
  }
  .home-shell.is-city-map .kindred-featured-marker-label strong { font-size: 11px; }
  .home-shell.is-city-map .kindred-featured-marker-label small,
  .home-shell.is-city-map :is(.poi-featured-badge, .search-featured-badge) { font-size: 10px; }
  .home-shell.is-city-map .poi-strip { max-height: 104px; transition: max-height 180ms ease; }
  .home-shell.is-city-map .poi-strip.is-expanded { max-height: 48svh; }
  .home-shell.is-city-map .poi-detail-card { max-height: 70svh; }
  .home-shell.is-city-map .poi-strip[data-drawer-state="collapsed"] .poi-list { display: none; }
  .home-shell.is-city-map .poi-strip[data-drawer-state="half"] .poi-list { display: grid; }
  .poi-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .poi-detail-more:not([open]) > :not(summary) { display: none; }
}

@media (max-width: 340px) {
  .home-shell.is-city-map .city-time-filter,
  .home-shell.is-city-map .city-budget-filter select { padding-inline: 10px; font-size: 12px; }
  .home-shell.is-city-map .poi-detail-card { max-height: 61svh; }
  .home-shell.is-city-map .poi-community-actions button span {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }
  .poi-glance { grid-template-columns: 1fr; }
  .device-library-panel { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .home-shell.is-city-map .poi-strip { transition-duration: 1ms; }
}
