:root {
  --serif: "Times New Roman", Times, serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
}

body {
  font-family: var(--serif);
  font-size: 13px;
  color: #000;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p { margin: 0; }

/* ---------- Texto fijo en el centro ---------- */
.intro {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  mix-blend-mode: difference;
  white-space: nowrap;
  text-align: center;
  font-size: 13px;
  line-height: 1.1em;
  color: #ffd6f7;
}

.intro a {
  color: #ffd6f7;
  text-decoration: none;
  cursor: pointer;
}

.intro a:hover { color: #ff1c91; }

/* ---------- Rejilla ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  min-height: 100vh;
}

.project { width: 100%; }

.cover {
  width: 100%;
  aspect-ratio: 4 / 5;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* Título que sigue al cursor (solo escritorio) */
.tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  padding: 6px 14px;
  background: #fff;
  color: #4c4c4c;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  opacity: 0;
  transition: opacity 0.15s;
  will-change: transform;
}

.tip.on { opacity: 1; }

/* Título bajo la portada (solo móvil) */
.project-title {
  display: none;
  margin-top: 12px;
  text-align: center;
  width: 100%;
}

/* Tablet: 2 columnas */
@media (min-width: 810px) and (max-width: 1199.98px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .project { order: var(--tablet); }
}

/* Teléfono: 1 columna */
@media (max-width: 809.98px) {
  .gallery {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 25px;
  }
}

/* Comportamiento "móvil" del componente (≤ 768 px) */
@media (max-width: 768px) {
  .project-title { display: block; }
  .cover img { pointer-events: auto; }
}

/* ---------- Ventana inferior ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-height: 100vh;
  padding: 15px;
  background: #fff;
  color: #000;
  font-size: 13px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  transform: translateY(100%);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet.in { transform: translateY(0); }

.sheet.is-mobile {
  max-height: 85vh;
  padding: 24px 7.5px;
}

.close-row {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
  padding-bottom: 24px;
}

.close {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.2s ease;
}

.close:hover { color: #808080; }

/* Escritorio: 3 columnas (info / descripción / archivos) */
.grid {
  display: grid;
  grid-template-columns: 15fr 51fr 34fr;
  gap: 15px;
  width: 100%;
  flex: 1;
  align-items: stretch;
  overflow: hidden;
}

.cell {
  position: relative;
  width: 100%;
  height: 100%;
}

.scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding-right: 8px;
  white-space: pre-wrap;
}

.col-media {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.viewer {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f5f5f5;
  cursor: e-resize;
}

.media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.meta {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: flex-start;
  padding-top: 16px;
}

.counter { white-space: nowrap; }
.caption { white-space: pre-wrap; }

/* Móvil: todo en una columna con scroll */
.m-col {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  padding-bottom: 40px;
  overflow-y: auto;
}

.m-text {
  width: 100%;
  white-space: pre-wrap;
}

.m-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.m-items .viewer { cursor: default; }
.m-items .media { pointer-events: auto; }
.m-caption { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .sheet { transition-duration: 0.01s; }
}
