/**
 * Homepage modular sections — layout from reference, discover color tokens.
 */
.home-modules .section {
  padding: 2rem 0;
}

.home-modules .section-title {
  color: var(--brand-green-dark);
  font-weight: 700;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
}

.home-modules .section-title::before {
  height: 3px;
  width: 36px;
  background: linear-gradient(90deg, var(--brand-green), rgba(26, 92, 69, 0.35));
}

.home-modules .section-subtitle {
  margin-bottom: 0;
}

/* Bento grid — map spans two columns (not SOS) */
.home-modules .home-bento {
  grid-template-areas:
    "blood blood doctor health"
    "blood blood shop pro"
    "gov complaint map map";
}

.home-modules .bt-map {
  grid-area: map;
}

.home-modules .bt-donation {
  grid-area: shop;
  --tint: #0c6b74;
  --tint-bg: #e6f1eb;
}

.home-modules .bt-citizen-complaint {
  grid-area: pro;
  --tint: #8a5a12;
  --tint-bg: #f4ebdd;
}

/* Minimal blood tile + ECG / droplet animation */
.home-modules .bt-blood.bt-blood-minimal {
  --tint: #c4513a;
  min-height: 334px;
  padding: 1.6rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(196, 81, 58, 0.22);
  box-shadow: var(--shadow-soft);
  position: relative;
}

.home-modules .bt-blood.bt-blood-minimal .bt-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

.home-modules .bt-blood.bt-blood-minimal .bt-title-row .bt-title {
  color: var(--ink);
  margin: 0;
}

.home-modules .bt-blood.bt-blood-minimal .bt-blood-heart {
  position: static;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
  pointer-events: none;
}

.home-modules .bt-blood.bt-blood-minimal:hover {
  color: var(--ink);
  box-shadow: var(--shadow-soft-hover);
  border-color: rgba(196, 81, 58, 0.35);
}

.home-modules .bt-blood.bt-blood-minimal .bt-icon {
  background: rgba(196, 81, 58, 0.1);
  color: #b8432f;
  width: 56px;
  height: 56px;
  box-shadow: none;
}

.home-modules .bt-blood.bt-blood-minimal .bt-count {
  color: #b8432f;
  background: rgba(196, 81, 58, 0.08);
}

.home-modules .bt-blood.bt-blood-minimal .bt-desc {
  color: var(--muted);
}

.home-modules .bt-blood.bt-blood-minimal .bt-groups span {
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--border-soft);
}

.home-modules .bt-blood.bt-blood-minimal .bt-groups span.has {
  background: rgba(196, 81, 58, 0.08);
  border-color: rgba(196, 81, 58, 0.25);
}

.home-modules .bt-blood.bt-blood-minimal .bt-cta {
  background: #b8432f;
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.88rem;
}

@media (prefers-reduced-motion: reduce) {
  .home-modules .bt-blood.bt-blood-minimal .bt-blood-heart,
  .home-modules .bt-blood.bt-blood-minimal .bt-blood-heart::after {
    animation: none;
  }
}

/* Home feed preview (under glance) */
.home-modules .home-feed-block {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-soft);
}

.home-modules .home-feed-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.home-modules .home-feed-block-title {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-display, "Baloo Da 2", sans-serif);
  color: var(--brand-green-dark);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.home-modules .home-feed-block-more {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-green);
  text-decoration: none;
}

.home-modules .home-feed-block-more:hover {
  text-decoration: underline;
}

.home-modules .home-feed-block-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.home-modules .home-update-spin {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(26, 92, 69, 0.1);
  color: var(--brand-green);
  font-size: 0.85rem;
  animation: homeUpdateSpin 2.8s linear infinite;
}

@keyframes homeUpdateSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .home-modules .home-update-spin {
    animation: none;
  }
}

.home-modules .bt-map-visual {
  position: absolute;
  right: 2%;
  top: 50%;
  width: min(42%, 200px);
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.92;
}

.home-modules .bt-map-visual img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
}

@media (max-width: 991.98px) {
  .home-modules .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "blood blood"
      "doctor health"
      "shop pro"
      "gov complaint"
      "map map";
  }

  .home-modules .bt-map {
    padding-right: 1.2rem;
    min-height: 200px;
  }

  .home-modules .bt-map-visual {
    width: 38%;
  }
}

@media (max-width: 575.98px) {
  .home-modules .bento {
    grid-template-columns: 1fr;
    grid-template-areas: unset;
  }

  .home-modules .bento-tile {
    grid-area: auto !important;
  }
}

/* Protiva spotlight */
.home-spotlight {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-soft);
}

.home-spotlight-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.home-spotlight-lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.home-spotlight-stat {
  margin: 1rem 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.home-spotlight-stat strong {
  display: block;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--brand-green);
  line-height: 1.1;
}

.home-spotlight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.home-spotlight-meta li {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  color: var(--muted);
}

.home-spotlight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.home-spotlight-carousel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.home-spotlight-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 200px);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.home-spotlight-card {
  scroll-snap-align: start;
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  min-height: 280px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
}

.home-spotlight-kind {
  position: absolute;
  z-index: 3;
  top: 0.65rem;
  left: 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(26, 92, 69, 0.92);
  color: #fff;
}

.home-spotlight-photo {
  position: relative;
  z-index: 0;
  flex: 1 1 auto;
  min-height: 160px;
  max-height: 200px;
  overflow: hidden;
  background: var(--bg-soft);
}

.home-spotlight-photo img,
.home-spotlight-photo-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-spotlight-photo-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e8f0ec, #d4e4dc);
  color: var(--brand-green);
  font-size: 2rem;
  min-height: 160px;
}

.home-spotlight-yr,
.home-spotlight-cat-icon {
  position: absolute;
  z-index: 2;
  top: 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.home-spotlight-yr {
  right: 0.65rem;
  left: auto;
  background: var(--surface);
  color: var(--ink);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
}

.home-spotlight-cat-icon {
  right: 0.65rem;
  top: 2.35rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--brand-green);
  border: 1px solid var(--border-soft);
}

.home-spotlight-body {
  position: relative;
  z-index: 1;
  padding: 0.85rem 0.85rem 0.9rem;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
}

.home-spotlight-body strong {
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--brand-green-dark);
}

.home-spotlight-body span {
  font-size: 0.82rem;
  color: var(--muted);
}

.home-spotlight-body small {
  font-size: 0.75rem;
  color: var(--muted);
}

.home-spotlight-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.home-spotlight-bar {
  flex: 1;
  height: 3px;
  background: var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
}

.home-spotlight-bar span {
  display: block;
  height: 100%;
  width: 20%;
  background: var(--brand-green);
  border-radius: inherit;
  transition: width 0.2s ease, margin-left 0.2s ease;
}

.home-spotlight-empty {
  color: var(--muted);
  align-self: center;
  margin: auto;
}

@media (max-width: 991.98px) {
  .home-spotlight {
    grid-template-columns: 1fr;
  }
}

/* Glance + live feed tweaks */
.home-modules .glance-fact {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.home-modules .glance-fact:hover {
  border-color: rgba(26, 92, 69, 0.35);
  box-shadow: var(--shadow-soft-hover);
}

.home-modules .live-feed-label {
  gap: 0.5rem;
}

.home-modules .live-feed-cta {
  flex-shrink: 0;
  border-radius: 999px;
}

.home-modules .live-feed-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1rem;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.88rem;
}

.home-modules .live-feed-item small {
  color: var(--muted);
}

.home-modules .live-feed-marquee {
  display: flex;
  gap: 1.5rem;
  animation: homeMarquee 40s linear infinite;
}

@keyframes homeMarquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-modules .live-feed-marquee {
    animation: none;
    flex-wrap: wrap;
  }
}

/* Notices + news split */
.home-nn-cols {
  display: grid;
  grid-template-columns: 0.42fr 0.58fr;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
}

@media (max-width: 991.98px) {
  .home-nn-cols {
    grid-template-columns: 1fr;
  }
}

.home-modules .nb-tag {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--brand-green-dark);
  background: rgba(26, 92, 69, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.home-modules .nw-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: auto;
}

/* Events */
.home-ev-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.home-ev-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s, box-shadow 0.2s;
}

.home-ev-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft-hover);
  color: var(--ink);
}

.home-ev-card time {
  font-size: 0.82rem;
  color: var(--muted);
}

.home-ev-card strong {
  font-size: 1.05rem;
  line-height: 1.45;
}

.home-ev-card span {
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 767.98px) {
  .home-ev-grid {
    grid-template-columns: 1fr;
  }
}

/* Contributors */
.home-contrib-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.home-contrib-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.home-contrib-rank {
  position: absolute;
  top: -6px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.home-contrib-rank.is-gold {
  background: #f4e4bc;
  border-color: #d4a843;
  color: #7a5a12;
}

.home-contrib-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: var(--brand-green);
}

.home-contrib-body {
  min-width: 0;
}

.home-contrib-name {
  font-weight: 700;
  font-size: 0.92rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.home-contrib-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(26, 92, 69, 0.12);
  color: var(--brand-green-dark);
}

.home-contrib-loc,
.home-contrib-count {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.home-contrib-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}

.home-contrib-foot p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 36rem;
}

@media (max-width: 991.98px) {
  .home-contrib-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .home-contrib-grid {
    grid-template-columns: 1fr;
  }
}

/* CTA bands */
.home-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 2.5rem;
}

.home-cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.home-cta-band--soft {
  background: var(--bg-soft);
}

.home-cta-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--border-soft);
  color: var(--brand-green);
  font-size: 1.2rem;
}

.home-cta-icon--green {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
}

.home-cta-text {
  flex: 1 1 220px;
  min-width: 0;
}

.home-cta-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.home-cta-text span {
  font-size: 0.88rem;
  color: var(--muted);
}

.home-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

.home-cta-outline {
  border-color: rgba(196, 81, 58, 0.45);
  color: #b8432f;
}

@media (max-width: 767.98px) {
  .home-cta-band {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-cta-actions {
    margin-left: 0;
    width: 100%;
  }

  .home-cta-actions .btn,
  .home-cta-band > .btn {
    width: 100%;
  }
}

/* Four-union interactive map (homepage) */
.home-union-map-panel {
  display: grid;
  gap: 1rem;
}

.home-union-map__canvas {
  height: min(52vh, 420px);
  min-height: 280px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: #d7e4ea;
  overflow: hidden;
}

.home-union-map-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
}

.home-union-map-legend a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--brand-green-dark);
  text-decoration: none;
}

.home-union-map-legend a:hover {
  color: var(--brand-green);
  text-decoration: underline;
}

.home-union-map-legend i {
  color: var(--ap-color-orange, #d4892a);
}

.home-union-map-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.home-union-map-note a {
  font-weight: 600;
}

@media (min-width: 768px) {
  .home-union-map-panel {
    grid-template-columns: 1fr minmax(200px, 260px);
    align-items: stretch;
  }

  .home-union-map-legend {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .home-union-map__canvas {
    min-height: 360px;
  }
}

.home-modules .section:not(.is-revealed):not(.dc-hero) {
  opacity: 0;
}

.home-modules .dc-hero,
.home-modules .section.is-revealed {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .home-modules .section.is-revealed {
    animation: home-section-in var(--ap-duration-normal, 280ms) var(--ap-ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
  }
}

@keyframes home-section-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-modules .section.is-revealed {
    animation: none;
  }
}
