/* ===================================================
   CHIRINO CUSTOM TRUCKS — Trabajos Realizados
   archive-trabajo.php + homepage section
   =================================================== */

/* ============================================================
   HERO
   ============================================================ */
.trabajos-archive-page {
  background: var(--color-bg);
}

.trabajos-hero {
  background: linear-gradient(160deg, #111 0%, #1a1a1a 60%, #0f1f1f 100%);
  border-bottom: 1px solid var(--color-border);
  padding: 6rem 0 3.5rem;
  position: relative;
  overflow: hidden;
}

.trabajos-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 80% 50%, rgba(42,138,138,.10) 0%, transparent 70%);
  pointer-events: none;
}

.trabajos-hero .breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}
.trabajos-hero .breadcrumb a {
  color: var(--color-muted);
  transition: color var(--transition);
}
.trabajos-hero .breadcrumb a:hover { color: var(--color-primary-h); }
.trabajos-hero .breadcrumb span { color: var(--color-muted); }

.trabajos-hero .badge {
  display: inline-block;
  background: rgba(42,138,138,.15);
  border: 1px solid rgba(42,138,138,.35);
  color: var(--color-primary-h);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.trabajos-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.8rem, 6vw, 5rem);
  color: var(--color-heading);
  line-height: 1;
  margin-bottom: .75rem;
}
.trabajos-hero h1 em {
  font-style: normal;
  color: var(--color-primary-h);
}

.trabajos-hero-sub {
  color: var(--color-muted);
  font-size: 1rem;
  margin-bottom: .5rem;
}

.trabajos-hero-counter {
  color: var(--color-muted);
  font-size: .9rem;
  margin-top: .25rem;
}
.trabajos-hero-counter strong {
  color: var(--color-primary-h);
  font-size: 1.3rem;
  font-family: var(--font-heading);
  letter-spacing: .05em;
}

/* ============================================================
   FILTROS
   ============================================================ */
.trabajos-filtros-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: var(--header-h);
  z-index: 40;
}
/* Con admin bar visible: ajustar el sticky para que quede debajo del header */
body.admin-bar .trabajos-filtros-bar {
  top: calc(32px + var(--header-h));
}
@media screen and (max-width: 782px) {
  body.admin-bar .trabajos-filtros-bar {
    top: calc(46px + var(--header-h));
  }
}
@media screen and (max-width: 600px) {
  body.admin-bar .trabajos-filtros-bar {
    top: var(--header-h);
  }
}

.trabajos-filtros {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.trb-filtro {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 500;
  padding: .45rem 1.1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.trb-filtro:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-h);
}
.trb-filtro.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* ============================================================
   GRILLA
   ============================================================ */
.trabajos-body {
  padding: 3rem 0 4rem;
}

.trabajos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

/* ============================================================
   CARD
   ============================================================ */
.trb-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}
.trb-card:hover {
  transform: translateY(-4px);
  border-color: rgba(42,138,138,.45);
  box-shadow: 0 12px 36px rgba(0,0,0,.5);
}
.trb-card.trb-oculto {
  display: none;
}

/* ---- Imagen ---- */
.trb-card-img {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #111;
}
.trb-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
  display: block;
}
.trb-card:hover .trb-card-img img {
  transform: scale(1.05);
}

/* Placeholder cuando no hay imagen */
.trb-card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}
.trb-card-img-placeholder svg {
  width: 48px;
  height: 48px;
  color: #333;
}

/* Badge de categoría sobre la imagen */
.trb-badge {
  position: absolute;
  bottom: .6rem;
  left: .6rem;
  background: rgba(10,10,10,.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(42,138,138,.3);
  color: var(--color-primary-h);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .25rem .65rem;
  border-radius: 4px;
}

/* ---- Cuerpo ---- */
.trb-card-body {
  padding: 1rem 1.1rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.trb-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--color-heading);
  line-height: 1.1;
  margin: 0;
}

/* ---- Tags ---- */
.trb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.trb-tag {
  background: rgba(42,138,138,.12);
  border: 1px solid rgba(42,138,138,.25);
  color: var(--color-muted);
  font-size: .7rem;
  padding: .2rem .55rem;
  border-radius: 4px;
}

/* ---- Meta ---- */
.trb-card-meta {
  display: flex;
  gap: .85rem;
  flex-wrap: wrap;
  margin-top: auto;
}
.trb-meta-item {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  color: var(--color-muted);
}
.trb-meta-item svg {
  flex-shrink: 0;
  color: var(--color-primary);
}

/* ============================================================
   ESTADO VACÍO (filtro JS)
   ============================================================ */
.trabajos-empty {
  text-align: center;
  color: var(--color-muted);
  padding: 3rem 0;
  font-size: 1rem;
}

/* Estado vacío cuando no hay posts en absoluto */
.trabajos-empty-full {
  text-align: center;
  color: var(--color-muted);
  padding: 5rem 0;
}

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.trabajos-pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}
.trabajos-pagination ul {
  display: flex;
  gap: .4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.trabajos-pagination li a,
.trabajos-pagination li span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: .88rem;
  background: var(--color-surface);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  text-decoration: none;
  white-space: nowrap;
  padding: 0 .75rem;
  width: auto;
  min-width: 2.4rem;
}
.trabajos-pagination li a:hover {
  background: rgba(42,138,138,.15);
  border-color: var(--color-primary);
  color: var(--color-primary-h);
}
.trabajos-pagination li .current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
}

/* ============================================================
   CARD — LINK INVISIBLE (cubre toda la card)
   ============================================================ */
.trb-card {
  position: relative; /* ya estaba, confirmar */
}
.trb-card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: var(--radius-lg);
}

/* ============================================================
   SINGLE TRABAJO — HERO
   ============================================================ */
.trabajo-single-page {
  background: var(--color-bg);
}

.trb-single-hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  padding-bottom: 4rem;
  overflow: hidden;
}

.trb-single-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  filter: brightness(.7);
}

.trb-single-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.3) 60%, transparent 100%);
}

.trb-single-hero-inner {
  position: relative;
  z-index: 2;
}

.trb-single-crumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: rgba(255,255,255,.6);
  margin-bottom: 1.25rem;
}
.trb-single-crumb a { color: rgba(255,255,255,.6); }
.trb-single-crumb a:hover { color: #fff; }
.trb-single-crumb span { color: rgba(255,255,255,.4); }

.trb-single-hero-badges {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.trb-single-year {
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  font-weight: 600;
}

.trb-single-title {
  font-family: var(--font-heading);
  font-size: clamp(2.6rem, 6vw, 5rem);
  color: #fff;
  line-height: 1;
  margin-bottom: 1rem;
}

.trb-single-hero-sub {
  color: rgba(255,255,255,.75);
  font-size: 1.05rem;
  max-width: 600px;
  line-height: 1.55;
}

/* ============================================================
   SINGLE TRABAJO — CUERPO
   ============================================================ */
.trb-single-body {
  padding: 4rem 0;
}

.trb-single-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 3rem;
  align-items: start;
}

/* Label de sección */
.trb-section-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-primary-h);
  margin-bottom: .6rem;
}

/* Contenido de la historia */
.trb-story-p {
  color: var(--color-text);
  line-height: 1.75;
  margin-bottom: 1.1rem;
  font-size: 1.02rem;
}

.trb-story-figure {
  margin: 1.5rem 0 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.trb-story-figure img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  display: block;
}

/* ============================================================
   SIDEBAR CARDS
   ============================================================ */
.trb-single-aside {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.trb-aside-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
}

.trb-aside-card-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--color-heading);
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--color-border);
}

/* Specs dl */
.trb-specs-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.trb-specs-list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
}
.trb-specs-list dt {
  font-size: .8rem;
  color: var(--color-muted);
  white-space: nowrap;
}
.trb-specs-list dd {
  font-size: .88rem;
  color: var(--color-text);
  font-weight: 600;
  text-align: right;
}

/* CTA aside */
.trb-aside-cta {
  text-align: center;
  background: rgba(42,138,138,.08);
  border-color: rgba(42,138,138,.3);
}
.trb-aside-cta p {
  font-size: .88rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}
.trb-aside-cta .btn {
  width: 100%;
  justify-content: center;
}

/* ============================================================
   SINGLE — GALERÍA
   ============================================================ */
.trb-single-gallery {
  padding: 3rem 0 4rem;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.trb-gallery-head {
  margin-bottom: 2rem;
}
.trb-gallery-head h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-heading);
  margin-bottom: .4rem;
}
.trb-gallery-head p {
  color: var(--color-muted);
  font-size: .95rem;
}

/* ============================================================
   SINGLE — CTA FINAL
   ============================================================ */
.trb-single-cta-final {
  padding: 5rem 0;
  text-align: center;
  background: linear-gradient(135deg, #0f1f1f 0%, #0a0a0a 100%);
  border-top: 1px solid var(--color-border);
}
.trb-single-cta-final h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--color-heading);
  margin-bottom: .75rem;
}
.trb-single-cta-final p {
  color: var(--color-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.trb-cta-final-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .trabajos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .trabajos-hero {
    padding: 5rem 0 2.5rem;
  }
  .trabajos-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .trabajos-filtros-bar {
    top: 0;
  }
  .trb-card-title {
    font-size: 1.1rem;
  }
}

/* Single responsive */
@media (max-width: 900px) {
  .trb-single-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .trb-single-aside {
    /* Sidebar debajo del contenido en mobile */
  }
  .trb-single-hero {
    min-height: 55vh;
    padding-bottom: 2.5rem;
  }
  .trb-story-figure img { height: 240px; }
}
@media (max-width: 480px) {
  .trb-cta-final-buttons { flex-direction: column; align-items: center; }
  .trb-cta-final-buttons .btn { width: 100%; justify-content: center; }
  .trb-single-body { padding: 2.5rem 0; }
}
