/**
 * Hamed Academic Dashboard 4.1.0
 * Collection hierarchy, annual trend dashboards and unified yellow trend colour.
 */

:root {
  --had-trend-yellow: #f2bf4c;
  --had-trend-yellow-soft: #f9d77d;
}

/* Journal Papers no longer reserves vertical space for the removed feature strip. */
[data-had-collection-type="journal-papers"] .had-collection-body {
  min-height: 0;
}

/* Three-panel collection architecture: two summaries above one annual trend. */
[data-had-collection-type="book"] .had-analytics-grid,
[data-had-collection-type="theses"] .had-analytics-grid,
[data-had-collection-type="persian-articles"] .had-analytics-grid,
[data-had-collection-type="conference-presentations"] .had-analytics-grid,
[data-had-collection-type="editorial-referee"] .had-analytics-grid,
[data-had-collection-type="media"] .had-analytics-grid,
[data-had-collection-type="scholarships"] .had-analytics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, .88fr) minmax(0, 1.12fr) !important;
  grid-auto-rows: unset !important;
  align-items: stretch !important;
  align-content: stretch !important;
}

[data-had-collection-type="book"] .had-analytics-wide,
[data-had-collection-type="theses"] .had-analytics-wide,
[data-had-collection-type="persian-articles"] .had-analytics-wide,
[data-had-collection-type="conference-presentations"] .had-analytics-wide,
[data-had-collection-type="editorial-referee"] .had-analytics-wide,
[data-had-collection-type="media"] .had-analytics-wide,
[data-had-collection-type="scholarships"] .had-analytics-wide {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  min-height: 0 !important;
}

[data-had-collection-type="book"] .had-analytics-panel,
[data-had-collection-type="theses"] .had-analytics-panel,
[data-had-collection-type="persian-articles"] .had-analytics-panel,
[data-had-collection-type="conference-presentations"] .had-analytics-panel,
[data-had-collection-type="editorial-referee"] .had-analytics-panel,
[data-had-collection-type="media"] .had-analytics-panel,
[data-had-collection-type="scholarships"] .had-analytics-panel {
  min-height: 0 !important;
}

[data-had-collection-type="book"] [data-had-book-analytics-body="subjects"],
[data-had-collection-type="book"] [data-had-book-analytics-body="publishers"],
[data-had-collection-type="theses"] [data-had-thesis-analytics-body]:not([data-had-thesis-analytics-body="years"]),
[data-had-collection-type="persian-articles"] [data-had-persian-analytics-body]:not([data-had-persian-analytics-body="years"]),
[data-had-collection-type="conference-presentations"] [data-had-presentation-analytics-body]:not([data-had-presentation-analytics-body="years"]),
[data-had-collection-type="media"] [data-had-media-analytics-body]:not([data-had-media-analytics-body="years"]),
[data-had-collection-type="scholarships"] [data-had-scholarship-analytics-body] {
  min-height: 0;
  max-height: calc(100% - 2px);
  overflow: auto;
  scrollbar-width: thin;
}

/* Degree and subject information now uses the same bar language as Research subjects. */
.had-dual-metric-groups {
  height: calc(100% - 28px);
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 8px;
}
.had-dual-metric-groups > section {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.had-dual-metric-groups h3 {
  margin: 0 0 7px;
  color: #87a7b5;
  font: 700 9px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Funding sources and purpose are now above the annual funding trend. */
[data-had-collection-type="scholarships"] .had-funding-sources-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
}
[data-had-collection-type="scholarships"] .had-funding-purpose-panel {
  grid-column: 2 !important;
  grid-row: 1 !important;
}
[data-had-collection-type="scholarships"] .had-funding-chart {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
}

/* Public engagement: audience profile left, platform coverage right, annual trend below. */
[data-had-collection-type="media"] .had-media-subjects-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
}
[data-had-collection-type="media"] .had-media-coverage-panel {
  grid-column: 2 !important;
  grid-row: 1 !important;
}
[data-had-collection-type="media"] .had-media-trend-panel {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
}
[data-had-collection-type="media"] .had-media-profile-panel {
  min-height: 0 !important;
  height: auto !important;
}

/* All annual trend lines use the funding dashboard's amber/yellow visual system. */
.had-year-trend {
  color: var(--had-trend-yellow) !important;
}
.had-year-trend-grid {
  stroke: rgba(242, 191, 76, .27) !important;
}
.had-year-trend-line {
  stroke: var(--had-trend-yellow) !important;
  filter: drop-shadow(0 0 5px rgba(242, 191, 76, .46)) !important;
}
.had-year-trend-point {
  fill: #061722 !important;
  stroke: var(--had-trend-yellow) !important;
}
.had-year-trend-value {
  fill: var(--had-trend-yellow-soft) !important;
}

/* Google Scholar is also an annual trend, so it follows the same palette. */
.had-scholar-line-chart .had-scholar-line {
  stroke: var(--had-trend-yellow) !important;
  filter: drop-shadow(0 0 5px rgba(242, 191, 76, .42));
}
.had-scholar-line-chart .had-scholar-point > circle {
  stroke: var(--had-trend-yellow-soft) !important;
}
.had-scholar-line-chart .had-scholar-point > line {
  stroke: rgba(242, 191, 76, .32) !important;
}
.had-scholar-line-chart .had-scholar-value {
  fill: var(--had-trend-yellow-soft) !important;
}

/* Keep trend panels readable at the 100% desktop viewport used by the site. */
.had-book-trend-panel [data-had-book-analytics-body="years"],
.had-thesis-trend-panel [data-had-thesis-analytics-body="years"],
.had-persian-trend-panel [data-had-persian-analytics-body="years"],
.had-presentation-trend-panel [data-had-presentation-analytics-body="years"],
.had-editorial-trend-panel [data-had-editorial-analytics-body="years"],
.had-media-trend-panel [data-had-media-analytics-body="years"] {
  height: calc(100% - 2px);
  min-height: 0;
}

@media (max-height: 720px) and (min-width: 901px) {
  [data-had-collection-type="book"] .had-analytics-grid,
  [data-had-collection-type="theses"] .had-analytics-grid,
  [data-had-collection-type="persian-articles"] .had-analytics-grid,
  [data-had-collection-type="conference-presentations"] .had-analytics-grid,
  [data-had-collection-type="editorial-referee"] .had-analytics-grid,
  [data-had-collection-type="media"] .had-analytics-grid,
  [data-had-collection-type="scholarships"] .had-analytics-grid {
    grid-template-rows: minmax(0, .78fr) minmax(0, 1.22fr) !important;
  }
  .had-dual-metric-groups { gap: 7px; padding-top: 5px; }
  .had-dual-metric-groups h3 { margin-bottom: 4px; }
}

@media (max-width: 900px) {
  [data-had-collection-type="book"] .had-analytics-grid,
  [data-had-collection-type="theses"] .had-analytics-grid,
  [data-had-collection-type="persian-articles"] .had-analytics-grid,
  [data-had-collection-type="conference-presentations"] .had-analytics-grid,
  [data-had-collection-type="editorial-referee"] .had-analytics-grid,
  [data-had-collection-type="media"] .had-analytics-grid,
  [data-had-collection-type="scholarships"] .had-analytics-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important;
  }
  [data-had-collection-type="book"] .had-analytics-panel,
  [data-had-collection-type="theses"] .had-analytics-panel,
  [data-had-collection-type="persian-articles"] .had-analytics-panel,
  [data-had-collection-type="conference-presentations"] .had-analytics-panel,
  [data-had-collection-type="editorial-referee"] .had-analytics-panel,
  [data-had-collection-type="media"] .had-analytics-panel,
  [data-had-collection-type="scholarships"] .had-analytics-panel,
  [data-had-collection-type="book"] .had-analytics-wide,
  [data-had-collection-type="theses"] .had-analytics-wide,
  [data-had-collection-type="persian-articles"] .had-analytics-wide,
  [data-had-collection-type="conference-presentations"] .had-analytics-wide,
  [data-had-collection-type="editorial-referee"] .had-analytics-wide,
  [data-had-collection-type="media"] .had-analytics-wide,
  [data-had-collection-type="scholarships"] .had-analytics-wide {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-height: 245px !important;
  }
  .had-dual-metric-groups {
    height: auto;
    grid-template-columns: 1fr;
  }
}


/* 4.1.1: keep complete dynamic year ranges legible in narrower panels. */
.had-year-trend-svg.is-dense .had-year-trend-year {
  font-size: 10px;
  letter-spacing: -0.2px;
}
.had-year-trend-svg.is-very-dense .had-year-trend-year {
  font-size: 9px;
  letter-spacing: -0.35px;
}
@media (max-width: 1250px) {
  .had-type-teaching-experience .had-year-trend-svg.is-dense .had-year-trend-year {
    font-size: 9px;
    letter-spacing: -0.4px;
  }
}
