/*
 * Grants page (/palyazatok/): the scoped <style> of components/palyazatok/ProjectArticle.astro and of
 * pages/palyazatok.astro, in the order of the Astro bundle. Every selector is prefixed with .page-grants (plan §8.3).
 * Deviation from §8.3: the ProjectArticle styles are here, not in site.css, because only this page uses the component.
 */

/* --- ProjectArticle --- */

.page-grants .palyazat {
  border-top: 1px solid var(--c-line);
}

.page-grants .palyazat__head {
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

/*
 * The official titles are long: they wrap at 36ch and hyphenate only at the soft hyphens written into the text
 * (Projects.cs) - the global automatic hyphenation below 40em would leave 2-3 letter fragments. On narrow screens
 * the size goes below --fs-5 (about 25px at 390px); from 1400px on it equals it.
 */
.page-grants .palyazat__head h2 {
  max-width: 36ch;
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.6rem);
  hyphens: manual;
  -webkit-hyphens: manual;
}

/* In Lato 1ch is about 0.58em: 58ch gives an ~80 character line (the global 68ch would allow ~93 here) */
.page-grants .palyazat__intro {
  margin: 0;
  max-width: 58ch;
}

.page-grants .palyazat__grid {
  display: grid;
  gap: var(--space-7);
}

@media (min-width: 60em) {
  .page-grants .palyazat__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2.5rem, 6vw, 5rem);
    align-items: start;
  }
}

/* Data sheet: hairline panel, white even on the alternating background */
.page-grants .palyazat__adatok {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  padding: clamp(1.25rem, 3vw, 2rem);
}

/*
 * Sticky data sheet in windows taller than ~864px: then the panels of the two R&D projects (<= 740px) are fully
 * visible together with the offset below the header. Deliberately no max-height + inner scrolling: it would needlessly
 * clip the panel of the training project (which is taller than its own description, so sticking does not move it
 * anyway) and would capture the scroll wheel over the panel.
 */
@media (min-width: 60em) and (min-height: 54em) {
  .page-grants .palyazat__adatok {
    position: sticky;
    top: calc(var(--header-h) + var(--space-5));
  }
}

.page-grants .palyazat__adatok-cim {
  font-size: var(--fs-3);
  margin: 0 0 var(--space-3);
}

.page-grants .palyazat__adatok .palyazat__datalist {
  row-gap: 0;
}

/* Single-column base (on phones and in the >= 60em panel): a line above the label, the value right below it */
.page-grants .palyazat__adatok .palyazat__datalist dt {
  padding: 0.75rem 0 0.15rem;
  border-top: 1px solid var(--c-line);
  font-size: var(--fs-0);
  line-height: 1.5;
}

.page-grants .palyazat__adatok .palyazat__datalist dd {
  padding: 0 0 0.75rem;
  overflow-wrap: anywhere;
}

.page-grants .palyazat__adatok .palyazat__datalist time {
  font-variant-numeric: tabular-nums;
}

/* The global .datalist has two columns from 40em on: here one line per row, label and value at the same height */
@media (min-width: 40em) and (max-width: 59.99em) {
  .page-grants .palyazat__adatok .palyazat__datalist dt,
  .page-grants .palyazat__adatok .palyazat__datalist dd {
    padding-block: 0.6rem;
    border-top: 1px solid var(--c-line);
  }
}

@media (min-width: 60em) {
  .page-grants .palyazat__adatok .palyazat__datalist {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The same line length as the intro: the 72ch of .prose would give a ~90 character line in Lato */
.page-grants .palyazat__leiras.prose {
  max-width: 58ch;
}

.page-grants .palyazat__leiras > h3:first-child {
  margin-top: 0;
}

/* The two h3s on one line: the left one sits lower by the panel border (1px) + padding */
@media (min-width: 60em) {
  .page-grants .palyazat__leiras {
    padding-top: calc(clamp(1.25rem, 3vw, 2rem) + 1px);
  }
}

/* --- Page --- */

/* The hairline runs the full container width; only the image is limited to ~40rem. Mandatory: keep it on the page. */
.page-grants .palyazatok-intro__infoblokk {
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--c-line);
}

.page-grants .palyazatok-intro__infoblokk img {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  background: var(--c-paper);
}

.page-grants .palyazatok-intro__grid {
  display: grid;
  gap: var(--space-7);
}

@media (min-width: 60em) {
  .page-grants .palyazatok-intro__grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: clamp(2.5rem, 6vw, 5rem);
    align-items: start;
  }
}

.page-grants .palyazatok-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--c-line);
}

.page-grants .palyazatok-toc li {
  border-bottom: 1px solid var(--c-line);
}

.page-grants .palyazatok-toc a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'title icon'
    'meta icon';
  column-gap: var(--space-4);
  row-gap: 0.3rem;
  align-items: center;
  padding: 1.1rem 0;
  color: var(--c-text);
  text-decoration: none;
}

.page-grants .palyazatok-toc__title {
  grid-area: title;
  font-family: var(--ff-display);
  font-weight: 500;
  font-size: var(--fs-2);
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
  /* Break only at the soft hyphens written into the titles; automatic hyphenation would leave 2-3 letter fragments */
  hyphens: manual;
  -webkit-hyphens: manual;
  transition: color 0.2s var(--ease);
}

.page-grants .palyazatok-toc__meta {
  grid-area: meta;
  font-size: var(--fs-0);
  color: var(--c-text-2);
  overflow-wrap: anywhere;
}

.page-grants .palyazatok-toc a .icon {
  grid-area: icon;
  color: var(--c-turq-700);
  transition: transform 0.2s var(--ease);
}

.page-grants .palyazatok-toc a:hover .palyazatok-toc__title {
  color: var(--c-turq-700);
}

.page-grants .palyazatok-toc a:hover .icon {
  transform: translateX(3px);
}
