/* ═══════════════════════════════════════════════════
   Variables
   ═══════════════════════════════════════════════════ */
:root {
  --bg:            #0D1018;
  --card-bg:       #1C1D23;
  --text-primary:  #F2F2F2;
  --text-secondary: #ADB0B6;
  --accent:        #7DA0D6;
  --border:        #2E3038;
  --number-color:  #262830;
  --radius:        28px;
}

/* ═══════════════════════════════════════════════════
   Reset
   ═══════════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════
   Base
     Background texture: fondo.png
   ═══════════════════════════════════════════════════ */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  background-image: url('fondo.png');
  background-repeat: repeat;
  background-size: auto;
  background-position: 50% 0;
  color: var(--text-primary);
  line-height: 1.75;
  font-weight: 400;
  padding: 0 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════ */
header {
  max-width: 800px;
  margin: 4.5rem auto 4rem;
  width: 100%;
  text-align: center;
}

header h1 {
  font-weight: 300;
  font-size: 1.5rem;
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════
   Main / Catalog container
   ═══════════════════════════════════════════════════ */
main {
  flex: 1;
}

#catalog {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  counter-reset: publication;
}

/* ═══════════════════════════════════════════════════
   Item — base card
     Subtle internal radial gradient for depth
   ═══════════════════════════════════════════════════ */
.item {
  position: relative;
  background:
    radial-gradient(
      ellipse 110% 80% at 50% 35%,
      rgba(125, 160, 214, 0.025) 0%,
      transparent 80%
    ),
    var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 3rem 3.25rem;
  margin-bottom: 2.5rem;
  width: 88%;
  counter-increment: publication;
  transition: border-color 0.5s ease, background 0.5s ease;
}

.item:last-child {
  margin-bottom: 0;
}

.item:hover {
  border-color: #38424F;
  background:
    radial-gradient(
      ellipse 110% 80% at 50% 35%,
      rgba(125, 160, 214, 0.045) 0%,
      transparent 80%
    ),
    var(--card-bg);
}

/* ═══════════════════════════════════════════════════
   Alternating rhythm
   ═══════════════════════════════════════════════════ */
.item-left {
  margin-left: 0;
  margin-right: auto;
  text-align: left;
}

.item-right {
  margin-right: 0;
  margin-left: auto;
  text-align: right;
}

/* ═══════════════════════════════════════════════════
   Publication number (CSS counter)
     Large, architectural — extends beyond card boundary
   ═══════════════════════════════════════════════════ */
.item::before {
  content: counter(publication);
  position: absolute;
  font-size: 8rem;
  font-weight: 200;
  line-height: 1;
  color: var(--number-color);
  opacity: 0.6;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  user-select: none;
  transition: opacity 0.5s ease, color 0.5s ease;
}

.item-left::before {
  top: -1.2rem;
  left: -0.5rem;
}

.item-right::before {
  top: -1.2rem;
  right: -0.5rem;
}

.item:hover::before {
  opacity: 0.85;
  color: #303030;
}

/* ═══════════════════════════════════════════════════
   Title
   ═══════════════════════════════════════════════════ */
.item-title {
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  max-width: 92%;
  position: relative;
  z-index: 1;
}

.item-right .item-title {
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════
   Type · Year
   ═══════════════════════════════════════════════════ */
.item-type-year {
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════
   Compiler
   ═══════════════════════════════════════════════════ */
.item-compiler {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════
   Authors
   ═══════════════════════════════════════════════════ */
.item-authors {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.65;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════
   LEER link — accent color on interactive elements only
   ═══════════════════════════════════════════════════ */
.btn-leer {
  display: inline-block;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 0.35rem 0;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
  position: relative;
  z-index: 1;
}

/* Underline that subtly appears on hover */
.btn-leer::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
  opacity: 0.6;
}

.item-right .btn-leer::after {
  transform-origin: right;
}

.btn-leer:hover::after,
.btn-leer:focus-visible::after {
  transform: scaleX(1);
}

.btn-leer:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
}

/* Override any .item-left / .item-right button styles */
.item-left .btn-leer,
.item-right .btn-leer {
  background: none;
  color: var(--accent);
}

.item-left .btn-leer:hover,
.item-right .btn-leer:hover,
.item-left .btn-leer:focus-visible,
.item-right .btn-leer:focus-visible {
  background: none;
}

/* ═══════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════ */
footer {
  max-width: 800px;
  margin: 4rem auto 2rem;
  width: 100%;
  text-align: center;
}

footer p {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════
   Loading & Error States
   ═══════════════════════════════════════════════════ */
.loading,
.error {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 5rem 0;
  font-weight: 400;
}

.error {
  color: #C76A6A;
}

/* ═══════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════ */  @media (max-width: 700px) {
  body {
    padding: 0 1rem;
  }

  header {
    margin: 2.5rem auto 2.5rem;
  }

  header h1 {
    font-size: 1.1rem;
  }

  .item {
    width: 100%;
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
  }

  .item-left,
  .item-right {
    margin-left: 0;
    margin-right: 0;
    text-align: left;
  }

  .item::before {
    font-size: 4.5rem;
    opacity: 0.4;
  }

  .item-left::before {
    top: -0.8rem;
    left: 0.5rem;
  }

  .item-right::before {
    top: -0.8rem;
    right: auto;
    left: 0.5rem;
  }

  .item-title {
    font-size: 1.1rem;
    max-width: 100%;
  }

  .item-right .item-title {
    margin-left: 0;
  }

  .item-right .btn-leer::after {
    transform-origin: left;
  }
}

@media (min-width: 1200px) {
  html {
    font-size: 17px;
  }
}
