:root {
    --ink: #162b60;
    --text: #233650;
    --muted: #667d98;
    --blue: #2443a1;
    --cyan: #00a9e6;
    --outline: rgba(42, 95, 147, .13);
    --surface: rgba(255, 255, 255, .95);
    --shadow: 0 8px 24px rgba(25, 73, 117, .065);
    --yellow: #f8f1cf;
    --yellow-border: #deb83b;
    --event-blue: #dbeeff;
    --blue-border: #5394d6;
    --red: #fde6e9;
    --red-border: #d9535d;
    --green: #dcf6e3;
    --green-border: #2c8b4d;
    --purple: #f3e9ff;
    --purple-border: #8032bb;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font: 400 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(ellipse 70% 40% at 4% 0%, rgba(64, 181, 226, .23), transparent 95%),
        radial-gradient(ellipse 70% 60% at 100% 24%, rgba(100, 167, 216, .20), transparent 95%),
        linear-gradient(155deg, #d9eafa 0%, #e9f4fa 41%, #f5f8fd 100%);
    background-attachment: fixed;
}
a { color: inherit; }
button, input { font: inherit; }
button, input { -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(0, 169, 230, .72); outline-offset: 3px; }

.site-container { width: min(calc(100% - 24px), 570px); margin-inline: auto; }
.site-header { background: transparent; }
.site-header-inner {
    min-height: 69px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(35, 84, 139, .105);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    text-decoration: none;
}
.brand-mark {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .92);
    border-radius: 13px;
    box-shadow: 0 3px 10px rgba(28, 90, 154, .12);
}
.brand-copy { display: block; min-width: 0; }
.brand strong, .brand small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brand strong { color: #122e74; font-size: 12.5px; font-weight: 600; letter-spacing: .025em; }
.brand small { margin-top: 2px; color: #496588; font-size: 11px; }

.page-main { min-height: calc(100vh - 145px); padding-block: 15px 28px; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    margin: 0 2px 10px;
}
.section-heading h1 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.01em;
}
.list-counter { flex: 0 0 auto; color: #5c7797; font-size: 11px; font-weight: 500; white-space: nowrap; }

.search-panel {
    margin-bottom: 13px;
    padding: 7px;
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding-inline: 13px;
    border: 1px solid #dce8f3;
    border-radius: 11px;
    background: #f5f9fd;
    transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: #78bedf; box-shadow: 0 0 0 3px rgba(0, 169, 230, .1); }
.search-box svg { width: 18px; height: 18px; flex: 0 0 auto; color: #7290ac; }
.search-box input {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    color: var(--ink);
    background: transparent;
    font-size: 14px;
}
.search-box input::placeholder { color: #8699ae; opacity: 1; }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }

.parish-list, .months-list { display: grid; gap: 13px; min-width: 0; }
.parish-card, .month-card {
    overflow: hidden;
    min-width: 0;
    border: 1px solid rgba(255,255,255,.95);
    border-radius: 19px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.parish-header, .month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 12px 15px;
    border-bottom: 1px solid #eaf0f7;
}
.text-ellipsis { min-width: 0; }
.eyebrow {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #5a779c;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: .07em;
}
.parish-header h2, .month-header h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 3px 0 0;
    color: var(--ink);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.3;
}
.parish-count, .count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 27px;
    height: 27px;
    flex: 0 0 auto;
    padding: 0 7px;
    border-radius: 9px;
    background: #eff6fc;
    color: #4c719d;
    font-size: 11px;
    font-weight: 600;
}
.congregation-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.congregation-card {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    min-height: 64px;
    padding: 10px 14px;
    border-bottom: 1px solid #edf2f7;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .15s ease;
}
.congregation-card:last-child { border-bottom: none; }
.congregation-card:hover, .congregation-card:focus-visible { background: #f1f9fe; }
.congregation-card:active { background: #e8f5fe; }
.congregation-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid #d6eaf4;
    border-radius: 12px;
    background: linear-gradient(140deg, #eff9ff, #e5f5fb);
    color: #138fbf;
}
.congregation-icon svg { width: 19px; height: 19px; }
.congregation-info { flex: 1; min-width: 0; }
.congregation-info strong, .congregation-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.congregation-info strong { color: #193264; font-size: 14px; font-weight: 600; }
.congregation-info small { margin-top: 2px; color: #6c819c; font-size: 12px; }
.chevron { width: 17px; height: 17px; flex: 0 0 17px; color: #9aacc0; }

.context-card {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    min-height: 66px;
    margin-bottom: 13px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.95);
    border-radius: 17px;
    background: rgba(255,255,255,.85);
    box-shadow: var(--shadow);
}
.context-back {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    border: 1px solid #dbeef7;
    border-radius: 12px;
    background: #eaf7fd;
    color: #2377b3;
    text-decoration: none;
    transition: background-color .15s;
}
.context-back:hover { background: #dceffc; }
.context-back svg { width: 18px; height: 18px; }
.context-info { min-width: 0; flex: 1; }
.context-parish { font-size: 10px; text-transform: uppercase; }
.context-info h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 3px 0 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}
.context-calendar { width: 21px; height: 21px; flex: 0 0 21px; color: #84b3d1; }

.month-header { min-height: 52px; padding: 11px 14px; }
.month-header h2 { margin: 0; font-size: 16px; }
.event-list { display: grid; gap: 8px; padding: 8px; }
.event-card {
    position: relative;
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    min-width: 0;
    min-height: 92px;
    padding: 2px;
    border: 1px solid rgba(218, 228, 239, .96);
    border-left: 4px solid #c5ccd4;
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(245,249,253,.94));
    box-shadow: 0 10px 24px rgba(21, 58, 98, .08), inset 0 1px 0 rgba(255,255,255,.85);
}
.event-type-1 {
    border-left-color: #b8c3d2;
    background: linear-gradient(145deg, rgba(255,255,255,.99), rgba(244,248,252,.95));
}
.event-type-2 {
    border-color: #cdb6f1;
    border-left-color: var(--purple-border);
    background: linear-gradient(145deg, #f8f2ff, #d8c6f7);
}
.event-type-3 {
    border-color: #c7def1;
    border-left-color: var(--blue-border);
    background: linear-gradient(145deg, #eef8ff, #dcedff);
}
.event-type-4 {
    border-color: #eccace;
    border-left-color: var(--red-border);
    background: linear-gradient(145deg, #fff2f3, #ffe2e6);
}
.event-type-5 {
    border-color: #eee0ac;
    border-left-color: var(--yellow-border);
    background: linear-gradient(145deg, #fff9df, #fff2c1);
}
.event-today {
    border-color: #ccf1d6;
    border-left-color: var(--green-border);
    background: linear-gradient(145deg, #eefcf2, #dcf6e3);
}
.event-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 4px 4px;
    color: #2c445e;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
}
.event-meta > * {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}
.event-meta strong { color: #203857; font-size: 14px; font-weight: 600; }
.event-day, .event-time { color: #35506f; }
.event-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.event-main h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
    color: #173153;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
}
.event-main p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 5px 0 0;
    color: #37516e;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: 0;
}
.event-tag {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    min-height: 21px;
    margin-top: 7px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.event-tag-4 { background: #d9535d; color: #fff; }

.empty-state {
    padding: 32px 17px;
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 18px;
    background: rgba(255,255,255,.83);
    box-shadow: var(--shadow);
    text-align: center;
}
.empty-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 11px;
    border-radius: 14px;
    background: #e7f5fe;
    color: #198fbd;
}
.empty-icon svg { width: 23px; height: 23px; }
.empty-state h2 { margin: 0 0 4px; color: var(--ink); font-size: 14px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }
.status {
    padding: 12px 14px;
    border: 1px solid #e4d0d2;
    border-radius: 13px;
    background: #fff6f6;
    color: #9e333d;
    font-size: 12.5px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.site-footer { padding: 4px 0 22px; color: #8195ad; font-size: 10.5px; text-align: center; }

@media (max-width: 360px) {
    .site-container { width: calc(100% - 20px); }
    .event-list { padding: 8px; gap: 8px; }
    .event-card { grid-template-columns: 94px minmax(0, 1fr); gap: 8px; min-height: 88px; padding: 10px; }
    .event-meta { gap: 5px; padding: 9px 6px; font-size: 12.5px; }
    .event-meta > * { font-size: 12.5px; }
    .event-meta strong { font-size: 12.5px; }
    .event-main h3 { font-size: 14px; }
    .event-main p { font-size: 12.5px; }
    .context-calendar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
