/* ================================================================
   ILC · Propuesta visual estilo Institut d'Estudis Catalans
   Paleta: rojo carmín #B8001E · negro editorial #121212
           gris claro #F5F4F2 · blanco #FFFFFF
   Tipografía: Source Serif 4 (editorial) + DM Sans (UI)
================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  color: #121212;
  background: #fff;
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
address { font-style: normal; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ================================================================
   VARIABLES
================================================================ */
:root {
  --red: #B8001E;
  --red-dark: #8C0016;
  --red-light: #fdf0f2;
  --black: #121212;
  --grey-dark: #3a3a3a;
  --grey-mid: #767676;
  --grey-light: #F5F4F2;
  --grey-border: #E2E0DB;
  --white: #ffffff;
  --serif: 'Source Serif 4', 'Times New Roman', serif;
  --sans: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* ================================================================
   BARRA SUPERIOR
================================================================ */
.topbar {
  background: var(--black);
  color: #fff;
  font-size: 0.76rem;
  font-family: var(--sans);
  padding: 0.5rem 0;
  letter-spacing: 0.02em;
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.topbar-left { color: #aaa; }
.topbar-nav a {
  color: #ccc;
  margin-left: 1.4rem;
  transition: color 0.2s;
}
.topbar-nav a:hover { color: #fff; }
.topbar-nav .lang {
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.15rem 0.5rem;
  margin-left: 1.4rem;
}

/* ================================================================
   CABECERA
================================================================ */
.main-header {
  background: var(--white);
  border-bottom: 1px solid var(--grey-border);
  padding: 1.4rem 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand-logo svg {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--black);
  letter-spacing: -0.01em;
}
.brand-text span {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
}
.search-wrap {
  display: flex;
  border: 1.5px solid var(--grey-border);
  overflow: hidden;
  transition: border-color 0.2s;
}
.search-wrap:focus-within { border-color: var(--red); }
.search-input {
  border: none;
  background: var(--grey-light);
  padding: 0.55rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  min-width: 200px;
  outline: none;
  color: var(--black);
}
.search-btn {
  border: none;
  background: var(--red);
  color: var(--white);
  padding: 0 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.2s;
}
.search-btn:hover { background: var(--red-dark); }

/* ================================================================
   NAVEGACIÓN PRINCIPAL
================================================================ */
.primary-nav {
  background: var(--white);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.nav-list {
  display: flex;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}
.nav-list li a {
  display: block;
  padding: 0.9rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey-dark);
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color 0.2s, border-color 0.2s;
}
.nav-list li a:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

/* ================================================================
   HERO
================================================================ */
.hero {
  position: relative;
  background: var(--black);
  overflow: hidden;
  min-height: clamp(480px, 70vh, 680px);
  display: flex;
  align-items: flex-end;
}
.hero-media {
  position: absolute;
  inset: 0;
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55) saturate(0.85);
}
.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(18,18,18,0.1) 0%,
    rgba(18,18,18,0.3) 40%,
    rgba(18,18,18,0.82) 100%
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  padding-bottom: 4rem;
  padding-top: 2rem;
  color: var(--white);
}
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}
.hero-tag {
  display: inline-block;
  background: var(--red);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.35rem 0.9rem;
}
.hero-year {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--white);
}
.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.78);
  line-height: 1.5;
  margin-bottom: 2rem;
  font-weight: 400;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.5);
}
.btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,0.1); }

.hero-scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  right: 2rem;
  color: rgba(255,255,255,0.5);
  z-index: 2;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ================================================================
   BARRA DE ESTADÍSTICAS
================================================================ */
.stats-bar {
  background: var(--red);
  color: var(--white);
  padding: 1.8rem 0;
}
.stats-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
}
.stat {
  text-align: center;
  padding: 0.5rem 2.5rem;
  flex: 1;
  min-width: 150px;
}
.stat-num {
  display: block;
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-num sup { font-size: 1rem; vertical-align: super; }
.stat-label {
  display: block;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
  margin-top: 0.3rem;
}
.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* ================================================================
   SECCIÓN BASE
================================================================ */
.section { padding: 5rem 0; }
.section--red { background: var(--red); }
.section--grey { background: var(--grey-light); }
.section--red-light { background: var(--red-light); }

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.6rem;
}
.section-label--light { color: rgba(255,255,255,0.7); }

.section-title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 600;
  color: var(--black);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.section-title--light { color: var(--white); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--grey-border);
}
.section--red .section-head { border-bottom-color: rgba(255,255,255,0.2); }

.link-more {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  transition: opacity 0.2s;
}
.link-more:hover { opacity: 0.7; }
.link-more--light { color: rgba(255,255,255,0.85); }
.link-more--light:hover { color: #fff; opacity: 1; }

/* ================================================================
   INTRO + NOTICIAS
================================================================ */
.intro-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 4rem;
  align-items: start;
}
@media (max-width: 900px) { .intro-grid { grid-template-columns: 1fr; gap: 3rem; } }

.intro-lead {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--black);
  margin-bottom: 1.2rem;
}
.intro-body {
  font-size: 1rem;
  color: var(--grey-dark);
  line-height: 1.7;
  margin-bottom: 1.8rem;
}
.intro-main .section-title { margin-bottom: 1.5rem; }

.link-more.inline {
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.news-panel {
  border: 1px solid var(--grey-border);
  background: var(--white);
}
.news-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.3rem;
  border-bottom: 2px solid var(--red);
  background: var(--red);
}
.news-panel-head h3 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
}
.news-panel-head a {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
}
.news-panel-head a:hover { color: #fff; }

.news-item {
  display: block;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--grey-border);
  transition: background 0.15s;
}
.news-item--last { border-bottom: none; }
.news-item:hover { background: #fafaf9; }
.news-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.news-cat {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  background: var(--red-light);
  padding: 0.15rem 0.5rem;
}
.news-date {
  font-size: 0.7rem;
  color: var(--grey-mid);
  letter-spacing: 0.05em;
}
.news-item h4 {
  font-family: var(--serif);
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--black);
  transition: color 0.2s;
}
.news-item:hover h4 { color: var(--red); }

/* ================================================================
   ÁREAS DE ACTIVIDAD
================================================================ */
.areas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5px;
  background: rgba(255,255,255,0.15);
}
.area-card {
  background: var(--white);
  overflow: hidden;
  transition: transform 0.3s;
}
.area-card:hover { transform: translateY(-4px); }
.area-thumb {
  position: relative;
  height: 200px;
  overflow: hidden;
}
.area-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.area-card:hover .area-thumb img { transform: scale(1.04); }
.area-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--red);
  color: var(--white);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
}
.area-body { padding: 1.5rem 1.5rem 1.8rem; }
.area-body h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.7rem;
  line-height: 1.3;
}
.area-body p {
  font-size: 0.88rem;
  color: var(--grey-dark);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.area-link {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}
.area-card:hover .area-link { text-decoration: underline; }

/* ================================================================
   SEDES
================================================================ */
.sedes-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3.5rem;
  align-items: center;
}
@media (max-width: 900px) { .sedes-layout { grid-template-columns: 1fr; } }

.sedes-photo {
  position: relative;
}
.sedes-photo img {
  width: 100%;
  height: 440px;
  object-fit: cover;
}
.sedes-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(18,18,18,0.78);
  color: #fff;
  padding: 1rem 1.3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sedes-photo-caption strong {
  font-family: var(--serif);
  font-size: 1rem;
}
.sedes-photo-caption span {
  font-size: 0.75rem;
  opacity: 0.75;
}

.sedes-intro {
  font-size: 1rem;
  color: var(--grey-dark);
  line-height: 1.7;
  margin-bottom: 1.8rem;
  font-family: var(--serif);
}
.sedes-items { margin-top: 0.5rem; }
.sede-item {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--grey-border);
  transition: background 0.15s;
}
.sede-item:last-child { border-bottom: 2px solid var(--red); }
.sede-icon {
  width: 36px;
  height: 36px;
  background: var(--red);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sede-item strong {
  display: block;
  font-family: var(--serif);
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.15rem;
}
.sede-item span {
  font-size: 0.78rem;
  color: var(--grey-mid);
  letter-spacing: 0.02em;
}

/* ================================================================
   PUBLICACIONES
================================================================ */
.pubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.5rem;
}
.pub-card {
  display: block;
  transition: transform 0.25s;
}
.pub-card:hover { transform: translateY(-4px); }
.pub-cover {
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 0.8rem;
}
.pub-cover--1 { background: linear-gradient(145deg, #8C0016 0%, #B8001E 100%); }
.pub-cover--2 { background: linear-gradient(145deg, #1a1a3e 0%, #2c2c5e 100%); }
.pub-cover--3 { background: linear-gradient(145deg, #1a3a1a 0%, #2e5a2e 100%); }
.pub-cover--4 { background: linear-gradient(145deg, #3a2a00 0%, #6b4e00 100%); }
.pub-cover--5 { background: linear-gradient(145deg, #2a1a2e 0%, #4a2a5a 100%); }

.pub-cover::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  background: var(--red);
}
.pub-colec {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  font-family: var(--sans);
}
.pub-titulo {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--white);
  font-style: italic;
}
.pub-year {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  font-family: var(--sans);
  letter-spacing: 0.08em;
}
.pub-meta strong {
  display: block;
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}
.pub-meta span {
  font-size: 0.78rem;
  color: var(--grey-mid);
}

/* ================================================================
   AGENDA
================================================================ */
.agenda-list {
  display: flex;
  flex-direction: column;
  border-top: 2px solid var(--red);
}
.evento {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--grey-border);
  transition: background 0.15s;
  cursor: pointer;
}
.evento:hover { background: #fafaf9; padding-left: 1rem; }
.evento-date {
  text-align: center;
  min-width: 60px;
  flex-shrink: 0;
}
.evento-day {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--red);
  line-height: 1;
}
.evento-month {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-top: 0.2rem;
}
.evento-body { flex: 1; }
.evento-tipo {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.35rem;
}
.evento-body h3 {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.evento-body p {
  font-size: 0.82rem;
  color: var(--grey-mid);
}
.evento-arrow {
  font-size: 1.2rem;
  color: var(--grey-border);
  transition: color 0.2s, transform 0.2s;
  margin-right: 0.5rem;
}
.evento:hover .evento-arrow { color: var(--red); transform: translateX(4px); }

/* ================================================================
   SERVICIOS INSTITUCIONALES
================================================================ */
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.servicio-card {
  background: var(--white);
  border: 1.5px solid var(--grey-border);
  padding: 2rem;
  transition: all 0.25s;
  display: block;
}
.servicio-card:hover {
  border-color: var(--red);
  box-shadow: 0 8px 24px rgba(184,0,30,0.1);
  transform: translateY(-2px);
}
.servicio-icon {
  color: var(--red);
  margin-bottom: 1.2rem;
}
.servicio-card h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.7rem;
  line-height: 1.3;
}
.servicio-card p {
  font-size: 0.9rem;
  color: var(--grey-dark);
  line-height: 1.6;
  margin-bottom: 1.2rem;
}
.servicio-link {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}

/* ================================================================
   FOOTER
================================================================ */
.site-footer {
  background: var(--black);
  color: #aaa;
  font-size: 0.88rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) { .footer-inner { grid-template-columns: 1fr; gap: 2.5rem; } }

.footer-brand { display: flex; flex-direction: column; gap: 1rem; }
.footer-logo { margin-bottom: 0.5rem; }
.footer-name {
  display: block;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}
.footer-sub {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
  margin-top: 0.25rem;
}
.footer-addr {
  font-size: 0.82rem;
  line-height: 1.8;
  color: #888;
}
.footer-addr a { color: #aaa; transition: color 0.2s; }
.footer-addr a:hover { color: var(--white); }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
@media (max-width: 600px) { .footer-cols { grid-template-columns: 1fr 1fr; } }

.footer-col h5 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #2a2a2a;
}
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col ul li a {
  font-size: 0.85rem;
  color: #888;
  transition: color 0.2s;
}
.footer-col ul li a:hover { color: var(--white); }

.footer-bottom {
  border-top: 1px solid #1e1e1e;
  padding: 1.2rem 0;
}
.footer-bottom-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #555;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 768px) {
  .hero-title { font-size: 2.4rem; }
  .hero-subtitle { display: none; }
  .stats-bar .stat { padding: 0.5rem 1.2rem; }
  .stat-divider { display: none; }
  .nav-list { overflow-x: auto; flex-wrap: nowrap; }
  .nav-list li a { padding: 0.9rem 0.7rem; white-space: nowrap; }
}
@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .hero-actions { flex-direction: column; }
  .btn { text-align: center; }
}
