/* ═══════════════════════════════════════════════════════════════
   St. Maria Männerbruderschaft — Premium Design System v2.0
   Design Principles: Editorial Typo · Liquid Glass · Organic Motion
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* ── Apple-tier Backgrounds ── */
    --bg:          #fdfcf9; /* Soft Ivory */
    --bg-raised:   #f8f4ee;
    --bg-alt:      #f7f2ea;
    --bg-dark:     #1a1714;

    /* ── Typography (Deep Earthy Tones) ── */
    --cloud:       #2e2519;
    --cloud-60:    rgba(46, 37, 25, 0.62);
    --cloud-30:    rgba(46, 37, 25, 0.35);
    --cloud-10:    rgba(46, 37, 25, 0.08);

    /* ── Signature Red (Premium & Historic) ── */
    --red:         #b02a2a; /* Deeper, more noble red */
    --red-bright:  #c03838;
    --red-dim:     rgba(176, 42, 42, 0.08);
    --red-glow:    rgba(176, 42, 42, 0.18);

    /* ── Liquid Glass 2.0 ── */
    --glass:       rgba(255, 255, 255, 0.72);
    --glass-md:    rgba(255, 255, 255, 0.88);
    --glass-edge:  rgba(46, 37, 25, 0.06);
    --glass-shine: rgba(255, 255, 255, 0.98);

    /* ── Typo Tokens ── */
    --font-display: 'Cormorant', Georgia, serif;
    --font-body:    'Figtree', system-ui, -apple-system, sans-serif;

    /* ── Border Radii (Apple-style Squircle influence) ── */
    --r-sm:  10px;
    --r-md:  16px;
    --r-lg:  22px;
    --r-xl:  30px;
    --r-2xl: 40px;

    /* ── Shadows (Airy & Diffuse) ── */
    --sh-glass:  0 4px 24px rgba(0,0,0,.04), inset 0 1px 0 var(--glass-shine);
    --sh-lg:     0 20px 50px rgba(0,0,0,.08);
    --sh-red:    0 8px 30px rgba(176,42,42,.25);

    /* ── Layout & Motion ── */
    --container: 1180px;
    --nav-h:     72px;
    --ease-spring: cubic-bezier(.3, 1.45, .6, 1);
    --ease-apple:  cubic-bezier(.25, .1, .25, 1);
}

/* ───────────────────────────────────────────────────────────────
   RESET & BASE
   In @layer base, damit Tailwind-Utilities (@layer utilities)
   diese Element-Regeln überschreiben können — ungelayerte
   Element-Selektoren würden sonst jedes p-*/m-*/text-* aushebeln.
─────────────────────────────────────────────────────────────── */
@layer base {
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px; }

    body {
        font-family: var(--font-body);
        font-size: 1rem;
        line-height: 1.7;
        color: var(--cloud);
        background: var(--bg);
        overflow-x: hidden;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    h1, h2, h3, h4 {
        font-family: var(--font-display);
        font-weight: 500;
        line-height: 1.1;
        letter-spacing: -0.01em;
    }

    img { display: block; max-width: 100%; height: auto; }
    a   { color: inherit; text-decoration: none; transition: color .2s var(--ease-apple); }
}

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 4px;
    border-radius: var(--r-sm);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* ───────────────────────────────────────────────────────────────
   PREMIUM COMPONENTS
─────────────────────────────────────────────────────────────── */

/* Hero Section — Kino-Modus: Kirche als Bühnenbild */
.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding-top: var(--nav-h);
    background: var(--bg-dark);
}

/* Vollflächiges Foto mit langsamem Ken-Burns-Zoom */
.hero-photo { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 28%;
    animation: heroZoom 16s var(--ease-apple) both;
}
@keyframes heroZoom {
    from { transform: scale(1.12); }
    to   { transform: scale(1); }
}
/* Warmes Abdunkeln: links stark (Textlese), rechts leichte Vignette, unten Sockel */
.hero-photo::after {
    content: '';
    position: absolute; inset: 0;
    background:
        linear-gradient(100deg,
            rgba(18, 14, 10, 0.94) 0%,
            rgba(18, 14, 10, 0.78) 38%,
            rgba(18, 14, 10, 0.35) 68%,
            rgba(18, 14, 10, 0.55) 100%),
        linear-gradient(to top, rgba(18, 14, 10, 0.85), transparent 45%);
}

.hero-backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-backdrop__ring {
    position: absolute; top: -10%; right: -10%; width: 60%; aspect-ratio: 1;
    border: 1px solid rgba(192, 56, 56, 0.35); border-radius: 50%; opacity: 0.6;
}
.hero-backdrop__grain {
    position: absolute; inset: 0; opacity: 0.03; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-title {
    font-size: clamp(3.5rem, 10vw, 7.5rem);
    line-height: 0.9;
    letter-spacing: -0.03em;
    font-style: italic;
    font-weight: 600;
}

/* Nur im dunklen Foto-Hero: heller Verlaufstext (Unterseiten behalten dunkle Schrift) */
.hero .hero-title {
    background: linear-gradient(115deg, #ffffff 0%, #f2ece2 45%, #d9d2c6 78%, #ffffff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Countdown-Karte: dunkles Glas mit Goldrand */
.cd-card {
    border-radius: var(--r-2xl);
    background: rgba(24, 18, 12, 0.55);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-scroll {
    position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.hero-scroll__track { width: 1px; height: 60px; background: rgba(255,255,255,.15); position: relative; overflow: hidden; }
.hero-scroll__thumb {
    position: absolute; top: 0; left: 0; width: 100%; height: 30%;
    background: var(--red-bright);
    animation: scrollMove 2s infinite ease-in-out;
}
@keyframes scrollMove {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(400%); }
}

/* section structure */
.section { padding-block: 6rem; position: relative; }
@media (min-width: 1024px) { .section { padding-block: 9rem; } }

.section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 1rem;
}

.section-label::before {
    content: '';
    display: inline-block;
    width: 1.5rem;
    height: 1px;
    background: currentColor;
    vertical-align: middle;
    margin-right: 0.625rem;
    opacity: 0.7;
}

.section-title {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-style: italic;
    color: var(--cloud);
    margin-bottom: 1.5rem;
}

/* Glass Card 2.0 */
.glass-card {
    background: var(--glass-md);
    backdrop-filter: blur(25px) saturate(140%);
    -webkit-backdrop-filter: blur(25px) saturate(140%);
    border: 1px solid var(--glass-edge);
    box-shadow: var(--sh-glass);
    border-radius: var(--r-lg);
    transition: transform .4s var(--ease-spring), box-shadow .4s var(--ease-apple);
}

.glass-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--sh-lg);
    border-color: rgba(176,42,42,.12);
}

/* ───────────────────────────────────────────────────────────────
   TYPOGRAPHY & MOTION
─────────────────────────────────────────────────────────────── */

@keyframes premiumFadeUp {
    0% { opacity: 0; transform: translateY(40px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

[data-anim] {
    opacity: 0;
}

/* Hero Entrance — Animates immediately */
.hero [data-anim] {
    animation: premiumFadeUp 1.2s var(--ease-apple) forwards;
    animation-delay: calc(var(--i, 0) * 150ms + 200ms);
}

/* Scroll Reveal — Triggered by JS or CSS */
.is-visible[data-anim],
[data-anim].is-visible {
    animation: premiumFadeUp 1s var(--ease-apple) forwards;
    animation-delay: calc(var(--i, 0) * 100ms);
}

/* Native Scroll-Driven Animations (Apple-like progressive enhancement) */
@supports (animation-timeline: view()) {
    .section:not(.hero) [data-anim] {
        animation: premiumFadeUp 1s var(--ease-apple) both;
        animation-timeline: view();
        animation-range: entry 10% entry 40%;
    }
}

/* ───────────────────────────────────────────────────────────────
   COMPONENTS: GRID & CARDS
─────────────────────────────────────────────────────────────── */

/* Teaser / Features */
.teaser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.teaser-card {
    display: flex;
    flex-direction: column;
    padding: 2.5rem;
    background: var(--bg-raised);
    border-radius: var(--r-xl);
    border: 1px solid var(--glass-edge);
    transition: all 0.4s var(--ease-apple);
}

.teaser-card:hover {
    background: #fff;
    transform: translateY(-8px);
    box-shadow: var(--sh-lg);
    border-color: var(--red-glow);
}

.teaser-card__icon {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    background: var(--red-dim);
    color: var(--red);
    border-radius: var(--r-md);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.teaser-card__title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--cloud);
}

.teaser-card__text {
    font-size: 0.9375rem;
    color: var(--cloud-60);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.teaser-card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--red);
}

/* Events / Termine */
.termine-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
}

@media (min-width: 1024px) {
    .termine-layout { grid-template-columns: 1fr 1.5fr; align-items: start; }
}

.termine-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
}

.termin-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.75rem;
}

.termin-card__date {
    flex-shrink: 0;
    width: 60px; height: 60px;
    background: var(--bg-dark);
    color: #fff;
    border-radius: var(--r-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.termin-card__day { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.termin-card__mon { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.7; }

.termin-card__body { flex-grow: 1; }
.termin-card__title { font-size: 1.0625rem; font-weight: 600; color: var(--cloud); margin-bottom: 0.25rem; }
.termin-card__meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8125rem; color: var(--cloud-30); }
.termin-card__meta i { color: var(--red); }

.termin-card__icon { font-size: 1.25rem; color: var(--cloud-10); }

/* News Section */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.news-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.news-card__img-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
}

.news-card__img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-apple);
}

.news-card:hover .news-card__img { transform: scale(1.05); }

.news-card__kat {
    position: absolute;
    top: 1rem; left: 1rem;
    background: var(--glass-md);
    backdrop-filter: blur(8px);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-card__body { padding: 1.75rem; flex-grow: 1; }
.news-card__date { font-size: 0.75rem; font-weight: 700; color: var(--red); text-transform: uppercase; margin-bottom: 0.5rem; display: block; }
.news-card__title { font-size: 1.25rem; color: var(--cloud); margin-bottom: 0.75rem; }
.news-card__text { font-size: 0.9375rem; color: var(--cloud-60); line-height: 1.6; }

/* CTA Section */
.cta-section {
    background: var(--red);
    padding-block: 6rem;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section__noise {
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none;
    mix-blend-mode: soft-light;
}

.cta-inner { position: relative; z-index: 1; }

.cta-icon {
    width: 64px; height: 64px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.5rem;
    border: 1px solid rgba(255,255,255,0.2);
}

.cta-title { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 1.5rem; color: #fff; }
.cta-sub { font-size: 1.125rem; opacity: 0.8; max-width: 600px; margin: 0 auto 2.5rem; }
.cta-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }

.btn--white {
    background: #fff;
    color: var(--red);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.btn--white:hover {
    background: var(--bg-raised);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.btn--glass-white {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
}

.btn--glass-white:hover {
    background: rgba(255,255,255,0.2);
    border-color: #fff;
    transform: translateY(-2px);
}

/* ───────────────────────────────────────────────────────────────
   COMPONENTS: 3D BOOK COVER
─────────────────────────────────────────────────────────────── */
.book-wrapper {
    perspective: 1200px;
    display: inline-block;
}

.book-card {
    position: relative;
    width: 240px;
    aspect-ratio: 3/4;
    transform-style: preserve-3d;
    transform: rotateY(-20deg) rotateX(5deg);
    transition: transform 0.6s var(--ease-spring);
}

.book-card:hover {
    transform: rotateY(-5deg) rotateX(0deg) scale(1.05);
}

.book-cover {
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 2px 8px 8px 2px;
    box-shadow: 
        5px 5px 20px rgba(0,0,0,0.2),
        inset 2px 0 5px rgba(255,255,255,0.5);
    z-index: 2;
    overflow: hidden;
}

.book-spine {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: #2e2519;
    transform: rotateY(-90deg) translateX(-15px);
    transform-origin: left;
    z-index: 1;
}

.book-pages {
    position: absolute;
    inset: 5px;
    background: #eee;
    transform: translateZ(-10px);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 0 5px 5px 0;
}

/* ───────────────────────────────────────────────────────────────
   BUTTONS (Tactile Feel)
─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 2rem;
    border-radius: 999px; /* Pill shape for modern look */
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.btn--red {
    background: var(--red);
    color: #fff;
    box-shadow: var(--sh-red);
}

.btn--red:hover {
    background: var(--red-bright);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 36px rgba(176,42,42,.35);
}

.btn--red:active { transform: scale(0.97); }

.btn--glass {
    background: var(--cloud-10);
    backdrop-filter: blur(10px);
    color: var(--cloud);
    border: 1px solid var(--glass-edge);
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.btn--glass:hover {
    background: var(--cloud-30);
    transform: translateY(-2px);
}

/* ───────────────────────────────────────────────────────────────
   NAVIGATION
─────────────────────────────────────────────────────────────── */
.site-header {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 100;
    padding-block: 1rem;
}

.site-nav {
    margin-inline: auto;
    width: calc(100% - 2rem);
    max-width: var(--container);
    background: rgba(253, 252, 249, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-edge);
    border-radius: 999px;
    height: 64px;
    display: flex;
    align-items: center;
    padding-inline: 1.5rem;
    box-shadow: var(--sh-glass);
    transition: all 0.4s var(--ease-apple);
}

.site-nav.is-scrolled {
    width: calc(100% - 3rem);
    background: rgba(253, 252, 249, 0.92);
    box-shadow: var(--sh-lg);
}

.nav-links { display: none; gap: 0.5rem; list-style: none; }
@media (min-width: 1024px) { .nav-links { display: flex; align-items: center; margin-inline: auto; } }

.nav-links li { display: flex; align-items: center; }

.nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--cloud-60);
    border-radius: 999px;
    transition: all 0.2s;
    /* Reset <button> browser defaults so it matches <a> nav-links */
    font-family: var(--font-body);
    border: none;
    background: none;
    cursor: pointer;
    line-height: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.nav-link:hover, .nav-link--active {
    color: var(--cloud);
    background: var(--cloud-10);
}

/* Dropdown per Klick/Tap geöffnet (Touch-Geräte ohne Hover) */
.nav-links li.drop-open [role="menu"] {
    opacity: 1 !important;
    pointer-events: auto !important;
    translate: -50% 0 !important;
}
.nav-links li.drop-open button svg { rotate: 180deg; }

/* ───────────────────────────────────────────────────────────────
   RESPONSIVE REFINEMENTS (Mobile First)
─────────────────────────────────────────────────────────────── */

/* Better mobile spacing for sections */
.section { 
    padding-block: 4rem; 
}
@media (min-width: 1024px) { 
    .section { padding-block: 9rem; } 
}

/* Responsive Typography Scaling — @layer base, damit text-*-Utilities gewinnen */
@layer base {
    h1 { font-size: clamp(2.75rem, 12vw, 7.5rem); }
    h2 { font-size: clamp(1.85rem, 8vw, 3.5rem); }
    h3 { font-size: clamp(1.35rem, 5vw, 2.25rem); }
}

/* Hero Mobile Optimization */
.hero {
    min-height: auto;
    padding-block: 6rem 4rem;
}
@media (min-width: 1024px) {
    .hero {
        min-height: 100svh;
        padding-top: var(--nav-h);
    }
}

.hero-title {
    line-height: 1.0;
    margin-bottom: 1.5rem;
}

/* Ensure images don't overflow on small screens */
.hero-image-wrap {
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
}
@media (min-width: 1024px) {
    .hero-image-wrap {
        max-width: none;
    }
}

/* Book / Festheft Mobile Refinement */
.book-wrapper {
    margin-bottom: 2rem;
}
.book-card {
    width: 180px; /* Smaller for mobile */
    margin-inline: auto;
    transform: rotateY(-15deg) rotateX(5deg);
}
@media (min-width: 768px) {
    .book-card { width: 240px; }
}

/* Grid Adjustments */
.teaser-grid, .news-grid {
    gap: 1.5rem;
}

/* Touch Targets for Buttons */
.btn {
    min-height: 48px; /* Mobile accessibility standard */
    padding-inline: 1.75rem;
    width: 100%; /* Full width on tiny screens */
    justify-content: center;
}
@media (min-width: 480px) {
    .btn { width: auto; }
}

/* Glass Card Mobile Padding */
.glass-card {
    padding: 1.5rem;
}
@media (min-width: 768px) {
    .glass-card { padding: 2.5rem; }
}

/* ───────────────────────────────────────────────────────────────
   UTILITIES
─────────────────────────────────────────────────────────────── */
.text-balance { text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
