/**
 * Hamed Academic Dashboard 3.9.0
 * Single-coordinate maps, credential artwork/actions and funding-style trends.
 */

/* Conferences now use the full analytics area after removing the duplicate
   subjects/hosts panel. */
[data-had-collection-type="conferences"] .had-analytics-grid {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  height: 100% !important;
}
[data-had-collection-type="conferences"] .had-conference-map-panel {
  grid-column: 1 !important;
  grid-row: 1 !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
}
[data-had-collection-type="conferences"] [data-had-conference-analytics-body="map"] {
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

/* Conference presentations retain only the useful source and theme panels. */
[data-had-collection-type="conference-presentations"] .had-analytics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}
[data-had-collection-type="conference-presentations"] .had-analytics-panel {
  grid-column: auto !important;
  grid-row: 1 !important;
}

/* Journal papers: two descriptive panels above one full-width trend. */
[data-had-collection-type="journal-papers"] .had-analytics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: minmax(0, .9fr) minmax(0, 1.1fr) !important;
}
[data-had-collection-type="journal-papers"] .had-journal-trend-panel {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
}
[data-had-collection-type="journal-papers"] [data-had-journal-analytics-body="years"] {
  height: calc(100% - 2px);
  min-height: 0;
}

/* Conferences and research visits use the map and markers inside one SVG
   viewBox. This is the same principle used by the homepage Global Reach map,
   so resizing cannot move a marker away from its country. */
.had-europe-map {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.had-europe-map-svg {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  overflow: hidden;
  background: #041722;
}
.had-europe-map-svg > image {
  opacity: .82;
}
.had-europe-map-point {
  color: #f6c94f;
  cursor: pointer;
  outline: none;
  transform-box: fill-box;
  transform-origin: center;
}
.had-europe-map-pulse {
  fill: rgba(246, 201, 79, .12);
  stroke: rgba(246, 201, 79, .7);
  stroke-width: .7;
  vector-effect: non-scaling-stroke;
  animation: hadEuropeMapPulse 2.3s ease-in-out infinite;
}
.had-europe-map-core {
  fill: #f6c94f;
  stroke: #fff4b0;
  stroke-width: .55;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px #f6c94f);
}
.had-europe-map-star {
  display: block;
  fill: #f6c94f;
  font-size: 7.6px;
  font-weight: 900;
  text-anchor: middle;
  pointer-events: none;
  filter: drop-shadow(0 0 2px #f6c94f);
}
.had-europe-map-point:hover .had-europe-map-pulse,
.had-europe-map-point:focus-visible .had-europe-map-pulse {
  fill: rgba(246, 201, 79, .34);
  stroke: #fff2a6;
  stroke-width: 1.2;
}
.had-map-empty-svg {
  fill: #7898a7;
  font: 5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@keyframes hadEuropeMapPulse {
  0%, 100% { opacity: .55; transform: scale(.78); }
  50% { opacity: 1; transform: scale(1.18); }
}
[data-had-collection-type="research-visits"] .had-analytics-grid,
[data-had-collection-type="research-visits"] .had-visit-map-panel {
  height: 100% !important;
  min-height: 0 !important;
}
[data-had-collection-type="research-visits"] .had-visit-map-panel {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
}
[data-had-collection-type="research-visits"] .had-map-location-list,
[data-had-collection-type="conferences"] .had-map-location-list {
  max-height: 76px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

/* Certificate artwork and explicit detail actions. */
.had-credentials-v3 .had-credential-certificate {
  display: grid;
  width: min(800px, 100%);
  height: clamp(150px, 27vh, 245px);
  min-height: 150px;
  flex: 0 0 auto;
}
.had-credentials-v3 .had-credential-certificate[hidden] {
  display: none !important;
}
.had-credentials-v3 .had-credential-image {
  position: static !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  display: block !important;
  object-fit: contain !important;
  object-position: center !important;
}
.had-credentials-v3 .had-credential-actions {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}
.had-credentials-v3 .had-credential-full,
.had-credentials-v3 .had-credential-verify {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 !important;
  padding: 9px 13px;
  border: 1px solid var(--had-current-accent, var(--had-accent));
  color: var(--had-current-accent, var(--had-accent));
  background: rgba(5, 28, 40, .72);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.had-credentials-v3 .had-credential-full:hover,
.had-credentials-v3 .had-credential-full:focus-visible,
.had-credentials-v3 .had-credential-verify:hover,
.had-credentials-v3 .had-credential-verify:focus-visible {
  background: color-mix(in srgb, var(--had-current-accent, var(--had-accent)) 14%, #071c29);
  color: #e9fbff;
}

/* Funding-style visual language for all count trends. */
.had-year-trend {
  width: 100%;
  height: 100%;
  min-height: 165px;
  display: grid;
  place-items: center;
  color: var(--had-current-accent, var(--had-accent));
  overflow: hidden;
}
.had-year-trend > svg {
  width: 100%;
  height: 100%;
  min-height: 165px;
  display: block;
  overflow: visible;
}
.had-year-trend-grid {
  stroke: color-mix(in srgb, var(--had-current-accent, var(--had-accent)) 32%, #173b50);
  stroke-width: 1;
  stroke-dasharray: 4 7;
  vector-effect: non-scaling-stroke;
}
.had-year-trend-axis-value {
  fill: #7796a4;
  font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-anchor: end;
}
.had-year-trend-area {
  color: var(--had-current-accent, var(--had-accent));
}
.had-year-trend-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px currentColor);
}
.had-year-trend-point {
  fill: #061925;
  stroke: currentColor;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.had-year-trend-value,
.had-year-trend-year {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-anchor: middle;
}
.had-year-trend-value {
  fill: #eafcff;
  font-size: 13px;
  font-weight: 800;
}
.had-year-trend-year {
  fill: #7f9da9;
  font-size: 12px;
  font-weight: 700;
}
.had-type-teaching-experience [data-had-teaching-analytics-body="years"],
.had-type-pedagogical-training [data-had-pedagogy-analytics-body="years"] {
  height: calc(100% - 2px) !important;
  min-height: 0 !important;
}

@media (max-height: 720px) and (min-width: 901px) {
  .had-credentials-v3 .had-credential-certificate {
    height: 138px;
    min-height: 138px;
    margin: 8px 0 9px;
  }
  .had-credentials-v3 .had-credential-summary {
    -webkit-line-clamp: 2 !important;
  }
  .had-credentials-v3 .had-skill-grid {
    max-height: 58px !important;
  }
}

@media (max-width: 900px) {
  [data-had-collection-type="conference-presentations"] .had-analytics-grid,
  [data-had-collection-type="journal-papers"] .had-analytics-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important;
  }
  [data-had-collection-type="conference-presentations"] .had-analytics-panel,
  [data-had-collection-type="journal-papers"] .had-analytics-panel,
  [data-had-collection-type="journal-papers"] .had-journal-trend-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-height: 250px;
  }
  .had-credentials-v3 .had-credential-certificate {
    height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .had-europe-map-pulse { animation: none !important; }
}


/* Interactive zoom and pan for every geographic map. */
[data-had-map-interactive] {
  position: relative;
  isolation: isolate;
  user-select: none;
}
[data-had-map-svg] {
  cursor: grab;
  touch-action: none;
  outline: none;
}
[data-had-map-svg]:focus-visible {
  outline: 2px solid var(--had-cyan);
  outline-offset: -3px;
}
[data-had-map-interactive].is-dragging [data-had-map-svg] {
  cursor: grabbing;
}
.had-map-controls {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(61, 137, 164, .76);
  border-radius: 5px;
  background: rgba(3, 19, 29, .9);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
  backdrop-filter: blur(5px);
}
.had-map-controls button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #245e76;
  border-radius: 3px;
  background: #071f2d;
  color: #dffbff;
  font: 800 17px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: pointer;
}
.had-map-controls button:hover,
.had-map-controls button:focus-visible {
  border-color: var(--had-cyan);
  background: #0a3547;
  color: #fff;
  outline: none;
}
.had-map-controls button:disabled {
  opacity: .35;
  cursor: default;
}
.had-map-controls span {
  padding: 0 5px 0 3px;
  color: #87a8b5;
  font: 700 8px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.had-reach-map .had-map-controls {
  top: 7px;
  right: 7px;
}
.had-europe-map-svg > image {
  opacity: .9;
}
.had-europe-map-point {
  text-decoration: none;
}

/* Assemble the active What's New image as twelve staggered puzzle blocks. */
.had-home-v320 .had-news-media {
  background-image: none !important;
}
.had-home-v320 .had-news-puzzle {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}
.had-home-v320 .had-news-puzzle > i {
  position: relative !important;
  inset: auto !important;
  display: block !important;
  width: calc(100% + 1px);
  height: calc(100% + 1px);
  margin: -.5px;
  border: 0 !important;
  background-image: var(--had-news-image) !important;
  background-size: 400% 300% !important;
  background-position: var(--had-piece-x) var(--had-piece-y) !important;
  background-repeat: no-repeat !important;
  opacity: 0;
  transform: translateY(22px) scale(.78) rotate(-3deg);
  filter: brightness(.62) saturate(.72);
}
.had-home-v320 .had-news-item.is-active .had-news-puzzle > i {
  animation: hadNewsPuzzleBuild .72s cubic-bezier(.2, .78, .18, 1) forwards;
  animation-delay: calc(var(--had-piece-index) * .085s);
}
.had-home-v320 .had-news-frame {
  position: absolute !important;
  inset: 10px !important;
  z-index: 3;
  display: block !important;
  pointer-events: none;
}
.had-home-v320 .had-news-media:before {
  z-index: 2;
}
.had-home-v320 .had-news-media > b {
  z-index: 4;
}
@keyframes hadNewsPuzzleBuild {
  0% { opacity: 0; transform: translateY(22px) scale(.78) rotate(-3deg); filter: brightness(.55) saturate(.6); }
  62% { opacity: 1; transform: translateY(-2px) scale(1.025) rotate(.5deg); filter: brightness(1.08) saturate(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); filter: brightness(1) saturate(1); }
}

/* Keep the full citation-history heading visible and remove the redundant
   year/value card grid beneath the chart. */
.had-scholar-modal-dialog > header {
  position: sticky;
  top: -22px;
  z-index: 5;
  margin: -22px -22px 0;
  padding: 22px 22px 14px;
  background: linear-gradient(180deg, rgba(5, 29, 43, .995) 82%, rgba(5, 29, 43, .92));
}
.had-scholar-modal-dialog > header .had-kicker {
  display: flex !important;
  color: var(--had-cyan) !important;
  opacity: 1 !important;
  font-size: 12px !important;
}
.had-scholar-modal-dialog > header h2 {
  color: #f1fdff !important;
}
.had-scholar-modal-chart {
  margin-top: 9px;
}
.had-scholar-year-grid {
  display: none !important;
}

/* Make certificate artwork unmistakably visible when an image is assigned. */
.had-credentials-v3 .had-credential-certificate {
  border: 1px solid #255a70;
  border-radius: 5px;
  background: linear-gradient(145deg, rgba(4, 23, 34, .96), rgba(8, 41, 55, .72));
  overflow: hidden;
}
.had-credentials-v3 .had-credential-image {
  background: rgba(235, 244, 247, .96);
}

@media (max-width: 700px) {
  .had-map-controls span { display: none; }
  .had-map-controls button { width: 28px; height: 28px; }
  .had-scholar-modal-dialog > header { top: -15px; margin: -15px -15px 0; padding: 15px 15px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .had-home-v320 .had-news-puzzle > i {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }
}
