/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #6b5b95;
    --primary-dark: #54477a;
    --accent: #8b7bb5;
    --accent-light: #ede8f5;
    --bg: #ffffff;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-light: #5a5a5a;
    --border: #e5e5e5;
    --success: #4caf50;
    --danger: #d94040;
    --info: #6b5b95;
    --radius: 6px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* Prevent iOS Safari from styling buttons/inputs its own way */
button, input, select, textarea { -webkit-appearance: none; -moz-appearance: none; appearance: none; }

/* Prevent iOS zoom on input focus (triggers when font-size < 16px) */
input, select, textarea { font-size: 1rem; }

body {
    font-family: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .nav-brand, .section-title {
    font-family: 'Source Serif 4', 'Georgia', 'Times New Roman', serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ===== Navigation ===== */
nav {
    background: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    position: relative;
}

.nav-brand {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 1rem 0;
}
.nav-brand:hover { text-decoration: none; color: var(--primary); }

/* Right side: FB + lang + hamburger */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.nav-links { display: flex; list-style: none; gap: 0; }

.nav-links a {
    color: var(--text-light);
    padding: 1rem 1.1rem;
    display: block;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    text-decoration: none;
}

/* Hamburger */
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; padding: 0.8rem; }

@media (max-width: 700px) {
    .nav-inner { flex-wrap: wrap; }

    .nav-brand {
        font-size: 0.95rem;
        flex: 1;
        min-width: 0;
        line-height: 1.3;
        padding: 0.7rem 0;
    }

    .nav-toggle { display: block; }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        z-index: 99;
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        padding: 1rem 1.5rem;
        border-top: 1px solid var(--border);
        font-size: 1rem;
    }
    .nav-links a.active {
        background: var(--accent-light);
    }

    /* Main content less padding on mobile */
    main { padding: 1.5rem 1rem; }

    /* Slideshow arrows bigger tap target */
    .slide-arrow { width: 48px; height: 48px; }

    /* Welcome banner */
    .welcome-banner { padding: 1.5rem 1rem; font-size: 1rem; }
}

/* ===== Main content ===== */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* ===== Hero section (unused but kept) ===== */
.hero {
    background: var(--accent-light);
    color: var(--text);
    text-align: center;
    padding: 4rem 1.5rem;
    margin: -2.5rem -1.5rem 2.5rem -1.5rem;
    width: calc(100% + 3rem);
}
.hero h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.15rem; color: var(--text-light); max-width: 600px; margin: 0 auto; }

@media (max-width: 700px) {
    .hero { padding: 2.5rem 1rem; }
    .hero h1 { font-size: 1.6rem; }
}

/* ===== Section titles ===== */
.section-title {
    font-size: 1.8rem;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    margin-bottom: 1.5rem;
}

/* ===== People list (contact) ===== */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.person-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    text-align: center;
}
.person-card h3 { color: var(--text); margin-bottom: 0.3rem; font-size: 1.15rem; }
.person-card .role { color: var(--primary); font-style: italic; margin-bottom: 0.6rem; }
.person-card .contact-detail { font-size: 0.9rem; color: var(--text-light); }

/* ===== Event list ===== */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.event-item {
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }
.event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    background: var(--accent-light);
    border-radius: var(--radius);
    padding: 0.5rem 0.6rem;
}
.event-day {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary);
}
.event-month {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
}
.event-details { flex: 1; }
.event-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text);
}
.event-time {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}
.event-location {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.15rem;
}

/* ===== Gallery ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card-bg);
}
.gallery-item img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}
.gallery-item .caption {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}
.gallery-item .delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* ===== Google Calendar embed ===== */
.calendar-wrap {
    margin-top: 1.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.calendar-wrap iframe {
    width: 100%;
    height: 600px;
    border: none;
}
@media (max-width: 700px) {
    .calendar-wrap iframe { height: 450px; }
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.form-group textarea { min-height: 150px; resize: vertical; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, opacity 0.2s;
}
.btn:hover { opacity: 0.88; text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* ===== Flash messages ===== */
.flash {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.flash-success { background: #e8f5e9; color: var(--success); border: 1px solid #c8e6c9; }
.flash-danger { background: #ffebee; color: var(--danger); border: 1px solid #ffcdd2; }
.flash-info { background: var(--accent-light); color: var(--primary); border: 1px solid #d5cee8; }

/* ===== Hero slideshow ===== */
.hero-slideshow {
    position: relative;
    width: calc(100% + 3rem);
    margin: 0 -1.5rem 2.5rem -1.5rem;
    overflow: hidden;
    background: #f5f3f0;
    height: 480px;
}
.hero-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease;
}
.hero-slide.active { opacity: 1; }

.slide-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,0.75);
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.slide-arrow:hover { background: rgba(255,255,255,0.95); }
.slide-prev { left: 1rem; }
.slide-next { right: 1rem; }
.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.slide-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
}

@media (max-width: 700px) {
    .hero-slideshow { height: 260px; }
}

/* Welcome banner */
.welcome-banner {
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: 2rem 1.5rem;
    width: calc(100% + 3rem);
    margin: -2.5rem -1.5rem 0 -1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* ===== Language switcher ===== */
.lang-switch {
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}
.lang-switch:hover {
    border-color: var(--primary);
    background: var(--accent-light);
    text-decoration: none;
}

/* Facebook nav link */
.nav-fb {
    font-weight: 700;
    color: #4267B2;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    text-decoration: none;
}
.nav-fb:hover { color: #365899; text-decoration: none; }

/* ===== Footer ===== */
footer {
    background: #2a2a2a;
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 2rem max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    font-size: 0.9rem;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}
.footer-fb {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}
.footer-fb:hover { color: #fff; text-decoration: underline; }

/* ===== Upload area ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    background: #fafafa;
}
.upload-area input[type="file"] { margin: 0.5rem 0; }

/* ===== Misc ===== */
.edit-bar {
    background: var(--accent-light);
    border: 1px solid #d5cee8;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.info-row { margin-bottom: 0.6rem; }
.info-row strong { min-width: 80px; display: inline-block; }

.text-content { white-space: pre-wrap; line-height: 1.8; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}
