/* Hamed Academic Dashboard 4.5.0
   Unified record typography, overview imagery, project imagery, and full readers. */

/* --------------------------------------------------------------------------
   Shared readable record-stream typography
   -------------------------------------------------------------------------- */
.had-latest-list .had-record-row,
.had-collection-records .had-record-row,
.had-blog-list [data-had-blog-row],
.had-credential-list [data-had-credential-select],
.had-portfolio-index .had-code-project,
.had-project-output-list > button {
  min-height: 82px !important;
  padding: 12px 14px !important;
  gap: 12px !important;
  line-height: 1.35 !important;
}

.had-latest-list .had-record-row > span > label,
.had-collection-records .had-record-row > span > label,
.had-blog-list [data-had-blog-row] > span > label,
.had-credential-list [data-had-credential-select] small,
.had-project-output-list label,
.had-teaching-stream-row label {
  font-size: 10px !important;
  line-height: 1.3 !important;
  letter-spacing: .055em !important;
}

.had-latest-list .had-record-row > span > b,
.had-collection-records .had-record-row > span > b,
.had-blog-list [data-had-blog-row] > span > b,
.had-credential-list [data-had-credential-select] b,
.had-portfolio-index .had-code-project b,
.had-project-output-list b,
.had-teaching-stream-row b,
.had-timeline-item h2 {
  display: block;
  font-size: 13px !important;
  line-height: 1.34 !important;
  font-weight: 750 !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

.had-latest-list .had-record-row > span > em,
.had-collection-records .had-record-row > span > em,
.had-blog-list [data-had-blog-row] > span > em,
.had-credential-list [data-had-credential-select] small,
.had-portfolio-index .had-code-project p,
.had-project-output-list small,
.had-teaching-stream-row em,
.had-timeline-item b,
.had-timeline-item p {
  font-size: 11px !important;
  line-height: 1.45 !important;
  white-space: normal !important;
}

.had-latest-list .had-record-row time,
.had-collection-records .had-record-row time,
.had-blog-list [data-had-blog-row] time,
.had-teaching-stream-row time {
  min-width: 58px !important;
  font-size: 16px !important;
  line-height: 1.1 !important;
}

.had-collection-records .had-record-row.is-detailed {
  min-height: 108px !important;
}

.had-collection-records .had-record-row.is-detailed p {
  margin-top: 7px;
  font-size: 11px !important;
  line-height: 1.48 !important;
  -webkit-line-clamp: 2;
}

.had-project-output-list > button {
  grid-template-columns: 36px minmax(0, 1fr) 18px !important;
  border-bottom: 1px solid #173c4e !important;
  color: #93adb8 !important;
  text-align: left !important;
}

/* --------------------------------------------------------------------------
   Images in scholarly and teaching overview cards
   -------------------------------------------------------------------------- */
.had-publication-overview-card,
.had-teaching-overview-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.had-overview-card-image {
  position: relative;
  z-index: 0;
  width: calc(100% + 2px);
  height: 104px;
  margin: -1px -1px 13px;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, currentColor 34%, transparent);
  background: rgba(238, 249, 250, .95);
}

.had-overview-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(0, 20, 31, .52));
  pointer-events: none;
}

.had-overview-card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform .45s ease, filter .45s ease;
}

.had-publication-overview-card:hover .had-overview-card-image img,
.had-teaching-overview-card:hover .had-overview-card-image img,
.had-publication-overview-card:focus-visible .had-overview-card-image img,
.had-teaching-overview-card:focus-visible .had-overview-card-image img {
  transform: scale(1.035);
  filter: saturate(1.08) contrast(1.03);
}

.had-publication-overview-head,
.had-teaching-card-head,
.had-publication-overview-card h3,
.had-teaching-overview-card h3,
.had-publication-evidence-summary,
.had-teaching-card-subtitle,
.had-teaching-card-metrics,
.had-teaching-card-action,
.had-publication-overview-card > p {
  position: relative;
  z-index: 1;
}

/* Portrait documents should remain visible rather than being cut into banners. */
.had-publication-overview-card[href*="had_type=book"] .had-overview-card-image img,
.had-publication-overview-card[href*="had_type=theses"] .had-overview-card-image img,
.had-publication-overview-card[href*="had_type=persian-articles"] .had-overview-card-image img,
.had-teaching-overview-card.had-accent-cyan .had-overview-card-image img,
.had-teaching-overview-card.had-accent-violet .had-overview-card-image img {
  object-fit: contain;
  background: #eef7f7;
}

/* --------------------------------------------------------------------------
   Project-card imagery
   -------------------------------------------------------------------------- */
.had-project-card {
  overflow: hidden;
  align-content: start;
}

.had-project-card-image {
  width: calc(100% + 28px);
  height: 118px;
  margin: -14px -14px 12px;
  overflow: hidden;
  border-bottom: 1px solid rgba(25, 220, 235, .24);
  background: rgba(235, 248, 250, .94);
}

.had-project-card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform .5s ease;
}

.had-project-card:hover .had-project-card-image img,
.had-project-card:focus-visible .had-project-card-image img {
  transform: scale(1.035);
}

.had-project-group-completed .had-project-card-image {
  height: 90px;
}

/* --------------------------------------------------------------------------
   Contained application shell for every supported full record
   -------------------------------------------------------------------------- */
html.had-document-page,
html.had-document-page body.had-unified-record-reader.had-theme {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.had-unified-record-reader.had-theme .had-app-shell {
  height: 100dvh !important;
  min-height: 560px !important;
  overflow: hidden !important;
}
body.admin-bar.had-unified-record-reader.had-theme .had-app-shell {
  height: calc(100dvh - 32px) !important;
}
body.had-unified-record-reader.had-theme .had-shell-body {
  height: calc(100dvh - var(--had-topbar)) !important;
  min-height: 0 !important;
  align-items: stretch !important;
  overflow: hidden !important;
}
body.admin-bar.had-unified-record-reader.had-theme .had-shell-body {
  height: calc(100dvh - var(--had-topbar) - 32px) !important;
}
body.had-unified-record-reader.had-theme .had-sidebar {
  position: relative !important;
  top: auto !important;
  height: 100% !important;
  min-height: 0 !important;
  align-self: stretch !important;
}
body.had-unified-record-reader.had-theme .had-workspace {
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
body.had-unified-record-reader.had-theme .had-v450-record-reader {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 10px !important;
  padding: 10px 14px 12px !important;
  overflow: hidden !important;
}
body.had-unified-record-reader.had-theme .had-v450-record-header {
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end !important;
  gap: 20px !important;
  padding: 16px clamp(20px, 2.6vw, 38px) 17px !important;
  border: 1px solid #1d5265 !important;
  background: linear-gradient(145deg, #062838, #075d66) !important;
}
body.had-unified-record-reader.had-theme .had-v450-record-header h1 {
  margin: 8px 0 10px !important;
  font-size: clamp(27px, 2.75vw, 46px) !important;
  line-height: 1.06 !important;
  text-wrap: balance;
}
body.had-unified-record-reader.had-theme .had-v450-record-header .had-blog-single-meta {
  gap: 8px !important;
  font-size: 10px !important;
}
body.had-unified-record-reader.had-theme .had-v450-reader-stage {
  min-width: 0 !important;
  min-height: 0 !important;
  position: relative !important;
  overflow: hidden !important;
  border: 1px solid rgba(43, 93, 112, .72) !important;
  background: #eef4f6 !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .2) !important;
}
body.had-unified-record-reader.had-theme .had-v450-record-article {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  scroll-behavior: smooth !important;
  scrollbar-gutter: stable !important;
  scrollbar-width: thin !important;
  scrollbar-color: #16889a #d9e6ea !important;
  background: #f7fafb !important;
  color: #25404a !important;
  box-shadow: none !important;
  outline: none !important;
}
body.had-unified-record-reader.had-theme .had-v450-record-article::-webkit-scrollbar { width: 12px; }
body.had-unified-record-reader.had-theme .had-v450-record-article::-webkit-scrollbar-track { background: #d9e6ea; }
body.had-unified-record-reader.had-theme .had-v450-record-article::-webkit-scrollbar-thumb {
  border: 3px solid #d9e6ea;
  border-radius: 999px;
  background: #16889a;
}
body.had-unified-record-reader.had-theme .had-v450-record-inner {
  min-height: 100% !important;
}
body.had-unified-record-reader.had-theme .had-blog-scroll-controls { right: 10px !important; }

/* --------------------------------------------------------------------------
   Unified full-page readers
   -------------------------------------------------------------------------- */
.had-v450-record-reader {
  min-height: 0;
}

.had-v450-record-header {
  gap: 28px;
}

.had-v450-record-header .had-blog-single-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.had-v450-record-header h1 {
  max-width: 1120px;
  font-size: clamp(30px, 3.1vw, 58px);
  line-height: 1.07;
  overflow-wrap: anywhere;
}

.had-v450-return-button {
  width: auto !important;
  max-width: min(100%, 480px) !important;
  min-width: 0 !important;
  min-height: 46px;
  padding: 12px 18px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
}

.had-v450-reader-stage {
  min-width: 0;
}

.had-v450-record-article {
  width: 100%;
  max-width: none;
  background: #f7fbfc;
  color: #103a45;
}

.had-v450-record-inner {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: clamp(22px, 2.5vw, 44px) !important;
  box-sizing: border-box;
}

.had-v450-record-hero {
  width: min(100%, 1180px);
  max-height: min(55vh, 660px);
  margin: 0 auto 26px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #b8d5dd;
  background: #edf6f8;
  box-shadow: 0 16px 36px rgba(1, 34, 50, .1);
}

.had-v450-record-hero img {
  width: 100%;
  max-height: min(55vh, 660px);
  display: block;
  object-fit: contain;
  object-position: center;
}

.had-v450-record-details {
  width: 100%;
  margin: 0 0 26px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  border-top: 1px solid #b8d5dd;
  border-left: 1px solid #b8d5dd;
  background: #f1f8f9;
}

.had-v450-record-details > div {
  min-height: 78px;
  padding: 13px 15px;
  border-right: 1px solid #b8d5dd;
  border-bottom: 1px solid #b8d5dd;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-wrap: anywhere;
}

.had-v450-record-details small,
.had-v450-abstract > small {
  color: #087786;
  font-family: var(--had-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
}

.had-v450-record-details b {
  color: #073b49;
  font-size: 13px;
  line-height: 1.42;
}

.had-v450-record-details a {
  color: #006f7c;
  text-decoration: none;
}

.had-v450-abstract {
  width: 100%;
  margin: 0 0 26px;
  padding: 20px 22px;
  border-left: 4px solid #00b9ca;
  background: #e9f6f8;
}

.had-v450-abstract p {
  margin: 9px 0 0;
  max-width: none;
  color: #264f59;
  font-size: 15px;
  line-height: 1.72;
  text-align: left;
}

.had-v450-reader-copy {
  width: 100%;
  max-width: none !important;
  margin: 0 !important;
  color: #183f49;
  text-align: left !important;
}

.had-v450-reader-copy > * {
  max-width: none;
}

.had-v450-reader-copy p,
.had-v450-reader-copy li,
.had-v450-reader-copy td,
.had-v450-reader-copy th {
  font-size: clamp(14px, .92vw, 17px);
  line-height: 1.72;
  text-align: left;
}

.had-v450-reader-copy h2,
.had-v450-reader-copy h3,
.had-v450-reader-copy h4 {
  color: #005463;
  text-align: left;
  overflow-wrap: anywhere;
}

.had-v450-reader-copy img,
.had-v450-reader-copy figure,
.had-v450-reader-copy .wp-block-image {
  max-width: 100%;
  height: auto;
}

.had-v450-reader-copy table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

.had-v450-reader-tags {
  margin-top: 28px;
}

.had-v450-record-reader .had-blog-engagement {
  width: 100%;
  max-width: none;
  margin: 32px 0 0;
}

.had-v450-record-reader .had-blog-reaction-panel,
.had-v450-record-reader .had-blog-discussion {
  width: 100%;
  max-width: none;
}

.had-v450-bottom-actions {
  width: 100%;
  margin-top: 26px;
  display: flex;
  justify-content: flex-start;
}

/* Preserve the carefully prepared Teaching Evidence body but remove page-wide gutters. */
.had-teaching-evidence-single-screen .had-v450-record-inner {
  padding-inline: clamp(12px, 1.35vw, 24px) !important;
}

.had-teaching-evidence-single-screen .had-v450-reader-copy {
  padding: 0 !important;
}

.had-teaching-evidence-single-screen .had-v450-reader-copy > .had-teaching-evidence-reader,
.had-teaching-evidence-single-screen .had-v450-reader-copy > .had-teaching-evidence-page,
.had-teaching-evidence-single-screen .had-v450-reader-copy > div {
  width: 100% !important;
  max-width: none !important;
  margin-inline: 0 !important;
}

/* Credentials always reserve a clean certificate stage when a fallback image exists. */
.had-credential-certificate {
  background: #edf5f7;
}

.had-credential-certificate img {
  object-fit: contain !important;
}

@media (max-width: 980px) {
  .had-overview-card-image { height: 90px; }
  .had-project-card-image { height: 105px; }
  .had-v450-record-header { align-items: flex-start; flex-direction: column; }
  .had-v450-record-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .had-v450-record-inner { padding: 20px !important; }
}

@media (max-width: 640px) {
  .had-latest-list .had-record-row,
  .had-collection-records .had-record-row,
  .had-blog-list [data-had-blog-row] {
    min-height: 96px;
    padding: 12px 10px;
  }
  .had-v450-record-details { grid-template-columns: 1fr; }
  .had-v450-record-inner { padding: 14px !important; }
  .had-v450-record-hero { margin-bottom: 18px; }
  .had-v450-return-button { max-width: 100% !important; }
}


@media (max-width: 900px) {
  body.had-unified-record-reader.had-theme .had-sidebar {
    position: fixed !important;
    top: var(--had-topbar) !important;
    height: auto !important;
  }
  body.admin-bar.had-unified-record-reader.had-theme .had-sidebar {
    top: calc(var(--had-topbar) + 46px) !important;
  }
  body.had-unified-record-reader.had-theme .had-v450-record-reader {
    padding: 8px !important;
    gap: 8px !important;
  }
  body.had-unified-record-reader.had-theme .had-v450-record-header {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 14px 18px !important;
  }
  body.had-unified-record-reader.had-theme .had-v450-record-header h1 {
    font-size: clamp(24px, 7vw, 38px) !important;
  }
  body.had-unified-record-reader.had-theme .had-v450-record-header .had-v450-return-button {
    justify-self: start !important;
  }
}

@media (max-width: 782px) {
  body.admin-bar.had-unified-record-reader.had-theme .had-app-shell {
    height: calc(100dvh - 46px) !important;
  }
  body.admin-bar.had-unified-record-reader.had-theme .had-shell-body {
    height: calc(100dvh - var(--had-topbar) - 46px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .had-overview-card-image img,
  .had-project-card-image img { transition: none; }
}
