/* =============================================
   DISEÑO — mundo frío, editorial, grid brutalista
   ============================================= */

body.diseno {
  background: var(--c-mint);
  color: var(--c-grey);
  font-family: var(--f-display);
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

/* ---------- Sub-nav top ---------- */
.d-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: var(--gutter);
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 12px;
}
.d-nav__back { font-weight: 500; }
.d-nav__back:hover { color: var(--d-accent); }
.d-nav__title { text-align: center; color: var(--d-mute); }
.d-nav__links { text-align: right; display: flex; gap: 1.5rem; justify-content: flex-end; }
.d-nav__links a { position: relative; }
.d-nav__links a:hover { color: var(--d-accent); }

/* ---------- Hero ---------- */
.d-hero {
  padding: clamp(90px, 12vh, 160px) var(--gutter) clamp(40px, 6vw, 80px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.d-hero__label {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--d-mute);
  display: flex;
  justify-content: space-between;
}
.d-hero__title {
  font-size: clamp(54px, 11vw, 180px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  font-weight: 600;
}
.d-hero__meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
  margin-top: 1.5rem;
  border-top: 1px dashed var(--d-line);
  padding-top: 1rem;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 12px;
}
.d-hero__meta span:first-child { color: var(--d-mute); display: block; margin-bottom: 4px; }

/* ---------- Grid de proyectos (legacy, sin uso) ---------- */
.d-grid {
  padding: var(--gutter);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
}

/* ---------- Tabla de proyectos (nuevo) ---------- */
.d-list-wrap {
  padding: 0 var(--gutter) clamp(40px, 6vw, 80px);
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
}

.d-list__head { display: none; }

/* Filtro por tags — estilo clou.ch/projekte */
.d-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4em 0.8em;
  padding: clamp(20px, 2.4vw, 36px) 0 clamp(20px, 2.4vw, 32px);
}
.d-filter__label {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.1;
  color: var(--c-grey);
}
.d-filter__chip {
  font-family: var(--f-serif);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.3;
  padding: 2px 12px;
  border: 1px solid var(--d-line);
  border-radius: 999px;
  background: transparent;
  color: var(--d-ink);
  cursor: pointer;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.d-filter__chip:hover {
  background: var(--c-purple);
  color: var(--c-mint);
  border-color: var(--c-purple);
}
.d-filter__chip.is-active {
  background: var(--c-grey);
  color: var(--c-bg);
  border-color: var(--c-grey);
}

.d-list {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  row-gap: clamp(70px, 10vh, 150px);
}

/* Cada proyecto es un bloque flex column. La imagen + pills + título + año
   van pegadas, sin espacio. La posición y el ancho del bloque dentro del grid
   de 12 columnas se controla con grid-column. */
.d-list__row {
  display: flex;
  flex-direction: column;
  padding: 0;
  grid-column: 2 / span 5;          /* default: bloque a la izquierda con 1 col de margen */
  position: relative;
}
.d-list__num { display: none; }
.d-list__arrow { display: none; }

/* Tamaño XL — bloque un punto más ancho, toca el borde para destacar */
.d-list__row[data-size="xl"] {
  grid-column: 1 / span 6;
}

/* Alternancia simple izquierda/derecha por filas pares — sin posición central.
   Las pares se bajan con margin-top para crear escalonado vertical. */
.d-list__row:nth-child(even) {
  grid-column: 7 / span 5;
  margin-top: clamp(80px, 14vh, 200px);
}
.d-list__row:nth-child(even)[data-size="xl"] {
  grid-column: 7 / span 6;
}

/* Imagen — proporción natural pero con altura máxima para imágenes verticales */
.d-list__thumb {
  order: 1;
  display: block;
  width: 100%;
  max-height: clamp(380px, 58vh, 640px);
  background: var(--d-ink);
  border: 1px solid var(--d-line);
  overflow: hidden;
  cursor: pointer;
}
.d-list__thumb img,
.d-list__thumb video {
  width: 100%;
  height: 100%;
  max-height: clamp(380px, 58vh, 640px);
  object-fit: cover;
  display: block;
}

/* row necesita ser contexto de posicionamiento para el preview */
.d-list__row {
  position: relative;
}

/* Preview flotante que sigue al ratón — slides del proyecto */
.d-list__preview {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(420px, 38vw, 680px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--d-ink);
  border: 1px solid var(--d-line);
  box-shadow: 0 30px 80px -20px rgba(72, 72, 72, 0.45);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 100;
  transform: translate3d(-9999px, -9999px, 0);
  will-change: transform;
}
.d-list__preview.is-visible {
  opacity: 1;
}
.d-list__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Tags (pills) — pegadas al borde inferior de la imagen */
.d-list__tags {
  order: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 10px;
}

/* Título — pegado debajo de las pills */
.d-list__title {
  order: 3;
  display: block;
  margin-top: 6px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(28px, 3vw, 56px);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}
@media (hover: hover) { .d-list__title:hover { color: var(--d-accent); } }

/* Título un poco más grande en proyectos XL */
.d-list__row[data-size="xl"] .d-list__title {
  font-size: clamp(36px, 4vw, 80px);
}

/* Año — pegado debajo del título */
.d-list__year {
  order: 4;
  display: block;
  margin-top: 4px;
  font-family: var(--f-serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(18px, 1.6vw, 26px);
  color: var(--d-mute);
  line-height: 1;
}
.d-pill {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(16px, 1.4vw, 22px);
  color: var(--d-ink);
  padding: 2px 14px;
  border: 1px solid var(--d-line);
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
}

.d-preview { display: none; }

/* =============================================
   MÓVIL — cards apiladas, simples. Anulamos el grid asimétrico de desktop.
   ============================================= */
@media (max-width: 760px) {
  /* Título de página a ancho completo en móvil */
  .d-hero__title {
    font-size: clamp(72px, 22vw, 140px);
  }

  /* Anular el grid de 12 columnas; volver a una sola columna apilada. */
  .d-list {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: clamp(16px, 2.5vh, 28px);
  }

  /* Resetear todas las reglas asimétricas y de escalonado del desktop */
  .d-list__row,
  .d-list__row:nth-child(even),
  .d-list__row:nth-child(odd),
  .d-list__row[data-size="xl"],
  .d-list__row:nth-child(even)[data-size="xl"] {
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: auto;
    margin-top: 0;
    padding: 0 0 clamp(12px, 2vh, 20px);
    text-decoration: none;
  }
  .d-list__row:hover { padding-left: 0; }

  /* Ocultar num y arrow en móvil */
  .d-list__num,
  .d-list__arrow { display: none; }

  /* Miniatura full-bleed: se escapa del padding de .d-list-wrap con margen negativo */
  .d-list__thumb {
    order: 1;
    display: block;
    width: auto;
    aspect-ratio: 16 / 9;
    max-height: none;
    overflow: hidden;
    background: var(--d-ink);
    border: 0;
    margin: 0 calc(-1 * var(--gutter)) 12px;
  }
  .d-list__thumb img,
  .d-list__thumb video {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    display: block;
  }

  .d-list__title {
    order: 2;
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(32px, 9vw, 56px);
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 0;
    max-width: none;
  }
  .d-list__year {
    order: 3;
    font-family: var(--f-serif);
    font-style: italic;
    font-size: clamp(14px, 4vw, 18px);
    color: var(--d-mute);
    margin-top: 2px;
    line-height: 1;
  }
  .d-list__tags {
    order: 4;
    margin-top: 10px;
    justify-content: flex-start;
  }
  /* Ocultar preview en móvil — no hay hover real */
  .d-list__preview { display: none !important; }
  .d-pill {
    font-family: var(--f-serif);
    font-size: 15px;
    padding: 2px 12px;
    line-height: 1.3;
  }

  .d-preview { display: none; }
}

.d-card {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  position: relative;
}
.d-card--sm { grid-column: span 3; }
.d-card--md { grid-column: span 4; }
.d-card--lg { grid-column: span 6; }
.d-card--xl { grid-column: span 8; }

.d-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.d-card__tags span {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 10px;
  padding: 3px 7px;
  border: 1px solid var(--d-line);
  color: var(--d-mute);
}

.d-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--d-ink);
  border: 1px solid var(--d-line);
}
.d-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.4s;
}
.d-card:hover .d-card__media img {
  transform: scale(1.04);
  filter: contrast(1.05);
}
.d-card__num {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--d-bg);
  color: var(--d-ink);
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--d-line);
  z-index: 2;
}
.d-card__ext {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--d-ink);
  color: var(--d-bg);
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  z-index: 2;
  transition: transform 0.3s, background 0.3s;
}
.d-card:hover .d-card__ext {
  background: var(--d-accent);
  transform: translate(4px, -4px);
}

.d-card__info {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: baseline;
}
.d-card__title {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.d-card__date {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--d-mute);
  white-space: nowrap;
}

/* ---------- Estados ---------- */
.d-status {
  grid-column: 1 / -1;
  padding: 4rem var(--gutter);
  text-align: center;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 13px;
  color: var(--d-mute);
}
.d-status .blink {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--d-accent);
  margin-right: 8px;
  animation: blink 1.2s infinite;
  vertical-align: middle;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.d-status--error {
  color: var(--d-ink);
}
.d-status--error a {
  color: var(--d-accent);
  border-bottom: 1px solid currentColor;
}

/* Skeleton */
.d-skeleton {
  grid-column: span 6;
}
.d-skeleton:nth-child(3n+1) { grid-column: span 8; }
.d-skeleton:nth-child(3n+2) { grid-column: span 4; }
.d-skeleton__media {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--d-line);
  background: linear-gradient(110deg, rgba(10,10,10,0.04) 8%, rgba(10,10,10,0.10) 18%, rgba(10,10,10,0.04) 33%);
  background-size: 200% 100%;
  animation: shine 1.4s linear infinite;
}
.d-skeleton__line {
  height: 14px;
  margin-top: 12px;
  width: 60%;
  background: rgba(10,10,10,0.08);
}
@keyframes shine {
  to { background-position-x: -200%; }
}

/* ---------- Footer ---------- */
.d-foot {
  padding: var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gutter);
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 12px;
}
.d-foot a { border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.d-foot a:hover { border-bottom-color: currentColor; }
.d-foot__col p { margin-top: 6px; color: var(--d-mute); text-transform: none; letter-spacing: 0; font-family: var(--f-display); font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .d-card--sm { grid-column: span 6; }
  .d-card--md { grid-column: span 6; }
  .d-card--lg { grid-column: span 12; }
  .d-card--xl { grid-column: span 12; }
}
@media (max-width: 700px) {
  .d-hero__meta { grid-template-columns: 1fr 1fr; }
  .d-card,
  .d-card--sm,
  .d-card--md,
  .d-card--lg,
  .d-card--xl { grid-column: span 12; }
  .d-skeleton,
  .d-skeleton:nth-child(3n+1),
  .d-skeleton:nth-child(3n+2) { grid-column: span 12; }
  .d-nav { grid-template-columns: 1fr 1fr; }
  .d-nav__title { display: none; }
  .d-foot { grid-template-columns: 1fr; }
}
