/*
 * ======================================================
 * MODULO RUB - SINGLE Y LOOP
 * Estilos aislados para el CPT campos-rub.
 * ======================================================
 */

.rub-single,
.rub-loop {
    --rub-bg: #f5f7fb;
    --rub-card: #ffffff;
    --rub-ink: #102033;
    --rub-muted: #687386;
    --rub-line: #dce3ee;
    --rub-blue: #2563eb;
    --rub-green: #17a36b;
    --rub-red: #dc2626;
    --rub-soft-blue: #eaf1ff;
    --rub-soft-green: #e9f8f0;
    --rub-shadow: 0 18px 45px rgba(16, 32, 51, 0.09);
    box-sizing: border-box;
    color: var(--rub-ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rub-single *,
.rub-single *::before,
.rub-single *::after,
.rub-loop *,
.rub-loop *::before,
.rub-loop *::after {
    box-sizing: inherit;
}

/* ================= RUB SINGLE LAYOUT MODULE ================= */
.rub-single {
    min-height: 100vh;
    background: var(--rub-bg);
}

.rub-single__topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 0 32px;
    border-bottom: 1px solid var(--rub-line);
    background: rgba(255, 255, 255, 0.92);
    position: sticky;
    top: 0;
    z-index: 20;
}

.rub-single__brand {
    font-size: 18px;
    font-weight: 800;
}

.rub-single__brand b {
    color: var(--rub-blue);
}

.rub-single__crumb,
.rub-single__crumb-title {
    color: var(--rub-muted);
    font-size: 14px;
}

.rub-single__crumb-title {
    color: var(--rub-ink);
    font-weight: 700;
}

.rub-single__back {
    margin-left: auto;
    color: var(--rub-blue);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.rub-single__wrap {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.rub-single__layout {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.rub-single__sidebar {
    display: grid;
    gap: 18px;
}

.rub-single__card,
.rub-content {
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    background: var(--rub-card);
    box-shadow: var(--rub-shadow);
}

/* ================= RUB GALLERY MODULE ================= */
.rub-gallery {
    overflow: hidden;
}

.rub-gallery__stage {
    position: relative;
    min-height: 290px;
    background: #eef3f9;
}

.rub-gallery__badges {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.rub-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff;
    color: var(--rub-ink);
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(16, 32, 51, 0.13);
}

.rub-badge span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
}

.rub-badge--success {
    color: var(--rub-green);
}

.rub-badge--blue {
    color: var(--rub-blue);
}

.rub-gallery__main {
    display: block;
    width: 100%;
    height: 290px;
    object-fit: cover;
}

.rub-gallery__placeholder {
    display: grid;
    place-items: center;
    height: 290px;
    color: var(--rub-blue);
    font-size: 54px;
    font-weight: 900;
    background: linear-gradient(135deg, #edf4ff, #f8fafc);
}

.rub-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
}

.rub-tag {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.rub-tag--blue {
    background: var(--rub-soft-blue);
    color: var(--rub-blue);
}

.rub-tag--green {
    background: var(--rub-soft-green);
    color: var(--rub-green);
}

.rub-tag--neutral {
    background: #f0f3f7;
    color: var(--rub-muted);
}

/* ================= RUB IDENTITY MODULE ================= */
.rub-identity {
    padding: 20px;
}

.rub-identity__code {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--rub-line);
}

.rub-identity__code span {
    display: block;
    color: var(--rub-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.rub-identity__code strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
    line-height: 1.1;
}

.rub-identity__qr {
    display: grid !important;
    justify-items: center;
    gap: 8px;
    width: 132px;
    min-height: 154px;
    padding: 9px;
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    color: var(--rub-blue) !important;
    font-size: 12px !important;
    background: #f8fbff;
}

.rub-identity__qr-code {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
}

.rub-identity__qr-code canvas,
.rub-identity__qr-code img {
    display: block;
    width: 112px;
    height: 112px;
}

.rub-identity__qr-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: 6px;
    background: var(--rub-blue);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.rub-identity__qr-download:hover {
    background: #1d4ed8;
}

.rub-identity__title {
    margin: 20px 0 8px;
    font-size: 32px;
    line-height: 1.05;
    letter-spacing: 0;
}

.rub-identity__subtitle {
    margin: 0 0 18px;
    color: var(--rub-muted);
    font-size: 15px;
}

.rub-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.rub-specs__item {
    min-height: 72px;
    padding: 12px;
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.rub-specs__item dt {
    margin: 0 0 6px;
    color: var(--rub-muted);
    font-size: 12px;
    font-weight: 800;
}

.rub-specs__item dd {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 800;
}

.rub-specs__swatch {
    width: 14px;
    height: 14px;
    border: 1px solid rgba(16, 32, 51, 0.12);
    border-radius: 999px;
}

/* ================= RUB OWNER MODULE ================= */
.rub-owner {
    padding: 20px;
}

.rub-owner h2,
.rub-panel h2 {
    margin: 0 0 16px;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: 0;
}

.rub-owner__row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.rub-owner__avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--rub-blue);
    color: #fff;
    font-weight: 900;
}

.rub-owner strong,
.rub-owner span,
.rub-owner em {
    display: block;
}

.rub-owner strong {
    font-size: 15px;
}

.rub-owner span {
    margin-top: 3px;
    color: var(--rub-muted);
    font-size: 13px;
}

.rub-owner em {
    margin-top: 6px;
    color: var(--rub-green);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

/* ================= RUB CONTENT MODULE ================= */
.rub-content {
    overflow: hidden;
}

.rub-tabs {
    display: flex;
    gap: 6px;
    padding: 12px;
    border-bottom: 1px solid var(--rub-line);
    overflow-x: auto;
}

.rub-tabs__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 13px;
    border-radius: 8px;
    color: var(--rub-muted);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.rub-tabs__item:hover,
.rub-tabs__item.is-active {
    background: var(--rub-soft-blue);
    color: var(--rub-blue);
}

.rub-panel {
    padding: 24px;
    border-bottom: 1px solid var(--rub-line);
}

.rub-panel:last-child {
    border-bottom: 0;
}

.rub-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.rub-stats article {
    min-height: 86px;
    padding: 16px;
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.rub-stats span {
    display: block;
    color: var(--rub-muted);
    font-size: 12px;
    font-weight: 800;
}

.rub-stats strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
    line-height: 1;
}

.rub-alert {
    margin-bottom: 22px;
    padding: 16px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
}

.rub-alert strong,
.rub-alert p {
    margin: 0;
}

.rub-alert p {
    margin-top: 4px;
}

.rub-documents,
.rub-routes,
.rub-history,
.rub-timeline,
.rub-gallery-grid {
    display: grid;
    gap: 12px;
}

.rub-documents {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rub-document {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    min-height: 76px;
    padding: 14px;
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    color: var(--rub-ink);
    text-decoration: none;
    background: #fbfcfe;
}

.rub-document span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--rub-red);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    grid-row: span 2;
}

.rub-document strong,
.rub-document em {
    display: block;
    min-width: 0;
}

.rub-document strong {
    font-size: 14px;
}

.rub-document em {
    color: var(--rub-muted);
    font-size: 12px;
    font-style: normal;
}

/* ================= RUB RECORDS MODULE ================= */
.rub-timeline__item,
.rub-history__item,
.rub-route {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.rub-timeline__item time,
.rub-history__item time {
    color: var(--rub-muted);
    font-size: 13px;
    font-weight: 800;
}

.rub-timeline__item h3,
.rub-history__item h3,
.rub-route h3 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.25;
}

.rub-timeline__item p,
.rub-history__item p,
.rub-route p {
    margin: 0 0 6px;
    color: var(--rub-muted);
}

.rub-timeline__item strong {
    color: var(--rub-green);
}

.rub-history__item span {
    display: inline-flex;
    margin-bottom: 6px;
    color: var(--rub-blue);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.rub-route {
    grid-template-columns: 130px minmax(0, 1fr);
}

.rub-route__map {
    display: grid;
    place-items: center;
    min-height: 96px;
    border-radius: 8px;
    background: var(--rub-soft-blue);
    color: var(--rub-blue);
    font-size: 12px;
    font-weight: 900;
}

.rub-route ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.rub-route li {
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--rub-muted);
    font-size: 12px;
    font-weight: 800;
}

/* ================= RUB GALLERY GRID MODULE ================= */
.rub-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rub-gallery-grid a {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    background: #eef3f9;
}

.rub-gallery-grid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================= RUB LOOP MODULE ================= */
.rub-loop {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.rub-loop__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

.rub-loop__header h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0;
}

.rub-loop__header p {
    margin: 6px 0 0;
    color: var(--rub-muted);
}

.rub-loop__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.rub-loop__card {
    overflow: hidden;
    border: 1px solid var(--rub-line);
    border-radius: 8px;
    background: var(--rub-card);
    color: var(--rub-ink);
    text-decoration: none;
    box-shadow: var(--rub-shadow);
}

.rub-loop__image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #eef3f9;
}

.rub-loop__body {
    padding: 14px;
}

.rub-loop__body span {
    color: var(--rub-blue);
    font-size: 12px;
    font-weight: 900;
}

.rub-loop__body h3 {
    margin: 6px 0;
    font-size: 18px;
    line-height: 1.2;
}

.rub-loop__body p {
    margin: 0;
    color: var(--rub-muted);
    font-size: 13px;
}

/* ================= RUB SEARCH MODULE ================= */
.rub-search-page {
    --rub-bg: #f5f7fb;
    --rub-card: #ffffff;
    --rub-ink: #102033;
    --rub-muted: #687386;
    --rub-line: #dce3ee;
    --rub-blue: #2563eb;
    --rub-blue-dark: #1d4ed8;
    --rub-soft-blue: #eaf1ff;
    --rub-shadow: 0 18px 45px rgba(16, 32, 51, 0.09);
    background: var(--rub-bg);
    color: var(--rub-ink);
    min-height: 70vh;
}

.rub-search-hero {
    padding: clamp(48px, 8vw, 96px) clamp(16px, 4vw, 32px);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 32%),
        linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
}

.rub-search-hero__inner,
.rub-search-results__inner {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.rub-search-hero__eyebrow {
    display: inline-flex;
    margin-bottom: 14px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--rub-soft-blue);
    color: var(--rub-blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.rub-search-hero h1 {
    margin: 0 0 14px;
    color: var(--rub-ink);
    font-size: clamp(36px, 6vw, 68px);
    line-height: 0.98;
    letter-spacing: -0.05em;
}

.rub-search-hero p {
    max-width: 720px;
    margin: 0 0 24px;
    color: var(--rub-muted);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.65;
}

.rub-search-access,
.rub-search-form {
    max-width: 820px;
    border: 1px solid var(--rub-line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--rub-shadow);
    padding: clamp(18px, 3vw, 28px);
}

.rub-search-access p {
    margin-bottom: 18px;
    color: var(--rub-ink);
    font-weight: 700;
}

.rub-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rub-search-page a:focus-visible,
.rub-search-page button:focus-visible,
.rub-search-page input:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .35);
    outline-offset: 3px;
}

.rub-search-form label {
    display: block;
    margin-bottom: 10px;
    color: var(--rub-ink);
    font-weight: 900;
}

.rub-search-form__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.rub-search-form input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--rub-line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--rub-ink);
    padding: 0 18px;
    font-size: 16px;
}

.rub-search-results {
    padding: clamp(34px, 6vw, 72px) clamp(16px, 4vw, 32px);
}

.rub-search-results h2 {
    margin: 0 0 22px;
    color: var(--rub-ink);
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: -0.04em;
}

.rub-search-empty {
    border: 1px solid var(--rub-line);
    border-radius: 20px;
    background: var(--rub-card);
    color: var(--rub-muted);
    padding: 18px;
}

.rub-search-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.rub-search-card {
    overflow: hidden;
    border: 1px solid var(--rub-line);
    border-radius: 24px;
    background: var(--rub-card);
    box-shadow: var(--rub-shadow);
}

.rub-search-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #102033, #2563eb);
    color: #ffffff;
    font-weight: 900;
    text-decoration: none;
}

.rub-search-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rub-search-card__body {
    padding: 18px;
}

.rub-search-card__body > span {
    color: var(--rub-blue);
    font-size: 12px;
    font-weight: 900;
}

.rub-search-card__body h3 {
    margin: 8px 0;
    font-size: 20px;
    line-height: 1.2;
}

.rub-search-card__body h3 a {
    color: var(--rub-ink);
    text-decoration: none;
}

.rub-search-card__body h3 a:hover,
.rub-search-card__body h3 a:focus-visible {
    color: var(--rub-blue);
}

.rub-search-card__body p {
    margin: 0 0 16px;
    color: var(--rub-muted);
}

/* ================= RUB RESPONSIVE MODULE ================= */
@media (max-width: 960px) {
    .rub-single__layout {
        grid-template-columns: 1fr;
    }

    .rub-stats,
    .rub-loop__grid,
    .rub-search-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .rub-single__topbar {
        padding: 0 16px;
    }

    .rub-single__crumb,
    .rub-single__crumb-title {
        display: none;
    }

    .rub-single__wrap,
    .rub-loop {
        width: min(100% - 20px, 1180px);
        padding-top: 16px;
    }

    .rub-identity__title {
        font-size: 26px;
    }

    .rub-specs,
    .rub-stats,
    .rub-documents,
    .rub-gallery-grid,
    .rub-loop__grid,
    .rub-search-grid,
    .rub-search-form__row {
        grid-template-columns: 1fr;
    }

    .rub-panel {
        padding: 18px;
    }

    .rub-timeline__item,
    .rub-history__item,
    .rub-route {
        grid-template-columns: 1fr;
    }

    .rub-loop__header {
        display: block;
    }
}
