* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
    height: 100%;
}

body {
    font-family: 'Merriweather', serif;
    background-size: 4px 4px, cover;
    background-position: 0 0, center center;
    background-repeat: repeat, no-repeat;
    background-attachment: scroll, fixed;
    color: #000000;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: background-color 2s ease, background-image 2s ease;
}

/* Day theme - off-white paper */
body.day-theme {
    background-image: radial-gradient(circle, rgba(232, 230, 225, 0.3) 1px, transparent 1px), url('image3.png');
    background-color: #f5f3ef;
}

body.day-theme::after {
    background: radial-gradient(ellipse at center, rgba(255, 255, 250, 0.3) 0%, transparent 50%);
}

/* Night theme - orange */
body.night-theme {
    background-image: radial-gradient(circle, rgba(255, 140, 66, 0.3) 1px, transparent 1px), url('image3.png');
    background-color: #d4691a;
}

body.night-theme::after {
    background: radial-gradient(ellipse at center, rgba(255, 180, 80, 0.5) 0%, transparent 50%);
}

body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: glow 6s ease-in-out infinite;
    z-index: 1;
    transition: background 2s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 5;
    animation: vignetteGlow 6s ease-in-out infinite;
}

header {
    padding: 1rem 2rem;
    text-align: left;
    position: relative;
    z-index: 10;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 300;
    font-family: 'Merriweather', serif;
    letter-spacing: 0.1em;
    color: #ffffff;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    margin-top: -18vh;
    position: relative;
    z-index: 10;
}

main h2 {
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 3rem;
}

main form {
    width: 100%;
    max-width: 400px;
    position: relative;
    min-height: 50px;
    padding-bottom: 3rem;
}

main input[type="email"] {
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 1.125rem;
    font-family: 'Merriweather', serif;
    background: transparent;
    border: none;
    border-bottom: 2px solid #000000;
    border-radius: 0;
    color: #000000;
    text-align: center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

main input[type="email"]::placeholder {
    color: #000000;
}

main input[type="email"]:focus {
    outline: none;
    border-bottom-color: #000000;
}

main input[type="email"].submitted {
    animation: collapseUnderline 0.4s ease forwards;
}

@keyframes collapseUnderline {
    to {
        transform: scaleX(0);
        opacity: 0;
    }
}

#confirmationMessage {
    color: #000000;
    font-size: 1.125rem;
    margin: 0;
    opacity: 0;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease 0.4s;
    white-space: nowrap;
    pointer-events: none;
}

#confirmationMessage.show {
    opacity: 1;
}

#errorMessage {
    color: #000000;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.25rem;
    text-align: center;
    min-height: 2.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 2rem);
}

#errorMessage.show {
    opacity: 1;
}

footer {
    padding: 1rem 2rem;
    text-align: center;
    position: relative;
    z-index: 10;
}

footer p {
    font-size: 0.75rem;
    color: #000000;
    font-family: 'Merriweather', serif;
    margin: 0.25rem 0;
}

footer .tagline {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

footer a {
    color: #000000;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.noise {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    opacity: 0.12;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    animation: noise 0.2s steps(8) infinite;
}

@keyframes noise {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(-10%, 5%); }
    30% { transform: translate(5%, -10%); }
    40% { transform: translate(-5%, 15%); }
    50% { transform: translate(-10%, 5%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 10%); }
    80% { transform: translate(-15%, 0%); }
    90% { transform: translate(10%, 5%); }
    100% { transform: translate(5%, 0%); }
}

@keyframes glow {
    0%, 100% {
        opacity: 0.75;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.03);
    }
}

@keyframes vignetteGlow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

@media (max-width: 768px) {
    body.day-theme {
        background-image: radial-gradient(circle, rgba(232, 230, 225, 0.3) 1px, transparent 1px), url('image3.png');
        background-size: 4px 4px, cover;
    }

    body.night-theme {
        background-image: radial-gradient(circle, rgba(255, 140, 66, 0.3) 1px, transparent 1px), url('image3.png');
        background-size: 4px 4px, cover;
    }

    header {
        padding: 0.5rem 1rem;
        text-align: center;
    }

    header h1 {
        font-size: 1rem;
        color: #000000;
    }

    main h2 {
        font-size: 2rem;
    }

    main input[type="email"] {
        font-size: 0.9rem;
        padding: 0.4rem 0.5rem;
    }

    main form {
        max-width: 90%;
    }

    footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .noise {
        opacity: 0.24;
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.25' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='white' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    }

    body::before {
        background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.6) 100%);
    }

    body::after {
        display: none;
    }
}