/* ==========================================================
   OBRAS (Acuarelas) · diseño galería + modal
   Nota: base.css aplica `* { margin:0 !important; padding:0 !important }`,
   por eso aquí márgenes y paddings llevan !important.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400;1,500&display=swap');

:root {
  --ob-bg: #fbf8f4;
  --ob-paper: #fdfcfa;
  --ob-white: #ffffff;
  --ob-text: #1f1d1b;
  --ob-muted: #6f6b66;
  --ob-line: #e6ded4;
  --ob-shadow: 0 6px 22px rgba(60, 45, 30, .07);
  --ob-shadow-hover: 0 14px 34px rgba(60, 45, 30, .12);
  --ob-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --ob-sans: 'Inter', system-ui, sans-serif;
}

.obras {
  background: var(--ob-bg);
  padding-bottom: 72px !important;
}

/* ---------- Título ---------- */
.obras-head {
  text-align: center;
  padding: 40px 16px 0 !important;
}

.obras-title {
  font-family: var(--ob-serif);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1;
  color: var(--ob-text);
  letter-spacing: .5px;
}

.obras-rule {
  display: block;
  width: 48px;
  height: 1px;
  background: #bdb3a7;
  margin: 18px auto 16px !important;
}

.obras-sub {
  font-family: var(--ob-sans);
  font-size: 14px;
  letter-spacing: .28em;
  color: #4a4642;
}

/* ---------- Buscador ---------- */
.obras-search {
  position: relative;
  max-width: 660px;
  margin: 34px auto 26px !important;
  padding: 0 16px !important;
}

.obras-search__icon {
  position: absolute;
  left: 32px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  fill: none;
  stroke: #6f6b66;
  stroke-width: 1.4;
  pointer-events: none;
}

.obras-search input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 50px !important;
  border: 1px solid var(--ob-line);
  border-radius: 4px;
  background: var(--ob-white);
  font-family: var(--ob-sans);
  font-size: 14px;
  color: var(--ob-text);
  box-shadow: 0 2px 10px rgba(60, 45, 30, .05);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.obras-search input::placeholder { color: #9a948d; }

.obras-search input:focus {
  border-color: #cbb9a7;
  box-shadow: 0 2px 14px rgba(60, 45, 30, .09);
}

/* ---------- Grid ---------- */
.obras-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 30px;
  max-width: 1460px;
  margin: 0 auto !important;
  padding: 0 40px !important;
}

.obra-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  background: var(--ob-paper);
  border: 0;
  border-radius: 4px;
  box-shadow: var(--ob-shadow);
  cursor: pointer;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
  font: inherit;
  color: inherit;
}

.obra-card[hidden] { display: none; }
.obra-card:hover { transform: translateY(-3px); box-shadow: var(--ob-shadow-hover); }
.obra-card:focus-visible { outline: 2px solid #cbb9a7; outline-offset: 3px; }

.obra-card__img {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 230px;
  padding: 24px 24px 8px !important;
  background: var(--ob-white);
}

.obra-card__img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.obra-card__body {
  display: block;
  padding: 14px 26px 24px !important;
  background: var(--ob-white);
}

.obra-card__title {
  display: block;
  font-family: var(--ob-serif);
  font-style: italic;
  font-size: 27px;
  line-height: 1.2;
  color: var(--ob-text);
}

.obra-card__meta {
  display: block;
  margin-top: 8px !important;
  font-family: var(--ob-sans);
  font-size: 13px;
  letter-spacing: .18em;
  color: var(--ob-muted);
}

.obras-empty {
  text-align: center;
  margin-top: 30px !important;
  font-family: var(--ob-serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ob-muted);
}

/* ---------- Modal ---------- */
.obra-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px !important;
}

.obra-modal[hidden] { display: none; }

.obra-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(251, 248, 244, .45);
  animation: obFade .2s ease;
}

.obra-modal__card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--ob-white);
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(40, 30, 20, .28);
  overflow: hidden;
  animation: obPop .22s ease;
}

.obra-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px 18px 40px !important;
  background: var(--ob-paper);
  border-bottom: 1px solid #efe9e2;
}

.obra-modal__title {
  font-family: var(--ob-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  color: var(--ob-text);
}

.obra-modal__close {
  width: 36px;
  height: 36px;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.obra-modal__close svg,
.obra-modal__nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #3a3632;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.obra-modal__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  height: 52vh;
  max-height: 460px;
  padding: 24px 80px !important;
  background: var(--ob-white);
}

.obra-modal__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.obra-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #f4f1ed;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.obra-modal__nav:hover { background: #ebe5de; }
.obra-modal__nav--prev { left: 16px; }
.obra-modal__nav--next { right: 16px; }
.obra-modal__nav[hidden] { display: none; }

.obra-modal__info {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 24px !important;
  border-top: 1px solid #efe9e2;
  background: var(--ob-paper);
}

.obra-modal__cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 44px !important;
  font-family: var(--ob-serif);
  font-size: 19px;
  color: #3a3632;
  white-space: nowrap;
}

.obra-modal__cell + .obra-modal__cell { border-left: 1px solid #8f8880; }
.obra-modal__cell[hidden] { display: none; }

.obra-modal__cell svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #3a3632;
  stroke-width: 1.1;
  stroke-linejoin: round;
}

.obra-modal__price {
  font-size: 25px;
  font-weight: 500;
  color: var(--ob-text);
}

body.obra-modal-abierto { overflow: hidden; }

@keyframes obFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes obPop  { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .obras-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; padding: 0 24px !important; }
  .obra-modal__cell { padding: 0 24px !important; }
}

@media (max-width: 575px) {
  .obras-head { padding-top: 24px !important; }
  .obras-sub { font-size: 12px; letter-spacing: .18em; }
  .obras-grid { grid-template-columns: 1fr; padding: 0 16px !important; }
  .obra-card__img { height: 200px; }

  .obra-modal { padding: 12px !important; }
  .obra-modal__head { padding: 16px 14px 14px 20px !important; }
  .obra-modal__title { font-size: 27px; }
  .obra-modal__media { height: 42vh; padding: 16px 52px !important; }
  .obra-modal__nav { width: 38px; height: 38px; }
  .obra-modal__nav--prev { left: 8px; }
  .obra-modal__nav--next { right: 8px; }

  .obra-modal__info { flex-direction: column; gap: 12px; padding: 18px !important; }
  .obra-modal__cell { padding: 0 !important; }
  .obra-modal__cell + .obra-modal__cell { border-left: 0; }
}

/* ===== Obra vendida: etiqueta sobre la foto ===== */
.obra-card__img { position: relative; }
.obra-modal__foto {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  height: 100%;
}
/* Galería: texto discreto con línea fina */
.obra-vendido {
  position: absolute;
  top: 18px;
  left: 20px;
  padding: 0 0 6px !important;
  color: #8a7f74;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  pointer-events: none;
}
.obra-vendido::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: .6;
}

/* Modal: rectángulo oscuro */
.obra-vendido--modal {
  top: 20px;
  left: 24px;
  z-index: 1;
  padding: 5px 12px !important;
  background: rgba(31, 29, 27, .86);
  color: #fff;
  font-size: 12px;
  letter-spacing: .14em;
  border-radius: 2px;
}
.obra-vendido--modal::after { display: none; }
.obra-vendido[hidden] { display: none !important; }

@media (max-width: 640px) {
  .obra-vendido--modal { top: 10px; left: 12px; }
}
