/*
 * Touchmark Registry — Public Stylesheet
 * Uses CSS custom properties that inherit from the active theme where possible.
 * Override these variables in your theme's CSS to fully match your brand.
 */

.tmr-wrap {
    --tmr-radius:     6px;
    --tmr-gap:        1.25rem;
    --tmr-border:     1px solid #ddd;
    --tmr-shadow:     0 2px 8px rgba(0,0,0,.08);
    --tmr-font:       inherit;
    --tmr-color-text: inherit;

    /* Override these to match your theme colors */
    --tmr-primary:    #333333;
    --tmr-primary-hover: #555555;
    --tmr-success:    #16a34a;
    --tmr-error:      #dc2626;
    --tmr-warning:    #d97706;
    --tmr-badge-bg:   #f1f5f9;
    --tmr-badge-text: #475569;
    --tmr-card-bg:    #ffffff;

    font-family: var(--tmr-font);
    color: var(--tmr-color-text);
    max-width: 100%;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.tmr-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--tmr-radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}
.tmr-alert-success { background: #f0fdf4; border-color: var(--tmr-success); color: #14532d; }
.tmr-alert-error   { background: #fef2f2; border-color: var(--tmr-error);   color: #7f1d1d; }
.tmr-alert ul      { margin: .5rem 0 0 1.25rem; padding: 0; }
.tmr-alert li      { margin-bottom: .25rem; }

/* ── Search bar ─────────────────────────────────────────────────────────────── */
.tmr-search-bar {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.tmr-search-bar .tmr-input {
    flex: 1;
    min-width: 200px;
}

/* ── Inputs / Selects ───────────────────────────────────────────────────────── */
.tmr-input,
.tmr-select,
.tmr-textarea {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    border: var(--tmr-border);
    border-radius: var(--tmr-radius);
    font-size: 1rem;
    font-family: var(--tmr-font);
    line-height: 1.5;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s;
}
.tmr-input:focus,
.tmr-select:focus,
.tmr-textarea:focus {
    outline: none;
    border-color: var(--tmr-primary);
    box-shadow: 0 0 0 3px rgba(51,51,51,.2);
}
.tmr-input-year { width: 110px; display: inline-block; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.tmr-btn {
    display: inline-block;
    padding: .5rem 1.1rem;
    border: none;
    border-radius: var(--tmr-radius);
    font-size: 1rem;
    font-family: var(--tmr-font);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
}
.tmr-btn-primary {
    background: var(--tmr-primary);
    color: #fff;
}
.tmr-btn-primary:hover { background: var(--tmr-primary-hover); color: #fff; }
.tmr-btn-secondary {
    background: #f1f5f9;
    color: #334155;
    border: var(--tmr-border);
}
.tmr-btn-secondary:hover { background: #e2e8f0; }
.tmr-btn-lg { padding: .75rem 1.75rem; font-size: 1.05rem; }

/* ── Filters ────────────────────────────────────────────────────────────────── */
.tmr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--tmr-gap);
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: var(--tmr-border);
    border-radius: var(--tmr-radius);
    background: #f8fafc;
}
.tmr-filter-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 160px;
}
.tmr-label {
    font-size: .875rem;
    font-weight: 600;
    color: #475569;
    display: block;
}
.tmr-era-range {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.tmr-era-sep { color: #94a3b8; }

/* ── Alphabet ────────────────────────────────────────────────────────────────── */
.tmr-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}
.tmr-letter-btn {
    padding: .2rem .45rem;
    border: var(--tmr-border);
    border-radius: 4px;
    background: #fff;
    font-size: .8rem;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.tmr-letter-btn:hover,
.tmr-letter-btn.tmr-letter-active {
    background: var(--tmr-primary);
    color: #fff;
    border-color: var(--tmr-primary);
}

/* ── Results meta ───────────────────────────────────────────────────────────── */
.tmr-results-meta {
    font-size: .9rem;
    color: #64748b;
    margin-bottom: 1rem;
}
.tmr-no-results {
    padding: 2rem;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
    border-radius: var(--tmr-radius);
    border: var(--tmr-border);
}
.tmr-loading {
    color: #94a3b8;
    padding: 1.5rem;
    text-align: center;
}

/* ── Cards grid ─────────────────────────────────────────────────────────────── */
.tmr-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--tmr-gap);
    margin-bottom: 1.5rem;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.tmr-card {
    background: var(--tmr-card-bg);
    border: var(--tmr-border);
    border-radius: var(--tmr-radius);
    box-shadow: var(--tmr-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s;
}
.tmr-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }

.tmr-card-gallery {
    background: #f1f5f9;
}
.tmr-card-img-primary {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: #f8fafc;
    display: block;
}
.tmr-card-thumbnails {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #e2e8f0;
    flex-wrap: wrap;
}
.tmr-card-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity .12s;
}
.tmr-card-thumb:hover { opacity: .8; }

.tmr-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    flex: 1;
}
.tmr-card-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}
.tmr-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.tmr-badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--tmr-badge-bg);
    color: var(--tmr-badge-text);
}
.tmr-badge-era { background: #fef9c3; color: #713f12; }
.tmr-card-description {
    margin: 0;
    font-size: .9rem;
    color: #475569;
    line-height: 1.55;
}
.tmr-card-contact {
    margin-top: auto;
    padding-top: .75rem;
    border-top: var(--tmr-border);
    font-size: .875rem;
}
.tmr-contact-heading {
    margin: 0 0 .35rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    font-weight: 700;
}
.tmr-card-contact p { margin: .15rem 0; }
.tmr-card-contact a { color: var(--tmr-primary); }
.tmr-card-contact a:hover { text-decoration: underline; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.tmr-pagination {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.tmr-page-btn {
    padding: .35rem .75rem;
    border: var(--tmr-border);
    border-radius: var(--tmr-radius);
    background: #fff;
    cursor: pointer;
    font-size: .9rem;
    transition: background .12s;
}
.tmr-page-btn:hover,
.tmr-page-btn.tmr-page-active {
    background: var(--tmr-primary);
    color: #fff;
    border-color: var(--tmr-primary);
}
.tmr-page-btn:disabled { opacity: .4; cursor: default; }

/* ── Submission form ────────────────────────────────────────────────────────── */
.tmr-form { max-width: 760px; }
.tmr-fieldset {
    border: var(--tmr-border);
    border-radius: var(--tmr-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.tmr-legend {
    font-weight: 700;
    font-size: 1rem;
    padding: 0 .5rem;
    color: #1e293b;
}
.tmr-field { margin-bottom: 1rem; }
.tmr-field:last-child { margin-bottom: 0; }
.tmr-field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.tmr-field-row .tmr-field { flex: 1; min-width: 180px; }
.tmr-field-half { flex: 0 0 calc(50% - .5rem); }
.tmr-field-note {
    font-size: .85rem;
    color: #64748b;
    margin: 0 0 .75rem;
}
.tmr-field-required .tmr-label span { color: var(--tmr-error); }
.tmr-form-footer {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-top: .5rem;
}
.tmr-input-file {
    display: block;
    margin-top: .3rem;
}
.tmr-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}
.tmr-image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--tmr-radius);
    border: var(--tmr-border);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .tmr-results-grid { grid-template-columns: 1fr; }
    .tmr-search-bar   { flex-direction: column; }
    .tmr-filters      { flex-direction: column; }
    .tmr-form-footer  { flex-direction: column; align-items: flex-start; }
    .tmr-card-img-primary { height: 180px; }
}

/* ── Form instructions ──────────────────────────────────────────────────────── */
.tmr-instructions {
    background: #f8fafc;
    border-left: 3px solid var(--tmr-primary);
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: 0 var(--tmr-radius) var(--tmr-radius) 0;
    font-size: .9rem;
}
.tmr-instructions p { margin: 0 0 .4rem; }
.tmr-instructions p:last-child { margin-bottom: 0; }
.tmr-instructions ul { margin: .25rem 0 0 1.25rem; padding: 0; }
.tmr-instructions li { margin-bottom: .2rem; }
.tmr-instructions-warning { color: #92400e; font-weight: 600; }
.tmr-required-star { color: var(--tmr-error); font-weight: 700; }
.tmr-optional { font-size: .8rem; font-weight: 400; color: #94a3b8; }

/* ── Card: teaser tweaks ─────────────────────────────────────────────────────── */
.tmr-card-clickable {
    cursor: pointer;
    position: relative;
}
.tmr-card-clickable:focus-visible {
    outline: 3px solid var(--tmr-primary);
    outline-offset: 2px;
}
.tmr-card-no-img {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
}
.tmr-img-count {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .75rem;
    padding: .2rem .5rem;
    border-radius: 999px;
}
.tmr-card-cta {
    font-size: .8rem;
    color: var(--tmr-primary);
    margin: .5rem 0 0;
    font-weight: 600;
}

/* ── Modal overlay ───────────────────────────────────────────────────────────── */
.tmr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}
.tmr-modal-overlay[hidden] { display: none; }
body.tmr-modal-open { overflow: hidden; }

.tmr-modal-box {
    background: #fff;
    border-radius: var(--tmr-radius);
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: tmr-modal-in .18s ease;
}
@keyframes tmr-modal-in {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);   }
}

.tmr-modal-close {
    position: sticky;
    top: 0;
    float: right;
    margin: .75rem .75rem 0 0;
    width: 2.2rem;
    height: 2.2rem;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
}
.tmr-modal-close:hover { background: #e2e8f0; }

.tmr-modal-body { clear: both; }

/* ── Modal detail layout ─────────────────────────────────────────────────────── */
.tmr-modal-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 400px;
}
@media (max-width: 640px) {
    .tmr-modal-detail { grid-template-columns: 1fr; }
}

.tmr-modal-info {
    padding: 1.5rem;
    overflow-y: auto;
}
.tmr-modal-name {
    margin: 0 0 .25rem;
    font-size: 1.4rem;
    line-height: 1.2;
}
.tmr-modal-business {
    margin: 0 0 .75rem;
    color: #64748b;
    font-size: 1rem;
}
.tmr-modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1rem;
}
.tmr-modal-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}
.tmr-modal-section:first-of-type { margin-top: .5rem; border-top: none; padding-top: 0; }
.tmr-modal-section-heading {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #94a3b8;
    font-weight: 700;
    margin: 0 0 .5rem;
}
.tmr-modal-section p { margin: .2rem 0; }
.tmr-modal-section a { color: var(--tmr-primary); }
.tmr-modal-section a:hover { text-decoration: underline; }

/* ── Carousel ────────────────────────────────────────────────────────────────── */
.tmr-carousel {
    position: relative;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    border-radius: var(--tmr-radius) 0 0 var(--tmr-radius);
    overflow: hidden;
    outline: none;
}
@media (max-width: 640px) {
    .tmr-carousel { border-radius: var(--tmr-radius) var(--tmr-radius) 0 0; min-height: 260px; }
}
.tmr-carousel-stage {
    width: 100%;
    height: 100%;
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tmr-carousel-slide {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.tmr-carousel-slide.tmr-slide-active {
    display: flex;
}
.tmr-carousel-slide img {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 4px;
}
.tmr-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 2rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
    z-index: 2;
    line-height: 1;
}
.tmr-carousel-btn:hover { background: rgba(255,255,255,.3); }
.tmr-carousel-prev { left: .5rem; }
.tmr-carousel-next { right: .5rem; }
.tmr-carousel-dots {
    display: flex;
    gap: .4rem;
    padding: .5rem 0;
    z-index: 2;
}
.tmr-carousel-dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: rgba(255,255,255,.35);
    border: none;
    cursor: pointer;
    transition: background .12s;
    padding: 0;
}
.tmr-carousel-dot.tmr-dot-active,
.tmr-carousel-dot:hover { background: #fff; }
.tmr-carousel-counter {
    font-size: .75rem;
    color: rgba(255,255,255,.6);
    margin: 0 0 .5rem;
}

/* ── Field hint (description guidance) ──────────────────────────────────────── */
.tmr-field-hint {
    font-size: .85rem;
    color: #475569;
    background: #f8fafc;
    border-left: 3px solid #cbd5e1;
    padding: .5rem .75rem;
    margin: .25rem 0 .5rem;
    border-radius: 0 4px 4px 0;
    line-height: 1.55;
}
.tmr-field-hint em {
    font-style: normal;
    font-weight: 600;
    color: #1e293b;
}

/* ── Image upload: cumulative picker ────────────────────────────────────────── */

/* The real input is driven by the "Add Images" button */
.tmr-input-file {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.tmr-upload-controls {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .5rem;
}
.tmr-upload-controls .tmr-btn:disabled {
    opacity: .5;
    cursor: default;
}
.tmr-image-count {
    font-size: .85rem;
    color: #64748b;
}

.tmr-upload-tip {
    margin-top: .5rem !important;
    font-style: italic;
}

.tmr-upload-status {
    font-size: .85rem;
    color: #64748b;
    min-height: 1.2em;
    margin: .35rem 0 0;
}
.tmr-upload-warn { color: #92400e; font-weight: 600; }

.tmr-limit-note {
    margin-top: .6rem;
    color: #94a3b8;
    font-size: .8rem;
}

/* Thumbnail grid */
.tmr-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: .6rem;
}
.tmr-preview-item {
    position: relative;
    width: 96px;
    border: 1px solid #e2e8f0;
    border-radius: var(--tmr-radius);
    overflow: hidden;
    background: #f8fafc;
}
.tmr-preview-item:first-child {
    border-color: var(--tmr-primary);
}
.tmr-image-preview .tmr-preview-item img {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: cover;
    border: 0;
    border-radius: 0;
    margin: 0;
}
.tmr-preview-size {
    display: block;
    text-align: center;
    font-size: .7rem;
    color: #64748b;
    padding: .2rem;
    background: #f1f5f9;
}
.tmr-preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 1.35rem;
    height: 1.35rem;
    border: none;
    border-radius: 50%;
    background: rgba(15,23,42,.72);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .12s;
}
.tmr-preview-remove:hover { background: #dc2626; }

@media (max-width: 640px) {
    .tmr-preview-item,
    .tmr-image-preview .tmr-preview-item img { width: 80px; }
    .tmr-image-preview .tmr-preview-item img { height: 80px; }
}

/* ── Pre-form notice (already registered / contact ABANA) ───────────────────── */
.tmr-notice-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-left: 4px solid #d97706;
    border-radius: var(--tmr-radius);
    padding: .9rem 1.1rem;
    margin-bottom: 1.5rem;
    font-size: .92rem;
    line-height: 1.6;
}
.tmr-notice-box p { margin: 0 0 .4rem; }
.tmr-notice-box p:last-child { margin-bottom: 0; }
.tmr-notice-box a {
    color: #b45309;
    font-weight: 600;
    text-decoration: underline;
}
.tmr-notice-box a:hover { color: #92400e; }

/* ── Editorial-rights note above the submit button ──────────────────────────── */
.tmr-editorial-note {
    font-size: .85rem;
    color: #64748b;
    line-height: 1.6;
    padding: .75rem 1rem;
    background: #f8fafc;
    border-radius: var(--tmr-radius);
    border: 1px solid #e2e8f0;
    margin: 0 0 1.25rem;
}


/* ── Theme-proofing (v1.3.1) ───────────────────────────────────────────────────
 * Dark themes push their own text and background colors onto form fields and
 * buttons. These rules pin every field to a white box with dark text, and keep
 * the plugin's buttons readable, no matter what the theme does.
 */
.tmr-wrap input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.tmr-wrap select,
.tmr-wrap textarea,
.tmr-wrap .tmr-input,
.tmr-wrap .tmr-select,
.tmr-wrap .tmr-textarea {
    background-color: #ffffff !important;
    color: #222222 !important;
    -webkit-text-fill-color: #222222 !important;
    border: 1px solid #bbbbbb !important;
    color-scheme: light;
}
.tmr-wrap select option {
    background-color: #ffffff !important;
    color: #222222 !important;
}
.tmr-wrap input::placeholder,
.tmr-wrap textarea::placeholder {
    color: #888888 !important;
    -webkit-text-fill-color: #888888 !important;
    opacity: 1;
}
.tmr-wrap input:focus,
.tmr-wrap select:focus,
.tmr-wrap textarea:focus {
    border-color: #333333 !important;
    box-shadow: 0 0 0 3px rgba(51,51,51,.2) !important;
    outline: none;
}

/* Primary buttons: Search, Submit */
.tmr-wrap .tmr-btn-primary {
    background: #333333 !important;
    background-image: none !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
}
.tmr-wrap .tmr-btn-primary:hover,
.tmr-wrap .tmr-btn-primary:focus {
    background: #555555 !important;
    border-color: #555555 !important;
    color: #ffffff !important;
}

/* Secondary buttons: Reset, Add Images */
.tmr-wrap .tmr-btn-secondary {
    background: #f1f1f1 !important;
    background-image: none !important;
    color: #333333 !important;
    border: 1px solid #bbbbbb !important;
}
.tmr-wrap .tmr-btn-secondary:hover { background: #e2e2e2 !important; }

/* First-letter and page-number buttons */
.tmr-wrap .tmr-letter-btn,
.tmr-wrap .tmr-page-btn {
    background: #ffffff !important;
    background-image: none !important;
    color: #333333 !important;
    border: 1px solid #bbbbbb !important;
}
.tmr-wrap .tmr-letter-btn:hover,
.tmr-wrap .tmr-letter-btn.tmr-letter-active,
.tmr-wrap .tmr-page-btn:hover,
.tmr-wrap .tmr-page-btn.tmr-page-active {
    background: #333333 !important;
    color: #ffffff !important;
    border-color: #333333 !important;
}

/* Links on cards and in the detail pop-up */
.tmr-wrap .tmr-card-contact a,
.tmr-modal-overlay .tmr-modal-section a {
    color: #333333 !important;
    text-decoration: underline;
}
