:root {
    --jmcu-blue: #0b3168;
    --gold: #ffd700;
    --white: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden; /* Zero scroll */
    position: fixed; /* Prevents iOS rubber-band effect */
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--white);
}

/* Robust Mobile Background fix (iOS Safari fix) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        linear-gradient(to bottom, rgba(0,0,0,0.65), rgba(0,0,0,0.35), rgba(0,0,0,0.65)),
        url('/static/majestic_bg.png') no-repeat center center;
    background-size: cover;
    z-index: -1; /* Behind content */
}

.majestic-wrapper {
    position: relative;
    width: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
    padding: clamp(5px, 1.5vh, 20px);
}

.content-overlay {
    max-width: 800px;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center; /* PERFECT CENTERING */
    color: var(--white);
    text-shadow: 0 4px 12px var(--shadow-color);
    padding: 5px 0;
}

/* Enlarged Logo - Viewport Constrained */
.logo-header {
    flex-shrink: 2;
    display: flex;
    justify-content: center;
    width: 100%;
}

.official-logo-large {
    max-width: clamp(200px, 60vw, 420px);
    max-height: 16vh;
    width: auto;
    height: auto;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.82); /* Whiter background */
    padding: clamp(5px, 1vh, 12px) clamp(10px, 2.5vw, 30px);
    border-radius: 8px;
}

.invitation-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center; /* CENTER CONTENT */
    height: 80%;
}

/* Greeting Section */
.top-greeting {
    font-size: clamp(18px, 3vh, 26px);
    font-weight: 700;
    color: var(--gold);
    width: 100%;
}

.guest-line {
    margin: 2px 0;
    width: 100%;
}

.greeting {
    font-size: clamp(14px, 2.2vh, 18px);
    font-weight: 400;
    margin-bottom: 2px;
}

.guest-name {
    font-family: 'Playfair Display', serif;
    font-size: clamp(22px, 4.8vh, 42px);
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

/* Invitation Body */
.message-section {
    line-height: 1.35;
    max-width: 95%;
    margin: 0 auto;
    text-align: center;
}

.body-text {
    font-size: clamp(13px, 2vh, 18px);
}

.theme-text {
    font-family: 'Playfair Display', serif;
    font-size: clamp(15px, 2.8vh, 26px);
    color: var(--gold);
    margin: clamp(2px, 0.8vh, 12px) 0;
    font-style: italic;
    font-weight: 700;
}

/* Styled Taklifnoma Title */
.special-title-container {
    margin: clamp(2px, 1vh, 15px) 0;
    flex-shrink: 1;
    width: 100%;
}

.staged-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(35px, 7.5vh, 80px);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--white);
}

/* Final Signature Block - CENTERED */
.signature-block-final {
    width: 100%;
    padding-top: clamp(2px, 1vh, 12px);
    border-top: 1px solid rgba(255,215,0,0.15);
    text-align: center;
}

.signature-text {
    font-size: clamp(11px, 1.8vh, 16px);
    line-height: 1.4;
}

.nowrap-name {
    white-space: nowrap;
}

/* Flags Row - 2 ROWS FOR BETTER FIT */
.flags-row {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: clamp(8px, 2vw, 15px);
    flex-wrap: wrap; /* Allows wrapping */
    max-width: 450px; /* Constrains width to force wrap into 2 rows */
    opacity: 0.85;
    padding: 5px 0;
}

.flag-icon {
    font-size: clamp(20px, 3.2vh, 32px);
    filter: drop-shadow(2px 2px 5px rgba(0,0,0,0.5));
}

/* Universal Mobile Adjustments */
@media (max-width: 450px) {
    .majestic-wrapper { padding: 10px 5px; }
    .content-overlay { padding: 5px 0; }
    .official-logo-large { max-width: 180px; }
    .guest-name { line-height: 1.05; }
    .flags-row { max-width: 300px; gap: 8px; } /* Force wrap on small phones */
    .flag-icon { font-size: 20px; }
}

/* SE/Tiny Android Fixes */
@media (max-height: 600px) {
    .official-logo-large { max-height: 12vh; }
    .staged-title { font-size: 28px; }
    .top-greeting { font-size: 16px; }
    .signature-block-final { padding-top: 2px; }
    .flag-icon { font-size: 16px; }
}