/* =========================================================================
   Quand est ma fête ? — front-end stylesheet
   Couleurs reprises de calendrierdujour.fr :
   - Fond crème            : #FAF6F0
   - Carte / encart        : #FFFFFF
   - Rouge bordeaux (titre): #9b1c1c
   - Vert action           : #10B981 / #27AE60
   - Brun lien             : #8B4513
   - Mint accent (date)    : #d8e8d6
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Dancing+Script:wght@500;700&display=swap');

.qemf-app,
.qemf-app *,
.qemf-app *::before,
.qemf-app *::after {
    box-sizing: border-box;
}

.qemf-app {
    --qemf-bg: #FAF6F0;
    --qemf-card: #FFFFFF;
    --qemf-text: #2a2422;
    --qemf-muted: #6b5f5a;
    --qemf-border: #e6ddd0;
    --qemf-red: #9b1c1c;
    --qemf-red-dark: #7a1414;
    --qemf-green: #10B981;
    --qemf-green-dark: #0e9e6e;
    --qemf-brown: #8B4513;
    --qemf-mint: #d8e8d6;
    --qemf-radius: 6px;

    font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--qemf-text);
    background: var(--qemf-bg);
    /*border: 1px solid var(--qemf-border);*/
    border-radius: 10px;
    padding: 28px 24px 32px;
    max-width: 860px;
    margin: 24px auto;
    line-height: 1.55;
    font-size: 16px;
}

/* --- Today banner ----------------------------------------------------- */
.qemf-today {
    text-align: center;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--qemf-border);
}
.qemf-today-label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--qemf-red);
    font-weight: 600;
    margin-bottom: 8px;
}
.qemf-today-date {
    display: inline-block;
    background: var(--qemf-mint);
    color: #2f4d2c;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
}
.qemf-today-greeting {
    margin: 10px 0 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18px;
    color: var(--qemf-text);
}
.qemf-today-greeting strong {
    color: var(--qemf-red);
    font-weight: 700;
}

/* --- Hero & search --------------------------------------------------- */
.qemf-hero {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}
.qemf-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    color: var(--qemf-text);
    margin: 0 0 8px;
    line-height: 1.15;
}
.qemf-subtitle {
    color: var(--qemf-muted);
    font-size: 15px;
    margin: 0 0 22px;
}

.qemf-search-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}
.qemf-search {
    width: 100%;
    height: 52px;
    padding: 0 44px 0 46px;
    background: #fff;
    border: 1px solid var(--qemf-border);
    border-radius: 26px;
    font-family: inherit;
    font-size: 16px;
    color: var(--qemf-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}
.qemf-search:focus {
    border-color: var(--qemf-red);
    box-shadow: 0 0 0 3px rgba(155, 28, 28, 0.12);
}
.qemf-search::placeholder {
    color: #b6a89d;
}
.qemf-search::-webkit-search-cancel-button {
    display: none;
}
.qemf-search-icon {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    color: var(--qemf-red);
    pointer-events: none;
}
.qemf-search-clear {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 0;
    background: #efe6da;
    color: var(--qemf-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: none;
}
.qemf-search-wrap.is-filled .qemf-search-clear {
    display: block;
}

/* --- Suggestions dropdown ------------------------------------------- */
.qemf-suggestions {
    list-style: none;
    margin: 8px auto 0;
    padding: 6px;
    max-width: 520px;
    background: #fff;
    border: 1px solid var(--qemf-border);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
    text-align: left;
    max-height: 280px;
    overflow-y: auto;
}
.qemf-suggestions li {
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.qemf-suggestions li:hover,
.qemf-suggestions li.is-active {
    background: #faf2e7;
}
.qemf-suggestions .qemf-sugg-name {
    font-weight: 600;
    color: var(--qemf-text);
}
.qemf-suggestions .qemf-sugg-date {
    font-size: 13px;
    color: var(--qemf-muted);
    font-family: Georgia, serif;
    font-style: italic;
}

/* --- Recent --------------------------------------------------------- */
.qemf-recent {
    text-align: center;
    margin-top: 14px;
}
.qemf-recent-label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--qemf-muted);
    margin-bottom: 6px;
}
.qemf-recent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.qemf-recent-chips button {
    background: #fff;
    border: 1px solid var(--qemf-border);
    color: var(--qemf-text);
    padding: 4px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background 0.12s;
}
.qemf-recent-chips button:hover {
    background: #f4ead8;
}

/* --- Result card ---------------------------------------------------- */
.qemf-result {
    margin-top: 18px;
    background: var(--qemf-card);
    border: 1px solid var(--qemf-border);
    border-radius: 10px;
    padding: 26px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.qemf-result.is-not-found {
    background: #fcf6e9;
}
.qemf-result-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}
.qemf-result-name {
    font-family: Georgia, serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--qemf-red);
    margin: 0;
    line-height: 1;
}
.qemf-result-date {
    background: var(--qemf-mint);
    color: #2f4d2c;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
}
.qemf-indirect {
    display: inline-block;
    background: #f4e8d6;
    color: var(--qemf-brown);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 3px 9px;
    border-radius: 999px;
    margin-bottom: 10px;
    font-weight: 600;
}
.qemf-result-saint {
    margin: 6px 0 14px;
    font-style: italic;
    color: var(--qemf-brown);
    font-size: 15px;
    font-family: Georgia, serif;
}
.qemf-result-desc {
    margin: 0 0 14px;
    color: var(--qemf-text);
}
.qemf-result-etymology {
    background: #faf2e7;
    border-left: 3px solid var(--qemf-brown);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: var(--qemf-text);
    margin: 0 0 14px;
}
.qemf-result-secondary {
    margin: 14px 0;
    padding-top: 14px;
    border-top: 1px dashed var(--qemf-border);
    font-size: 14px;
    color: var(--qemf-muted);
}
.qemf-result-secondary ul {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
}
.qemf-result-secondary li {
    padding: 3px 0;
}
.qemf-result-cta {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* --- Buttons -------------------------------------------------------- */
.qemf-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    cursor: pointer;
    padding: 11px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.12s, transform 0.1s, box-shadow 0.12s;
    text-decoration: none;
    line-height: 1;
}
.qemf-btn-primary {
    background: var(--qemf-green);
    color: #fff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.28);
}
.qemf-btn-primary:hover {
    background: var(--qemf-green-dark);
}
.qemf-btn-secondary {
    background: #fff;
    color: var(--qemf-text);
    border: 1px solid var(--qemf-border);
    box-shadow: none;
}
.qemf-btn-secondary:hover {
    background: #f7efe2;
}
.qemf-btn:active {
    transform: translateY(1px);
}

/* --- Trends --------------------------------------------------------- */
.qemf-trends {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px dashed var(--qemf-border);
}
.qemf-trends-title {
    font-family: Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--qemf-text);
    margin: 0 0 4px;
    text-align: center;
}
.qemf-trends-sub {
    text-align: center;
    color: var(--qemf-muted);
    font-size: 14px;
    margin: 0 0 16px;
}
.qemf-trends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.qemf-trends-grid button {
    background: #fff;
    border: 1px solid var(--qemf-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.qemf-trends-grid button:hover {
    background: #faf2e7;
    border-color: var(--qemf-brown);
}
.qemf-trends-grid .qemf-trend-name {
    display: block;
    font-weight: 700;
    color: var(--qemf-red);
    font-family: Georgia, serif;
    font-size: 17px;
    margin-bottom: 2px;
}
.qemf-trends-grid .qemf-trend-date {
    display: block;
    font-size: 12px;
    color: var(--qemf-muted);
}

/* --- Modal ---------------------------------------------------------- */
.qemf-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.qemf-modal[hidden] { display: none; }
.qemf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(35, 25, 20, 0.55);
    backdrop-filter: blur(2px);
}
.qemf-modal-content {
    position: relative;
    background: var(--qemf-bg);
    border-radius: 12px;
    max-width: 980px;
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.qemf-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.06);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: var(--qemf-text);
    z-index: 2;
}
.qemf-modal-close:hover { background: rgba(0, 0, 0, 0.12); }

/* --- Card builder --------------------------------------------------- */
.qemf-card-builder {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 0;
    min-height: 580px;
}
@media (max-width: 760px) {
    .qemf-card-builder { grid-template-columns: 1fr; }
}
.qemf-builder-controls {
    padding: 24px;
    border-right: 1px solid var(--qemf-border);
    background: #fffaf2;
}
@media (max-width: 760px) {
    .qemf-builder-controls { border-right: 0; border-bottom: 1px solid var(--qemf-border); }
}
.qemf-builder-title {
    font-family: Georgia, serif;
    font-size: 22px;
    margin: 0 0 18px;
    color: var(--qemf-red);
}
.qemf-field {
    display: block;
    margin-bottom: 14px;
}
.qemf-field > span {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--qemf-muted);
    margin-bottom: 5px;
    font-weight: 600;
}
.qemf-field input,
.qemf-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--qemf-border);
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    color: var(--qemf-text);
    resize: none;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.qemf-field input:focus,
.qemf-field textarea:focus {
    border-color: var(--qemf-red);
    box-shadow: 0 0 0 3px rgba(155, 28, 28, 0.1);
}
.qemf-templates {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.qemf-templates button {
    aspect-ratio: 3 / 4;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    background: #ddd;
    transition: border-color 0.12s, transform 0.08s;
}
.qemf-templates button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qemf-templates button.is-active {
    border-color: var(--qemf-red);
    transform: scale(0.98);
}
.qemf-fonts {
    display: flex;
    gap: 6px;
}
.qemf-fonts button {
    flex: 1;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--qemf-border);
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.qemf-fonts button.is-active {
    border-color: var(--qemf-red);
    background: #faf2e7;
    color: var(--qemf-red);
}
.qemf-builder-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--qemf-border);
}
.qemf-builder-actions .qemf-btn {
    justify-content: center;
}
.qemf-builder-preview {
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--qemf-bg);
    min-height: 480px;
}
.qemf-card {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 3 / 4;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.qemf-card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}
.qemf-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(1px);
}
.qemf-card-inner {
    position: absolute;
    inset: 0;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    text-align: center;
    color: var(--qemf-text);
}
.qemf-card-top { margin-bottom: auto; }
.qemf-card-mid {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.qemf-card-bot { margin-top: auto; }
.qemf-card-date {
    margin: 0;
    font-family: Georgia, serif;
    font-style: italic;
    color: var(--qemf-red);
    font-size: 13px;
}
.qemf-card-saint {
    margin: 4px 0 0;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--qemf-muted);
}
.qemf-card-name {
    margin: 0 0 14px;
    font-family: Georgia, serif;
    font-size: clamp(28px, 8vw, 40px);
    color: var(--qemf-red);
    font-weight: 700;
    line-height: 1.05;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}
.qemf-card-name.font-sans { font-family: 'Manrope', sans-serif; }
.qemf-card-name.font-script { font-family: 'Dancing Script', cursive; font-size: clamp(34px, 9vw, 48px); }
.qemf-card-msg {
    margin: 0;
    font-style: italic;
    color: #3a2f2c;
    font-size: 14px;
    padding: 0 8px;
}
.qemf-card-from {
    margin: 0 0 4px;
    font-style: italic;
    color: var(--qemf-red);
    font-family: Georgia, serif;
    font-size: 13px;
}
.qemf-card-footer {
    margin: 0;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--qemf-muted);
}

/* --- Animation utilities ------------------------------------------- */
.qemf-fade-in { animation: qemf-fade-in 0.3s ease both; }
@keyframes qemf-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Mobile tweaks ------------------------------------------------- */
@media (max-width: 480px) {
    .qemf-app { padding: 20px 16px; }
    .qemf-result-name { font-size: 30px; }
    .qemf-builder-actions { flex-direction: column; }
    .qemf-templates { grid-template-columns: repeat(3, 1fr); }
}

/* --- Custom-date card flow (v1.1) --------------------------------- */
.qemf-customdate {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
}
.qemf-customdate-label {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.45;
    color: #3a2f2c;
}
.qemf-customdate-fields {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.qemf-customdate-fields select {
    flex: 0 1 110px;
    min-width: 90px;
    padding: 9px 10px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #fff;
    font-family: inherit;
    color: inherit;
}
.qemf-customdate-fields .qemf-btn {
    flex: 1 1 auto;
    min-width: 160px;
}
.qemf-customdate-hint {
    margin: 10px 0 0;
    font-size: 12.5px;
    color: var(--qemf-muted, #6b6058);
}
.qemf-customdate-error {
    color: var(--qemf-red, #9b1c1c);
    font-weight: 500;
}

/* Date row inside the card builder modal (custom-date card) */
.qemf-field-date .qemf-date-row {
    display: flex;
    gap: 8px;
}
.qemf-field-date .qemf-date-row select {
    flex: 1;
    padding: 9px 10px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: #fff;
    font-family: inherit;
    color: inherit;
}
.qemf-field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--qemf-muted, #6b6058);
    font-style: italic;
}

/* ----- Visitor-facing FAQ shortcode ----- */
.qemf-faq {
    max-width: 820px;
    margin: 32px auto;
    font-family: inherit;
    color: inherit;
}
.qemf-faq-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 18px;
    text-align: left;
}
.qemf-faq-item {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}
.qemf-faq-item[open] {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.qemf-faq-q {
    list-style: none;
    cursor: pointer;
    padding: 14px 44px 14px 18px;
    font-weight: 600;
    font-size: 16px;
    position: relative;
    user-select: none;
    transition: background 0.15s ease;
}
.qemf-faq-q::-webkit-details-marker { display: none; }
.qemf-faq-q::after {
    content: "+";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    line-height: 1;
    font-weight: 400;
    color: var(--qemf-muted, #6b6058);
    transition: transform 0.2s ease;
}
.qemf-faq-item[open] .qemf-faq-q::after {
    content: "−";
}
.qemf-faq-q:hover { background: rgba(0, 0, 0, 0.02); }
.qemf-faq-q:focus-visible {
    outline: 2px solid var(--qemf-accent, #c97d54);
    outline-offset: -2px;
}
.qemf-faq-a {
    padding: 4px 18px 18px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--qemf-text, #2b2b2b);
}
.qemf-faq-a p:first-child { margin-top: 0; }
.qemf-faq-a p:last-child  { margin-bottom: 0; }
.qemf-faq-a ul { margin: 8px 0 0 18px; padding: 0; }
.qemf-faq-a ul li { margin-bottom: 4px; }
.qemf-faq-a code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 90%;
}
