@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Lora:wght@400;700&display=swap');

/* --- Global Styles & Accessibility --- */
:root {
    --background-color: #fdfaf3;
    --text-color: #333333;
    --primary-color: #5a7d7c;
    --primary-hover-color: #4a6b6a;
    --border-color: #dddddd;
    --card-background: #ffffff;
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    --sepia-filter: sepia(20%);
    --font-family-sans: 'Lato', 'Helvetica Neue', Arial, sans-serif;
    --base-font-size: 18px;
    --header-font-family: 'Lora', Georgia, serif;
}

html {
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    font-family: var(--font-family-sans);
    font-size: var(--base-font-size);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.wizard-container,
#newsletter-view {
    width: 100%;
    max-width: 900px;
    padding: 30px 40px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s;
}

/* --- Typography --- */
h1,
h2,
h3 {
    font-family: var(--header-font-family);
    color: var(--primary-color);
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1em;
}

h2 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 1em;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1em;
}

/* --- Form & Onboarding Wizard --- */
#profile-form {
    display: flex;
    flex-direction: column;
}

.form-step {
    border: none;
    padding: 0;
    margin: 0;
    animation: fadeIn 0.5s;
}

.form-field {
    margin-bottom: 25px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.1em;
}

input[type='text'],
input[type='number'] {
    width: 100%;
    padding: 15px;
    font-size: 1em;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    transition: border-color 0.3s;
    min-height: 44px;
}

input[type='text']:focus,
input[type='number']:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(90, 125, 124, 0.5);
}

input[type='text']:focus-visible,
input[type='number']:focus-visible {
    outline: 2px solid var(--primary-hover-color);
    outline-offset: 2px;
    box-shadow: none;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* --- Buttons --- */
button {
    padding: 15px 30px;
    font-size: 1.1em;
    font-family: var(--font-family-sans);
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, color 0.3s;
    text-align: center;
    -webkit-appearance: none;
    min-height: 44px;
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    background-color: var(--primary-hover-color);
}

button:disabled {
    background-color: #cccccc;
    border-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

button:focus-visible {
    outline: 2px solid var(--primary-hover-color);
    outline-offset: 2px;
}

#prev-btn {
    background-color: #f0f0f0;
    color: var(--text-color);
    border-color: #f0f0f0;
}

#prev-btn:hover:not(:disabled) {
    background-color: #e0e0e0;
}

/* --- Newsletter Display --- */
.newsletter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}

.newsletter-header h1 {
    font-size: 2rem;
    margin: 0;
    text-align: left;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.button-group button {
    padding: 12px 24px;
    font-size: 1rem;
}

#reset-btn {
    background-color: transparent;
    color: var(--primary-color);
}

#reset-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

#newsletter-content {
    padding-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.loading-message {
    font-style: italic;
    color: #666;
    text-align: center;
    grid-column: 1 / -1;
    padding: 40px 0;
    font-size: 1.2em;
}

.content-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.content-card h3 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.content-card img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 15px;
    object-fit: cover;
    aspect-ratio: 4 / 3;
    background-color: #f0f0f0;
    filter: var(--sepia-filter);
}

/* --- Utility & Animations --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Print-Friendly Styles --- */
@media print {
    body {
        padding: 0;
        font-size: 12pt;
        color: #000000;
        background-color: #ffffff;
    }

    .wizard-container,
    .button-group {
        display: none;
    }

    #newsletter-view {
        box-shadow: none;
        border: none;
        padding: 0;
        max-width: 100%;
        width: 100%;
    }

    .newsletter-header {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 1em;
        justify-content: center;
    }

    .newsletter-header h1 {
        font-size: 20pt;
        text-align: center;
        width: 100%;
    }

    #newsletter-content {
        margin-top: 0;
        border: none;
        padding: 0;
        box-shadow: none;
        display: block;
    }

    h2 {
        font-size: 18pt;
        border-bottom: 2px solid #000000;
        padding-bottom: 5px;
        margin-top: 1.2em;
        page-break-after: avoid;
    }

    .content-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .content-card img {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        max-width: 50% !important;
        filter: grayscale(100%);
    }

    p,
    h3 {
        page-break-inside: avoid;
    }

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

    a[href]:after {
        content: ' (' attr(href) ')';
    }
}