/*
 * CSECC theme — components: content, images, members, messages,
 * breadcrumb, forms, teasers (news), lists.
 */

/* ---------- Node content ---------- */
.node__content { max-width: none; }
/* Keep running text at a readable line length; let photos and tables use the full width. */
.field--name-body > p,
.field--name-body > ul,
.field--name-body > ol,
.field--name-body > h2,
.field--name-body > h3,
.field--name-body > h4,
.field--name-body > blockquote { max-width: var(--measure); }
.field--name-body > p:has(> img + img) { max-width: none; }
.node--view-mode-full .field--name-body > p:first-child,
.node--view-mode-full .field--name-body > div:first-child > p:first-child { margin-top: 0; }
.node__meta {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.6rem 0 1.4rem;
}

/* Body text: headings inside the editor content */
.field--name-body h2 { padding-top: 0.2rem; }
.field--name-body h2:first-child, .field--name-body h3:first-child { margin-top: 0; }

/* Course codes, project numbers etc. written in <strong> read better in the display face */
.field--name-body strong { font-weight: 600; color: var(--navy-900); }

/* ---------- Images inside editor content ---------- */
.field--name-body img,
.text-content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: var(--radius);
}

/* Floated portrait (Members page): keep it a sensible size whatever
   width/height the old editor hard-coded. */
.field--name-body img[style*="float"],
.field--name-body img[align="left"],
.field--name-body img[align="right"],
.field--name-body .align-right img,
.field--name-body .align-left img,
.field--name-body img.align-right,
.field--name-body img.align-left {
  width: clamp(110px, 24%, 190px) !important;
  margin: 0.3rem 0 1rem 1.5rem;
  box-shadow: var(--shadow);
}
.field--name-body img[style*="float: left"],
.field--name-body img[style*="float:left"],
.field--name-body img[align="left"],
.field--name-body .align-left img,
.field--name-body img.align-left {
  margin: 0.3rem 1.5rem 1rem 0;
}
/* Optional class for a circular portrait: add class="member-photo" in the editor */
.field--name-body img.member-photo {
  width: 140px !important;
  height: 140px !important;
  object-fit: cover;
  border-radius: 50%;
  float: right;
  margin: 0 0 1rem 1.5rem;
  box-shadow: var(--shadow);
}
.field--name-body .align-center img,
.field--name-body img.align-center { display: block; margin-inline: auto; }

@media (max-width: 40rem) {
  .field--name-body img[style*="float"],
  .field--name-body img[align],
  .field--name-body .align-right img,
  .field--name-body .align-left img,
  .field--name-body img.align-right,
  .field--name-body img.align-left,
  .field--name-body img.member-photo {
    float: none !important;
    display: block;
    width: min(60%, 170px) !important;
    margin: 0 auto 1rem;
  }
}

/* Side-by-side photos (About Us page) */
.field--name-body p:has(> img + img) {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.field--name-body p:has(> img + img) img {
  flex: 1 1 14rem;
  width: auto !important;
  min-width: 0;
  object-fit: cover;
  box-shadow: var(--shadow);
}

/* ---------- Members page: name + description pairs ---------- */
.path-members .field--name-body h3,
.field--name-body h3:has(+ p) {
  margin-top: 1.8rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--honey-500);
  font-size: 1.12rem;
}
.path-members .field--name-body h3 a { text-decoration: none; color: var(--navy-900); }
.path-members .field--name-body h3 a:hover { color: var(--blue-600); text-decoration: underline; }
.path-members .field--name-body h3 + p { margin-top: 0.4rem; color: var(--ink-soft); }
.path-members .field--name-body h2 { margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { margin: 0 0 1rem; font-family: var(--font-display); font-size: 0.82rem; }
.breadcrumb__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.breadcrumb__item { color: var(--muted); }
.breadcrumb__item + .breadcrumb__item::before { content: "/"; margin-right: 0.35rem; opacity: 0.5; }
.breadcrumb__item a { color: var(--muted); text-decoration: none; }
.breadcrumb__item a:hover { color: var(--blue-600); text-decoration: underline; }
/* The breadcrumb is noise on a six-page site when it only says "Home". */
.breadcrumb__list:has(> .breadcrumb__item:only-child) { display: none; }

/* ---------- Messages ---------- */
.region--highlighted { margin-bottom: 1rem; }
.messages {
  padding: 0.9rem 1.1rem;
  margin: 0 0 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  border-left-width: 5px;
  background: #fff;
  font-family: var(--font-display);
  font-size: 0.92rem;
  box-shadow: var(--shadow);
}
.messages--status  { border-left-color: #2E8B57; }
.messages--warning { border-left-color: var(--honey-500); }
.messages--error   { border-left-color: #C0392B; }
.messages__list { margin: 0; padding-left: 1.2rem; }

/* ---------- Forms (contact, login, search) ---------- */
.form-item, .form-actions { margin: 0 0 1.1rem; }
label { display: block; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; color: var(--navy-900); margin-bottom: 0.3rem; }
.form-item__description, .description { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="url"], input[type="tel"], input[type="number"], textarea, select {
  width: 100%;
  max-width: 34rem;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #B9C5D6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
textarea { min-height: 9rem; }
input:focus, textarea:focus, select:focus { border-color: var(--blue-600); }
.button, button, input[type="submit"] {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border: 1.5px solid var(--navy-800);
  border-radius: 999px;
  background: var(--navy-800);
  color: #fff;
  font: 600 0.92rem/1.2 var(--font-display);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.button:hover, button:hover, input[type="submit"]:hover { background: var(--navy-700); color: #fff; }
.button--secondary, .button--danger { background: #fff; color: var(--navy-800); }
.nav-toggle { padding: 0.5rem 0.8rem; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 0.4rem; accent-color: var(--navy-800); }
.form-type-checkbox label, .form-type-radio label { display: inline; font-weight: 400; font-family: var(--font-text); font-size: 1rem; }

/* Tabs (Edit / View) for logged-in editors */
.tabs, ul.tabs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1.25rem;
  padding: 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.85rem;
}
.tabs a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.is-active, .tabs a:hover { color: var(--navy-800); border-bottom-color: var(--honey-500); }
.local-actions { list-style: none; padding: 0; margin: 0 0 1rem; }

/* ---------- Lists of content (views, teasers): ready for a News section ---------- */
.view-content:has(> .views-row > .node--view-mode-teaser) { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.node--view-mode-teaser {
  height: 100%;
  padding: 1.2rem 1.3rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(6, 30, 63, 0.05);
}
.node--view-mode-teaser .node__title { font-size: 1.08rem; margin: 0 0 0.4rem; }
.node--view-mode-teaser .node__title a { text-decoration: none; color: var(--navy-900); }
.node--view-mode-teaser .node__title a:hover { color: var(--blue-600); }
.node--view-mode-teaser .node__meta { margin: 0 0 0.6rem; font-size: 0.8rem; }
.node--view-mode-teaser .node__content { font-size: 0.97rem; max-width: none; }
.node--view-mode-teaser .field--name-field-image img { border-radius: 6px; margin-bottom: 0.8rem; }
.node__links, .node__links ul { list-style: none; margin: 0.6rem 0 0; padding: 0; font-family: var(--font-display); font-size: 0.85rem; }
.node__links a { text-decoration: none; font-weight: 600; }
.pager__items { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0; margin: 1.5rem 0 0; font-family: var(--font-display); font-size: 0.9rem; }
.pager__item a { display: inline-block; padding: 0.35rem 0.7rem; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; }
.pager__item.is-active a { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

/* ---------- Bibliography (BibCite) ---------- */
.bibcite-reference, .bibcite-citation { line-height: 1.55; }
.view-content:has(.bibcite-citation) { gap: 0.9rem; }
.views-row:has(.bibcite-citation) { padding-left: 1rem; border-left: 2px solid var(--blue-100); }
.bibcite-links, .bibcite-reference .links { font-family: var(--font-display); font-size: 0.8rem; margin-top: 0.25rem; }
.bibcite-links a { margin-right: 0.8rem; text-decoration: none; }

/* ---------- Misc ---------- */
.feed-icon { display: none; }
.item-list ul { padding-left: 1.2em; }
figure img { display: block; }
figcaption { font-family: var(--font-display); font-size: 0.82rem; color: var(--muted); margin-top: 0.4rem; }

/* ---------- Publication list (Views + BibCite) ---------- */
.pub-filter { margin: 0 0 1.5rem; }
.pub-filter__label { margin-bottom: 0.35rem; }
.pub-filter__row { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.pub-filter__input {
  flex: 1 1 18rem;
  max-width: 34rem;
  padding: 0.65rem 0.9rem 0.65rem 2.4rem;
  border-radius: 999px;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6F88' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") no-repeat 0.85rem center / 1.05rem;
}
.pub-filter__count { font-family: var(--font-display); font-size: 0.85rem; color: var(--muted); }

/* Year headings produced by the view's grouping */
.view-content > h3,
.view-grouping-header {
  margin: 2.2rem 0 0.9rem;
  padding: 0 0 0.35rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.5rem;
  color: var(--navy-800);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.view-content > h3:first-child { margin-top: 0.5rem; }
.view-content > h3::before,
.view-grouping-header::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--honey-500);
  transform: translateY(-0.15rem);
}
/* One citation per row */
.view-content:has(.bibcite-citation) .views-row,
.view-content:has(.views-field-rendered-entity) .views-row,
.view-id-research .views-row {
  margin: 0 0 1rem;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--blue-100);
}
.bibcite-citation { line-height: 1.55; }
.bibcite-citation a { text-decoration: none; }
.bibcite-citation a:hover { text-decoration: underline; }
.bibcite-links { margin-top: 0.3rem; font-family: var(--font-display); font-size: 0.8rem; }
.bibcite-links a { margin-right: 0.8rem; }
.views-row[hidden], .view-content > h3[hidden] { display: none; }
