/* emAffEvents – affiliated events list (Entrymaster V4)
   Works alongside W3.CSS; everything is scoped under .emae.
   Per-society colour comes from --emae-primary set inline by the snippet. */

.emae {
    --emae-primary: #2c4f7c;
    --emae-bg: #f4f6f9;
    --emae-panel: #ffffff;
    --emae-border: #e1e6ee;
    --emae-text: #1b2230;
    --emae-muted: #5d6878;
    --emae-badge: #eaf0f7;
    --emae-em-red: #b3213b;
    --emae-radius: 14px;

    box-sizing: border-box;
    max-width: 1140px;
    margin: 0 auto;
    padding: 24px 16px 16px;
    color: var(--emae-text);
    font-family: "Source Sans 3", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
}
.emae *, .emae *::before, .emae *::after { box-sizing: inherit; }
body.emae-body { background: var(--emae-bg, #f4f6f9); margin: 0; }

.emae a { color: var(--emae-primary); text-decoration: none; }
.emae a:hover { text-decoration: underline; }
.emae [hidden] { display: none !important; }

.emae-panel {
    background: var(--emae-panel);
    border: 1px solid var(--emae-border);
    border-radius: var(--emae-radius);
}

/* ---------- header ---------- */
.emae-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
}
.emae-brand { display: flex; align-items: center; gap: 22px; min-width: 0; }
.emae-logo {
    flex: 0 0 auto; width: 96px; height: 96px; border-radius: 50%;
    background: var(--emae-badge); color: var(--emae-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 22px; letter-spacing: .03em; overflow: hidden;
}
.emae-logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; background: #fff; }
.emae-title { margin: 0; font-size: 32px; font-weight: 600; line-height: 1.15; }
.emae-subtitle { margin: 6px 0 0; color: var(--emae-muted); font-size: 18px; }
/* Entrymaster banner (header + footer) */
.emae .emae-powered, .emae .emae-footer a {
    display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px;
    color: var(--emae-muted); font-size: 12px; line-height: 1; text-decoration: none;
}
.emae .emae-powered:hover, .emae .emae-footer a:hover { text-decoration: none; opacity: .85; }
.emae-powered img { display: block; width: 210px; height: auto; }

/* ---------- filters ---------- */
.emae-filters {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px 22px; padding: 26px 32px; margin-bottom: 26px;
}
.emae-field label, .emae-actions label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.emae-actions label { margin: 0; }
.emae-input {
    width: 100%; min-width: 0; height: 48px; padding: 0 14px;
    border: 1px solid #cfd6e0; border-radius: 8px; background: #fff;
    font: inherit; font-size: 15px; color: var(--emae-text);
}
.emae-input::placeholder { color: #98a2b0; }
.emae-input:focus { outline: 2px solid var(--emae-primary); outline-offset: 1px; border-color: var(--emae-primary); }
select.emae-input {
    appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%231b2230' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
}
/* ---------- toolbar ---------- */
.emae-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 20px;
}
.emae-status { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 18px; }
.emae-summary { margin: 0; font-size: 19px; }
.emae-reset {
    border: 0; background: none; padding: 2px 0; cursor: pointer; white-space: nowrap;
    color: var(--emae-primary); font: inherit; font-size: 15px;
}
.emae-reset:hover { text-decoration: underline; }
.emae-reset i { font-size: .85em; margin-right: 2px; }
.emae-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.emae-actions select.emae-input { width: auto; min-width: 240px; }

/* ---------- buttons ---------- */
.emae-btn, .emae-btn-outline {
    display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px;
    border-radius: 8px; font: inherit; font-size: 16px; cursor: pointer; white-space: nowrap;
}
.emae .emae-btn { background: var(--emae-primary); color: #fff; border: 1px solid var(--emae-primary); }
.emae .emae-btn:hover { filter: brightness(1.12); text-decoration: none; }
.emae .emae-btn-outline { background: #fff; color: var(--emae-text); border: 1px solid #cfd6e0; }
.emae .emae-btn-outline:hover { border-color: var(--emae-primary); color: var(--emae-primary); text-decoration: none; }
.emae-btn i { font-size: .8em; }

/* ---------- event cards ---------- */
.emae-list { display: flex; flex-direction: column; gap: 20px; }
.emae-card {
    display: grid; grid-template-columns: 146px minmax(0, 1fr) minmax(200px, 340px);
    gap: 32px; padding: 36px;
}
.emae-date {
    background: var(--emae-badge); border-radius: 8px; height: 158px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--emae-primary);
}
.emae-date-month { font-size: 22px; letter-spacing: .02em; }
.emae-date-day { font-size: 42px; font-weight: 700; line-height: 1.15; }
.emae-date-year { font-size: 22px; }

.emae-name { margin: 2px 0 14px; font-size: 27px; font-weight: 600; line-height: 1.25; }
.emae-line { margin: 0 0 12px; color: var(--emae-muted); font-size: 19px; }
.emae-line i { width: 1.1em; text-align: center; margin-right: 4px; opacity: .75; font-size: .85em; }
.emae-types { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.emae-type {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    background: var(--emae-badge); color: var(--emae-primary); font-size: 14px; font-weight: 600;
}
.emae-contact { margin: 0 0 6px; color: var(--emae-muted); font-size: 17px; overflow-wrap: anywhere; }
.emae-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.emae-buttons:empty { display: none; }

.emae-sr, .emae-printonly {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.emae-empty { text-align: center; padding: 48px 24px; color: var(--emae-muted); }
.emae-empty i { font-size: 34px; opacity: .5; }
.emae-empty p { font-size: 18px; margin: 12px 0 18px; }

.emae-footer { text-align: center; padding: 32px 0 8px; }
.emae-footer a { align-items: center; }
.emae-footer img { display: block; width: 175px; height: auto; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .emae-card { grid-template-columns: 110px minmax(0, 1fr); gap: 20px 24px; padding: 24px; }
    .emae-side { grid-column: 2; }
    .emae-date { height: 124px; }
    .emae-date-day { font-size: 34px; }
    .emae-date-month, .emae-date-year { font-size: 18px; }
    .emae-name { font-size: 23px; }
    .emae-line { font-size: 17px; }
}
@media (max-width: 600px) {
    .emae { padding-top: 16px; }
    .emae-logo { width: 64px; height: 64px; font-size: 16px; }
    .emae-brand { gap: 14px; }
    .emae .emae-powered { align-items: flex-start; }
    .emae-powered img { width: 160px; }
    .emae-title { font-size: 23px; }
    .emae-subtitle { font-size: 16px; }
    .emae-filters { padding: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
    .emae-filters .emae-field:has(#emae-q),
    .emae-filters .emae-field:has(#emae-year) { grid-column: 1 / -1; }
    .emae-input { padding: 0 10px; font-size: 16px; } /* 16px stops iOS zooming on focus */
    select.emae-input { padding-right: 32px; background-position: right 10px center; }
    .emae-card { grid-template-columns: 76px minmax(0, 1fr); padding: 18px; gap: 14px 16px; }
    .emae-side { grid-column: 1 / -1; }
    .emae-date { height: 92px; }
    .emae-date-day { font-size: 26px; }
    .emae-date-month, .emae-date-year { font-size: 14px; }
    .emae-name { font-size: 20px; margin-bottom: 8px; }
    .emae-line { font-size: 16px; margin-bottom: 6px; }
    .emae-actions { width: 100%; }
    .emae-actions select.emae-input { min-width: 0; flex: 1; }
    .emae-btn, .emae-btn-outline { height: 44px; padding: 0 16px; }
}

/* ---------- print ---------- */
@media print {
    @page { margin: 14mm; }
    body.emae-body { background: #fff; }
    .emae { max-width: none; padding: 0; font-size: 11pt; }
    .emae-noprint { display: none !important; }
    .emae-printonly { position: static; width: auto; height: auto; clip: auto; }
    .emae-header { margin-bottom: 10mm; }
    .emae-logo { width: 60px; height: 60px; }
    .emae-title { font-size: 20pt; }
    .emae-summary { font-size: 12pt; }
    .emae-list { gap: 0; }
    .emae-card {
        grid-template-columns: 60px minmax(0, 1fr) 200px; gap: 14px; padding: 10px 0;
        border: 0; border-bottom: 1px solid #ccc; border-radius: 0; break-inside: avoid;
    }
    .emae-date { height: auto; padding: 6px 0; background: none; border: 1px solid #ccc; }
    .emae-date-day { font-size: 18pt; }
    .emae-date-month, .emae-date-year { font-size: 9pt; }
    .emae-name { font-size: 13pt; margin-bottom: 4px; }
    .emae-line, .emae-contact { font-size: 10pt; margin-bottom: 2px; }
    .emae-type { border: 1px solid #999; background: none; font-size: 8pt; }
    .emae a { color: #000; }
    .emae-footer { padding-top: 8mm; }
    .emae-footer img { width: 140px; }
}
