/* ---------- Faculty / user profile page (/user/ID) ---------- */
/* Works with the markup of user.html.twig:
   #user-profile > .banner + .profileleft + .profileright
   Field wrappers are plain <div><div>Label</div><div>Value</div></div>, so the
   labels/values are targeted by position rather than by class. */

/* ===== 1. Remove clutter below the profile (blocks left in the Content region) =====
   Better long-term: Structure > Block layout > configure each block >
   Visibility > Pages: "/user/*" > "Hide for the listed pages". */
body.path-user #main .main > .block:not([id*="system-main"]),
body.path-user #main .main > .search-block-form,
body.path-user #main .main > nav.block {
  display: none;
}

/* ===== 2. Layout ===== */
body #user-profile {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px 28px;
  align-items: start;
  margin: 0 0 30px;
}
body #user-profile .banner { grid-column: 1 / -1; }
body #user-profile .banner:not(:has(img)) { display: none; }
body #user-profile .banner img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
}

/* neutralise floats/widths from the old Drupal 7 stylesheet */
body #user-profile .profileleft,
body #user-profile .profileright {
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
}

/* ===== 3. Left column: photo, position, phone ===== */
body #user-profile .profileleft {
  position: sticky;
  top: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid #d9e3dc;
  border-top: 4px solid var(--ces-green, #1d4e3a);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(16, 28, 22, .08);
  text-align: center;
}
body #user-profile #user-picture { margin: 0 0 14px; line-height: 0; }
body #user-profile #user-picture img {
  display: block;
  width: 100%;
  max-width: 228px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid #d9e3dc;
  background: #eef3ee;
}
/* position: hide its label, show value as a role badge */
body #user-profile .position:empty { display: none; }
body #user-profile .position > div > div:first-child { display: none; }
body #user-profile .position > div > div {
  margin: 0 0 4px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ces-green, #1d4e3a);
}
/* phone */
body #user-profile .phone:not(:has(b)) { display: none; }
body #user-profile .phone {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #cfdcd3;
  font-size: .92rem;
  line-height: 1.6;
  text-align: center;
}
body #user-profile .phone b {
  display: block;
  margin-bottom: 2px;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #55635a;
}

/* ===== 4. Right column ===== */
body #user-profile .profileright > div:empty { display: none; }

/* name = page heading */
body #user-profile .profileright > .name {
  margin: 0 0 14px;
  padding: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ces-ink, #101c16);
  border-bottom: 3px solid var(--ces-leaf, #7a8f3a);
}
body #user-profile .profileright > .name strong { display: none; } /* hides "Name:" */
/* If your Page title block already shows the person's name, also add:
   body #user-profile .profileright > .name { display: none; } */

/* e-mail line under the name */
body #user-profile .profileright > .email { margin: 0 0 18px; }
body #user-profile .profileright > .email .field { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
body #user-profile .profileright > .email .field__label {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #55635a;
}
body #user-profile .profileright > .email .field__items { font-size: 1rem; }

/* section cards (affiliation, office, link, research, specialization,
   description, biography, publications, awards, lab ...) */
body #user-profile .profileright > div:not(.name):not(.email):not(:empty) {
  margin: 0 0 16px;
  padding: 16px 20px 18px;
  background: #fff;
  border: 1px solid #d9e3dc;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(16, 28, 22, .06);
}
/* label (first inner div) */
body #user-profile .profileright > div:not(.name):not(.email) > div > div:first-child {
  margin: 0 0 10px;
  padding: 0 0 6px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ces-green, #1d4e3a);
  border-bottom: 2px solid var(--ces-leaf, #7a8f3a);
}
/* values */
body #user-profile .profileright > div:not(.name):not(.email) > div > div:not(:first-child) {
  font-size: 1rem;
  line-height: 1.6;
  color: #26342c;
  overflow-wrap: anywhere;
}
/* links */
body #user-profile .profileright a {
  color: var(--ces-green, #1d4e3a);
  text-decoration: underline;
  text-underline-offset: 2px;
}
body #user-profile .profileright a:hover,
body #user-profile .profileright a:focus { color: var(--ces-leaf, #7a8f3a); }

/* paragraphs inside description / biography */
body #user-profile .profileright .description p,
body #user-profile .profileright .lab p {
  margin: 0 0 .9em;
  line-height: 1.7;
}
body #user-profile .profileright .description p:last-child,
body #user-profile .profileright .lab p:last-child { margin-bottom: 0; }

/* publications: one reference per paragraph */
body #user-profile .profileright .publication p {
  margin: 0 0 .8em;
  padding: 0 0 0 14px;
  border-left: 3px solid #d9e3dc;
  font-size: .92rem;
  line-height: 1.55;
}
body #user-profile .profileright .publication p:last-child { margin-bottom: 0; }

/* ===== 5. Responsive / print ===== */
@media (max-width: 760px) {
  body #user-profile { grid-template-columns: 1fr; }
  body #user-profile .profileleft {
    position: static;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 6px 16px;
    text-align: left;
    align-items: start;
  }
  body #user-profile #user-picture { grid-row: 1 / span 3; margin: 0; }
  body #user-profile .phone { text-align: left; }
  body #user-profile .profileright > .name { font-size: 1.5rem; }
}
@media print {
  body #user-profile { display: block; }
  body #user-profile .profileleft { position: static; box-shadow: none; }
  body #user-profile .profileright > div { break-inside: avoid; box-shadow: none; }
}
