/* ========================================
   EMAIL NOTIFICATIONS — sign-up / confirm / preferences / unsubscribe
   Uses the site tokens from main.css (--primary-color, --accent-color, etc.).
   Status is never carried by color alone (WCAG 1.4.1): every state pairs its
   color with an icon and a text label.
   ======================================== */

/* The form sits in a card so it reads as one task on the page. */
.en-panel {
    background: var(--white, #fff);
    border: 1px solid var(--border-gray, #e9ecef);
    border-radius: 10px;
    box-shadow: var(--shadow-sm, 0 2px 4px rgba(0, 0, 0, 0.05));
    padding: 1.5rem 1.6rem;
    margin: 1.5rem 0 2rem;
    max-width: 44rem;
}
.en-panel-result { padding: 1.75rem 1.6rem; }

/* ---- Topic checkboxes ---- */
.en-topics {
    border: 0;
    padding: 0;
    margin: 0 0 1.4rem;
}
.en-topics legend {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-color-dark, #063a6d);
    padding: 0;
    margin-bottom: 0.15rem;
}
.en-legend-hint {
    color: var(--mid-gray, #5c636a);
    font-size: 0.9rem;
    margin: 0 0 0.85rem;
}

.en-topic {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-gray, #e9ecef);
    border-radius: 8px;
    margin-bottom: 0.6rem;
    background: var(--off-white, #fafafa);
}
.en-topic:hover { border-color: var(--primary-color-light, #a0bde1); }
/* The whole row highlights when its box is checked, so the selection reads at a
   glance and not only from the 1rem control. */
.en-topic:has(input:checked) {
    border-color: var(--primary-color, #094989);
    background: #eef4fb;
}
.en-topic input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0.15rem 0 0;
    flex: none;
    accent-color: var(--primary-color, #094989);
    cursor: pointer;
}
.en-topic-text { min-width: 0; }
.en-topic-text label {
    font-weight: 600;
    color: var(--primary-color-dark, #063a6d);
    cursor: pointer;
    display: block;
}
.en-topic-text p {
    margin: 0.1rem 0 0;
    font-size: 0.92rem;
    color: var(--mid-gray, #5c636a);
}

/* The opt-out row. Set apart with a rule and a gap so it does not read as a
   fourth thing to subscribe to, and it warms to red rather than blue when
   checked — the one row where checking the box means "stop". */
.en-topic-all {
    margin-top: 1.1rem;
    padding-top: 1.05rem;
    border-top: 1px solid var(--border-gray, #e9ecef);
    border-radius: 0 0 8px 8px;
}
.en-topic-all:hover { border-color: var(--border-gray, #e9ecef); }
.en-topic-all:has(input:checked) {
    border-color: #f5c6c2;
    border-top-color: #f5c6c2;
    background: #fdecea;
}
.en-topic-all:has(input:checked) .en-topic-text label { color: #8c1d18; }
.en-topic-all input[type="checkbox"] { accent-color: #b3261e; }

/* A topic switched off by the opt-out box above. Still readable — it has to stay
   legible enough to see what you are giving up. */
.en-topic:has(input:disabled) {
    opacity: 0.55;
    background: var(--off-white, #fafafa);
    border-color: var(--border-gray, #e9ecef);
}
.en-topic:has(input:disabled):hover { border-color: var(--border-gray, #e9ecef); }
.en-topic input[type="checkbox"]:disabled { cursor: not-allowed; }
.en-topic:has(input:disabled) .en-topic-text label { cursor: not-allowed; }

/* ---- Inline note (unconfirmed subscription) ---- */
.en-note {
    background: #eef4fb;
    border: 1px solid var(--primary-color-light, #a0bde1);
    border-left: 4px solid var(--primary-color, #094989);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    margin: 0 0 1.1rem;
    font-size: 0.95rem;
    color: var(--primary-color-dark, #063a6d);
}
.en-note i { margin-right: 0.35rem; }

/* ---- Email field ---- */
.en-field { margin-bottom: 1.2rem; }
.en-field label {
    display: block;
    font-weight: 600;
    color: var(--primary-color-dark, #063a6d);
    margin-bottom: 0.3rem;
}
.en-field input {
    font: inherit;
    width: 100%;
    max-width: 26rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-gray, #ced4da);
    border-radius: 8px;
    background: #fff;
    color: var(--dark-gray, #333);
}
.en-field input:hover { border-color: var(--primary-color-light, #a0bde1); }
.en-field input[aria-invalid="true"] { border-color: #b3261e; border-width: 2px; }
.en-hint {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
    color: var(--mid-gray, #5c636a);
    max-width: 40rem;
}

/* ---- Buttons ---- */
.en-submit {
    font: inherit;
    font-weight: 600;
    background: var(--primary-color, #094989);
    color: #fff;
    border: 1px solid var(--primary-color, #094989);
    border-radius: 8px;
    padding: 0.65rem 1.4rem;
    cursor: pointer;
    transition: background var(--transition-fast, 0.2s ease);
}
.en-submit:hover:not([disabled]) { background: var(--primary-color-dark, #063a6d); }
.en-submit[disabled] { opacity: 0.65; cursor: progress; }

.en-btn-secondary {
    display: inline-block;
    font-weight: 600;
    background: #fff;
    color: var(--primary-color, #094989);
    border: 1px solid var(--primary-color, #094989);
    border-radius: 8px;
    padding: 0.55rem 1.2rem;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}
.en-btn-secondary:hover { background: #eef4fb; color: var(--primary-color-dark, #063a6d); }

.en-btn-quiet {
    font: inherit;
    background: none;
    border: 1px solid var(--border-gray, #ced4da);
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    color: var(--mid-gray, #5c636a);
    cursor: pointer;
}
.en-btn-quiet:hover { border-color: #b3261e; color: #b3261e; }

.en-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    align-items: center;
}

.en-link {
    font: inherit;
    background: none;
    border: 0;
    padding: 0;
    color: var(--primary-color, #094989);
    text-decoration: underline;
    cursor: pointer;
}
.en-link:hover { color: var(--primary-color-dark, #063a6d); }

/* ---- Messages ---- */
.en-error {
    background: #fdecea;
    border: 1px solid #f5c6c2;
    border-left: 4px solid #b3261e;
    color: #8c1d18;
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1.1rem;
    font-size: 0.95rem;
}
.en-status {
    margin: 0.8rem 0 0;
    font-size: 0.95rem;
    color: var(--mid-gray, #5c636a);
    min-height: 1.2em;
}
.en-status-bad { color: #8c1d18; font-weight: 500; }

.en-done h3,
.en-result-title {
    color: var(--primary-color-dark, #063a6d);
    margin: 0 0 0.6rem;
    font-size: 1.35rem;
}
.en-done h3:focus-visible,
.en-result-title:focus-visible { outline: 3px solid var(--accent-color, #6AADE4); outline-offset: 3px; }
.en-result-title.en-ok i { color: #1e5631; }
.en-result-title.en-bad i { color: #b3261e; }
.en-done p { max-width: 42rem; }
.en-done-sub {
    color: var(--mid-gray, #5c636a);
    font-size: 0.92rem;
}
.en-who {
    color: var(--mid-gray, #5c636a);
    font-size: 0.95rem;
    margin: 0 0 1rem;
}

/* ---- Supporting copy on the sign-up page ---- */
.en-h3 {
    margin-top: 2rem;
    font-size: 1.15rem;
    color: var(--primary-color-dark, #063a6d);
}
.en-list {
    max-width: 46rem;
    padding-left: 1.3rem;
}
.en-list li { margin-bottom: 0.4rem; }

@media (max-width: 576px) {
    .en-panel { padding: 1.15rem 1.1rem; }
    .en-field input { max-width: 100%; }
    .en-submit { width: 100%; }
}
