/* Cathedral Info Guide — Typography Hard Override v1.0.3e
   Fix: '오늘 미사 시간' heading still too large due to theme h2 rules.
   Strategy: Scope-wide h2/h3 normalization inside .cig-single-church, excluding page H1.
*/

/* Keep structural safety */
.cig-single-church{ display:block !important; max-width:min(1160px,96vw); margin:0 auto; padding:0 16px; }
.cig-single-church .entry-header{ display:block !important; }
.cig-single-church, .cig-single-church *{ writing-mode:horizontal-tb !important; white-space:normal !important; word-break:keep-all; overflow-wrap:anywhere; }
.cig-single-church .cig-layout-container{ display:block; }
@media (min-width:980px){
  .cig-single-church .cig-layout-container{ display:flex !important; align-items:flex-start; gap:24px; }
  .cig-single-church .cig-layout-container > *:first-child{ flex:0 0 380px !important; max-width:420px !important; }
  .cig-single-church .cig-layout-container > *:not(:first-child){ flex:1 1 0% !important; min-width:520px !important; max-width:100% !important; }
}

/* Global type scale inside single page */
.cig-single-church{ font-size:16px; line-height:1.6; color:#2B1F17; }
.cig-single-church .entry-header h1{ font-size:1.7rem; line-height:1.25; font-weight:800; letter-spacing:-0.01em; margin:0 0 18px 0; }
@media (max-width:979.98px){ .cig-single-church .entry-header h1{ font-size:1.5rem; } }

/* === HARD OVERRIDES === */
/* Normalize any h2/h3 except the page H1 */
.cig-single-church h2,
.cig-single-church h3{
  font-size:1.0625rem !important; /* 17px */
  line-height:1.3 !important;
  font-weight:700 !important;
  letter-spacing:-0.005em !important;
  margin:0 0 10px 0 !important;
  color:#5A3F2E !important;
  display:flex; align-items:center; gap:10px;
}
/* avoid touching H1 */
.cig-single-church .entry-header h1{ font-size:1.7rem !important; font-weight:800 !important; }

/* Decorative divider after normalized headings */
.cig-single-church h2::after,
.cig-single-church h3::after{
  content:""; height:1px; flex:1 1 auto;
  background:linear-gradient(90deg, rgba(230,208,150,.55), rgba(230,208,150,.12));
  margin-left:8px; transform:translateY(1px);
}

/* Standard card shell in case some sections lack .cig-card */
.cig-single-church .cig-card{ background:#fff; border:1px solid rgba(230,208,150,.55); border-radius:14px; box-shadow:0 2px 10px rgba(0,0,0,.04); padding:18px 20px; }
.cig-single-church .cig-card + .cig-card{ margin-top:14px; }

/* Lists & rows in mass sections */
.cig-single-church .cig-today-mass-section ul{ margin:0; padding:0; list-style:none; }
.cig-single-church .cig-today-mass-section li{ display:flex; align-items:center; gap:12px; padding:8px 0; border-bottom:1px dashed #EDE5D4; }
.cig-single-church .cig-today-mass-section li:last-child{ border-bottom:none; }
.cig-single-church .cig-today-mass-section .time{ margin-left:auto; font-variant-numeric:tabular-nums; font-size:1rem; }

/* Step5: Single Church heading normalization (safe override) */
body.single-church h2 {
  font-size: 1.25rem;   /* ~20px */
  line-height: 1.35;
  font-weight: 700;
  margin: 1.25rem 0 .75rem;
}
body.single-church h3 {
  font-size: 1.0625rem; /* ~17px */
  line-height: 1.4;
  font-weight: 600;
  margin: .75rem 0 .5rem;
}
/* Keep existing .cig-details-title slightly bolder for the first block */
body.single-church .cig-details-title {
  font-size: 1.3rem;
  font-weight: 750;
}
/* Minor spacing harmony for section containers */
body.single-church .cig-layout-container { gap: 24px; }


/* === Layout polish & 안정형 다음 미사 배지 === */
.cig-section-card{background:#EFE9DE;border:1px solid #E2D6B8;border-radius:14px;box-shadow:0 8px 24px rgba(0,0,0,.06);padding:16px 18px;margin-bottom:16px;}
.cig-section-card h2{color:#5A3F2E;font-weight:600;font-size:18px;margin:0;}
.cig-section-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;}
.cig-badge-next{display:inline-flex;align-items:center;gap:6px;background:#5A3F2E;color:#fff;border-radius:999px;padding:4px 10px;font-size:13px;line-height:1.2;white-space:nowrap;}
.cig-badge-next strong{font-weight:600;color:#fff;}
.cig-today-mass-section ul{list-style:none;margin:0;padding:0;}
.cig-today-mass-section li{display:flex;gap:8px;align-items:baseline;padding:6px 0;border-bottom:1px solid #E2D6B8;}
.cig-today-mass-section li:last-child{border-bottom:0;}
.cig-today-mass-section li strong{color:#2B1F17;}
.cig-today-mass-section li span{color:#2B1F17;opacity:.9;}


/* === Mobile refinements (<= 420px) === */
@media (max-width: 420px){
  .cig-section-card{ padding:14px 14px; border-radius:12px; }
  .cig-section-header{ flex-direction: column; align-items: flex-start; gap:8px; margin-bottom:12px; }
  .cig-section-card h2{ font-size:16px; }
  .cig-badge-next{ align-self:flex-start; font-size:12.5px; padding:4px 9px; }
  .cig-today-mass-section li{ padding:8px 0; }
  .cig-section-card a{ word-break: break-word; overflow-wrap: anywhere; }
  .cig-section-card .cig-mapmenu{ margin-left:0; margin-top:8px; }
}
/* Prevent long URLs from breaking layout on narrow screens */
.cig-section-card a{ word-break: break-word; overflow-wrap: anywhere; }


/* === Regression-safe patch: preserve original markup, adjust only styles === */
/* Hide any legacy top 'next mass' badge; stable rule uses today section only */
.cig-next-mass-badge{ display:none !important; }
/* Ensure the in-section badge stays visible when applicable */
.cig-today-mass-section .cig-badge-next{ display:inline-flex; }

/* Right-align and 2/3 size for the existing Map button (no markup change) */
.cig-section-card .cig-mapmenu{ display:inline-flex; margin-left:auto; }
.cig-section-card .cig-mapmenu__trigger{ padding:.45rem .75rem; font-size:14px; min-height:44px; line-height:1.2; }
.cig-section-card .cig-mapmenu__icon{ width:16px; height:16px; }

/* If older structure with .cig-map-links is present, match the same tone/size and right-align */
.cig-section-card .cig-map-links{ display:flex; justify-content:flex-end; }
.cig-section-card .cig-map-links a{
  display:inline-flex; align-items:center; gap:.4rem;
  background:#5A3F2E; color:#fff;
  padding:.45rem .75rem; font-size:14px; border-radius:999px;
}

/* Try to keep address and button on one line without changing markup */
.cig-section-card p:has(+ .cig-mapmenu),
.cig-section-card p:has(+ .cig-map-links){
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap;
}
@supports not (selector(p:has(+ *))){
  .cig-section-card .cig-mapmenu, .cig-section-card .cig-map-links{ float:right; margin-left:12px; }
  .cig-section-card p{ overflow:hidden; }
}

/* Mobile: gentle reductions and tidy wrapping */
@media (max-width: 480px){
  .cig-section-header{ flex-direction:column; align-items:flex-start; gap:8px; }
  .cig-section-card .cig-mapmenu__trigger,
  .cig-section-card .cig-map-links a{ padding:.35rem .65rem; font-size:13.5px; }
  .cig-section-card a{ word-break:break-word; overflow-wrap:anywhere; }
}

/* === Consolidated Weekly Mass Times Layout (Mobile-First) === */

/* Main container for the daily groups */
.cig-mass-times-by-day {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Space between day cards */
}

/* Card for each day */
.cig-day-group {
    background-color: #ffffff;
    border: 1px solid #e2d6b8;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.2s ease-in-out;
}

/* Highlight for the current day */
.cig-day-group--today {
    border-color: #c8ae5f;
    background-color: #fffdf5;
    box-shadow: 0 6px 16px rgba(200, 174, 95, 0.2);
}

/* Day heading (e.g., "주일") */
.cig-mass-day-heading {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: #5A3F2E !important;
    margin: 0 0 0.75rem 0 !important;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2d6b8;
    /* Remove the flexbox and ::after pseudo-element from the generic h3 rule */
    display: block !important;
}
.cig-mass-day-heading::after {
    display: none !important;
}

.cig-day-group--today .cig-mass-day-heading {
    color: #a5853b !important;
}

/* List of mass times within a day card */
.cig-mass-times-by-day .cig-mass-times-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* A single mass time entry (row) */
.cig-mass-times-by-day .cig-mass-entry {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid #f0ebe0;
}

.cig-mass-times-by-day .cig-mass-times-list li:last-child {
    border-bottom: none;
}

/* The time itself (e.g., "10:30") */
.cig-mass-times-by-day .cig-mass-time {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    flex-shrink: 0; /* Prevents time from shrinking if note is long */
}

/* The note for the mass (e.g., "청년 미사") */
.cig-mass-times-by-day .cig-mass-note {
    color: #555;
    font-size: 0.9rem;
    text-align: left;
}

/* On larger screens, make it a bit more spacious */
@media (min-width: 768px) {
    .cig-day-group {
        padding: 1.25rem;
    }
    .cig-mass-times-by-day {
        gap: 1.5rem;
    }
}

/* === End of Consolidated Weekly Mass Times Layout === */

/* === Related Churches (Same Diocese) === */
.cig-related-churches {
    margin: 1.5rem 0 1rem;
    padding: 1rem;
    background-color: #f5f2ed;
    border-radius: 12px;
    border: 1px solid #e2d6b8;
}

.cig-related-churches-title {
    font-size: 1rem;
    font-weight: 600;
    color: #5A3F2E;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9e2d4;
}

.cig-related-churches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cig-chip {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: #4a4a4a;
    background-color: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 999px; /* Pill shape */
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.cig-chip:hover,
.cig-chip:focus {
    color: #1a1a1a;
    background-color: #fffdf5;
    border-color: #c8ae5f;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
/* === End Related Churches === */