/* Upcoming CME page and its admin preview styles. Colours come from the site's primary/secondary settings. */
:root {
    --cme-ivory: #fdf9f1;
    --cme-cream: #fbf1df;
    --cme-peach: #fbe7d9;
    --cme-beige: #f6ead3;
    --cme-gold: #e2c98f;
    --cme-line: #ead8ae;
    --cme-text: #3b2a24;
    --cme-muted: #6b5a52;
    --cme-main: #690303;
    --cme-rgb: 105, 3, 3;
    --cme-accent: #b50505;
    --cme-shadow: 0 8px 22px rgba(var(--cme-rgb), .10);
    --cme-heading: 'Marcellus', 'Playfair Display', Georgia, serif;
    --cme-body: 'Outfit', system-ui, sans-serif;
}

.cme-page {
    background: var(--cme-ivory);
    color: var(--cme-text);
    font-family: var(--cme-body);
    line-height: 1.5;
    padding-bottom: 56px;
    overflow-x: clip;
}
.cme-page *, .cme-page *::before, .cme-page *::after { box-sizing: border-box; }
.cme-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.cme-page h1, .cme-page h2, .cme-page h3 { font-family: var(--cme-heading); color: var(--cme-main); font-weight: 500; }
.cme-page [hidden] { display: none !important; }

/* ---------- Hero ---------- */
.cme-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: stretch;
    min-height: 330px;
    background: linear-gradient(100deg, var(--cme-cream) 0%, var(--cme-cream) 40%, rgba(251, 241, 223, .6) 62%, rgba(251, 241, 223, 0) 100%);
    overflow: hidden;
}
.cme-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('/assets/images/quote-leaves-tl-trans.png') left top / 150px no-repeat;
    opacity: .6;
    pointer-events: none;
}
.cme-hero-text { position: relative; z-index: 2; padding: 38px 24px 36px max(20px, calc((100% - 1180px) / 2 + 20px)); display: flex; flex-direction: column; justify-content: center; }
.cme-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    background: #fff;
    color: var(--cme-main);
    border: 1px solid var(--cme-line);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: 14px;
}
.cme-hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); line-height: 1.08; margin: 0 0 6px; }
.cme-hero-sub { font-family: var(--cme-heading); font-style: italic; font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--cme-muted); margin: 0 0 12px; }
.cme-hero-lead { font-size: .95rem; color: var(--cme-text); max-width: 460px; margin: 0 0 20px; }
.cme-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    background: var(--cme-main);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(var(--cme-rgb), .25);
    transition: background .2s, transform .15s;
}
.cme-btn:hover { background: #4a0202; color: #fff; transform: translateY(-1px); }
.cme-hero-image {
    position: relative;
    background: var(--cme-hero-image) center / cover no-repeat;
    min-height: 260px;
}
.cme-hero-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--cme-cream) 0%, rgba(251, 241, 223, .35) 30%, rgba(251, 241, 223, 0) 55%);
}
@media (max-width: 860px) {
    .cme-hero { grid-template-columns: 1fr; min-height: 0; }
    .cme-hero-text { padding: 26px 20px 12px; }
    .cme-hero-image { min-height: 230px; order: 2; }
    .cme-hero-image::before { background: linear-gradient(180deg, var(--cme-cream) 0%, rgba(251, 241, 223, 0) 35%); }
}
@media (max-width: 520px) {
    .cme-hero-text { padding: 20px 16px 8px; }
    .cme-hero-image { min-height: 190px; }
    .cme-btn { width: 100%; justify-content: center; }
}

/* ---------- Section titles ---------- */
.cme-section-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.45rem;
    margin: 30px 0 16px;
    text-align: center;
}
.cme-section-title::before, .cme-section-title::after {
    content: "";
    height: 1px;
    flex: 1 1 60px;
    background: linear-gradient(90deg, transparent, var(--cme-gold), transparent);
}
.cme-section-title i { color: var(--cme-main); font-size: 1.1rem; }
@media (max-width: 520px) { .cme-section-title { font-size: 1.2rem; } .cme-section-title::before, .cme-section-title::after { flex-basis: 24px; } }

/* ---------- Academic year selector ---------- */
.cme-years { margin-top: 26px; }
.cme-year-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}
.cme-year {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 999px;
    border: 1.5px solid var(--cme-main);
    background: var(--cme-cream);
    color: var(--cme-main);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, color .2s, transform .15s;
}
.cme-year:hover { background: var(--cme-peach); color: var(--cme-main); transform: translateY(-1px); }
.cme-year.is-active { background: var(--cme-main); color: #fff; box-shadow: 0 6px 14px rgba(var(--cme-rgb), .28); }
.cme-year.is-draft { border-style: dashed; }
@media (max-width: 720px) {
    .cme-year-row { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
    .cme-year-row::-webkit-scrollbar { display: none; }
    .cme-year { flex: 0 0 auto; }
}

/* ---------- PDF card ---------- */
.cme-pdf {
    position: relative;
    display: flex;
    align-items: center;
    gap: 22px;
    margin-top: 22px;
    padding: 20px 28px;
    background: linear-gradient(100deg, var(--cme-cream) 0%, var(--cme-beige) 100%);
    border: 1px solid var(--cme-gold);
    border-radius: 22px;
    box-shadow: var(--cme-shadow);
    overflow: hidden;
}
.cme-pdf-icon {
    flex: 0 0 auto;
    width: 74px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--cme-line);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(var(--cme-rgb), .12);
    font-size: 2.4rem;
    color: var(--cme-accent);
}
.cme-pdf-text { flex: 1 1 auto; min-width: 0; text-align: left; position: relative; z-index: 1; }
.cme-pdf-text h3 { font-size: 1.35rem; margin: 0 0 4px; }
.cme-pdf-text p { margin: 0; color: var(--cme-muted); font-size: .92rem; }
.cme-btn-pdf { position: relative; z-index: 1; flex: 0 0 auto; }
.cme-pdf-deco {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 170px;
    background: url('/assets/images/quote-leaves-tr-trans.png') right center / contain no-repeat;
    opacity: .7;
    pointer-events: none;
}
@media (max-width: 720px) {
    .cme-pdf { flex-direction: column; text-align: center; gap: 14px; padding: 20px 18px; }
    .cme-pdf-text { text-align: center; }
    .cme-btn-pdf { width: 100%; justify-content: center; }
    .cme-pdf-deco { width: 110px; opacity: .45; }
}

/* ---------- Day cards ---------- */
.cme-day-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}
.cme-status { grid-column: 1 / -1; text-align: center; color: var(--cme-muted); padding: 22px 10px; margin: 0; }
.cme-day {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--cme-line);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(var(--cme-rgb), .07);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    animation: cmeRise .45s ease both;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.cme-day:hover, .cme-day:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(var(--cme-rgb), .16); border-color: var(--cme-gold); outline: none; }
.cme-day-media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--cme-peach); overflow: hidden; }
.cme-day-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.cme-day:hover .cme-day-media img { transform: scale(1.04); }
.cme-day-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    background: rgba(var(--cme-rgb), .9);
    color: #fff;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cme-day-meta { display: block; padding: 9px 10px 10px; text-align: center; }
.cme-day-count { display: block; font-size: .78rem; color: var(--cme-main); font-weight: 600; }
@keyframes cmeRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 1100px) { .cme-day-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cme-day-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ---------- Gallery popup ---------- */
.cme-modal {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(35, 8, 10, .62);
    opacity: 0;
    transition: opacity .25s ease;
}
.cme-modal.is-open { opacity: 1; }
.cme-modal-box {
    width: min(920px, 100%);
    max-height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    background: var(--cme-ivory);
    border: 1px solid var(--cme-gold);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    padding: 16px 18px 14px;
    transform: translateY(18px) scale(.97);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.cme-modal.is-open .cme-modal-box { transform: none; }
.cme-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cme-modal-head h3 { font-size: 1.2rem; margin: 0; }
.cme-close {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--cme-line);
    background: #fff;
    color: var(--cme-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.cme-close:hover { background: var(--cme-peach); }
.cme-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; flex: 1 1 auto; background: var(--cme-beige); border-radius: 14px; overflow: hidden; }
.cme-slide { margin: 0; width: 100%; height: clamp(260px, 56vh, 520px); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.cme-slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; cursor: zoom-in; transition: opacity .25s ease; }
.cme-slide.is-changing img { animation: cmeSwap .35s ease; }
@keyframes cmeSwap { from { opacity: .2; transform: scale(.985); } to { opacity: 1; transform: none; } }
.cme-slide figcaption {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(35, 8, 10, .62);
    color: #fff;
    font-size: .78rem;
    padding: 3px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.cme-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .92);
    color: var(--cme-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
}
.cme-nav:hover { background: #fff; }
.cme-prev { left: 10px; }
.cme-next { right: 10px; }
.cme-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cme-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--cme-gold); transition: background .2s, transform .2s; }
.cme-dots span.is-active { background: var(--cme-main); transform: scale(1.3); }
.cme-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: thin; }
.cme-thumbs button { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; opacity: .6; cursor: pointer; transition: opacity .2s, border-color .2s; }
.cme-thumbs button.is-active, .cme-thumbs button:hover { opacity: 1; }
.cme-thumbs button.is-active { border-color: var(--cme-main); }
.cme-thumbs img { width: 84px; height: 60px; object-fit: cover; border-radius: 6px; display: block; }
body.cme-lock { overflow: hidden; }

/* Full-screen view of one photograph */
.cme-viewer {
    position: fixed;
    inset: 0;
    z-index: 1070;
    background: rgba(12, 3, 4, .94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity .22s ease;
}
.cme-viewer.is-open { opacity: 1; }
.cme-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; transform: scale(.97); transition: transform .3s ease; }
.cme-viewer.is-open img { transform: none; }
.cme-viewer-close { position: absolute; top: 14px; right: 14px; background: #fff; }

/* Mobile: the popup takes the full screen */
@media (max-width: 640px) {
    .cme-modal { padding: 0; align-items: stretch; }
    .cme-modal-box { width: 100%; max-height: none; height: 100%; border-radius: 0; padding: 12px 12px 14px; border: 0; }
    .cme-slide { height: auto; flex: 1 1 auto; min-height: 260px; }
    .cme-nav { width: 38px; height: 38px; }
    .cme-thumbs img { width: 70px; height: 52px; }
}
