/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties for dynamic viewport */
:root {
    --vh: 1vh;
    --samsung-top: 0px;
    --samsung-bottom: 0px;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Raleway', sans-serif;
    font-size: 16px; /* Larger for readability on iPhones */
    font-weight: 400;
    text-align: center;
    color: #333;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;

    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    min-height: -webkit-fill-available; /* iOS fix */
    min-height: 100dvh; /* modern browsers */
    min-height: calc(var(--vh, 1vh) * 100); /* Dynamic height fallback */
    padding: constant(safe-area-inset-top) 1rem constant(safe-area-inset-bottom);
    padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
}

/* ULTRA-SAFE SAMSUNG S23 ULTRA FIXES - 100% GUARANTEED VISIBILITY */
body.samsung-device {
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    padding-top: 130px !important;
    padding-bottom: 270px !important;
}

/* Samsung S23 Ultra specific fixes */
body.samsung-s23-ultra {
    padding-top: 130px !important;
    padding-bottom: 270px !important;
}

ul {
    list-style: none;
}

a {
    color: #333;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

a:hover, a:active {
    color: #0077b5;
}

/* Main container */
#newsletter-wrapper {
    width: 100%;
    max-width: 320px;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
    display: -webkit-flex; /* Safari fix */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 1rem;
}

/* Samsung S23 Ultra wrapper adjustments - ULTRA-SAFE */
body.samsung-device #newsletter-wrapper {
    min-height: calc(100vh - 620px) !important;
    padding: 0.5rem;
    justify-content: flex-start !important;
    padding-top: 0px !important;
    padding-bottom: 220px !important;
}

body.samsung-s23-ultra #newsletter-wrapper {
    min-height: calc(100vh - 620px) !important;
    padding: 0.5rem;
    justify-content: flex-start !important;
    padding-top: 0px !important;
    padding-bottom: 220px !important;
}

/* Links and tap targets */
a {
    color: #333;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    font-size: 15px; /* Prevent zoom on iOS */
}

/* Ionicons rendering fix */
.social-icon a {
    font-size: 1.3rem;
    color: #a78341;
    transition: color 0.3s;
    display: block;
    padding: 6px;
    -webkit-font-smoothing: antialiased;
}

#newsletter {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* Logo */
.logo-section {
    margin-bottom: 6px;
    margin-top: 24px;
}

/* Samsung S23 Ultra logo adjustments - ULTRA-SAFE SIZE */
body.samsung-device .logo-section {
    margin-top: 0px !important;
    margin-bottom: 6px !important;
}

body.samsung-device .logo-section img {
    width: 120px !important;
    padding-bottom: 0.3em !important;
}

body.samsung-device .tagline h2 {
    font-size: 20px !important;
    line-height: 1.1em !important;
    margin-bottom: 4px !important;
}

body.samsung-s23-ultra .logo-section {
    margin-top: 0px !important;
    margin-bottom: 6px !important;
}

body.samsung-s23-ultra .logo-section img {
    width: 120px !important;
    padding-bottom: 0.3em !important;
}

body.samsung-s23-ultra .tagline h2 {
    font-size: 20px !important;
    line-height: 1.1em !important;
    margin-bottom: 4px !important;
}

.logo-section img {
    width: 80px;
    height: auto;
}

/* Tagline */
.tagline {
    margin-bottom: 8px;
}

.tagline h2 {
    font-size: 24px;
    font-weight: 500;
    margin: 0;
    line-height: 1.2;
}

/* Contact section */
.contact-section {
    margin-bottom: 8px;
    width: 100%;
}

/* Samsung device contact section adjustments */
body.samsung-device .contact-section {
    margin-bottom: 6px;
}

body.samsung-s23-ultra .contact-section {
    margin-bottom: 6px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
    margin-bottom: 6px;
}

.contact-item {
    font-size: 17px;
    line-height: 27px;
    padding: 0.5em;
}

.contact-item img {
    width: 14px;
    height: auto;
    margin-bottom: 2px;
}

.contact-item.full-width {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5.5px;
    padding: 2px 0;
}

.contact-item.full-width img {
    margin-bottom: 0;
}

.contact-item a {
    color: #333;
    font-weight: 400;
}

.contact-item a:hover, .contact-item a:active {
    color: #007bff;
}

/* Divider */
.divider {
    width: 60%;
    height: 1px;
    background: #ccc;
    margin: 6px auto;
}

/* Social section */
.social-section {
    padding-bottom: 4px;
}

/* Samsung S23 Ultra social section - MAXIMUM PADDING FOR 100% GUARANTEE */
body.samsung-device .social-section {
    padding-bottom: 200px !important;
    margin-bottom: 180px !important;
}

body.samsung-s23-ultra .social-section {
    padding-bottom: 200px !important;
    margin-bottom: 180px !important;
}

.social-icons {
    margin: 0 0 6px 0;
    display: flex;
    justify-content: center;
    gap: 16px;
}

.social-icon a {
    font-size: 1.2rem;
    color: #a78341;
    transition: color 0.3s;
    display: block;
    padding: 4px;
}

.social-icon a:hover, .social-icon a:active {
    color: #0077b5;
}

.website-link {
    font-size: 0.9rem;
    padding: 6px 0;
    margin-bottom: 0; /* keeps visible on iPhone */
}

.website-link a {
    color: #333;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ULTRA-SAFE SAMSUNG S23 ULTRA MEDIA QUERIES - MAXIMUM PROTECTION */

/* Target Samsung S23 Ultra and similar tall, high-DPI screens */
@media screen and (min-height: 750px) and (-webkit-min-device-pixel-ratio: 3) {
    body {
        padding-top: 130px !important;
        padding-bottom: 270px !important;
        min-height: calc(100vh - 400px) !important;
        justify-content: flex-start !important;
    }
    
    #newsletter-wrapper {
        padding-top: 0px !important;
        padding-bottom: 220px !important;
        min-height: calc(100vh - 620px) !important;
        justify-content: flex-start !important;
        max-width: 340px;
    }
    
    .logo-section {
        margin-top: 0px !important;
        margin-bottom: 6px !important;
    }
    
    .logo-section img {
        width: 120px !important;
        padding-bottom: 0.3em !important;
    }
    
    .contact-section {
        margin-bottom: 6px;
    }
    
    .social-section {
        padding-bottom: 200px !important;
        margin-bottom: 180px !important;
    }
    
    .tagline h2 {
        font-size: 20px !important;
        line-height: 1.1em !important;
        margin-bottom: 4px !important;
    }
}

/* Extra protection for Samsung S23 Ultra exact specs */
@media screen and (min-height: 820px) and (-webkit-min-device-pixel-ratio: 3.5) {
    body {
        padding-top: 140px !important;
        padding-bottom: 290px !important;
    }
    
    #newsletter-wrapper {
        min-height: calc(100vh - 650px) !important;
        padding-bottom: 240px !important;
    }
    
    .social-section {
        padding-bottom: 220px !important;
        margin-bottom: 200px !important;
    }
}

/* Samsung S23 Ultra exact viewport targeting */
@media screen and (min-width: 384px) and (max-width: 384px) and (min-height: 824px) and (max-height: 824px) {
    body {
        padding-top: 140px !important;
        padding-bottom: 290px !important;
    }
    
    #newsletter-wrapper {
        padding: 0.5rem;
        justify-content: flex-start !important;
        padding-top: 0px !important;
        padding-bottom: 240px !important;
        min-height: calc(100vh - 650px) !important;
    }
    
    .logo-section {
        margin-top: 0px !important;
        margin-bottom: 6px !important;
    }
    
    .contact-section {
        margin-bottom: 6px;
    }
    
    .social-section {
        padding-bottom: 220px !important;
        margin-bottom: 200px !important;
    }
}

/* High DPI Samsung devices (S23 Ultra has 3.75 pixel ratio) */
@media only screen and (-webkit-min-device-pixel-ratio: 3.75),
       only screen and (min-resolution: 360dpi) {
    body {
        padding-top: 140px !important;
        padding-bottom: 290px !important;
    }
    
    #newsletter-wrapper {
        padding-top: 0px !important;
        padding-bottom: 240px !important;
        min-height: calc(100vh - 650px) !important;
        justify-content: flex-start !important;
    }
    
    .logo-section {
        margin-top: 0px !important;
    }
    
    .social-section {
        padding-bottom: 220px !important;
        margin-bottom: 200px !important;
    }
}

/* PROTECTED STYLES FOR NON-SAMSUNG DEVICES - UNCHANGED PERFECT LAYOUT */

/* Slightly larger for bigger phones (EXCLUDING Samsung devices) */
@media screen and (min-height: 700px) and (min-width: 375px) and (max-height: 749px) {
    body:not(.samsung-device) {
        font-size: 17px;
        padding-top: env(safe-area-inset-top, 20px);
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    body:not(.samsung-device) #newsletter-wrapper {
        max-width: 340px;
    }

    body:not(.samsung-device) .logo-section img {
        width: 90px;
    }

    body:not(.samsung-device) .tagline h2 {
        font-size: 1.2rem;
    }

    body:not(.samsung-device) .contact-item {
        font-size: 0.9rem;
    }

    body:not(.samsung-device) .contact-item img {
        width: 15px;
    }

    body:not(.samsung-device) .social-icon a {
        font-size: 1.3rem;
    }

    body:not(.samsung-device) .website-link {
        font-size: 1rem;
    }
}

/* Landscape mode (EXCLUDING Samsung devices) */
@media screen and (orientation: landscape) and (max-height: 500px) {
    body:not(.samsung-device) {
        font-size: 14px;
        justify-content: flex-start;
        padding-top: max(env(safe-area-inset-top), 10px);
        padding-bottom: max(env(safe-area-inset-bottom), 10px);
    }

    body:not(.samsung-device) #newsletter-wrapper {
        max-width: 260px;
        padding-top: 10px;
    }

    body:not(.samsung-device) .logo-section {
        margin-top: 5px;
        margin-bottom: 4px;
    }

    body:not(.samsung-device) .logo-section img {
        width: 60px;
    }

    body:not(.samsung-device) .tagline {
        margin-bottom: 4px;
    }

    body:not(.samsung-device) .tagline h2 {
        font-size: 1rem;
    }

    body:not(.samsung-device) .contact-item {
        font-size: 0.75rem;
        padding: 0.3em;
    }

    body:not(.samsung-device) .contact-item img {
        width: 12px;
    }

    body:not(.samsung-device) .social-icon a {
        font-size: 1rem;
        padding: 2px;
    }

    body:not(.samsung-device) .website-link {
        font-size: 0.8rem;
        padding: 4px 0;
    }
    
    body:not(.samsung-device) .contact-section {
        margin-bottom: 4px;
    }
    
    body:not(.samsung-device) .social-section {
        padding-bottom: 2px;
    }
}
