/* ==========================================================================
   Contritok — "Heritage Editorial" public theme (v5)
   A modern, editorial redesign that keeps the emerald & gold brand. Loaded
   after Bootstrap 5 so it overrides the framework defaults across all pages.
   Every class and Bootstrap hook the templates use is preserved.
   ========================================================================== */

:root {
    /* --- Brand: emerald (refined forest/fresh fern) --- */
    --ct-emerald-50:  #ebf7ef;
    --ct-emerald-100: #d6efe0;
    --ct-emerald-200: #b0e0c4;
    --ct-emerald-300: #7fcaa0;
    --ct-emerald-400: #4cb27a;
    --ct-emerald-500: #2e9e5f;
    --ct-emerald-600: #0f7a41;   /* primary */
    --ct-emerald-700: #0c6236;
    --ct-emerald-800: #0a4d2b;
    --ct-emerald-900: #073a21;
    --ct-emerald-950: #042617;

    /* --- Brand: gold --- */
    --ct-gold-50:  #fff9e6;
    --ct-gold-100: #fff1c9;
    --ct-gold-200: #ffe58d;
    --ct-gold-300: #ffd54f;      /* accent */
    --ct-gold-400: #ffca28;
    --ct-gold-500: #f5b300;
    --ct-gold-600: #c98200;

    /* --- Neutrals (soft green-tinted parchment) --- */
    --ct-bg:            #f4f7f3;
    --ct-surface:       #ffffff;
    --ct-surface-2:     #f6f8f4;
    --ct-border:        #e2e8e3;
    --ct-border-strong: #c9d5cc;
    --ct-text:          #26332c;
    --ct-heading:       #12301d;
    --ct-muted:         #64746b;
    --ct-link:          #0c6236;
    --ct-link-hover:    #073a21;

    /* --- Semantic --- */
    --ct-success: #0f7a41;
    --ct-info:    #128277;
    --ct-warning: #f5b300;
    --ct-danger:  #c0392b;

    /* --- Typography --- */
    --ct-font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --ct-font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* --- Shape & depth --- */
    --ct-radius:    .95rem;
    --ct-radius-sm: .7rem;
    --ct-radius-lg: 1.4rem;
    --ct-shadow-sm: 0 1px 2px rgba(12,32,20,.05), 0 3px 10px rgba(12,32,20,.06);
    --ct-shadow:    0 10px 28px rgba(12,32,20,.10);
    --ct-shadow-lg: 0 26px 58px rgba(12,32,20,.16);
    --ct-shadow-large: var(--ct-shadow-lg);
    --ct-ring:      0 0 0 .22rem rgba(15,122,65,.20);

    /* --- Legacy aliases still referenced by page inline styles --- */
    --primary-emerald: var(--ct-emerald-600);
    --accent-gold:     var(--ct-gold-300);
    --dark-bg:         var(--ct-emerald-900);

    /* --- App shell --- */
    --ct-appbar-h: 60px;
    --ct-tabbar-h: 66px;
    --ct-safe-t: env(safe-area-inset-top, 0px);
    --ct-safe-b: env(safe-area-inset-bottom, 0px);
    --ct-safe-l: env(safe-area-inset-left, 0px);
    --ct-safe-r: env(safe-area-inset-right, 0px);
    --ct-gap: .9rem;
    --ct-pad: 1rem;
    --ct-content-max: 1180px;

    /* --- Re-tune Bootstrap's own theme variables --- */
    --bs-primary-rgb:   15, 122, 65;
    --bs-success-rgb:   15, 122, 65;
    --bs-warning-rgb:   245, 179, 0;
    --bs-danger-rgb:    192, 57, 43;
    --bs-info-rgb:      18, 130, 119;
    --bs-secondary-rgb: 100, 116, 107;
    --bs-light-rgb:     244, 247, 243;
    --bs-dark-rgb:      4, 38, 23;
    --bs-body-bg:       #f4f7f3;
    --bs-body-color:    #26332c;
    --bs-emphasis-color:#12301d;
    --bs-secondary-color:#64746b;
    --bs-border-color:  #e2e8e3;
    --bs-link-color-rgb:       12, 98, 54;
    --bs-link-hover-color-rgb: 7, 58, 33;
    --bs-border-radius:    .7rem;
    --bs-border-radius-lg: .95rem;
    --bs-border-radius-xl: 1.4rem;
}

html { color-scheme: light; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; touch-action: manipulation; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

/* ============================ Base ==================================== */
body {
    font-family: var(--ct-font-body);
    background-color: var(--ct-bg);
    color: var(--ct-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.55;
    letter-spacing: -0.005em;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}
h1, h2, h3, h4, h5, h6 {
    font-family: var(--ct-font-display);
    color: var(--ct-heading);
    font-weight: 700;
    letter-spacing: -.015em;
}
h1, h2 { letter-spacing: -.02em; }
.display-1, .display-2, .display-3, .display-4 {
    font-family: var(--ct-font-display);
    color: var(--ct-heading);
    font-weight: 800;
    letter-spacing: -.02em;
}
.lead { color: #33443b; }
hr { border-color: var(--ct-border); opacity: 1; }
a {
    color: var(--ct-link);
    text-decoration-color: color-mix(in srgb, var(--ct-link) 35%, transparent);
    text-underline-offset: .15em;
    transition: color .15s ease;
}
a:hover { color: var(--ct-link-hover); text-decoration-color: currentColor; }
small, .small { color: inherit; }
::selection { background: var(--ct-gold-200); color: var(--ct-emerald-900); }

/* Scrollbar (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ct-emerald-200); border-radius: 999px; border: 2px solid var(--ct-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ct-emerald-300); }

img, video { max-width: 100%; height: auto; }

/* ====================== Utility color fixes ========================== */
.text-success { color: var(--ct-emerald-700) !important; }
.text-muted   { color: var(--ct-muted) !important; }
.text-dark    { color: var(--ct-heading) !important; }
.text-secondary { color: var(--ct-muted) !important; }
.text-white-50 { color: rgba(255,255,255,.7) !important; }
.bg-light     { background-color: var(--ct-surface-2) !important; }
.bg-dark      { background-color: var(--ct-emerald-900) !important; }
.bg-white     { background-color: var(--ct-surface) !important; }
.bg-success   { color: #fff; }
.bg-warning   { color: var(--ct-emerald-950); }
.border-success { border-color: var(--ct-emerald-600) !important; }
.border-warning { border-color: var(--ct-gold-300) !important; }
.border-light   { border-color: var(--ct-border) !important; }
.link-success { color: var(--ct-emerald-700) !important; }
.link-success:hover { color: var(--ct-emerald-800) !important; }

/* Soft tinted badges: keep bg-opacity-10 working, but make them readable */
.bg-success.bg-opacity-10 { color: var(--ct-emerald-700) !important; }
.bg-warning.bg-opacity-10 { color: var(--ct-gold-600) !important; }
.bg-danger.bg-opacity-10  { color: var(--ct-danger) !important; }

/* ============================ App bar ================================ */
.navbar-custom {
    min-height: calc(var(--ct-appbar-h) + var(--ct-safe-t));
    padding: var(--ct-safe-t) 0 0 !important;
    background: linear-gradient(135deg, var(--ct-emerald-800) 0%, var(--ct-emerald-950) 100%);
    border-bottom: 1px solid rgba(255,255,255,.08);
    border-top: 3px solid var(--ct-gold-300);
    box-shadow: 0 8px 26px rgba(4,38,23,.22);
}
.navbar-custom .navbar-brand { color: #fff !important; letter-spacing: .4px; }
.navbar-custom .navbar-brand small { color: var(--ct-gold-300) !important; }
.navbar-custom .navbar-toggler { border-color: rgba(255,255,255,.35); border-radius: .65rem; padding: .3rem .5rem; }
.navbar-custom .navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(255,213,79,.35); }

.ct-appbar-inner {
    display: flex; align-items: center; gap: .5rem;
    min-height: var(--ct-appbar-h);
}
.ct-brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.ct-brand:hover { text-decoration: none; }
.ct-brand-mark {
    width: 40px; height: 40px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 13px; font-size: 1.1rem;
    color: var(--ct-emerald-900);
    background: linear-gradient(160deg, var(--ct-gold-300), var(--ct-gold-500));
    box-shadow: 0 4px 14px rgba(245,179,0,.4), inset 0 1px 0 rgba(255,255,255,.35);
}
.ct-brand-text { display: flex; flex-direction: column; line-height: 1; }
.ct-brand-text b { color: #fff; font-size: 1.15rem; font-weight: 800; letter-spacing: .2px; }
.ct-brand-text span { color: var(--ct-gold-300); font-size: .62rem; font-weight: 700; letter-spacing: .55px; text-transform: uppercase; }

.ct-appnav { display: none; align-items: center; gap: .15rem; margin: 0 0 0 1rem; padding: 0; list-style: none; }
.ct-appnav a {
    display: inline-flex; align-items: center; gap: .45rem;
    color: rgba(255,255,255,.85); text-decoration: none;
    font-weight: 600; font-size: .92rem;
    padding: .55rem .85rem; border-radius: .7rem;
    transition: background-color .16s ease, color .16s ease;
}
.ct-appnav a:hover, .ct-appnav a.active { color: #fff; background: rgba(255,255,255,.12); }
.ct-appnav a.active { color: var(--ct-gold-300); }

.ct-appbar-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.ct-iconbtn {
    position: relative;
    width: 42px; height: 42px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 13px;
    color: #fff; background: rgba(255,255,255,.10);
    font-size: 1.05rem; cursor: pointer; text-decoration: none;
    transition: background-color .16s ease, transform .12s ease;
}
.ct-iconbtn:hover { background: rgba(255,255,255,.2); color: #fff; }
.ct-iconbtn:active { transform: scale(.92); }
.ct-iconbtn .ct-dot {
    position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--ct-gold-300); border: 2px solid var(--ct-emerald-800);
}
.ct-avatarbtn { padding: 0; border: 2px solid rgba(255,213,79,.7); border-radius: 50%; overflow: hidden; width: 40px; height: 40px; display: inline-flex; }
.ct-avatarbtn img { width: 100%; height: 100%; object-fit: cover; }
.ct-avatarbtn .ct-initials { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--ct-gold-300); color: var(--ct-emerald-900); font-weight: 800; font-size: .8rem; }

@media (min-width: 992px) {
    .ct-appnav { display: flex; }
    .ct-brand-text b { font-size: 1.25rem; }
}

/* ============================ Tab bar ================================ */
.ct-tabbar {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(var(--ct-tabbar-h) + var(--ct-safe-b));
    padding: 0 0 var(--ct-safe-b);
    background: rgba(255,255,255,.94);
    -webkit-backdrop-filter: blur(18px) saturate(1.6);
    backdrop-filter: blur(18px) saturate(1.6);
    border-top: 1px solid var(--ct-border);
    box-shadow: 0 -10px 30px rgba(12,32,20,.12);
    z-index: 1040;
}
@media (max-width: 991.98px) {
    body { padding-bottom: calc(var(--ct-tabbar-h) + var(--ct-safe-b) + 10px); }
    .ct-tabbar { display: flex; }
    .ct-footer { margin-bottom: 0; }
}
.ct-tab {
    position: relative; flex: 1 1 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; text-decoration: none; border: 0; background: transparent;
    color: var(--ct-muted); font-family: var(--ct-font-body);
    font-size: .67rem; font-weight: 700; letter-spacing: .01em;
    padding: 0; cursor: pointer; transition: color .16s ease;
}
.ct-tab i { font-size: 1.28rem; line-height: 1; transition: transform .18s ease; }
.ct-tab > span { display: block; }
.ct-tab.active { color: var(--ct-emerald-700); }
.ct-tab.active i { transform: translateY(-1px); }
.ct-tab:active { transform: scale(.94); }
.ct-tab.active::after {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 30px; height: 3px; border-radius: 0 0 4px 4px; background: var(--ct-gold-400);
}
.ct-tab-center .ct-tab-fab {
    width: 54px; height: 54px; margin-top: -20px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; color: #fff; font-size: 1.35rem;
    background: linear-gradient(160deg, var(--ct-gold-300), var(--ct-gold-500));
    box-shadow: 0 8px 20px rgba(245,179,0,.45), 0 0 0 4px var(--ct-surface);
    transition: transform .16s ease;
}
.ct-tab-center:active .ct-tab-fab { transform: scale(.92); }
.ct-tab-center span { margin-top: 2px; }

/* ============================ Buttons ================================ */
.btn { --bs-btn-font-weight: 600; border-radius: .75rem; }
.btn-lg { border-radius: .9rem; }
.btn-pill { border-radius: 999px; }
.btn-block-mobile { }
@media (max-width: 575.98px) { .btn-block-mobile { width: 100%; } }
.btn:focus-visible { box-shadow: var(--ct-ring); }

.btn-success {
    --bs-btn-bg: var(--ct-emerald-600);
    --bs-btn-border-color: var(--ct-emerald-600);
    --bs-btn-hover-bg: var(--ct-emerald-700);
    --bs-btn-hover-border-color: var(--ct-emerald-700);
    --bs-btn-active-bg: var(--ct-emerald-800);
    --bs-btn-active-border-color: var(--ct-emerald-800);
    --bs-btn-disabled-bg: var(--ct-emerald-600);
    --bs-btn-disabled-border-color: var(--ct-emerald-600);
}
.btn-success:hover { box-shadow: 0 8px 18px rgba(15,122,65,.30); }
.btn-outline-success {
    --bs-btn-color: var(--ct-emerald-700);
    --bs-btn-border-color: var(--ct-emerald-400);
    --bs-btn-hover-bg: var(--ct-emerald-600);
    --bs-btn-hover-border-color: var(--ct-emerald-600);
    --bs-btn-active-bg: var(--ct-emerald-700);
    --bs-btn-active-border-color: var(--ct-emerald-700);
}
.btn-warning {
    --bs-btn-color: #2a1f00;
    --bs-btn-bg: var(--ct-gold-300);
    --bs-btn-border-color: var(--ct-gold-300);
    --bs-btn-hover-color: #2a1f00;
    --bs-btn-hover-bg: var(--ct-gold-400);
    --bs-btn-hover-border-color: var(--ct-gold-400);
    --bs-btn-active-color: #2a1f00;
    --bs-btn-active-bg: var(--ct-gold-500);
    --bs-btn-active-border-color: var(--ct-gold-500);
}
.btn-outline-warning {
    --bs-btn-color: var(--ct-gold-600);
    --bs-btn-border-color: var(--ct-gold-400);
    --bs-btn-hover-color: #2a1f00;
    --bs-btn-hover-bg: var(--ct-gold-300);
    --bs-btn-hover-border-color: var(--ct-gold-300);
}
.btn-light {
    --bs-btn-bg: var(--ct-surface);
    --bs-btn-border-color: var(--ct-border-strong);
    --bs-btn-hover-bg: var(--ct-surface-2);
    --bs-btn-hover-border-color: var(--ct-border-strong);
}
.btn-gold {
    --bs-btn-color: #3a2a00;
    --bs-btn-bg: var(--ct-gold-300);
    --bs-btn-border-color: var(--ct-gold-300);
    --bs-btn-hover-color: #3a2a00;
    --bs-btn-hover-bg: var(--ct-gold-400);
    --bs-btn-hover-border-color: var(--ct-gold-400);
    --bs-btn-active-color: #3a2a00;
    --bs-btn-active-bg: var(--ct-gold-500);
    --bs-btn-active-border-color: var(--ct-gold-500);
    background-color: var(--ct-gold-300);
    background-image: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0));
    font-weight: 700;
}
.btn-gold:hover { background-color: var(--ct-gold-400); box-shadow: 0 8px 20px rgba(255,202,40,.38); }
.btn-gold:active { background-color: var(--ct-gold-500); }

.shadow-sm { box-shadow: var(--ct-shadow-sm) !important; }
.shadow    { box-shadow: var(--ct-shadow) !important; }
.shadow-lg { box-shadow: var(--ct-shadow-lg) !important; }

/* ============================= Cards ================================= */
.card {
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    box-shadow: var(--ct-shadow-sm);
    background-color: var(--ct-surface);
}
.card-body { color: var(--ct-text); }
.card-title { font-family: var(--ct-font-display); color: var(--ct-heading); }
.card-header {
    background-color: var(--ct-surface-2);
    border-bottom: 1px solid var(--ct-border);
    color: var(--ct-heading);
    font-weight: 700;
}
.card-footer { background-color: var(--ct-surface-2); border-top: 1px solid var(--ct-border); }
.card > .card-img-top:first-child,
.card > img:first-child { border-top-left-radius: var(--ct-radius); border-top-right-radius: var(--ct-radius); }
.card > .card-img-bottom:last-child,
.card > img:last-child { border-bottom-left-radius: var(--ct-radius); border-bottom-right-radius: var(--ct-radius); }

/* Signature "alphabet tile" card (soft shadow + emerald spine) */
.alphabet-tile {
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-left: 5px solid var(--ct-emerald-600) !important;
    border-radius: var(--ct-radius);
    box-shadow: var(--ct-shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.alphabet-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--ct-shadow);
    border-left-color: var(--ct-gold-400) !important;
}

/* ============================= Forms ================================= */
.form-label { font-weight: 600; color: var(--ct-heading); }
.form-control, .form-select {
    border-color: var(--ct-border-strong);
    border-radius: var(--ct-radius-sm);
    color: var(--ct-text);
    background-color: var(--ct-surface);
}
.form-control::placeholder { color: #9aa79d; }
.form-control:focus, .form-select:focus {
    border-color: var(--ct-emerald-400);
    box-shadow: var(--ct-ring);
    background-color: var(--ct-surface);
}
.input-group-text {
    background-color: var(--ct-surface-2);
    border-color: var(--ct-border-strong);
    color: var(--ct-emerald-700);
}
.form-check-input:checked { background-color: var(--ct-emerald-600); border-color: var(--ct-emerald-600); }
.form-check-input:focus { border-color: var(--ct-emerald-400); box-shadow: var(--ct-ring); }
.form-range::-webkit-slider-thumb { background-color: var(--ct-emerald-600); }

/* =========================== Breadcrumb ============================== */
.breadcrumb { --bs-breadcrumb-divider-color: var(--ct-border-strong); }
.breadcrumb-item.active { color: var(--ct-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--ct-border-strong); }
.breadcrumb-item a { color: var(--ct-emerald-700); font-weight: 600; }

/* ============================= Badges ================================ */
.badge { border-radius: 999px; font-weight: 600; letter-spacing: .01em; padding: .4em .65em; }

/* ============================= Alerts ================================ */
.alert { border-radius: var(--ct-radius-sm); border: 1px solid transparent; }
.alert-success { background: var(--ct-emerald-50); border-color: var(--ct-emerald-200); color: var(--ct-emerald-800); }
.alert-warning { background: var(--ct-gold-50); border-color: var(--ct-gold-200); color: #7a5200; }
.alert-danger  { background: #fdeceb; border-color: #f4c9c6; color: #8f1d12; }
.alert-info    { background: #e8f6f4; border-color: #bfe4de; color: #0b5c52; }

/* ============================= Tables ================================ */
.table { --bs-table-border-color: var(--ct-border); --bs-table-color: var(--ct-text); }
.table thead th {
    background: var(--ct-surface-2);
    color: var(--ct-heading);
    font-weight: 700;
    border-bottom: 2px solid var(--ct-border-strong);
    white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: var(--ct-emerald-50); }

/* ====================== List group & pagination ====================== */
.list-group-item { color: var(--ct-text); border-color: var(--ct-border); background-color: var(--ct-surface); }
.list-group-item.active { background: var(--ct-emerald-600); border-color: var(--ct-emerald-600); }
.page-link {
    color: var(--ct-emerald-700); border-color: var(--ct-border);
    background-color: var(--ct-surface);
    min-height: 42px; min-width: 42px; display: inline-flex; align-items: center; justify-content: center;
}
.page-link:hover { color: var(--ct-emerald-800); background: var(--ct-emerald-50); }
.page-item.active .page-link { background: var(--ct-emerald-600); border-color: var(--ct-emerald-600); }
.page-item.disabled .page-link { color: var(--ct-muted); background-color: var(--ct-surface-2); }

/* ========================= Tabs / pills / nav ======================== */
.nav-tabs { border-bottom-color: var(--ct-border); }
.nav-tabs .nav-link { color: var(--ct-muted); border: 0; border-bottom: 3px solid transparent; font-weight: 600; }
.nav-tabs .nav-link:hover { color: var(--ct-emerald-700); border-bottom-color: var(--ct-emerald-200); }
.nav-tabs .nav-link.active { color: var(--ct-emerald-700); background: transparent; border-bottom-color: var(--ct-emerald-600); }
.nav-pills .nav-link { color: var(--ct-muted); font-weight: 600; }
.nav-pills .nav-link.active { background: var(--ct-emerald-600); color: #fff; }

/* ======================= Dropdowns / modals ========================== */
.dropdown-menu { border-color: var(--ct-border); border-radius: var(--ct-radius-sm); box-shadow: var(--ct-shadow); background-color: var(--ct-surface); }
.dropdown-item.active, .dropdown-item:active { background: var(--ct-emerald-600); }
.modal-content { border: 0; border-radius: var(--ct-radius); box-shadow: var(--ct-shadow-lg); background-color: var(--ct-surface); }
.modal-header, .modal-footer { border-color: var(--ct-border); }
.modal-title { font-family: var(--ct-font-display); color: var(--ct-heading); }
.offcanvas { background-color: var(--ct-surface); color: var(--ct-text); }

/* ============================ Progress =============================== */
.progress { background-color: var(--ct-emerald-50); border-radius: 999px; }
.progress-bar { background-color: var(--ct-emerald-600); }

/* ====================== PAGES, HEADERS & SECTIONS ==================== */
.ct-main { padding: 1.25rem clamp(1rem, 2.6vw, 1.5rem) 1.75rem; }
.ct-main > .container-xxl,
.ct-main > .container,
.ct-main > .container-fluid { padding-left: 0; padding-right: 0; }
.ct-page { max-width: var(--ct-content-max); margin: 0 auto; padding: 0 var(--ct-pad); }
.ct-page-head { margin-bottom: 1.25rem; }
.ct-page-head .ct-eyebrow {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ct-emerald-600); margin-bottom: .35rem;
}
.ct-page-title { font-size: clamp(1.45rem, 5vw, 2rem); font-weight: 800; margin: 0 0 .25rem; letter-spacing: -.02em; }
.ct-page-sub { color: var(--ct-muted); margin: 0; font-size: .93rem; max-width: 52rem; }
.ct-section { margin-bottom: 1.5rem; }
.ct-section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.ct-section-head h2, .ct-section-head h3, .ct-section-head h5 { margin: 0; font-weight: 800; font-size: 1.05rem; }
.ct-section-head a { font-size: .82rem; font-weight: 700; text-decoration: none; }
.ct-section-title { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--ct-heading); margin: 0; }

/* ============================ Hero =================================== */
.ct-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(820px 360px at 92% -18%, rgba(255,213,79,.20) 0%, rgba(255,213,79,0) 60%),
        linear-gradient(140deg, var(--ct-emerald-800) 0%, var(--ct-emerald-700) 58%, var(--ct-emerald-600) 100%);
    color: #fff;
    border-radius: var(--ct-radius-lg);
    border-bottom: 4px solid var(--ct-gold-300);
    padding: 1.6rem 1.2rem;
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
    box-shadow: var(--ct-shadow);
}
.ct-hero::before {
    content: "";
    position: absolute; top: -45%; right: -12%;
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(255,213,79,.18) 0%, rgba(255,213,79,0) 70%);
    pointer-events: none;
}
@media (min-width: 768px) {
    .ct-hero { border-radius: 2rem; padding: 2.4rem 2rem; }
}
@media (min-width: 992px) {
    .ct-hero { padding: 3.2rem 2.75rem; }
}
.ct-hero h1, .ct-hero h2, .ct-hero h3, .ct-hero .display-1,
.ct-hero .display-2, .ct-hero .display-3, .ct-hero .display-4 { color: #fff; }
.ct-hero-title {
    font-size: clamp(1.6rem, 6.4vw, 2.8rem);
    font-weight: 800; line-height: 1.12; letter-spacing: -.02em;
}
.ct-hero .ct-hero-title--gold { color: var(--ct-gold-300); }
.ct-hero-sub { font-size: .97rem; color: rgba(255,255,255,.9); max-width: 52rem; }
.ct-hero .lead, .ct-hero p:not(.ct-hero-badge) { color: rgba(255,255,255,.9); }
.ct-hero-badge {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .45rem .9rem; border-radius: 999px;
    background: rgba(255,213,79,.16); color: var(--ct-gold-300);
    border: 1px solid rgba(255,213,79,.35);
    font-size: .74rem; font-weight: 700;
}
.ct-hero .ct-searchbar { width: min(100%, 34rem); margin: .5rem auto 0; }

/* Quick action tiles */
.ct-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.ct-quick-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem;
    padding: .85rem .35rem; border-radius: var(--ct-radius); text-decoration: none;
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    box-shadow: var(--ct-shadow-sm); color: var(--ct-heading);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ct-quick-item:active { transform: scale(.96); }
.ct-quick-item:hover { border-color: var(--ct-emerald-300); box-shadow: var(--ct-shadow); text-decoration: none; }
.ct-quick-item .ct-tile {
    width: 44px; height: 44px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem; color: #fff;
}
.ct-tile.emerald { background: linear-gradient(160deg, var(--ct-emerald-500), var(--ct-emerald-700)); }
.ct-tile.gold    { background: linear-gradient(160deg, var(--ct-gold-300), var(--ct-gold-500)); color: var(--ct-emerald-900) !important; }
.ct-tile.info    { background: linear-gradient(160deg, #1aa79a, #0f6f66); }
.ct-tile.danger  { background: linear-gradient(160deg, #e05a4a, #b53225); }
.ct-quick-item b { font-size: .72rem; font-weight: 700; text-align: center; }

/* ========================= CARDS / LISTS / ROWS ====================== */
.ct-card {
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow-sm);
    overflow: hidden;
}
.ct-card-pad { padding: 1rem; }
.ct-card-hover { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.ct-card-hover:hover { transform: translateY(-2px); box-shadow: var(--ct-shadow); border-color: var(--ct-emerald-200); }

.ct-app-card {
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
    overflow: hidden;
}
.ct-row {
    display: flex; align-items: center; gap: .75rem;
    padding: .85rem .9rem; border-bottom: 1px solid var(--ct-border);
    text-decoration: none; color: inherit;
}
.ct-row:last-child { border-bottom: 0; }
.ct-row:active { background: var(--ct-emerald-50); }
.ct-avatar-badge {
    width: 38px; height: 38px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; font-weight: 800; color: var(--ct-gold-300);
    background: linear-gradient(135deg, var(--ct-emerald-700), var(--ct-emerald-900));
}

.ct-list { background: var(--ct-surface); border: 1px solid var(--ct-border); border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow-sm); overflow: hidden; }
.ct-list-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .85rem 1rem; border-bottom: 1px solid var(--ct-border);
    text-decoration: none; color: inherit; background: transparent;
    width: 100%; text-align: left;
    border-left: 0; border-right: 0; border-top: 0;
    font-family: var(--ct-font-body);
    transition: background-color .14s ease;
}
.ct-list-item:last-child { border-bottom: 0; }
.ct-list-item:active, .ct-list-item:hover { background: var(--ct-emerald-50); text-decoration: none; }
.ct-list-icon {
    width: 46px; height: 46px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 14px; font-size: 1.15rem;
    color: var(--ct-emerald-700); background: var(--ct-emerald-50);
}
.ct-list-icon.gold { color: var(--ct-gold-600); background: var(--ct-gold-50); }
.ct-list-body { flex: 1 1 auto; min-width: 0; }
.ct-list-body b, .ct-list-title { display: block; font-weight: 700; color: var(--ct-heading); font-size: .96rem; }
.ct-list-body small, .ct-list-sub { color: var(--ct-muted); font-size: .8rem; }
.ct-list-chev { color: var(--ct-border-strong); font-size: .85rem; flex: 0 0 auto; }

/* Media cards (ads, exhibits) */
.ct-media { position: relative; overflow: hidden; background: var(--ct-emerald-50); }
.ct-media > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ct-media-16x9 { aspect-ratio: 16 / 9; }
.ct-media-badge { position: absolute; top: .6rem; left: .6rem; }

/* ============================= STAT ROW ============================== */
.ct-statrow { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .55rem; }
.ct-stat {
    background:
        linear-gradient(160deg, var(--ct-surface) 0%, var(--ct-emerald-50) 130%);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg); padding: .7rem .4rem; text-align: center;
    box-shadow: var(--ct-shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease;
}
.ct-stat:hover { transform: translateY(-2px); box-shadow: var(--ct-shadow); }
.ct-stat b {
    display: block; font-size: 1.2rem; font-weight: 800; line-height: 1.1;
    background: linear-gradient(120deg, var(--ct-emerald-700), var(--ct-emerald-500));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ct-stat span { font-size: .63rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ct-muted); font-weight: 700; }

/* ================== SEARCH BAR / SEGMENTED / CHIPS =================== */
.ct-searchbar { display: flex; align-items: center; gap: .55rem; background: var(--ct-surface); border: 1px solid var(--ct-border-strong); border-radius: 999px; padding: .55rem .95rem; box-shadow: var(--ct-shadow-sm); }
.ct-searchbar input { border: 0; outline: 0; background: transparent; flex: 1 1 auto; min-width: 0; font-size: .95rem; color: var(--ct-text); }
.ct-searchbar input::placeholder { color: var(--ct-muted); }
.ct-searchbar i { color: var(--ct-emerald-600); }

.ct-segmented { display: flex; background: var(--ct-emerald-50); border: 1px solid var(--ct-border); border-radius: 999px; padding: 3px; gap: 2px; }
.ct-segmented a, .ct-segmented button {
    flex: 1 1 0; text-align: center; padding: .5rem .6rem; border-radius: 999px;
    font-size: .82rem; font-weight: 700; color: var(--ct-muted); text-decoration: none;
    border: 0; background: transparent; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.ct-segmented a.active, .ct-segmented button.active { background: var(--ct-surface); color: var(--ct-emerald-700); box-shadow: var(--ct-shadow-sm); }

.ct-chip-row {
    display: flex; gap: .5rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: .25rem .1rem .6rem;
    scrollbar-width: none;
}
.ct-chip-row::-webkit-scrollbar { display: none; }
@media (min-width: 992px) { .ct-chip-row { flex-wrap: wrap; overflow: visible; } }
.ct-chip {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem .95rem; border-radius: 999px;
    font-size: .83rem; font-weight: 600; white-space: nowrap;
    background: var(--ct-surface); color: var(--ct-heading);
    border: 1px solid var(--ct-border-strong); text-decoration: none;
    transition: transform .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.ct-chip:active { transform: scale(.96); }
.ct-chip.active, .ct-chip:hover {
    background: var(--ct-emerald-600); color: #fff; border-color: var(--ct-emerald-600);
}
.ct-chip.active i, .ct-chip:hover i { color: var(--ct-gold-300); }
.ct-chip-gold.active, .ct-chip-gold:hover {
    background: var(--ct-gold-300); color: #2a1f00; border-color: var(--ct-gold-400);
}

/* ======================== Empty state ================================ */
.ct-empty { text-align: center; padding: 2.25rem 1.25rem; }
.ct-empty .ct-empty-ico {
    width: 68px; height: 68px; margin: 0 auto .85rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 20px; font-size: 1.7rem;
    color: var(--ct-emerald-600); background: var(--ct-emerald-50);
}
.ct-empty h5 { font-weight: 800; margin-bottom: .3rem; }
.ct-empty p { color: var(--ct-muted); font-size: .88rem; margin-bottom: 1rem; }

/* ================== OFFCANVAS "MORE" SHEET + SEARCH ================== */
.ct-sheet.offcanvas { border: 0; border-radius: 1.25rem 1.25rem 0 0; }
.ct-sheet.offcanvas-bottom { height: auto; max-height: 88vh; }
.ct-sheet .offcanvas-body { padding: .5rem 1rem calc(1rem + var(--ct-safe-b)); }
.ct-sheet-grip { width: 44px; height: 5px; border-radius: 999px; background: var(--ct-border-strong); margin: .55rem auto .35rem; }
.ct-sheet-user {
    display: flex; align-items: center; gap: .8rem;
    padding: .9rem 1rem; border-radius: var(--ct-radius);
    background:
        radial-gradient(360px 160px at 100% 0%, rgba(255,213,79,.14) 0%, transparent 60%),
        linear-gradient(135deg, var(--ct-emerald-700), var(--ct-emerald-900));
    color: #fff; margin-bottom: .85rem;
}
.ct-sheet-user img, .ct-sheet-user .ct-initials { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.ct-sheet-user .ct-initials { display: flex; align-items: center; justify-content: center; background: var(--ct-gold-300); color: var(--ct-emerald-900); font-weight: 800; font-size: 1.05rem; }
.ct-sheet-user b { font-size: 1.02rem; display: block; }
.ct-sheet-user small { color: rgba(255,255,255,.82); }

.ct-menu { display: grid; gap: .35rem; }
.ct-menu-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .8rem .9rem; border-radius: var(--ct-radius-sm);
    text-decoration: none; color: var(--ct-heading); font-weight: 600; font-size: .95rem;
    background: var(--ct-surface-2); border: 1px solid var(--ct-border);
    text-align: left; font-family: inherit; letter-spacing: inherit;
    -webkit-appearance: none; appearance: none; width: 100%;
}
.ct-menu-item:active { background: var(--ct-emerald-50); }
.ct-menu-item .ct-mi-icon {
    width: 38px; height: 38px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 11px; background: var(--ct-surface); color: var(--ct-emerald-700);
    border: 1px solid var(--ct-border);
}
.ct-menu-item .ct-chev { margin-left: auto; color: var(--ct-border-strong); }
.ct-menu-item.danger { color: var(--ct-danger); }
.ct-menu-item.danger .ct-mi-icon { color: var(--ct-danger); }

/* ======================== Museum components ========================== */
.ct-museum-hero {
    position: relative; overflow: hidden;
    background:
        radial-gradient(900px 420px at 90% -20%, rgba(255,213,79,.20) 0%, rgba(255,213,79,0) 60%),
        linear-gradient(135deg, var(--ct-emerald-900) 0%, var(--ct-emerald-700) 55%, var(--ct-emerald-800) 100%);
    color: #fff;
    border-radius: var(--ct-radius-lg);
    border-bottom: 4px solid var(--ct-gold-300);
    box-shadow: var(--ct-shadow);
}
.ct-museum-hero::before {
    content: "\2605";
    position: absolute; top: -30px; right: -20px;
    font-size: 220px; line-height: 1; color: rgba(255,255,255,.05);
    pointer-events: none;
}
.ct-museum-hero h1, .ct-museum-hero h2, .ct-museum-hero h3,
.ct-museum-hero h4, .ct-museum-hero h5, .ct-museum-hero h6 { color: #fff; }
.ct-museum-hero .ct-museum-title { color: var(--ct-gold-300); }
.ct-museum-hero p { color: rgba(255,255,255,.88); }
.ct-museum-stat {
    flex: 1 1 0; min-width: 74px; text-align: center;
    padding: .55rem .35rem; border-radius: var(--ct-radius-sm);
    background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16);
}
.ct-museum-stat b { display: block; font-size: 1.15rem; color: var(--ct-gold-300); line-height: 1.1; }
.ct-museum-stat span { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: rgba(255,255,255,.75); }

.ct-exhibit {
    border: 1px solid var(--ct-border);
    border-left: 5px solid var(--ct-emerald-600);
    border-radius: var(--ct-radius);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ct-exhibit:hover { transform: translateY(-3px); box-shadow: var(--ct-shadow); border-left-color: var(--ct-gold-400); }
.ct-exhibit.ct-featured { border-left-color: var(--ct-gold-400);
    background: linear-gradient(180deg, var(--ct-gold-50), var(--ct-surface)); }
.ct-exhibit-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }

/* Bilingual exhibit titles */
.ct-title-local-row { color: var(--ct-emerald-700); }
.ct-title-local-row .ct-title-local i { color: var(--ct-gold-500, #b8860b); }
.ct-title-local-row .ct-title-sep { color: var(--ct-muted); margin: 0 .15rem; }

/* Collection layout toggle (Gallery grid vs. Feed single column) */
.ct-view-toggle { flex: 0 0 auto; }
.ct-museum-collection.ct-feed { flex-direction: column; max-width: 720px; margin-left: auto; margin-right: auto; }
.ct-museum-collection.ct-feed > [class*="col-"] { flex: 0 0 auto; width: 100%; max-width: 100%; }

/* ===================== Museum feed (communication) =================== */
.ct-fb-feed { display: flex; flex-direction: column; gap: 1rem; max-width: 720px; margin: 0 auto; }
.ct-fb-post {
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    box-shadow: var(--ct-shadow-sm);
    overflow: hidden;
}
.ct-fb-post.ct-fb-featured { border-color: var(--ct-gold-300); box-shadow: 0 0 0 1px var(--ct-gold-300), var(--ct-shadow-sm); }
.ct-fb-head { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem .55rem; }
.ct-fb-headmain { min-width: 0; }
.ct-fb-name { display: block; font-weight: 700; color: var(--ct-emerald-800); line-height: 1.15; }
.ct-fb-sub { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; font-size: .72rem; color: var(--ct-muted); }
.ct-fb-wing { color: var(--ct-emerald-700); font-weight: 600; }
.ct-fb-icon {
    border: 0; background: transparent; color: var(--ct-muted);
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    transition: background .15s, color .15s;
}
.ct-fb-icon:hover { background: var(--ct-surface-2); color: var(--ct-heading); }
.ct-fb-avatar, .ct-fb-icon img { border-radius: 50%; object-fit: cover; }
.ct-fb-body { padding: 0 1rem; }
.ct-fb-title { font-size: 1.12rem; font-weight: 700; margin-bottom: .35rem; }
.ct-fb-title a { color: var(--ct-emerald-800); text-decoration: none; }
.ct-fb-title a:hover { text-decoration: underline; }
.ct-fb-text { color: var(--ct-text); font-size: .93rem; line-height: 1.6; margin-bottom: .6rem; white-space: pre-line; }
.ct-fb-text-full { color: var(--ct-text); font-size: 1.02rem; line-height: 1.75; margin-bottom: .6rem; }
.ct-fb-media { background: #0c1a0e; display: flex; justify-content: center; }
.ct-fb-media img { width: 100%; max-height: 440px; object-fit: cover; display: block; cursor: zoom-in; }
.ct-fb-audio { padding: .55rem 1rem; }
.ct-fb-stats { display: flex; align-items: center; justify-content: space-between; padding: .45rem 1rem; font-size: .78rem; color: var(--ct-muted); }
.ct-fb-bar { display: flex; border-top: 1px solid var(--ct-border); }
.ct-fb-act {
    flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem .3rem; background: transparent; border: 0;
    color: var(--ct-muted); font-weight: 600; font-size: .85rem;
    font-family: var(--ct-font-body); text-decoration: none; cursor: pointer;
    transition: background .15s, color .15s;
}
.ct-fb-act:hover { background: var(--ct-surface-2); color: var(--ct-heading); text-decoration: none; }
.ct-fb-act.liked { color: var(--ct-emerald-600); }
.ct-fb-act.disliked { color: var(--ct-danger); }
.ct-fb-act.liked i, .ct-fb-act.disliked i { animation: ctFbPop .3s ease; }
.ct-fb-act.active { color: var(--ct-gold-500, #b8860b); }
.ct-fb-comments { background: var(--ct-surface-2); border-top: 1px solid var(--ct-border); padding: .75rem 1rem; }
.ct-fb-clist { display: flex; flex-direction: column; gap: .65rem; }
.ct-fb-comment { display: flex; gap: .5rem; align-items: flex-start; }
.ct-fb-comment-main { min-width: 0; flex: 1 1 auto; }
.ct-fb-bubble { background: var(--ct-surface); border: 1px solid var(--ct-border); border-radius: 14px; padding: .5rem .7rem; font-size: .88rem; }
.ct-fb-cname { display: block; font-weight: 700; font-size: .82rem; color: var(--ct-emerald-800); margin-bottom: .1rem; }
.ct-fb-ctext { color: var(--ct-text); line-height: 1.5; }
.ct-fb-cmeta { display: flex; align-items: center; gap: .75rem; padding: .2rem .3rem 0; }
.ct-fb-cmeta small { font-size: .68rem; }
.ct-fb-clike, .ct-fb-cdislike { border: 0; background: transparent; color: var(--ct-muted); font-size: .72rem; font-weight: 600; cursor: pointer; padding: 0; }
.ct-fb-clike.liked { color: var(--ct-emerald-600); }
.ct-fb-cdislike.disliked { color: var(--ct-danger); }
.ct-fb-clink { font-size: .72rem; font-weight: 600; text-decoration: none; color: var(--ct-muted); border: 0; background: transparent; padding: 0; cursor: pointer; }
.ct-fb-clink.danger { color: var(--ct-danger); }
.ct-fb-cform { margin-top: .75rem; }
.ct-fb-cinput {
    flex: 1 1 auto; resize: none;
    border: 1px solid var(--ct-border); border-radius: 18px;
    padding: .45rem .8rem; font-size: .88rem; font-family: var(--ct-font-body);
    max-height: 140px; background: var(--ct-surface); color: var(--ct-text);
}
.ct-fb-cinput:focus { outline: none; border-color: var(--ct-emerald-400); box-shadow: var(--ct-ring); }
.ct-fb-csend { border-radius: 50%; width: 38px; height: 38px; padding: 0; flex: 0 0 auto; }
.ct-fb-reactionsum { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ct-fb-reaction-chip { display: inline-flex; align-items: center; gap: .2rem; }
.ct-fb-reaction-chip i { color: var(--ct-emerald-600); }
.ct-fb-reaction-chip.text-danger i { color: var(--ct-danger); }
@keyframes ctFbPop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@media (max-width: 575.98px) {
    .ct-fb-head, .ct-fb-body, .ct-fb-stats, .ct-fb-comments { padding-left: .85rem; padding-right: .85rem; }
}

/* ======================= Media rail (carousel) ======================= */
.ct-rail { display: flex; gap: .75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; padding: .15rem .1rem .65rem; margin: 0 -.1rem; scrollbar-width: none; }
.ct-rail::-webkit-scrollbar { display: none; }
.ct-rail > * { flex: 0 0 auto; scroll-snap-align: start; }
.ct-rail-card { width: 250px; }
@media (min-width: 768px) { .ct-rail { flex-wrap: wrap; overflow: visible; } .ct-rail > * { flex: 1 1 260px; width: auto; } }

/* ================== AUTO-SLIDING CAROUSEL (home ads) ================= */
.ct-carousel { position: relative; --ct-carousel-gap: 1rem; }
.ct-carousel-viewport { overflow: hidden; }
.ct-carousel-track {
    display: flex; gap: var(--ct-carousel-gap);
    transition: transform .55s cubic-bezier(.22, .61, .36, 1);
    will-change: transform;
    touch-action: pan-y;
}
.ct-carousel-item { flex: 0 0 100%; min-width: 0; }
@media (min-width: 576px) { .ct-carousel-item { flex-basis: calc((100% - var(--ct-carousel-gap)) / 2); } }
@media (min-width: 992px) { .ct-carousel-item { flex-basis: calc((100% - 2 * var(--ct-carousel-gap)) / 3); } }
.ct-carousel-nav {
    position: absolute; top: 40%; transform: translateY(-50%);
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--ct-border); background: rgba(255,255,255,.95);
    color: var(--ct-emerald-700); display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--ct-shadow); cursor: pointer; z-index: 2;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.ct-carousel-nav:hover { background: var(--ct-emerald-600); color: #fff; border-color: var(--ct-emerald-600); }
.ct-carousel-nav.prev { left: -8px; }
.ct-carousel-nav.next { right: -8px; }
.ct-carousel-dots { display: flex; justify-content: center; gap: .4rem; margin-top: .9rem; }
.ct-carousel-dot {
    width: 8px; height: 8px; border-radius: 999px; border: 0; padding: 0;
    background: var(--ct-border-strong); cursor: pointer;
    transition: width .2s ease, background-color .2s ease;
}
.ct-carousel-dot.active { width: 22px; background: var(--ct-emerald-600); }
@media (max-width: 575.98px) { .ct-carousel-nav { display: none; } }
.ct-carousel.ct-carousel-static .ct-carousel-nav,
.ct-carousel.ct-carousel-static .ct-carousel-dots { display: none; }

/* ============================ Software card ========================== */
.ct-soft-card {
    background: linear-gradient(135deg, var(--ct-emerald-50) 0%, var(--ct-emerald-100) 100%);
    border-left: 6px solid var(--ct-emerald-600) !important;
    border-radius: var(--ct-radius);
}

/* =========================== Save / share ============================ */
.ct-save-btn, .ct-share-btn, .ct-vote-btn, .ct-comment-toggle {
    border: 0; background: transparent; color: var(--ct-muted);
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .85rem; font-weight: 600; cursor: pointer;
    padding: .4rem .55rem; border-radius: .6rem;
    transition: background-color .15s ease, color .15s ease;
}
.ct-save-btn:hover, .ct-share-btn:hover, .ct-vote-btn:hover, .ct-comment-toggle:hover {
    background: var(--ct-emerald-50); color: var(--ct-emerald-700);
}
.ct-save-btn.active, .ct-share-btn.active, .ct-vote-btn.active { color: var(--ct-gold-600); }

/* ============================== Audios =============================== */
audio { width: 100%; }

/* ====================== Utilities & helpers ========================== */
.ct-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ct-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ct-muted { color: var(--ct-muted) !important; }
.ct-tap { cursor: pointer; }
.ct-badge-soft { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700; background: var(--ct-emerald-50); color: var(--ct-emerald-700); }
.ct-badge-soft.gold { background: var(--ct-gold-50); color: var(--ct-gold-600); }
.ct-divider { border: 0; border-top: 1px solid var(--ct-border); margin: 1rem 0; }

/* ======================== Search overlay ============================= */
.ct-searchoverlay { position: fixed; inset: 0; z-index: 1060; background: rgba(8,20,12,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); padding: calc(var(--ct-safe-t) + 1rem) 1rem 1rem; }
.ct-searchoverlay[hidden] { display: none; }
.ct-searchoverlay-inner { max-width: 640px; margin: 0 auto; background: var(--ct-surface); border-radius: 1.2rem; padding: .85rem; box-shadow: var(--ct-shadow-lg); }
.ct-searchoverlay .ct-searchbar { border-radius: .85rem; }
.ct-searchoverlay .ct-close { margin-left: .25rem; }
body.ct-lock { overflow: hidden; }

/* ========================== Keyboard & A11y ========================== */
.ct-skip {
    position: fixed; top: -120px; left: 1rem; z-index: 1300;
    padding: .65rem 1.1rem; border-radius: 0 0 14px 14px;
    background: var(--ct-gold-300); color: #241a00;
    font-weight: 800; text-decoration: none; box-shadow: var(--ct-shadow-lg);
    transition: top .22s cubic-bezier(.22,.61,.36,1);
}
.ct-skip:focus { top: 0; }
a:focus-visible,
button:focus-visible,
.ct-chip:focus-visible,
.ct-tab:focus-visible,
.ct-quick-item:focus-visible,
.ct-list-item:focus-visible,
.ct-menu-item:focus-visible,
.ct-exhibit a:focus-visible,
[contenteditable]:focus-visible {
    outline: 3px solid var(--ct-gold-400);
    outline-offset: 2px;
    border-radius: .5rem;
}
.ct-quick-item, .ct-tile, .ct-chip, .ct-menu-item, .ct-row, .ct-fb-act { -webkit-tap-highlight-color: transparent; }
.ct-iconbtn { text-align: left; font-family: inherit; letter-spacing: inherit; -webkit-appearance: none; appearance: none; }
.ct-theme-toggle i { transition: transform .3s ease, color .25s ease; }
.ct-theme-toggle:active i { transform: rotate(45deg) scale(.9); }

/* Smooth theme switch (scoped so we never animate layout-heavy nodes) */
body,
.ct-card, .ct-app-card, .card, .ct-list, .ct-exhibit, .ct-fb-post,
.navbar-custom, .ct-tabbar,
.form-control, .form-select, .input-group-text,
.ct-searchbar, .ct-chip, .ct-segmented, .ct-menu-item,
.btn, .dropdown-menu, .modal-content, .offcanvas,
.breadcrumb, .page-link, .list-group-item, .progress {
    transition: background-color .25s ease, color .25s ease,
                border-color .25s ease, box-shadow .25s ease;
}

/* ============================ Touch sizing =========================== */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 38px; }
    .form-control, .form-select { min-height: 46px; }
    .form-control-lg, .input-group-lg > .form-control, .input-group-lg > .form-select { min-height: 52px; }
    .nav-link { min-height: 44px; }
}

/* ========================= Responsive polish ========================= */
@media (max-width: 767.98px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .card { border-radius: var(--ct-radius); }
    .p-4 { padding: 1.1rem !important; }
    .p-5 { padding: 1.35rem !important; }
    .table-responsive { border-radius: var(--ct-radius-sm); }
}
@media (max-width: 575.98px) {
    .ct-main { padding: 1.1rem 1rem 1.6rem; }
    h1 { font-size: clamp(1.5rem, 7vw, 2rem); }
    h2 { font-size: clamp(1.3rem, 6vw, 1.7rem); }
    .ct-section-head { flex-wrap: wrap; }
    .ct-statrow { gap: .5rem; }
    .ct-stat { padding: .8rem .4rem; }
    .ct-stat b { font-size: 1.05rem; }
    .ct-quick { gap: .5rem; }
    .ct-quick-item { padding: .75rem .25rem; }
    .ct-quick-item .ct-tile { width: 40px; height: 40px; font-size: 1.05rem; }
    .ct-museum-stat { min-width: 62px; }
    .ct-footer .ct-donate-actions { flex-direction: column; align-items: stretch; }
    .ct-paypal { align-items: center; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn { flex: 1 1 auto; }
}
@keyframes ctFadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
    .container { animation: ctFadeIn .3s ease both; }
}

/* ========================= Tablet refinement ========================= */
@media (min-width: 768px) and (max-width: 991.98px) {
    .ct-main { padding: 1.5rem 1.5rem 2.25rem; }
    .ct-page-title { font-size: clamp(1.6rem, 4vw, 2.1rem); }
    .ct-quick { gap: .8rem; }
    .ct-quick-item { padding: .9rem .4rem; }
    .ct-exhibit { padding: 1.1rem !important; }
    .ct-fb-head, .ct-fb-body, .ct-fb-stats { padding-left: 1.15rem; padding-right: 1.15rem; }
}

/* ====================== Desktop enhancements ========================= */
@media (min-width: 992px) {
    .ct-main { padding: 2.25rem 2rem 3rem; }
    .ct-hero-sub { font-size: 1.06rem; }
    .ct-hero .ct-searchbar { max-width: 34rem; margin-left: auto; margin-right: auto; }
    .ct-page-head { margin-bottom: 1.5rem; }
    .ct-page-title { font-size: clamp(1.8rem, 2.6vw, 2.4rem); }
    .ct-page-sub { font-size: 1rem; }

    .ct-quick { gap: 1rem; }
    .ct-quick-item {
        flex-direction: row; justify-content: flex-start; text-align: left;
        gap: .9rem; padding: 1.05rem 1.15rem; border-radius: var(--ct-radius-lg);
    }
    .ct-quick-item b { font-size: 1rem; text-align: left; }
    .ct-quick-item .ct-tile { border-radius: 16px; width: 48px; height: 48px; }

    .ct-stat { padding: 1.15rem .75rem; }
    .ct-stat b { font-size: 1.8rem; }
    .ct-stat span { font-size: .72rem; }

    .ct-card-pad { padding: 1.25rem; }
    .ct-section { margin-bottom: 1.75rem; }
    .ct-section-head h2, .ct-section-head h3, .ct-section-head h5 { font-size: 1.22rem; }
    .ct-rail { gap: 1rem; }
    .ct-searchbar { max-width: 42rem; }

    .ct-list--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ct-list--grid .ct-list-item { border-right: 1px solid var(--ct-border); }
    .ct-list--grid .ct-list-item:nth-child(2n) { border-right: 0; }
    .ct-list--grid .ct-list-item:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (min-width: 1400px) {
    .ct-main { padding-left: 2.5rem; padding-right: 2.5rem; }
    .ct-fb-feed, .ct-museum-collection.ct-feed { max-width: 820px; }
}

/* ==========================================================================
   DARK MODE — token swap.
   Components are written against tokens, so swapping them below restyles
   the whole system. Explicit overrides handle the few hard-coded values.
   ========================================================================== */
html[data-theme="dark"] {
    --ct-emerald-50:  #12201a;
    --ct-emerald-100: #162a1d;
    --ct-emerald-200: #1f3a27;
    --ct-emerald-300: #2d5238;
    --ct-emerald-400: #4c8752;
    --ct-emerald-500: #3f9451;
    --ct-emerald-600: #2f8a3a;
    --ct-emerald-700: #8ad392;
    --ct-emerald-800: #0d3314;
    --ct-emerald-900: #0a2710;
    --ct-emerald-950: #071a0b;

    --ct-gold-50:  #2a2306;
    --ct-gold-100: #3a3109;
    --ct-gold-200: #5c4c0d;
    --ct-gold-300: #ffd54f;
    --ct-gold-400: #ffca28;
    --ct-gold-500: #f5b300;
    --ct-gold-600: #ffcf3d;

    --ct-bg:            #0e1511;
    --ct-surface:       #16201a;
    --ct-surface-2:     #1c281f;
    --ct-border:        #29382f;
    --ct-border-strong: #3a4f42;
    --ct-text:          #d5e2d8;
    --ct-heading:       #eef6ef;
    --ct-muted:         #91a698;
    --ct-link:          #86d68f;
    --ct-link-hover:    #aae8b1;

    --ct-success: #8ad392;
    --ct-info:    #4fd6c9;
    --ct-warning: #ffcf3d;
    --ct-danger:  #f07d6f;

    --ct-shadow-sm: 0 1px 2px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.4);
    --ct-shadow:    0 10px 28px rgba(0,0,0,.5);
    --ct-shadow-lg: 0 22px 56px rgba(0,0,0,.62);
    --ct-shadow-large: var(--ct-shadow-lg);
    --ct-ring:      0 0 0 .22rem rgba(163,222,169,.30);

    --bs-body-bg:       #0e1511;
    --bs-body-color:    #d5e2d8;
    --bs-emphasis-color:#eef6ef;
    --bs-secondary-color:#91a698;
    --bs-border-color:  #29382f;
    --bs-light-rgb:     28, 40, 31;
    --bs-dark-rgb:      10, 17, 12;
    --bs-secondary-rgb: 145, 166, 152;
    --bs-link-color-rgb:      134, 214, 143;
    --bs-link-hover-color-rgb:170, 232, 177;
}

/* ---- Dark: core surfaces ---- */
html[data-theme="dark"] .bg-white { background-color: var(--ct-surface) !important; }
html[data-theme="dark"] .bg-light { background-color: var(--ct-surface-2) !important; }
html[data-theme="dark"] .bg-dark  { background-color: #26362c !important; color: var(--ct-heading) !important; }
html[data-theme="dark"] .text-dark { color: var(--ct-heading) !important; }
html[data-theme="dark"] .text-info { color: #4fd6c9 !important; }
html[data-theme="dark"] .bg-warning.bg-opacity-10 { color: var(--ct-gold-600) !important; }
html[data-theme="dark"] .bg-success.bg-opacity-10 { color: var(--ct-emerald-700) !important; }
html[data-theme="dark"] .bg-info.bg-opacity-10    { color: #4fd6c9 !important; }
html[data-theme="dark"] .bg-danger.bg-opacity-10  { color: #f07d6f !important; }

html[data-theme="dark"] .navbar-custom {
    background: linear-gradient(135deg, #0d3314 0%, #071a0b 100%);
    box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
html[data-theme="dark"] .ct-tabbar {
    background: rgba(20,28,23,.92);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    border-top-color: #29382f;
}
html[data-theme="dark"] .ct-tab-fab { box-shadow: 0 8px 20px rgba(245,179,0,.35), 0 0 0 4px #16201a; }
html[data-theme="dark"] .ct-sheet-user {
    background:
        radial-gradient(360px 160px at 100% 0%, rgba(255,213,79,.12) 0%, transparent 60%),
        linear-gradient(135deg, #123f1a, #0a1f0d);
}
html[data-theme="dark"] .ct-avatar-badge,
html[data-theme="dark"] .ct-sheet-user .ct-initials {
    background: linear-gradient(160deg, #ffcf3d, #f5b300);
    color: #0a1f0d;
}
html[data-theme="dark"] .ct-tile.emerald { background: linear-gradient(160deg, #2f8a3a, #1b4a1e); }
html[data-theme="dark"] .ct-tile.info    { background: linear-gradient(160deg, #2aa99b, #0f6f66); }
html[data-theme="dark"] .ct-tile.danger  { background: linear-gradient(160deg, #c44d3d, #8f2f23); }
html[data-theme="dark"] .ct-museum-hero {
    background:
        radial-gradient(900px 420px at 90% -20%, rgba(255,213,79,.14) 0%, rgba(255,213,79,0) 60%),
        linear-gradient(135deg, #0b2410 0%, #123f1a 55%, #0e2f14 100%);
}
html[data-theme="dark"] .ct-soft-card { background: linear-gradient(135deg, #12201a 0%, #172a1c 100%); }
html[data-theme="dark"] .ct-carousel-nav { background: rgba(22,32,26,.92); border-color: #3a4f42; color: #8ad392; }

/* ---- Dark: text & icon accents ---- */
html[data-theme="dark"] a { color: var(--ct-link); }
html[data-theme="dark"] a:hover { color: var(--ct-link-hover); }
html[data-theme="dark"] .navbar-custom a,
html[data-theme="dark"] .ct-appnav a { color: rgba(255,255,255,.85); }
html[data-theme="dark"] .ct-appnav a:hover,
html[data-theme="dark"] .ct-appnav a.active { color: #fff; }
html[data-theme="dark"] .ct-appnav a.active { color: var(--ct-gold-300); }
html[data-theme="dark"] .ct-footer .ct-bottom a,
html[data-theme="dark"] .ct-footer .ct-bottom a:hover { color: var(--ct-gold-300); }
html[data-theme="dark"] .ct-footer .ct-bottom a:hover { text-decoration: underline; }
html[data-theme="dark"] .ct-fb-name,
html[data-theme="dark"] .ct-fb-title a { color: #aae8b1; }
html[data-theme="dark"] .ct-fb-title a:hover { color: #d1f5d4; }
html[data-theme="dark"] .ct-list-icon.gold { color: #ffcf3d; }
html[data-theme="dark"] .breadcrumb-item a,
html[data-theme="dark"] .breadcrumb-item a:hover { color: var(--ct-link); }
html[data-theme="dark"] .ct-list-chev { color: #3a4f42; }
html[data-theme="dark"] .ct-fb-reaction-chip i { color: #6fc277; }
html[data-theme="dark"] .ct-fb-act.liked { color: #6fc277; }
html[data-theme="dark"] ::selection { background: #c98a00; color: #071a0b; }

/* ---- Dark: containers ---- */
html[data-theme="dark"] .dropdown-menu { background: #1a251e; border-color: #2d5238; box-shadow: var(--ct-shadow);
    color: var(--ct-text); }
html[data-theme="dark"] .dropdown-item { color: var(--ct-text); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background: #223029; color: #fff; }
html[data-theme="dark"] .dropdown-item.active, html[data-theme="dark"] .dropdown-item:active { background: #2f8a3a; color: #fff; }
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .offcanvas { background: #16201a; color: var(--ct-text); }
html[data-theme="dark"] .modal-header, html[data-theme="dark"] .modal-footer { border-color: #29382f; }
html[data-theme="dark"] .modal-title { color: var(--ct-heading); }
html[data-theme="dark"] .list-group-item { background: #16201a; color: var(--ct-text); border-color: #29382f; }
html[data-theme="dark"] .list-group-item.active { background: #2f8a3a; border-color: #2f8a3a; }
html[data-theme="dark"] .card-header, html[data-theme="dark"] .card-footer { background: #1c281f; border-color: #29382f; }
html[data-theme="dark"] .ct-menu-item { background: #1a251e; border-color: #29382f; color: var(--ct-text); }
html[data-theme="dark"] .ct-menu-item .ct-mi-icon { background: #111a15; border-color: #29382f; color: #8ad392; }
html[data-theme="dark"] .ct-menu-item:active { background: #12201a; }
html[data-theme="dark"] .ct-searchbar { background: #16201a; border-color: #3a4f42; }
html[data-theme="dark"] .ct-searchbar input { color: var(--ct-text); }
html[data-theme="dark"] .ct-searchbar i { color: #8ad392; }
html[data-theme="dark"] .ct-searchoverlay-inner { background: #16201a; }
html[data-theme="dark"] .ct-chip { background: #16201a; border-color: #3a4f42; color: var(--ct-heading); }
html[data-theme="dark"] .ct-chip:hover, html[data-theme="dark"] .ct-chip.active { background: #2f8a3a; color: #fff; border-color: #2f8a3a; }
html[data-theme="dark"] .ct-chip.active i, html[data-theme="dark"] .ct-chip:hover i { color: #ffd54f; }
html[data-theme="dark"] .ct-segmented { background: #10201a; border-color: #29382f; }
html[data-theme="dark"] .ct-segmented a.active, html[data-theme="dark"] .ct-segmented button.active { background: #1e2c23; color: #aae8b1; box-shadow: var(--ct-shadow-sm); }
html[data-theme="dark"] .ct-segmented a, html[data-theme="dark"] .ct-segmented button { color: #91a698; }
html[data-theme="dark"] .ct-empty .ct-empty-ico { background: #12201a; color: #6fc277; }

/* ---- Dark: forms ---- */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: #111a15;
    border-color: #3a4f42;
    color: var(--ct-text);
}
html[data-theme="dark"] .form-control::placeholder { color: #718579; }
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: #131e17;
    border-color: #6fc277;
    box-shadow: var(--ct-ring);
}
html[data-theme="dark"] .input-group-text { background: #1c281f; color: #8ad392; border-color: #3a4f42; }
html[data-theme="dark"] .form-check-input { background-color: #111a15; border-color: #3a4f42; }
html[data-theme="dark"] .form-check-input:checked { background-color: #2f8a3a; border-color: #2f8a3a; }
html[data-theme="dark"] .form-range::-webkit-slider-runnable-track { background: #2d5238; }

/* ---- Dark: alerts, tables, pagination ---- */
html[data-theme="dark"] .alert-success { background: #12281a; border-color: #1f3a27; color: #aae8b1; }
html[data-theme="dark"] .alert-warning { background: #2a2306; border-color: #4a3d09; color: #ffd76b; }
html[data-theme="dark"] .alert-danger  { background: #2c1512; border-color: #553026; color: #f0a79e; }
html[data-theme="dark"] .alert-info    { background: #0f2622; border-color: #1f4a43; color: #8fe0d5; }

html[data-theme="dark"] .table { --bs-table-color: var(--ct-text); --bs-table-border-color: #29382f; }
html[data-theme="dark"] .table thead th { background: #1c281f; color: var(--ct-heading); border-bottom-color: #3a4f42; }
html[data-theme="dark"] .table-light > :not(caption) > * > * { background-color: #1c281f; color: var(--ct-heading); }
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: rgba(255,255,255,.025); }
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > * { --bs-table-accent-bg: rgba(255,255,255,.008); }
html[data-theme="dark"] .table-hover > tbody > tr:hover > * { --bs-table-accent-bg: rgba(138,211,146,.10); }
html[data-theme="dark"] .table-success { --bs-table-bg: #12281a; --bs-table-color: #cdeecd; }
html[data-theme="dark"] .table-warning { --bs-table-bg: #2a2306; --bs-table-color: #ffe9ad; }
html[data-theme="dark"] .table-danger  { --bs-table-bg: #2c1512; --bs-table-color: #f2c3bc; }

html[data-theme="dark"] .page-link { background: #16201a; border-color: #29382f; color: #8ad392; }
html[data-theme="dark"] .page-link:hover { background: #1c281f; color: #aae8b1; }
html[data-theme="dark"] .page-item.active .page-link { background: #2f8a3a; border-color: #2f8a3a; color: #fff; }
html[data-theme="dark"] .page-item.disabled .page-link { background: #131b16; color: #5a6b60; }
html[data-theme="dark"] .breadcrumb-item.active { color: #91a698; }
html[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: #3a4f42; }

/* ---- Dark: buttons ---- */
html[data-theme="dark"] .btn-light {
    --bs-btn-bg: #1c281f; --bs-btn-border-color: #3a4f42; --bs-btn-color: #eef6ef;
    --bs-btn-hover-bg: #24332a; --bs-btn-hover-border-color: #4c8752; --bs-btn-hover-color: #fff;
}
html[data-theme="dark"] .btn-outline-light {
    --bs-btn-color: #d5e2d8; --bs-btn-border-color: #91a698;
    --bs-btn-hover-bg: #2d5238; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #91a698;
}
html[data-theme="dark"] .btn-dark {
    --bs-btn-bg: #26362c; --bs-btn-border-color: #3a4f42; --bs-btn-color: #eef6ef;
    --bs-btn-hover-bg: #33463a; --bs-btn-hover-color: #fff;
}
html[data-theme="dark"] .btn-success {
    --bs-btn-bg: #2f8a3a; --bs-btn-border-color: #2f8a3a;
    --bs-btn-hover-bg: #37a043; --bs-btn-hover-border-color: #37a043;
    --bs-btn-active-bg: #286e31; --bs-btn-active-border-color: #286e31;
    --bs-btn-color: #fff;
}
html[data-theme="dark"] .btn-success:hover { box-shadow: 0 6px 16px rgba(47,138,58,.35); }
html[data-theme="dark"] .btn-outline-success {
    --bs-btn-color: #8ad392; --bs-btn-border-color: #4c8752;
    --bs-btn-hover-bg: #2f8a3a; --bs-btn-hover-border-color: #2f8a3a; --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #286e31; --bs-btn-active-border-color: #286e31; --bs-btn-active-color: #fff;
}
html[data-theme="dark"] .btn-warning,
html[data-theme="dark"] .btn-gold { color: #241a00; }
html[data-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #c2d0c6; --bs-btn-border-color: #3a4f42;
    --bs-btn-hover-bg: #2a3a30; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #3a4f42;
}
html[data-theme="dark"] .btn-close { filter: invert(.9) grayscale(.2) brightness(1.5); }

/* ---- Dark: social / feed / minor fixes ---- */
html[data-theme="dark"] .ct-social a { background: rgba(255,255,255,.1); }
html[data-theme="dark"] .ct-fb-bubble { background: #1c281f; border-color: #29382f; }
html[data-theme="dark"] .ct-fb-comments { background: #131d17; }
html[data-theme="dark"] .ct-fb-media { background: #05080a; }
html[data-theme="dark"] .shadow-sm { box-shadow: var(--ct-shadow-sm) !important; }
html[data-theme="dark"] .shadow    { box-shadow: var(--ct-shadow) !important; }
html[data-theme="dark"] .shadow-lg { box-shadow: var(--ct-shadow-lg) !important; }
html[data-theme="dark"] .ct-stat b { -webkit-text-fill-color: #8ad392; color: #8ad392; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2d5238; border-color: #0e1511; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a5b40; }

/* ---- Dark: injected JS-driven widgets ---- */
html[data-theme="dark"] .rich-editor { background: #16201a; border-color: #3a4f42; }
html[data-theme="dark"] .rich-editor-toolbar { background: #1c281f; border-color: #29382f; }
html[data-theme="dark"] .rich-btn { background: #16201a; border-color: #3a4f42; color: #8ad392; }
html[data-theme="dark"] .rich-btn:hover { background: #243529; }
html[data-theme="dark"] .rich-editor-area { color: var(--ct-text); background: #111a15; }
html[data-theme="dark"] .rich-editor-area[contenteditable]:focus { border-color: #6fc277; }
html[data-theme="dark"] .rich-editor-area img.is-selected { outline-color: #6fc277; }
html[data-theme="dark"] .rich-size-range { accent-color: #6fc277; }
html[data-theme="dark"] .rich-handle { background: #16201a; border-color: #6fc277; }
html[data-theme="dark"] .rich-content img { background: #0a140d; }

html[data-theme="dark"] .cp-panel,
html[data-theme="dark"] .cp-card { background: #16201a; color: var(--ct-text); }
html[data-theme="dark"] .cp-card .cp-body { color: var(--ct-text); }
html[data-theme="dark"] .cp-panel-body { background: #0e1511; }
html[data-theme="dark"] .cp-msg.them { background: #1c281f; border-color: #29382f; color: var(--ct-text); }
html[data-theme="dark"] .cp-panel-foot { background: #16201a; border-top-color: #29382f; }
html[data-theme="dark"] .cp-btn-muted { background: #26362c; color: #eef6ef; }
html[data-theme="dark"] .ct-searchoverlay { background: rgba(4,8,6,.62); }

/* ==========================================================================
   HERITAGE HALL v2 — redesigned Living Museum (community.php / my_museum.php)
   A gallery-style experience: a marble hero, "wing" room cards, a curator
   spotlight, the Voice Vault and framed artifact cards.
   ========================================================================== */
.ct-hall-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--ct-radius-lg);
    color: #fff;
    background:
        radial-gradient(760px 420px at 88% -20%, rgba(255,213,79,.22) 0%, rgba(255,213,79,0) 62%),
        radial-gradient(560px 300px at 4% 120%, rgba(255,255,255,.06) 0%, rgba(255,255,255,0) 60%),
        linear-gradient(140deg, var(--ct-emerald-950) 0%, var(--ct-emerald-800) 48%, var(--ct-emerald-700) 100%);
    border: 1px solid rgba(255,213,79,.28);
    border-bottom: 5px solid var(--ct-gold-300);
    box-shadow: var(--ct-shadow);
    padding: 1.5rem 1.25rem;
}
.ct-hall-hero::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 42px),
        repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 42px);
    pointer-events: none;
    opacity: .6;
}
.ct-hall-hero-inner { position: relative; z-index: 1; }
.ct-hall-emblem {
    width: 58px; height: 58px; border-radius: 18px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--ct-emerald-950);
    background: linear-gradient(150deg, var(--ct-gold-200), var(--ct-gold-500));
    box-shadow: 0 8px 22px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6);
}
.ct-hall-eyebrow {
    display: inline-flex; align-items: center; gap: .45rem;
    font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    color: var(--ct-gold-300);
}
.ct-hall-title {
    font-family: var(--ct-font-display);
    font-size: clamp(1.55rem, 5.6vw, 2.6rem);
    font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
    color: #fff; margin: .35rem 0 .5rem;
}
.ct-hall-title em { font-style: italic; color: var(--ct-gold-300); }
.ct-hall-lede { color: rgba(255,255,255,.86); font-size: .96rem; max-width: 46rem; margin: 0 0 1.1rem; }
.ct-hall-cta { display: flex; flex-wrap: wrap; gap: .6rem; }

.ct-hall-stats {
    display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
    gap: .55rem; margin-top: 1.25rem;
}
@media (min-width: 640px) { .ct-hall-stats { grid-template-columns: repeat(5, minmax(0,1fr)); } }
.ct-hall-stat {
    text-align: left; padding: .7rem .85rem; border-radius: var(--ct-radius-sm);
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.ct-hall-stat b {
    display: flex; align-items: baseline; gap: .3rem;
    font-size: 1.35rem; font-weight: 800; color: var(--ct-gold-300); line-height: 1.1;
}
.ct-hall-stat i { font-size: .78rem; opacity: .85; }
.ct-hall-stat span { display: block; font-size: .63rem; text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.72); margin-top: .1rem; }

/* --- Wing rooms --- */
.ct-wing-scroll {
    display: flex; gap: .6rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: .25rem .15rem .7rem; scrollbar-width: none;
}
.ct-wing-scroll::-webkit-scrollbar { display: none; }
@media (min-width: 992px) { .ct-wing-scroll { flex-wrap: wrap; overflow: visible; } }
.ct-wing {
    flex: 0 0 auto; width: 132px;
    display: flex; flex-direction: column; gap: .4rem;
    padding: .8rem .8rem .75rem; border-radius: var(--ct-radius);
    text-decoration: none; color: var(--ct-heading);
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    border-top: 3px solid var(--ct-emerald-500);
    box-shadow: var(--ct-shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ct-wing:hover { transform: translateY(-3px); box-shadow: var(--ct-shadow); border-top-color: var(--ct-gold-400); color: var(--ct-heading); }
.ct-wing.active { border-top-color: var(--ct-gold-400); background: linear-gradient(180deg, var(--ct-gold-50), var(--ct-surface)); }
.ct-wing-ico {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
    font-size: 1.05rem; color: var(--ct-emerald-700); background: var(--ct-emerald-50);
}
.ct-wing.active .ct-wing-ico { color: var(--ct-gold-600); background: var(--ct-gold-50); }
.ct-wing-name { font-weight: 800; font-size: .84rem; line-height: 1.2; }
.ct-wing-count { font-size: .7rem; color: var(--ct-muted); font-weight: 700; }

/* --- Curator spotlight --- */
.ct-hall-spot {
    position: relative; overflow: hidden;
    border-radius: var(--ct-radius-lg);
    border: 1px solid var(--ct-gold-300);
    background: linear-gradient(180deg, var(--ct-gold-50), var(--ct-surface) 70%);
    box-shadow: 0 0 0 1px rgba(255,213,79,.35), var(--ct-shadow);
}
.ct-hall-spot-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 768px) { .ct-hall-spot-grid { grid-template-columns: 42% 1fr; } }
.ct-hall-spot-media { position: relative; min-height: 210px; background: var(--ct-emerald-900); }
.ct-hall-spot-media img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.ct-hall-spot-media .ct-hall-spot-noimg {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 3.4rem; color: rgba(255,213,79,.55);
    background:
        radial-gradient(320px 200px at 70% 10%, rgba(255,213,79,.18), transparent 60%),
        linear-gradient(150deg, var(--ct-emerald-800), var(--ct-emerald-950));
}
.ct-hall-spot-body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; }
.ct-hall-spot-badge {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: #4a3200; background: linear-gradient(150deg, var(--ct-gold-200), var(--ct-gold-400));
    padding: .28rem .65rem; border-radius: 999px;
}
.ct-hall-spot-title { font-family: var(--ct-font-display); font-size: 1.5rem; font-weight: 800; margin: .6rem 0 .35rem; line-height: 1.15; }
.ct-hall-spot-title a { color: var(--ct-heading); text-decoration: none; }
.ct-hall-spot-title a:hover { color: var(--ct-emerald-700); }
.ct-hall-spot-excerpt { color: var(--ct-muted); font-size: .9rem; line-height: 1.6; margin-bottom: .9rem; }
.ct-hall-spot-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

/* --- Voice Vault (oral archive) --- */
.ct-vault { border-radius: var(--ct-radius-lg); border: 1px solid var(--ct-border); background: var(--ct-surface); box-shadow: var(--ct-shadow-sm); padding: 1rem; }
.ct-vault-grid { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ct-vault-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1200px) { .ct-vault-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.ct-vault-card {
    display: flex; align-items: center; gap: .7rem; padding: .65rem .7rem;
    border-radius: var(--ct-radius-sm); background: var(--ct-surface-2);
    border: 1px solid var(--ct-border); text-decoration: none; color: inherit; min-width: 0;
    transition: transform .14s ease, box-shadow .14s ease;
}
.ct-vault-card:hover { transform: translateY(-2px); box-shadow: var(--ct-shadow-sm); color: inherit; }
.ct-vault-play {
    width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; color: #fff; font-size: .95rem;
    background: linear-gradient(150deg, var(--ct-emerald-500), var(--ct-emerald-700));
    box-shadow: 0 3px 0 var(--ct-emerald-900);
}
.ct-vault-play:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ct-emerald-900); }
.ct-vault-body { min-width: 0; flex: 1 1 auto; }
.ct-vault-body b { display: block; font-weight: 700; color: var(--ct-heading); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-vault-body small { color: var(--ct-muted); font-size: .74rem; }

/* --- Artifact cards (collection) --- */
.ct-artifact {
    position: relative; height: 100%;
    display: flex; flex-direction: column;
    border-radius: var(--ct-radius-lg);
    border: 1px solid var(--ct-border);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ct-artifact:hover { transform: translateY(-4px); box-shadow: var(--ct-shadow); border-color: var(--ct-emerald-200); }
.ct-artifact.ct-artifact-featured { border-color: var(--ct-gold-300); box-shadow: 0 0 0 1px var(--ct-gold-300), var(--ct-shadow-sm); }
.ct-artifact-frame { position: relative; aspect-ratio: 16 / 10; background: var(--ct-emerald-900); overflow: hidden; }
.ct-artifact-frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.ct-artifact:hover .ct-artifact-frame img { transform: scale(1.04); }
.ct-artifact-frame .ct-artifact-noimg {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 2.6rem; color: rgba(255,213,79,.5);
    background:
        radial-gradient(280px 180px at 72% 8%, rgba(255,213,79,.18), transparent 62%),
        linear-gradient(150deg, var(--ct-emerald-800), var(--ct-emerald-950));
}
.ct-artifact-plaque {
    position: absolute; top: .6rem; left: .6rem;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .6rem; border-radius: 999px;
    font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
    color: #4a3200; background: linear-gradient(150deg, var(--ct-gold-200), var(--ct-gold-400));
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.ct-artifact-flag {
    position: absolute; top: .6rem; right: .6rem;
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .6rem; border-radius: 999px;
    font-size: .66rem; font-weight: 800; text-transform: uppercase;
    background: rgba(4,38,23,.72); color: #fff;
}
.ct-artifact-body { padding: .95rem 1rem .4rem; flex: 1 1 auto; display: flex; flex-direction: column; }
.ct-artifact-title { font-family: var(--ct-font-display); font-weight: 800; font-size: 1.1rem; line-height: 1.2; margin: 0 0 .3rem; }
.ct-artifact-title a { color: var(--ct-heading); text-decoration: none; }
.ct-artifact-title a:hover { color: var(--ct-emerald-700); }
.ct-artifact-excerpt { color: var(--ct-muted); font-size: .87rem; line-height: 1.6; margin-bottom: .75rem; }
.ct-artifact-audio {
    margin-top: auto; display: flex; align-items: center; gap: .55rem;
    padding: .45rem .55rem; border-radius: var(--ct-radius-sm);
    background: var(--ct-emerald-50); border: 1px solid var(--ct-border);
}
.ct-artifact-audio audio { width: 100%; height: 34px; }
.ct-artifact-audio .ct-artifact-audio-ico { color: var(--ct-emerald-700); flex: 0 0 auto; }
.ct-artifact-foot {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .75rem 1rem .95rem; border-top: 1px solid var(--ct-border);
}
.ct-artifact-curator { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.ct-artifact-curator small { color: var(--ct-muted); font-size: .72rem; }
.ct-artifact-curator b { display: block; font-size: .82rem; color: var(--ct-heading); line-height: 1.1; }
.ct-artifact-metrics { display: flex; align-items: center; gap: .7rem; font-size: .78rem; color: var(--ct-muted); }
.ct-artifact-actions { display: flex; gap: .4rem; padding: 0 1rem .95rem; }
.ct-artifact-actions .ct-iconbtn-mini {
    width: 36px; height: 36px; border-radius: 10px; padding: 0; flex: 0 0 auto;
    display: inline-grid; place-items: center; font-size: .85rem;
}

/* --- Small round icon button (save / report on cards) --- */
.ct-iconbtn-mini {
    border: 1px solid var(--ct-border-strong); background: var(--ct-surface); color: var(--ct-emerald-700);
    width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center;
    cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease; text-decoration: none;
}
.ct-iconbtn-mini:hover { background: var(--ct-emerald-50); }
.ct-iconbtn-mini.on, .ct-iconbtn-mini.active { background: var(--ct-emerald-600); border-color: var(--ct-emerald-600); color: #fff; }
.ct-iconbtn-mini.danger:hover { background: #fdecea; border-color: var(--ct-danger); color: var(--ct-danger); }

/* --- Toolbar (search + filters) --- */
.ct-hall-toolbar {
    border-radius: var(--ct-radius-lg); border: 1px solid var(--ct-border);
    background: var(--ct-surface); box-shadow: var(--ct-shadow-sm); padding: .85rem .9rem;
}

/* --- Empty hall --- */
.ct-hall-empty {
    text-align: center; padding: 3rem 1.25rem; border-radius: var(--ct-radius-lg);
    border: 1px dashed var(--ct-border-strong); background: var(--ct-surface);
}
.ct-hall-empty .ct-hall-empty-ico {
    width: 74px; height: 74px; margin: 0 auto .9rem; border-radius: 22px;
    display: grid; place-items: center; font-size: 1.9rem;
    color: var(--ct-emerald-700); background: var(--ct-emerald-50);
}
.ct-hall-empty h3 { font-family: var(--ct-font-display); font-weight: 800; margin-bottom: .35rem; }
.ct-hall-empty p { color: var(--ct-muted); font-size: .9rem; margin-bottom: 1rem; }

/* --- Section heading with rule --- */
.ct-hall-sechead { display: flex; align-items: center; gap: .7rem; margin: 1.6rem 0 .85rem; }
.ct-hall-sechead h2 { margin: 0; font-family: var(--ct-font-display); font-size: 1.15rem; font-weight: 800; white-space: nowrap; }
.ct-hall-sechead .ct-hall-rule { flex: 1 1 auto; height: 1px; background: linear-gradient(90deg, var(--ct-gold-300), transparent); }
.ct-hall-sechead .ct-hall-count { font-size: .74rem; font-weight: 800; color: var(--ct-emerald-700); background: var(--ct-emerald-50); border-radius: 999px; padding: .15rem .55rem; }
.ct-hall-sechead .ct-hall-link { margin-left: auto; font-size: .78rem; font-weight: 700; text-decoration: none; white-space: nowrap; }

/* --- Museum photo-wall (kept for My Museum) --- */
.ct-hall-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .ct-hall-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1200px) { .ct-hall-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }

/* Dark theme */
html[data-theme="dark"] .ct-hall-hero { border-color: rgba(255,213,79,.32); }
html[data-theme="dark"] .ct-wing { background: var(--ct-surface); border-color: var(--ct-border); }
html[data-theme="dark"] .ct-wing.active { background: linear-gradient(180deg, #2a2306, var(--ct-surface)); }
html[data-theme="dark"] .ct-wing-ico { background: #12281a; color: #8ad392; }
html[data-theme="dark"] .ct-hall-spot { background: linear-gradient(180deg, #2a2306, var(--ct-surface) 70%); }
html[data-theme="dark"] .ct-vault-card { background: var(--ct-surface-2); border-color: var(--ct-border); }
html[data-theme="dark"] .ct-artifact { background: var(--ct-surface); border-color: var(--ct-border); }
html[data-theme="dark"] .ct-artifact-audio { background: #12281a; border-color: var(--ct-border); }
html[data-theme="dark"] .ct-iconbtn-mini { background: var(--ct-surface); border-color: var(--ct-border-strong); color: #8ad392; }
html[data-theme="dark"] .ct-iconbtn-mini:hover { background: #12281a; }
html[data-theme="dark"] .ct-iconbtn-mini.danger:hover { background: #2c1512; }
html[data-theme="dark"] .ct-hall-empty { background: var(--ct-surface); }
html[data-theme="dark"] .ct-hall-sechead .ct-hall-count { background: #12281a; color: #8ad392; }

/* ==========================================================================
   POST ENTRY v2 — classic single-post (WordPress-style) reading layout
   Used by post_view.php
   ========================================================================== */
.ct-entry {
    max-width: 820px;
    margin: 0 auto 1rem;
    background: var(--ct-surface);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    box-shadow: var(--ct-shadow-sm);
    overflow: hidden;
}
@media (min-width: 992px) { .ct-entry { max-width: 860px; } }
.ct-entry.ct-entry-featured { border-color: var(--ct-gold-300); box-shadow: 0 0 0 1px var(--ct-gold-300), var(--ct-shadow-sm); }

.ct-entry-head { padding: 1.5rem 1.35rem .75rem; }
@media (min-width: 768px) { .ct-entry-head { padding: 2rem 2.25rem .75rem; } }

.ct-entry-wings { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.ct-entry-wing {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ct-emerald-700); text-decoration: none;
    background: var(--ct-emerald-50); border: 1px solid var(--ct-border);
    padding: .28rem .7rem; border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}
.ct-entry-wing:hover { background: var(--ct-emerald-100, #d6f0da); color: var(--ct-emerald-800); }
.ct-entry-feat {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    color: #4a3200; background: linear-gradient(150deg, var(--ct-gold-200), var(--ct-gold-400));
    padding: .28rem .7rem; border-radius: 999px;
}

.ct-entry-title {
    font-family: var(--ct-font-display);
    font-weight: 800;
    font-size: clamp(1.7rem, 4.6vw, 2.55rem);
    line-height: 1.12; letter-spacing: -.02em;
    color: var(--ct-heading);
    margin: .1rem 0 .5rem;
    overflow-wrap: anywhere;
}

.ct-entry-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .85rem;
    color: var(--ct-muted); font-size: .85rem;
    padding-top: .85rem; margin-top: .35rem;
    border-top: 1px solid var(--ct-border);
}
.ct-entry-author { display: inline-flex; align-items: center; gap: .55rem; }
.ct-entry-author b { display: block; color: var(--ct-heading); font-weight: 700; line-height: 1.15; }
.ct-entry-author small { color: var(--ct-muted); font-size: .76rem; }
.ct-entry-chip { display: inline-flex; align-items: center; gap: .3rem; }
.ct-entry-chip i { color: var(--ct-emerald-600); }

.ct-entry-featured-img { margin: 0; background: var(--ct-emerald-950); }
.ct-entry-featured-img img { width: 100%; max-height: 560px; object-fit: cover; display: block; cursor: zoom-in; }

.ct-entry-body { padding: 1.25rem 1.35rem 1.5rem; }
@media (min-width: 768px) { .ct-entry-body { padding: 1.5rem 2.25rem 1.75rem; } }
.ct-entry-content { font-size: 1.06rem; line-height: 1.85; color: var(--ct-text); }
.ct-entry-content img { max-width: 100%; height: auto; border-radius: var(--ct-radius-sm); }
.ct-entry-content p { margin-bottom: 1.1rem; }
.ct-entry-edit-head { font-family: var(--ct-font-display); font-weight: 800; font-size: 1.25rem; margin-bottom: 1rem; }

.ct-entry-audio { margin: 0 1.35rem 1.25rem; }
@media (min-width: 768px) { .ct-entry-audio { margin: 0 2.25rem 1.5rem; } }
.ct-entry-audio-inner {
    display: flex; align-items: center; gap: .65rem;
    padding: .6rem .75rem; border-radius: var(--ct-radius-sm);
    background: var(--ct-emerald-50); border: 1px solid var(--ct-border);
}

html[data-theme="dark"] .ct-entry { background: var(--ct-surface); border-color: var(--ct-border); }
html[data-theme="dark"] .ct-entry-wing { background: #12281a; border-color: var(--ct-border); color: #8ad392; }
html[data-theme="dark"] .ct-entry-wing:hover { background: #17351f; color: #aae8b1; }
html[data-theme="dark"] .ct-entry-audio-inner { background: #12281a; }

/* ==========================================================================
   MARKETPLACE v2 — classified ads listing (ads.php)
   ========================================================================== */
.ct-market-stat-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .6rem; }
@media (min-width: 576px) { .ct-market-stat-row { grid-template-columns: repeat(4, minmax(0,1fr)); } }

.ct-market-toolbar {
    display: flex; flex-direction: column; gap: .7rem;
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow-sm);
    padding: .85rem .9rem;
}
@media (min-width: 992px) {
    .ct-market-toolbar { flex-direction: row; align-items: center; }
    .ct-market-toolbar .ct-searchbar { max-width: 22rem; flex: 0 0 auto; }
}

/* Listing card */
.ct-listing {
    display: flex; flex-direction: column; height: 100%;
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow-sm);
    overflow: hidden; text-decoration: none; color: inherit;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ct-listing:hover { transform: translateY(-3px); box-shadow: var(--ct-shadow); border-color: var(--ct-emerald-200); text-decoration: none; color: inherit; }
.ct-listing.is-featured { border-color: var(--ct-gold-300); }
.ct-listing-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(150deg, var(--ct-emerald-50), var(--ct-emerald-100, #d6f0da)); }
.ct-listing-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.ct-listing:hover .ct-listing-media img { transform: scale(1.06); }
.ct-listing-noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ct-emerald-300); font-size: 2.4rem; }
.ct-listing-tags { position: absolute; top: .6rem; left: .6rem; display: flex; flex-wrap: wrap; gap: .35rem; max-width: calc(100% - 1.2rem); }
.ct-listing-price {
    position: absolute; right: .6rem; bottom: .6rem;
    display: inline-flex; align-items: center; gap: .25rem;
    background: rgba(7,58,33,.92); color: #fff; font-weight: 800; font-size: .82rem;
    padding: .3rem .65rem; border-radius: 999px;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.ct-listing-body { display: flex; flex-direction: column; gap: .45rem; padding: .85rem .9rem .95rem; flex: 1 1 auto; }
.ct-listing-loc { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; color: var(--ct-emerald-700); }
.ct-listing-title { font-weight: 700; color: var(--ct-heading); font-size: .98rem; line-height: 1.3; margin: 0; }
.ct-listing-desc { color: var(--ct-muted); font-size: .82rem; line-height: 1.45; margin: 0; }
.ct-listing-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .65rem; border-top: 1px solid var(--ct-border); }
.ct-listing-seller { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.ct-listing-seller img.ct-listing-avatar { width: 30px; height: 30px; border-radius: 999px; object-fit: cover; flex: 0 0 auto; background: var(--ct-emerald-50); }
.ct-listing-seller small { color: var(--ct-muted); font-size: .74rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-listing-cta { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 800; color: var(--ct-emerald-700); }
.ct-listing:hover .ct-listing-cta { color: var(--ct-emerald-800); }

.ct-tag { display: inline-flex; align-items: center; gap: .25rem; font-size: .66rem; font-weight: 800; letter-spacing: .02em; padding: .22rem .5rem; border-radius: 999px; }
.ct-tag.gold { background: linear-gradient(150deg, var(--ct-gold-200), var(--ct-gold-400)); color: #4a3200; }
.ct-tag.emerald { background: rgba(255,255,255,.94); color: var(--ct-emerald-700); border: 1px solid var(--ct-border); }
.ct-tag.info { background: rgba(255,255,255,.94); color: var(--ct-info); border: 1px solid var(--ct-border); }

html[data-theme="dark"] .ct-listing { background: var(--ct-surface); border-color: var(--ct-border); }
html[data-theme="dark"] .ct-listing:hover { border-color: var(--ct-emerald-700); }
html[data-theme="dark"] .ct-listing-media { background: linear-gradient(150deg, #10251a, #17351f); }
html[data-theme="dark"] .ct-tag.emerald,
html[data-theme="dark"] .ct-tag.info { background: rgba(18,40,26,.94); }
html[data-theme="dark"] .ct-market-toolbar { background: var(--ct-surface); }

/* ==========================================================================
   AD DETAIL v2 — single classified ad (ad_detail.php)
   ========================================================================== */
.ct-ad-gallery { min-width: 0; }
.product-main-img {
    position: relative; background: var(--ct-surface-2);
    border: 1px solid var(--ct-border); border-radius: var(--ct-radius-lg);
    overflow: hidden; box-shadow: var(--ct-shadow-sm);
}
.product-main-img img { width: 100%; max-height: 520px; object-fit: contain; display: block; background: var(--ct-surface-2); }
.product-main-img .ct-ad-flag { position: absolute; top: .75rem; left: .75rem; }
.product-thumbs { display: flex; gap: .5rem; overflow-x: auto; padding: .1rem .1rem .4rem; scrollbar-width: thin; }
.product-thumb {
    width: 76px; height: 76px; flex: 0 0 auto; padding: 0; cursor: pointer;
    border: 2px solid var(--ct-border-strong); border-radius: var(--ct-radius-sm);
    overflow: hidden; background: var(--ct-surface-2);
    transition: border-color .15s ease, transform .15s ease;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-thumb.active, .product-thumb:hover { border-color: var(--ct-emerald-600); transform: translateY(-2px); }
@media (max-width: 575.98px) { .product-thumb { width: 64px; height: 64px; } }

.product-summary { position: sticky; top: calc(var(--ct-appbar-h) + 1rem); }
@media (max-width: 991.98px) { .product-summary { position: static; } }

.ct-ad-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.ct-ad-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 800; padding: .3rem .65rem; border-radius: 999px; }
.ct-ad-badge.emerald { background: var(--ct-emerald-50); color: var(--ct-emerald-700); }
.ct-ad-badge.gold { background: linear-gradient(150deg, var(--ct-gold-200), var(--ct-gold-400)); color: #4a3200; }
.ct-ad-badge.info { background: rgba(18,130,119,.12); color: var(--ct-info); }

.ct-ad-title { font-family: var(--ct-font-display); font-weight: 800; font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.15; letter-spacing: -.01em; color: var(--ct-heading); margin: 0 0 .5rem; overflow-wrap: anywhere; }
.product-price { font-family: var(--ct-font-display); font-weight: 800; font-size: clamp(1.5rem, 4.5vw, 2.05rem); color: var(--ct-emerald-700); line-height: 1.1; }

.product-meta-row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--ct-border); font-size: .88rem; }
.product-meta-row:last-child { border-bottom: 0; }
.product-meta-row .meta-label { color: var(--ct-muted); }
.product-meta-row .meta-value { font-weight: 600; color: var(--ct-heading); text-align: right; }

.ct-ad-actions { display: grid; gap: .5rem; margin-top: .9rem; }
.social-icon-btn { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.05rem; }

.ct-ad-tabs .nav-link { font-weight: 700; color: var(--ct-muted); }
.ct-ad-tabs .nav-link.active { color: var(--ct-emerald-700); }

.ct-ad-related-card .ct-ad-related-img { height: 128px; object-fit: cover; width: 100%; }

html[data-theme="dark"] .product-main-img { background: #10251a; }
html[data-theme="dark"] .product-main-img img { background: #10251a; }
html[data-theme="dark"] .ct-ad-badge.emerald { background: #12281a; color: #8ad392; }
html[data-theme="dark"] .ct-ad-badge.info { background: #10251a; color: #5fd0c4; }
html[data-theme="dark"] .product-thumb { background: #10251a; border-color: #27402f; }