/* The Twelve Apostles interactive board. Embeds inside an article body via
   [[apostles]]. Illuminated-manuscript styling to match the site. */

.apostles-widget {
  margin: 2rem 0;
  padding: 1.4rem 1.4rem 1.6rem;
  border: 1px solid rgba(150, 103, 47, 0.42);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 243, 0.97), rgba(247, 238, 219, 0.97)),
    url('./assets/parchment-bg.png');
  background-size: cover;
  box-shadow: 0 20px 50px -28px rgba(60, 38, 16, 0.5), inset 0 0 0 1px rgba(255, 244, 214, 0.6);
  color: #3a2a17;
}

.apostles-head { text-align: center; margin-bottom: 1.2rem; }

.apostles-kicker {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: rgba(122, 78, 28, 0.85);
  margin: 0 0 0.35rem;
}

.apostles-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  color: #2e1c0c;
  margin: 0 0 0.4rem;
}

.apostles-intro {
  font-size: 1.05rem;
  color: #4f3a22;
  margin: 0 auto 0.5rem;
  max-width: 46ch;
}

.apostles-disclaimer {
  font-size: 0.86rem;
  font-style: italic;
  color: rgba(96, 64, 32, 0.92);
  margin: 0 auto;
  max-width: 56ch;
}

.apostles-board {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.apostles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.apostle-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem 0.7rem;
  border: 1px solid rgba(150, 103, 47, 0.4);
  border-radius: 0.7rem;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.95), rgba(245, 233, 209, 0.92));
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: #3a2a17;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.apostle-card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(60, 38, 16, 0.55); }

.apostle-card.is-active {
  border-color: rgba(141, 86, 33, 0.85);
  box-shadow: 0 0 0 2px rgba(195, 142, 70, 0.55), 0 14px 26px -14px rgba(60, 38, 16, 0.6);
  background: linear-gradient(180deg, #fffaf0, #f3e3c4);
}

.apostle-card:focus-visible { outline: 2px solid rgba(141, 86, 33, 0.85); outline-offset: 2px; }

.apostle-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #5a3a16;
  background: radial-gradient(circle at 32% 28%, #fbeec9, #e7c486 62%, #b9883f);
  border: 1px solid rgba(120, 80, 33, 0.5);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.7);
}

.apostle-card-name {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  line-height: 1.15;
  color: #2e1c0c;
}

.apostle-card-epithet { font-size: 0.74rem; font-style: italic; color: rgba(96, 64, 32, 0.85); }

.apostle-card-tag {
  margin-top: 0.15rem;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  color: #7a4e1c;
  background: rgba(195, 142, 70, 0.2);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

/* ---- Detail panel ---- */
.apostles-detail { min-height: 100%; }

.apostle-detail-card {
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid rgba(150, 103, 47, 0.4);
  border-radius: 0.85rem;
  background: rgba(255, 252, 245, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 214, 0.6);
  animation: apostle-fade 0.18s ease;
}

@keyframes apostle-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.apostle-detail-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; }

.apostle-detail-emblem {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #5a3a16;
  background: radial-gradient(circle at 32% 28%, #fbeec9, #e7c486 62%, #b9883f);
  border: 1px solid rgba(120, 80, 33, 0.5);
}

.apostle-detail-name { font-family: 'Cinzel', serif; font-size: 1.25rem; color: #2e1c0c; margin: 0; line-height: 1.1; }
.apostle-detail-epithet { font-size: 0.9rem; font-style: italic; color: rgba(96, 64, 32, 0.9); margin: 0.1rem 0 0; }

.apostle-detail-role { font-size: 1.04rem; line-height: 1.5; color: #43301b; margin: 0 0 0.85rem; }

.apostle-detail-facts { display: flex; flex-direction: column; gap: 0.5rem; margin: 0 0 0.85rem; }
.apostle-detail-facts > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(150, 103, 47, 0.2);
}
.apostle-detail-facts dt {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7a4e1c;
}
.apostle-detail-facts dd { margin: 0; font-size: 0.95rem; line-height: 1.4; color: #43301b; }

.apostle-detail-note {
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(86, 57, 28, 0.95);
  background: rgba(195, 142, 70, 0.12);
  border-left: 3px solid rgba(141, 86, 33, 0.6);
  border-radius: 0.3rem;
  padding: 0.55rem 0.7rem;
  margin: 0;
}
.apostle-detail-note strong { color: #5a3a16; }

/* ===================== Map mode ===================== */
.apostles-map-widget {
  margin: 2rem 0;
  padding: 1.4rem 1.4rem 1.6rem;
  border: 1px solid rgba(150, 103, 47, 0.42);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 243, 0.97), rgba(247, 238, 219, 0.97)),
    url('./assets/parchment-bg.png');
  background-size: cover;
  box-shadow: 0 20px 50px -28px rgba(60, 38, 16, 0.5), inset 0 0 0 1px rgba(255, 244, 214, 0.6);
  color: #3a2a17;
}

.apm-map {
  position: relative; /* own stacking context so Leaflet controls stay under the sticky nav */
  height: 460px;
  border: 1px solid rgba(150, 103, 47, 0.42);
  border-radius: 0.75rem;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(244, 234, 210, 0.9), rgba(236, 222, 192, 0.9));
  z-index: 0;
}

/* Warm the tiles toward the parchment palette without hurting legibility. */
.apm-map .leaflet-tile-pane { filter: sepia(0.28) saturate(0.92) contrast(0.96) brightness(1.02); }

.apm-map .leaflet-container {
  background: #efe6cf;
  font-family: 'Cormorant Garamond', serif;
}

.apm-map .leaflet-bar a {
  color: #5a3a16;
  background: #fffaf0;
  border-bottom-color: rgba(150, 103, 47, 0.3);
}
.apm-map .leaflet-bar a:hover { background: #fff4dc; }

.apm-map .leaflet-tooltip {
  background: #fffaf0;
  border: 1px solid rgba(150, 103, 47, 0.5);
  color: #3a2a17;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(60, 38, 16, 0.25);
}
.apm-map .apm-death-tip { font-family: 'Cinzel', serif; font-size: 0.78rem; }

.apm-fallback {
  margin: 0;
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-style: italic;
  color: rgba(96, 64, 32, 0.9);
}

.apm-caption {
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  color: #43301b;
  min-height: 2.6em;
  margin: 0.9rem auto 0.6rem;
  max-width: 60ch;
}
.apm-caption strong { color: #2e1c0c; font-family: 'Cinzel', serif; }

.apm-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }

.apm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem 0.32rem 0.35rem;
  border: 1px solid rgba(150, 103, 47, 0.4);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.9);
  font: inherit;
  font-size: 0.85rem;
  color: #3a2a17;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.apm-chip:hover { transform: translateY(-1px); }
.apm-chip.is-active { border-color: rgba(141, 86, 33, 0.85); background: #fff4dc; box-shadow: 0 0 0 1px rgba(195, 142, 70, 0.55); }
.apm-chip:focus-visible { outline: 2px solid rgba(141, 86, 33, 0.85); outline-offset: 2px; }

.apm-chip-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #5a3a16;
  background: radial-gradient(circle at 32% 28%, #fbeec9, #e7c486 62%, #b9883f);
  border: 1px solid rgba(120, 80, 33, 0.5);
}

/* ===================== Timeline mode ===================== */
.apostles-timeline-widget {
  margin: 2rem 0;
  padding: 1.4rem 1.4rem 1.6rem;
  border: 1px solid rgba(150, 103, 47, 0.42);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 252, 243, 0.97), rgba(247, 238, 219, 0.97)),
    url('./assets/parchment-bg.png');
  background-size: cover;
  box-shadow: 0 20px 50px -28px rgba(60, 38, 16, 0.5), inset 0 0 0 1px rgba(255, 244, 214, 0.6);
  color: #3a2a17;
}

.apt-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.apt-line { list-style: none; margin: 0; padding: 0; position: relative; }
.apt-line::before {
  content: '';
  position: absolute;
  left: 73px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: rgba(141, 86, 33, 0.3);
}

.apt-row { margin: 0; }

.apt-anchor,
.apt-entry {
  display: grid;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.42rem 0.45rem;
  font: inherit;
  text-align: left;
  color: inherit;
}
.apt-anchor { grid-template-columns: 54px 16px 1fr; }
.apt-entry {
  grid-template-columns: 54px 16px auto 1fr;
  background: none;
  border: 0;
  cursor: pointer;
  border-radius: 0.55rem;
}
.apt-entry:hover { background: rgba(124, 94, 59, 0.07); }
.apt-entry.is-active { background: #fff4dc; box-shadow: inset 0 0 0 1px rgba(195, 142, 70, 0.6); }
.apt-entry:focus-visible { outline: 2px solid rgba(141, 86, 33, 0.85); outline-offset: 1px; }

.apt-year {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #7a4e1c;
  text-align: right;
}

.apt-node {
  justify-self: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #b9883f;
  border: 2px solid #fffaf0;
  box-shadow: 0 0 0 1px rgba(120, 80, 33, 0.5);
  position: relative;
  z-index: 1;
}
.apt-node-martyr { background: #9c3a1a; }
.apt-node-bible { background: #caa24a; }
.apt-node-natural { background: #2f7d4f; }
.apt-node-betrayer { background: #5a5a5a; }

.apt-anchor .apt-node { width: 10px; height: 10px; background: #fffaf0; border-color: rgba(141, 86, 33, 0.6); }
.apt-anchor .apt-body strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7a4e1c;
}
.apt-anchor .apt-body span { font-size: 0.86rem; font-style: italic; color: rgba(96, 64, 32, 0.9); }

.apt-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a3a16;
  background: radial-gradient(circle at 32% 28%, #fbeec9, #e7c486 62%, #b9883f);
  border: 1px solid rgba(120, 80, 33, 0.5);
}

.apt-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.apt-name { font-family: 'Cinzel', serif; font-size: 0.92rem; color: #2e1c0c; }
.apt-place { font-size: 0.82rem; font-style: italic; color: rgba(96, 64, 32, 0.85); }

.apt-detail { min-height: 100%; }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .apostles-board { grid-template-columns: 1fr; }
  .apostles-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .apt-wrap { grid-template-columns: 1fr; }
  .apm-map { height: 360px; }
}

@media (max-width: 460px) {
  .apostles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .apostle-detail-facts > div { grid-template-columns: 1fr; gap: 0.15rem; }
}
