﻿/* =========================================================
   MCS.Web — Base site stylesheet
   Component-level styles shared across all templates.
   Template-specific overrides live in css/themes/*.css
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary: #1e3a5f;
    --color-accent:  #2ecc71;
    --font-heading:  system-ui, sans-serif;
    --font-body:     system-ui, sans-serif;
    --max-width:     1100px;
    --radius:        8px;
    --shadow:        0 2px 8px rgba(0,0,0,.12);
}

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-body); color: #222; line-height: 1.6; }

/* ── Layout ──────────────────────────────────────────────── */
.site-header {
    background: var(--color-primary);
    color: #fff;
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.site-header__inner { max-width: var(--max-width); margin: 0 auto; display: flex; align-items: center; gap: 1rem; }
.site-header__logo  { height: 48px; width: auto; }
.site-header__title { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; }
.site-main  { min-height: 60vh; }
.site-footer{ background: #1a1a1a; color: #aaa; text-align: center; padding: 2rem; font-size: .9rem; }

.section-inner        { max-width: var(--max-width); margin: 0 auto; padding: 3rem 1.5rem; }
.section-inner--narrow{ max-width: 680px; }
.section-inner--center{ text-align: center; }
.section-heading { font-family: var(--font-heading); font-size: 2rem; color: var(--color-primary); margin-bottom: 1.5rem; }
/* Accent underline under section headings (was in per-theme CSS; now universal). */
.section-heading::after { content: ""; display: block; width: 48px; height: 4px; background: var(--color-accent); margin-top: .4rem; }
/* Accent border under the (legacy) site header. */
.site-header { border-bottom: 3px solid var(--color-accent); }

/* ── Buttons ─────────────────────────────────────────────── */
/* Legacy site-level buttons */
.btn { display: inline-block; padding: .6rem 1.5rem; border-radius: var(--radius); text-decoration: none; font-weight: 600; cursor: pointer; border: 2px solid transparent; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn--primary   { background: var(--color-primary); color: #fff; }
.btn--secondary { background: var(--color-accent);  color: #fff; }
.btn--outline   { border-color: var(--color-primary); color: var(--color-primary); background: transparent; }
.btn--ghost     { background: transparent; color: var(--color-primary); }
.btn--link      { background: transparent; color: var(--color-primary); text-decoration: underline; padding: 0; border: none; }
.btn--small  { font-size: .85rem; padding: .4rem 1rem; }
.btn--medium { font-size: 1rem;   padding: .6rem 1.5rem; }
.btn--large  { font-size: 1.1rem; padding: .9rem 2.2rem; }

/* ── Forms ───────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1.2rem; }
.form__field { display: flex; flex-direction: column; gap: .3rem; }
.form__label { font-weight: 600; font-size: .9rem; }
.form__input, .form__textarea {
    padding: .55rem .75rem;
    border: 1.5px solid #ccc;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    transition: border-color .15s;
}
.form__input:focus, .form__textarea:focus { outline: none; border-color: var(--color-accent); }
.form__check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }

/* ── Hero Banner ─────────────────────────────────────────── */
/* min-height scales with viewport width so a full-bleed hero stays tall on wide screens
   (a short, very-wide band is what makes background-size:cover crop the subject's head). */
.hero-banner { padding: 5rem 1.5rem; text-align: center; color: #fff; min-height: clamp(360px, 34vw, 560px); display: flex; flex-direction: column; justify-content: center; align-items: center; }
.hero-banner__content { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.hero-banner__headline { font-family: var(--font-heading); font-size: clamp(2rem,5vw,3.5rem); font-weight: 800; }
.hero-banner__subtext  { font-size: 1.2rem; opacity: .9; }
.hero-banner__cta      { margin-top: .5rem; }
/* Bias hero image crop toward the top so heads/faces survive the crop on wide screens.
   !important overrides the inline background-position the slideshow JS sets on each slide.
   Scoped to heroes so ImageBlock/CardGrid slideshows keep their centered crop. */
.hero-banner .mcs-slide, .mcs-hero-panel .mcs-slide { background-position: center 20% !important; }

/* ── Announcement Banner ─────────────────────────────────── */
.announcement-banner        { color: #fff; }
.announcement-banner__inner { max-width: var(--max-width); margin: 0 auto; padding: .75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.announcement-banner__text  { font-weight: 600; }
.announcement-banner__close { background: none; border: none; color: inherit; font-size: 1.5rem; cursor: pointer; line-height: 1; }

/* ── Service Times ───────────────────────────────────────── */
.service-times__grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 1.5rem; }
.service-times__card { background: #f8f9fa; border-left: 4px solid var(--color-accent); padding: 1.25rem; border-radius: var(--radius); }
.service-times__name { font-family: var(--font-heading); font-size: 1.1rem; margin-bottom: .3rem; }
.service-times__when, .service-times__location { font-size: .9rem; color: #555; }

/* ── Sermon Carousel ─────────────────────────────────────── */
.sermon-carousel__track { display: flex; gap: 1.5rem; overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x mandatory; }
.sermon-card { flex: 0 0 280px; scroll-snap-align: start; background: #fff; border: 1.5px solid #e0e0e0; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .6rem; }
.sermon-card__title { font-family: var(--font-heading); font-size: 1.05rem; }
.sermon-card__meta  { font-size: .85rem; color: #666; }
.sermon-card__link  { margin-top: auto; align-self: flex-start; }

/* ── Event List ──────────────────────────────────────────── */
.event-list { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.event-list__item   { display: flex; gap: 1.25rem; align-items: flex-start; padding: 1rem; border-radius: var(--radius); background: #f8f9fa; }
.event-list__date   { min-width: 70px; font-weight: 700; color: var(--color-accent); font-size: .9rem; line-height: 1.4; }
.event-list__title  { font-weight: 600; }
.event-list__time, .event-list__location { font-size: .85rem; color: #666; }

/* ── Donate CTA ──────────────────────────────────────────── */
.donate-cta { padding: 3rem 1.5rem; background: var(--node-bg, var(--color-primary)); }
.donate-cta .section-heading { color: #fff; }
.donate-cta__btn { font-size: 1.15rem; }

/* ── Staff Directory ─────────────────────────────────────── */
.staff-directory__grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 1.5rem; }
.staff-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.staff-card__photo { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; }
.staff-card__photo--placeholder { background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; }
.staff-card__name  { font-family: var(--font-heading); font-weight: 700; }
.staff-card__title { font-size: .85rem; color: #666; }
.staff-card__email { font-size: .85rem; color: var(--color-accent); text-decoration: none; }

/* ── Photo Gallery ───────────────────────────────────────── */
.photo-gallery__grid { column-gap: 1rem; }
.photo-gallery__item { margin-bottom: 1rem; break-inside: avoid; }
.photo-gallery__img  { width: 100%; border-radius: var(--radius); display: block; }

/* ── Verse of the Day ────────────────────────────────────── */
.verse-of-day { background: #f0f4f8; padding: 3rem 1.5rem; }
.verse-of-day__quote { max-width: 680px; margin: 0 auto; }
.verse-of-day__text  { font-family: var(--font-heading); font-size: 1.3rem; font-style: italic; line-height: 1.7; margin-bottom: .75rem; }
.verse-of-day__reference { font-size: .95rem; color: var(--color-accent); font-weight: 700; font-style: normal; }

/* ── Livestream ──────────────────────────────────────────── */
.livestream-embed__wrapper { position: relative; padding-top: 56.25%; background: #000; border-radius: var(--radius); overflow: hidden; }
.livestream-embed__frame   { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* ── Social Links ────────────────────────────────────────── */
.social-links__row { display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; margin-top: .5rem; }
.social-links__link { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--color-primary); color: #fff; transition: background .15s; }
.social-links__link:hover { background: var(--color-accent); }
.social-links__icon { width: 22px; height: 22px; fill: currentColor; }

/* ── Contact / Prayer Forms ──────────────────────────────── */
.contact-form__confirmation, .prayer-form__confirmation { background: #d4edda; color: #155724; padding: 1rem; border-radius: var(--radius); font-weight: 600; }

/* ── Rich Text ───────────────────────────────────────────── */
.rich-text { padding: 2rem 1.5rem; }
.rich-text h1, .rich-text h2, .rich-text h3 { font-family: var(--font-heading); color: var(--color-primary); margin-bottom: .75rem; margin-top: 1.5rem; }
.rich-text p { margin-bottom: 1rem; }
.rich-text a { color: var(--color-accent); }

/* ── Divider & Spacer ────────────────────────────────────── */
.divider { padding: 0 1.5rem; }
.divider hr { border: none; border-top: 2px solid var(--color-accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero-banner { padding: 3rem 1rem; }
    .section-inner { padding: 2rem 1rem; }
    .sermon-carousel__track { flex-direction: column; }
    .event-list__item { flex-direction: column; gap: .5rem; }
}

/* ── Grid Layout (RowId / ColSpan) ───────────────────────── */

/* Public-site row: a flex band of 1–3+ components */
.site-row { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 0; align-items: stretch; }

/* Column spans — 12-col grid. Use flex-basis + flex-grow so components fill the row. */
.site-col--span-1  { flex: 0 0 8.333%;  min-width: 80px;  }
.site-col--span-2  { flex: 0 0 16.666%; min-width: 80px;  }
.site-col--span-3  { flex: 0 0 25%;     min-width: 120px; }
.site-col--span-4  { flex: 0 0 33.333%; min-width: 140px; }
.site-col--span-5  { flex: 0 0 41.666%; min-width: 160px; }
.site-col--span-6  { flex: 0 0 50%;     min-width: 180px; }
.site-col--span-7  { flex: 0 0 58.333%; min-width: 200px; }
.site-col--span-8  { flex: 0 0 66.666%; min-width: 200px; }
.site-col--span-9  { flex: 0 0 75%;     min-width: 200px; }
.site-col--span-10 { flex: 0 0 83.333%; min-width: 200px; }
.site-col--span-11 { flex: 0 0 91.666%; min-width: 200px; }
.site-col--span-12 { flex: 0 0 100%; }

@media (max-width: 640px) {
    /* On mobile every column stacks full-width */
    .site-row { flex-direction: column; }
    [class^="site-col--span-"] { flex: 0 0 100% !important; }
}

/* ── Editor grid ─────────────────────────────────────────── */

/* Row band in the drag-drop editor */
.editor-row {
    border: 2px dashed #c8d0db;
    border-radius: 6px;
    padding: 6px 8px 8px 8px;
    margin-bottom: 10px;
    position: relative;
    background: #fafbfc;
    user-select: none;
    -webkit-user-select: none;
}
.editor-row:hover { border-color: #2ecc71; }

/* Row-level split buttons (1 / ½½ / ⅓⅓⅓) */
.editor-row__controls {
    position: absolute;
    top: -1px;
    right: 6px;
    display: flex;
    gap: 3px;
    background: #fff;
    border: 1px solid #c8d0db;
    border-top: none;
    border-radius: 0 0 5px 5px;
    padding: 2px 4px;
    z-index: 20;
}
.editor-row__controls button {
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 1px 7px;
    font-size: .72rem;
    cursor: pointer;
    line-height: 1.6;
    opacity: .85;
}
.editor-row__controls button:hover { opacity: 1; background: #2ecc71; }

/* The flex container that holds columns inside a row */
.editor-col-list {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: nowrap;
    justify-content: center;
    min-height: 60px;
}

/* Each draggable column slot */
.editor-col {
    min-width: 100px;
    min-height: 60px;
    position: relative;
    border: 1.5px solid transparent;
    border-radius: 4px;
    transition: border-color .15s;
    background: #fff;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.editor-col:hover { border-color: #2ecc71; }

/* Handle that initiates column drag */
.editor-col__handle {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #1e3a5f;
    color: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: grab;
    cursor: -webkit-grab;
    font-size: 1rem;
    z-index: 10;
    opacity: .35;
    transition: opacity .15s;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.editor-col:hover .editor-col__handle { opacity: 1; }
.editor-col__handle:active { cursor: grabbing; cursor: -webkit-grabbing; }

/* Type badge in the top-right corner of each column */
.editor-col__label {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(30,58,95,.85);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: .68rem;
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}
.editor-col:hover .editor-col__label { opacity: 1; }

/* SortableJS ghost / drag classes */
.editor-col--ghost  { opacity: .4; outline: 2px dashed #2ecc71; }
.editor-col--drag   { box-shadow: 0 4px 20px rgba(0,0,0,.2); background: #fff; z-index: 100; }
.editor-row--ghost  { opacity: .4; }

/* Row-level drag handle (the dashed border itself acts as the grab zone) */
.editor-row__drag-handle {
    display: inline-block;
    cursor: grab;
    color: #aaa;
    font-size: 1.1rem;
    padding: 0 6px 4px 0;
    vertical-align: middle;
    user-select: none;
}


/* ── NavBar Component (Phase M) ──────────────────────────────────────────────────── */

/* Three-zone grid: [logo-or-empty | centred tabs | empty-or-logo + hamburger] */
.mcs-navbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  height: 64px;
  position: relative;
  z-index: 200;
}
.mcs-navbar--sticky { position: sticky; top: 0; }

/* Zones */
.mcs-navbar__zone         { display: flex; align-items: center; min-width: 0; }
.mcs-navbar__zone--start  { justify-content: flex-start; }
.mcs-navbar__zone--center { justify-content: center; gap: 2px; }
.mcs-navbar__zone--end    { justify-content: flex-end; gap: 8px; }

/* Brand (logo + church name) */
.mcs-navbar__brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mcs-navbar__logo  { height: 40px; width: auto; object-fit: contain; }
.mcs-navbar__name  { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

/* Individual tab / link */
.mcs-navbar__tab {
  background: transparent; border: none; cursor: pointer;
  padding: 8px 14px; font-size: .92rem; font-weight: 600; letter-spacing: .04em;
  border-radius: 4px; text-decoration: none; transition: background .15s;
  white-space: nowrap; display: inline-flex; align-items: center;
  text-transform: uppercase;
}
.mcs-navbar__tab:hover { background: rgba(255,255,255,.15); }
.mcs-navbar__arrow { font-size: .65rem; margin-left: 5px; opacity: .8; }

/* Dropdown container */
.mcs-navbar__item { position: relative; display: flex; align-items: center; }
.mcs-navbar__dropdown {
  position: absolute; top: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  min-width: 180px; background: #fff; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18); z-index: 300; overflow: hidden;
}
.mcs-navbar__dropdown-item {
  display: block; padding: 10px 16px; color: #1a1a1a;
  text-decoration: none; font-size: .9rem; transition: background .12s;
}
.mcs-navbar__dropdown-item:hover { background: #f0f3f7; }
.mcs-navbar__dropdown-item--sub  { padding-left: 28px; color: #555; font-size: .85rem; }

/* Hamburger (right zone, hidden on desktop) */
.mcs-navbar__hamburger {
  display: none; background: transparent; border: none;
  font-size: 1.5rem; cursor: pointer; padding: 6px 8px; line-height: 1;
}

/* Mobile full-width dropdown */
.mcs-navbar__mobile-menu {
  position: absolute; top: 64px; left: 0; right: 0; z-index: 250;
  padding: 8px 0; box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.mcs-navbar__mobile-item {
  display: block; padding: 12px 24px; color: inherit;
  text-decoration: none; font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.mcs-navbar__mobile-item--sub { padding-left: 40px; font-size: .9rem; opacity: .85; }

/* Mobile breakpoint: hide centre tabs, show hamburger */
@media (max-width: 640px) {
  .mcs-navbar__zone--center { display: none; }
  .mcs-navbar__hamburger    { display: flex !important; align-items: center; }
}

/* ── Image Slideshow Animations (Phase O) ─────────────────────────────────── */

/* Ken Burns zoom: slow oscillating zoom-in */
@keyframes mcs-zoom { from { transform: scale(1.0); } to { transform: scale(1.18); } }

/* Swipe directions: subtle pan */
@keyframes mcs-swipe-left  { from { transform: translateX(0);   } to { transform: translateX(-6%); } }
@keyframes mcs-swipe-right { from { transform: translateX(0);   } to { transform: translateX(6%);  } }
@keyframes mcs-swipe-up    { from { transform: translateY(0);   } to { transform: translateY(-6%); } }
@keyframes mcs-swipe-down  { from { transform: translateY(0);   } to { transform: translateY(6%);  } }

/* Slide host: clips overflow so zoom/pan stays within its box */
.mcs-slide-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Each slide layer: absolute fill, invisible by default */
.mcs-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 0.8s ease;
}

/* Active slide */
.mcs-slide--active { opacity: 1; }

/* Animation classes applied dynamically by slideshow.js */
.mcs-slide--zoom        { animation: mcs-zoom 9s ease-in-out infinite alternate; }
.mcs-slide--swipe-left  { animation: mcs-swipe-left  9s ease-in-out forwards; }
.mcs-slide--swipe-right { animation: mcs-swipe-right 9s ease-in-out forwards; }
.mcs-slide--swipe-up    { animation: mcs-swipe-up    9s ease-in-out forwards; }
.mcs-slide--swipe-down  { animation: mcs-swipe-down  9s ease-in-out forwards; }
