:root {
  color-scheme: light;
  --ink: #0b1c46;
  --tile-bg: transparent;
  --header-height: 126px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: #fff; }
a, button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.skip-link { position: absolute; z-index: 10; top: -80px; left: 12px; padding: 13px 18px; color: #fff; background: #0b1c46; }
.skip-link:focus { top: 10px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.site-header {
  min-height: var(--header-height);
  padding: 11px clamp(20px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(13px, 2vw, 30px);
  background: #fff;
}
.institutional-branding {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.8vw, 24px);
  min-width: 0;
  flex: 0 1 auto;
}
.government-brand, .european-funds-brand { flex: 0 1 auto; min-width: 0; }
.government-logo { display: block; width: clamp(144px, 13.5vw, 192px); max-width: 100%; height: auto; }
.funds-logo { display: block; width: clamp(215px, 21vw, 302px); max-width: 100%; height: auto; }
.brand-divider, .header-divider {
  display: block; width: 1.5px; height: 55px; background: #1d3051;
  flex: 0 0 auto;
}
.header-divider { margin-left: auto; }
.city-brand { flex: 0 1 286px; display: flex; align-items: center; min-width: 175px; }
.city-brand img { width: 100%; max-width: 286px; height: auto; display: block; }
.city-brand:focus-visible { outline: 3px solid #165ad6; outline-offset: 7px; }
.eu-flag { display: block; width: clamp(67px, 7vw, 90px); height: auto; flex: 0 0 auto; margin-left: auto; }

.program-grid {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto;
}
.program {
  --tile-bg: #0640a0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 285px;
  gap: clamp(15px, 2vw, 26px);
  padding: clamp(18px, 2.1vw, 30px);
  background: var(--tile-bg);
  color: white;
  text-decoration: none;
  transition: filter .22s ease;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
}
.program--feder, .program--fse { cursor: pointer; }
.program[aria-expanded="true"] .program__plus { transform: rotate(45deg); }
.program[aria-expanded="true"] { filter: brightness(1.06); }
.program::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(150deg, rgb(255 255 255 / 4%) 0%, transparent 44%, rgb(0 0 0 / 8%) 100%);
  pointer-events: none;
}
.program--feder { --tile-bg: #073e98; }
.program--fse { --tile-bg: #d0392e; }
.program--erasmus { --tile-bg: #00818a; }
.program--next { --tile-bg: #a66800; }
.program--agenda { --tile-bg: #6646a5; }
.program--empresarial { --tile-bg: #e7eead; color: #152223; }
.program__icon--empresarial { display: block; object-fit: contain; object-position: left center; }
.program__title--two-lines { font-size: clamp(29px, 3.1vw, 50px); line-height: .96; }
.program__title--empresarial { font-size: clamp(24px, 2.7vw, 42px); letter-spacing: -.048em; line-height: .97; }

.program__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.program__icon { width: clamp(55px, 5.1vw, 86px); height: clamp(55px, 5.1vw, 86px); flex: 0 1 auto; transition: transform .25s ease; }
.program__more { margin-top: 0; white-space: nowrap; display: flex; align-items: center; gap: 9px; font-size: clamp(12px, 1.15vw, 18px); font-weight: 700; }
.program__plus { font-size: 1.9em; font-weight: 300; line-height: .7; transition: transform .25s ease; }
.program__details { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(8px, 1vw, 14px); }
.program__title { display: block; font-size: clamp(29px, 3.45vw, 56px); font-weight: 800; line-height: .99; letter-spacing: -.055em; }
.program__description { font-size: clamp(14px, 1.25vw, 21px); line-height: 1.28; font-weight: 400; }
.program__title--stacked { font-size: clamp(26px, 2.8vw, 47px); line-height: .93; letter-spacing: -.05em; }
.program:hover { filter: brightness(1.075); }
.program:hover .program__icon { transform: translateY(-4px); }
.program:hover .program__plus { transform: rotate(90deg); }
.program:focus-visible { z-index: 2; outline: 5px solid #111; outline-offset: -8px; }


/* Paneles desplegables FEDER y FSE+, sólo uno abierto a la vez. */
.fund-subprograms {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 22px clamp(18px, 3vw, 42px) 28px;
  background: #eef5ff;
  border-top: 4px solid #073e98;
  border-bottom: 1px solid #cadbf4;
  color: #142d55;
}
.fund-subprograms--fse {
  background: #fff3ef;
  border-top-color: #d0392e;
  border-bottom-color: #f2c6ba;
  color: #66251d;
}
.fund-subprograms--fse .fund-subprograms__eyebrow { color: #965348; }
.fund-subprograms--fse .fund-subprograms__close { color: #66251d; border-color: #e4a99e; }
.fund-subprograms--fse .fund-option { border-left-color: #d0392e; color: #66251d; }
.fund-subprograms--fse .fund-option:hover { background: #fffaf9; }
.fund-subprograms--fse .fund-option:focus-visible,
.fund-subprograms--fse .fund-subprograms__close:focus-visible { outline-color: #b42f24; }
.fund-option--pending {
  background: #f7f0ee;
  box-shadow: none;
  border-left-color: #c5a8a1 !important;
  color: #745e59 !important;
  cursor: default;
}
.fund-option--pending:hover { background: #f7f0ee !important; transform: none; }
.fund-option__status {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 5px 9px;
  border: 1px solid #d5bdb6;
  border-radius: 20px;
  font-weight: 700;
  font-size: clamp(10px, 1.1vw, 13px);
  white-space: nowrap;
}
.fund-subprograms__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 17px;
}
.fund-subprograms__eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #526f9e; }
.fund-subprograms h2 { margin: 5px 0 0; font-size: clamp(19px, 2.2vw, 28px); line-height: 1.2; }
.fund-subprograms__close { border: 1px solid #aec4e4; border-radius: 5px; padding: 7px 12px; background: #fff; color: #173760; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.fund-subprograms__close span { font-size: 21px; vertical-align: -1px; padding-left: 6px; }
.fund-subprograms__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(11px, 2vw, 23px); }
.fund-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 7px 12px;
  min-height: 110px;
  padding: clamp(15px, 2vw, 22px);
  border-left: 5px solid #0c57b2;
  border-radius: 3px;
  background: #fff;
  color: #173760;
  text-decoration: none;
  box-shadow: 0 3px 12px rgb(23 55 96 / 8%);
  transition: background .2s ease, transform .2s ease;
}
.fund-option__label { font-size: clamp(22px, 2.6vw, 32px); font-weight: 800; grid-column: 1; }
.fund-option__period { grid-column: 1; font-size: clamp(12px, 1.2vw, 15px); line-height: 1.4; }
.fund-option__arrow { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 25px; }
.fund-option:hover { background: #f8fbff; transform: translateY(-2px); }
.fund-option:focus-visible, .fund-subprograms__close:focus-visible { outline: 3px solid #073e98; outline-offset: 3px; }

.europa-footer {
  padding: clamp(22px, 2.4vw, 34px) 16px;
  text-align: center;
  background: #fff;
}
.europa-footer p {
  margin: 0;
  font-size: clamp(24px, 2.7vw, 36px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.15;
  color: var(--ink);
}

@media (max-width: 920px) {
  :root { --header-height: 158px; }
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "instit flag" "city city";
    gap: 7px 20px;
    min-height: var(--header-height);
    padding: 13px 25px;
  }
  .institutional-branding { grid-area: instit; }
  .government-logo { width: clamp(135px, 19vw, 172px); }
  .funds-logo { width: clamp(205px, 30vw, 270px); }
  .header-divider { display: none; }
  .city-brand { grid-area: city; width: 250px; }
  .eu-flag { grid-area: flag; width: 76px; justify-self: end; }
  .program-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
  }
  .program { min-height: 265px; padding: clamp(20px, 3vw, 30px); gap: 20px; }
  .program__icon { width: clamp(60px, 8vw, 90px); height: clamp(60px, 8vw, 90px); }
  .program__title { font-size: clamp(38px, 6vw, 66px); }
  .program__title--stacked { font-size: clamp(34px, 5.2vw, 58px); }
  .program__title--two-lines { font-size: clamp(34px, 5.2vw, 58px); }
  .program__title--empresarial { font-size: clamp(28px, 4.7vw, 48px); }
  .program__description { font-size: clamp(16px, 2.2vw, 23px); }
  .program__more { font-size: clamp(13px, 1.8vw, 17px); }
}
@media (max-width: 600px) {
  :root { --header-height: auto; }
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "instit instit" "city flag";
    gap: 10px 12px;
    min-height: 0;
    padding: 12px 17px;
  }
  .institutional-branding { gap: 10px; }
  .brand-divider { display: none; }
  .government-logo { width: clamp(106px, 31vw, 150px); }
  .funds-logo { width: clamp(140px, 47vw, 235px); }
  .city-brand { width: min(225px, 100%); min-width: 0; }
  .eu-flag { width: 61px; margin-left: auto; }
  .program-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
  }
  .program { min-height: 215px; padding: clamp(12px, 3.7vw, 22px); gap: 17px; }
  .program__top { gap: 5px; }
  .program__icon { width: clamp(40px, 11vw, 62px); height: clamp(40px, 11vw, 62px); }
  .program__title { font-size: clamp(21px, 6.25vw, 36px); letter-spacing: -.045em; }
  .program__title--stacked { font-size: clamp(19px, 5.2vw, 32px); }
  .program__title--two-lines { font-size: clamp(21px, 5.9vw, 34px); }
  .program__title--empresarial { font-size: clamp(16px, 4.5vw, 25px); }
  .program__description { font-size: clamp(11.5px, 3.15vw, 16px); line-height: 1.25; }
  .program__more { font-size: clamp(10px, 2.8vw, 13px); gap: 4px; }
  .program__plus { font-size: 26px; }
  .fund-subprograms { padding: 18px 15px 20px; }
  .fund-subprograms__heading { align-items: center; gap: 8px; }
  .fund-subprograms__eyebrow { font-size: 10px; }
  .fund-subprograms h2 { font-size: 18px; }
  .fund-subprograms__close { padding: 5px 8px; font-size: 12px; }
  .fund-subprograms__links { gap: 10px; }
  .fund-option { padding: 12px; border-left-width: 4px; min-height: 112px; gap: 6px; }
  .fund-option__label { font-size: clamp(20px, 5.3vw, 25px); }
  .fund-option__period { font-size: 12px; }
  .fund-option__arrow { font-size: 18px; }
  .fund-option--pending { grid-template-columns: minmax(0, 1fr); }
  .fund-option__status { grid-column: 1; grid-row: auto; justify-self: start; }
  .europa-footer { padding: 23px 12px; }
  .europa-footer p { font-size: clamp(22px, 6vw, 30px); }
}
@media (max-width: 420px) {
  .program__more { font-size: 0; }
  .program__plus { font-size: 27px; }
}
@media (max-width: 350px) {
  .site-header { padding-inline: 12px; }
  .government-logo { width: 105px; }
  .funds-logo { width: min(47vw, 155px); }
  .program { padding: 12px 10px; }
  .program__title { font-size: 20px; }
  .program__title--stacked { font-size: 19px; }
  .program__title--two-lines { font-size: 20px; }
  .program__title--empresarial { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .program, .program__icon, .program__plus, .fund-option { transition: none; }
}
