/* =============================================================
   ITI Design System — Research & Development projects
   Loaded only on the two project listing pages (EL + EN).

   The page is a register, not a feed: ~690 projects per language, every
   one of them on the page at once. So it is set as an index of single
   banded lines — the wording and order of the old listing — rather than
   as cards, which at this length would be unreadable.
   ============================================================= */

/* =========================================================
   Ground rules
   ========================================================= */

/* iti-shell.css scopes the Plex Sans stack to the header/footer components
   only, so that pages not yet redesigned keep the type they had. This page
   is redesigned, so it opts in for its own subtree. */
.prj { font-family: var(--iti-font-sans); }

/* The seven anchor ids are back on the group headings, where css/style.css
   has always styled them:
       #horizon2020, #fp6fp7, … { font-size: 20px; margin: 20px 0;
                                  font-weight: 700; color: … }
   That is the rule this page's headings build on, so it is restated rather
   than cancelled. An id beats a class, so the selectors here carry the ids
   too. */
.prj #horizon_europe,
.prj #horizon2020,
.prj #fp6fp7,
.prj #european-general,
.prj #national,
.prj #international,
.prj #services {
  display: flex;
  align-items: baseline;
  gap: var(--iti-s-4);
  flex-wrap: wrap;
  /* The rail links here, and this page has a second sticky element the
     others do not — the filter bar, pinned at 84px and ~68px tall — so a
     heading has to clear 152px, not just the 79px site header. */
  scroll-margin-top: 175px;
  margin: 0 0 var(--iti-s-4);
  padding-bottom: var(--iti-s-3);
  font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--iti-text);
  border-bottom: 1px solid var(--iti-line-strong);
}
.prj .project-count {
  margin-left: auto;
  flex: none;
  font-family: var(--iti-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .06em;
  color: var(--iti-text-muted);
}

/* The page heading. css/style.css already has `.page-title { font-weight:
   700; margin: 20px 0 }`; only the scale and colour change here. */
.prj .page-title {
  scroll-margin-top: 175px;
  margin: 0 0 var(--iti-s-6);
  font-size: clamp(1.4rem, 1.15rem + 1vw, 1.9rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--iti-text);
}

/* =========================================================
   Filter bar
   Hidden until js/iti-projects.js takes it over: without script it
   would be a control that does nothing.
   ========================================================= */

.prj-tools {
  /*
   * Not sticky. It used to follow the page down, which put a second bar under
   * the header for the whole length of a long list — the rail on the left is
   * what you navigate with, and this only needs to be where it is written.
   * z-index went with it: it was there to sit above the cards it floated over.
   */
  display: flex;
  align-items: center;
  gap: var(--iti-s-4);
  flex-wrap: wrap;
  margin-bottom: var(--iti-s-6);
  padding: var(--iti-s-3) var(--iti-s-4);
  background: var(--iti-surface);
  border: 1px solid var(--iti-line);
  clip-path: var(--iti-clip-sm);
}
.prj-search {
  position: relative;
  flex: 1 1 16rem;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--iti-s-3);
}
.prj-search svg { flex: none; color: var(--iti-text-decor); }
.prj-search input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: .45rem 0;
  font-family: inherit;
  font-size: .95rem;
  color: var(--iti-text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--iti-line);
  border-radius: 0;
  box-shadow: none;
  transition: border-color var(--iti-dur) var(--iti-ease);
}
.prj-search input::placeholder { color: var(--iti-text-muted); opacity: 1; }
.prj-search input:focus {
  outline: none;
  border-bottom-color: var(--iti-electric);
}

.prj-tools__count {
  flex: none;
  font-family: var(--iti-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
  letter-spacing: .06em;
  color: var(--iti-electric-ink);
}
/* IBM Plex Mono has no Greek subset, so the word beside the figure has to
   take the sans face or it falls back mid-string. */
.prj-tools__count b {
  font-family: var(--iti-font-sans);
  font-weight: 500;
  font-size: .78rem;
  letter-spacing: normal;
  color: var(--iti-text-muted);
}
.prj-tools__clear {
  flex: none;
  padding: .3rem .7rem;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 500;
  color: var(--iti-text-muted);
  background: transparent;
  border: 1px solid var(--iti-line);
  cursor: pointer;
  transition: color var(--iti-dur) var(--iti-ease),
              border-color var(--iti-dur) var(--iti-ease);
}
.prj-tools__clear:hover { color: var(--iti-blue); border-color: var(--iti-line-strong); }

/* =========================================================
   Groups
   ========================================================= */

.prj section { margin-bottom: var(--iti-s-7); }
.prj section:last-child { margin-bottom: 0; }

/* Only the subcategory headings still need a scroll margin set here; the
   group headings and the page title carry theirs in the id block above. */
.prj .project-sub { scroll-margin-top: 175px; }

/* Subcategory of a group — a rank below the group heading, a rank above
   the records. */
.prj .project-sub {
  display: flex;
  align-items: center;
  gap: var(--iti-s-3);
  margin: var(--iti-s-6) 0 var(--iti-s-3);
  /* The old `.project-sub` was 16px bold. The root here is 15px, so 1rem
     would put this at the same size as the records it heads; 1.15rem sits
     it clearly between them and the 22.5px group title. Label tracking is
     eased off too — .14em was set for an 11px eyebrow and sprawls here. */
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--iti-electric-ink);
}
.prj .project-sub::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--iti-line);
}

/* =========================================================
   Records
   Each entry is one flowing line, as before:
       ACRONYM - Full title (2026: FUNDING PROGRAMME)
   ========================================================= */

.prj .project-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--iti-line);
}
.prj .project-list > li {
  position: relative;
  margin: 0;
  padding: .7rem 1rem .7rem .85rem;
  list-style: none;
  font-size: var(--iti-fs-body);
  line-height: 1.6;
  color: var(--iti-text);
  background: var(--iti-surface);
  border-bottom: 1px solid var(--iti-line);
  transition: background var(--iti-dur) var(--iti-ease);
}
/* Alternating rows, as the old listing had
   (`.project-list article:nth-child(2n) { background: #f4f4f4 }`).

   nth-of-type counts position in the document, not what is on screen, so
   once the filter hides rows the banding would go ragged. js/iti-projects.js
   therefore marks every second VISIBLE row with .is-alt and puts .is-banded
   on the list to hand over. Without script the nth-of-type rule below is
   what applies, and nothing is ever filtered, so it is correct. */
.prj .project-list > li:nth-of-type(even) { background: var(--iti-paper); }
.prj .project-list.is-banded .prj .project-list > li { background: var(--iti-surface); }
.prj .project-list.is-banded .prj .project-list > li.is-alt { background: var(--iti-paper); }

/* The rail is the hover state; it grows from the top edge so a run of
   rows reads as a single column being scanned. */
.prj .project-list > li::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--iti-electric);
  box-shadow: var(--iti-electric-glow);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--iti-dur) var(--iti-ease);
}
/* Hover BRIGHTENS the row rather than darkening it. Darkening looked
   better but put the funding text at 4.42:1 on the banded ground, under
   AA; going the other way means a hovered row is always at the white-row
   figures (5.15 / 16.19 / 5.21), which are the best the page offers.
   Written with enough weight to beat the banding selectors above, which
   carry two extra classes. */
.prj .project-list .prj .project-list > li:hover,
.prj .project-list .prj .project-list > li:focus-within,
.prj .project-list .prj .project-list > li.is-alt:hover,
.prj .project-list .prj .project-list > li.is-alt:focus-within { background: var(--iti-surface); }
.prj .project-list > li:hover::before,
.prj .project-list > li:focus-within::before { transform: scaleY(1); }

.prj .project-title a {
  font-weight: 600;
  color: var(--iti-blue);
  text-decoration: none;
  transition: color var(--iti-dur) var(--iti-ease);
}
.prj .project-title a:hover,
.prj .project-title a:focus-visible {
  color: var(--iti-blue-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prj .full-title { color: var(--iti-text); }

/* Year and funding programme. Figures are set in Plex Mono, which has no
   Greek subset — the programme name beside them can be Greek, so only the
   bracket group as a whole takes the muted colour and the face stays the
   sans one. */
.prj .year, .prj .project-fp {
  color: var(--iti-text-muted);
  font-size: .92em;
}
/* A programme stored with a link to its own site. The old sheet set
   `pointer-events: none` on these, leaving something that looked like a
   link and did nothing; they work now. Only the link is underlined — the
   year beside it is not one. */
.prj .project-fp a,
.prj .year a {
  color: var(--iti-text-muted);
  text-decoration: underline;
  text-decoration-color: var(--iti-line-strong);
  text-underline-offset: 2px;
}
.prj .project-fp a:hover,
.prj .year a:hover { color: var(--iti-blue); text-decoration-color: currentColor; }

/* =========================================================
   Filtered-out state + empty result
   ========================================================= */

.prj .project-list > li[hidden],
.prj section[hidden],
.prj .project-sub[hidden] { display: none !important; }

.prj .project-empty {
  margin: 0;
  padding: var(--iti-s-6);
  text-align: center;
  font-size: .95rem;
  color: var(--iti-text-muted);
  background: var(--iti-surface);
  border: 1px dashed var(--iti-line-strong);
}

/* =========================================================
   Narrow screens
   ========================================================= */

@media (max-width: 600px) {
  .prj .project-list > li { padding: .8rem .75rem; }
  .prj-tools { position: static; }
  .prj .project-count { margin-left: 0; }
}

/*
 * A project whose start date plus duration has passed.
 *
 * Applied by the script in functions.php that asks admin-ajax which of the
 * projects on the page have expired. It used to set five inline colours from
 * JavaScript; the colour lives here so it can be found and changed, and so
 * the rule against inline styles holds on this page too.
 */
.project-expired,
.project-expired .project-title a,
.project-expired .full-title,
.project-expired .year,
.project-expired #project-fp,
.project-expired #project-fp a {
	color: #999;
}
