/*
 * publications-unu.css
 * Style override for UNU-MERIT publications pages (index, search, abstract).
 * Matches the design language of https://unu.edu/merit
 *
 * Link this AFTER the existing theme stylesheets so it takes priority:
 *   <link rel="stylesheet" href="/publications/publications-unu.css">
 */

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --unu-navy:       #003366;   /* primary dark blue */
  --unu-navy-deep:  #00224d;   /* darker variant for hover/active */
  --unu-red:        #c8102e;   /* accent – tags, highlights */
  --unu-gold:       #e8a000;   /* secondary accent */
  --unu-white:      #ffffff;
  --unu-off-white:  #f5f6f8;   /* page background */
  --unu-light-grey: #e8eaed;   /* borders, dividers */
  --unu-mid-grey:   #767676;   /* secondary text */
  --unu-text:       #1a1a1a;   /* body text */

  --font-sans: 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;

  --radius:   4px;
  --shadow:   0 2px 8px rgba(0,0,0,.10);
  --shadow-md:0 4px 16px rgba(0,0,0,.14);

  --max-w: 1200px;
  --gutter: 24px;
}

/* ── Google Font ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body,
.body-wrapper {
  margin: 0;
  padding: 0;
  background: var(--unu-off-white);
  color: var(--unu-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
}

a {
  color: var(--unu-navy);
  text-decoration: none;
}
a:hover { color: var(--unu-red); text-decoration: underline; }

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.top-navigation-wrapper {
  background: var(--unu-navy-deep);
  border-bottom: none;
}
.top-navigation-wrapper-gimmick { display: none; }
.top-navigation { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.top-navigation .menu,
.top-navigation ul { margin: 0; padding: 0; list-style: none; display: flex; }

/* ── Header / logo bar ────────────────────────────────────────────────────── */
.header-outer-wrapper {
  background: var(--unu-navy);
  padding: 16px 0;
}
.header-container-wrapper { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.header-wrapper { display: flex; align-items: center; justify-content: space-between; }

.logo-wrapper a { display: inline-block; }
.logo-wrapper img {
  height: 56px;
  width: auto;
  /* invert logo to white on dark background if it's a dark logo */
  filter: brightness(0) invert(1);
}

/* ── Header right logo ───────────────────────────────────────────────────── */
.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-wrapper-right {
  margin-left: auto;
  padding-right: 24px;
}
.logo-wrapper-right img {
  height: 48px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  -webkit-filter: brightness(0) invert(1);
  /* Firefox SVG filter fallback */
  color-scheme: light;
}
/* Firefox-specific: force compositing layer */
@-moz-document url-prefix() {
  .logo-wrapper-right img {
    filter: brightness(0) invert(1);
    opacity: 0.9999;
    transform: translateZ(0);
  }
}

/* ── Main navigation ──────────────────────────────────────────────────────── */
.main-navigation-wrapper {
  background: var(--unu-navy);
  border-top: 1px solid rgba(255,255,255,.12);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.navigation-container-wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Nav links */
.sf-menu,
nav[aria-label="Main navigation"] { flex: 1; }
.sf-menu ul,
nav[aria-label="Main navigation"] ul {

  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 0;
}
.sf-menu ul li a,
nav[aria-label="Main navigation"] ul li a {
  display: block;
  padding: 14px 16px;
  color: rgba(255,255,255,.85);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
  text-decoration: none;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.sf-menu ul li a:hover,
nav[aria-label="Main navigation"] ul li a:hover,
.sf-menu ul li.current_page_item a,
nav[aria-label="Main navigation"] ul li.current_page_item a {
  color: var(--unu-white);
  background: rgba(255,255,255,.10);
}
.sf-menu ul li.current_page_item a {
  border-bottom: 3px solid var(--unu-gold);
  padding-bottom: 11px;
}

/* Search form in nav */
.search-wrapper { flex-shrink: 0; }
.search-wrapper form { display: flex; align-items: center; gap: 6px; }
#search-text input[type="search"],
#search-text input[type="text"] {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  color: var(--unu-white);
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  width: 180px;
  transition: background .15s, border-color .15s;
}
#search-text input::placeholder { color: rgba(255,255,255,.5); }
#search-text input:focus {
  outline: none;
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.5);
}

/* ── Page layout ──────────────────────────────────────────────────────────── */
.container.main.content-container {
  max-width: var(--max-w);
  margin: 32px auto;
  padding: 0 var(--gutter);
}
.header-content-wrapper,
.content-wrapper { background: none; box-shadow: none; border: none; }

/* Two-column layout: main + sidebar */
.page-wrapper {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.gdl-page-float-left { flex: 1 1 0; min-width: 0; }
.five.columns.gdl-left-sidebar { flex: 0 0 280px; width: 280px; }

/* ── Content card — white card wraps the entire row (main + sidebar) ─────── */
.page-wrapper {
  background: var(--unu-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 36px;
}

/* Inner divs are transparent — no double card effect */
.gdl-page-item,
.sixteen.columns.mt30 {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  border: none !important;
}

/* Sidebar loses its own card since it's inside the wrapper card now */
.left-sidebar-wrapper {
  background: transparent;
  box-shadow: none;
  border-left: 1px solid var(--unu-light-grey);
  border-radius: 0;
  padding: 0 0 0 28px;
}

/* Page title */
h1.gdl-page-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 700;
  color: var(--unu-navy);
  border-bottom: 3px solid var(--unu-navy);
  padding-bottom: 12px;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}

/* ── Publication list entries ─────────────────────────────────────────────── */
.text,
div[style*="margin-left:20pt"],
div[style*="margin-left:20.0pt"] {
  margin: 0 !important;
  padding: 8px 16px !important;
  text-indent: 0 !important;
  background: var(--unu-white);
  border-left: 3px solid var(--unu-light-grey);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  line-height: 1.6;
  transition: border-color .15s;
}
.text:hover,
div[style*="margin-left:20pt"]:hover {
  border-left-color: var(--unu-navy);
}

/* Links inside pub entries */
.text a,
div[style*="margin-left:20pt"] a { color: var(--unu-navy); font-weight: 500; }
.text a:hover,
div[style*="margin-left:20pt"] a:hover { color: var(--unu-red); }

/* Italic journal names — must stay inline within the citation flow */
.text em,
div[style*="margin-left:20pt"] em {
  display: inline !important;
  color: var(--unu-mid-grey);
  font-style: italic;
}

/* More information link — inline, not block */
.text a.linkNormal,
div[style*="margin-left:20pt"] a.linkNormal {
  display: inline !important;
}

/* Result count line */
p > em { color: var(--unu-mid-grey); font-size: 15px; }

/* ── Abstract page ────────────────────────────────────────────────────────── */
.gdl-page-item h3 {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  color: var(--unu-navy);
  margin: 0 0 4px;
  line-height: 1.35;
}
.gdl-page-item > div > div > div > em,
.gdl-page-item > em {
  display: block;
  color: var(--unu-mid-grey);
  font-size: 14px;
  margin-bottom: 0;
}
.gdl-page-item strong {
  display: inline-block;
  background: var(--unu-off-white);
  border: 1px solid var(--unu-light-grey);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 13px;
  color: var(--unu-navy);
  margin-bottom: 16px;
}
.gdl-page-item p { font-size: 15px; line-height: 1.7; color: var(--unu-text); }

/* PDF / DOI button links — abstract page only, not inside pub list entries */
.gdl-page-item > p a[href*=".pdf"],
.gdl-page-item > p a[href*="doi.org"] {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 16px;
  background: var(--unu-navy);
  color: var(--unu-white) !important;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background .15s;
}
.gdl-page-item > p a[href*=".pdf"]:hover,
.gdl-page-item > p a[href*="doi.org"]:hover { background: var(--unu-navy-deep); }

/* All links inside pub list entries: plain inline, no button styling */
.text a,
div[style*="margin-left:20pt"] a,
div[style*="margin-left:20.0pt"] a {
  display: inline !important;
  padding: 0 !important;
  background: none !important;
  color: var(--unu-navy) !important;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0 !important;
}
.text a:hover,
div[style*="margin-left:20pt"] a:hover,
div[style*="margin-left:20.0pt"] a:hover {
  color: var(--unu-red) !important;
  text-decoration: underline;
}

/* Social share */
.social-share-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--unu-mid-grey);
  margin-top: 24px;
  margin-bottom: 8px;
}
.social-shares ul {
  display: flex; gap: 10px; list-style: none; margin: 0; padding: 0;
}
.social-shares ul li a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--unu-off-white);
  border: 1px solid var(--unu-light-grey);
  border-radius: 50%;
  transition: background .15s, border-color .15s;
}
.social-shares ul li a:hover {
  background: var(--unu-navy);
  border-color: var(--unu-navy);
}
.social-shares ul li a img {
  width: 18px; height: 18px; display: block;
  filter: none;
}
.social-shares ul li a:hover img { filter: brightness(0) invert(1); }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.left-sidebar-wrapper {
  background: var(--unu-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.left-sidebar-wrapper h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--unu-navy);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--unu-light-grey);
}

/* Sidebar form */
.left-sidebar-wrapper form { display: flex; flex-direction: column; gap: 0; }

.left-sidebar-wrapper label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--unu-mid-grey);
  margin: 0 0 2px;
  display: block;
}

/* Gap between field groups: space above labels that follow a field */
.left-sidebar-wrapper select + label,
.left-sidebar-wrapper input[type="search"] + label {
  margin-top: 14px;
}
.left-sidebar-wrapper select,
.left-sidebar-wrapper input[type="search"],
.left-sidebar-wrapper input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--unu-light-grey);
  border-radius: var(--radius);
  background: var(--unu-off-white);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--unu-text);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s;
}
.left-sidebar-wrapper select:focus,
.left-sidebar-wrapper input:focus {
  outline: none;
  border-color: var(--unu-navy);
  background: var(--unu-white);
}
.left-sidebar-wrapper input[type="submit"] {
  background: var(--unu-navy);
  color: var(--unu-white);
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .03em;
  transition: background .15s;
  width: 100%;
  margin-top: 4px;
}
.left-sidebar-wrapper input[type="submit"]:hover { background: var(--unu-red); }

/* Sidebar cover image */
.left-sidebar-wrapper img { max-width: 100%; border-radius: var(--radius); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer-container-wrapper {
  background: var(--unu-navy);
  margin-top: 48px;
  padding: 32px 0 16px;
}
.footer-wrapper { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.copyright-container-wrapper {
  background: var(--unu-navy-deep);
  padding: 12px 0;
}
.copyright-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  font-size: 12px;
  color: rgba(255,255,255,.5);
  display: flex;
  justify-content: space-between;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

/* Prevent any element from breaking out of the viewport */
html, body, .body-wrapper { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; height: auto; }

@media (max-width: 900px) {
  /* Stack main column and sidebar vertically */
  .page-wrapper {
    flex-direction: column;
    padding: 16px;
  }
  .five.columns.gdl-left-sidebar {
    width: 100%;
    flex: none;
    border-left: none;
    border-top: 1px solid var(--unu-light-grey);
    padding: 20px 0 0;
  }
  .gdl-page-float-left { width: 100%; }

  /* Search form: two columns on tablet */
  .left-sidebar-wrapper form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
  }
  .left-sidebar-wrapper input[type="submit"] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  /* Navigation: horizontally scrollable, no wrap */
  .main-navigation-wrapper { overflow-x: auto; }
  .navigation-container-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: max-content;
  }
  .sf-menu ul,
  nav[aria-label="Main navigation"] ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sf-menu ul::-webkit-scrollbar { display: none; }
  .sf-menu ul li a,
  nav[aria-label="Main navigation"] ul li a {
    padding: 10px 12px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  /* Search bar full width */
  .search-wrapper { width: 100%; padding: 6px 0 10px; }
  #search-text input { width: 100%; box-sizing: border-box; }

  /* Logo */
  .logo-wrapper img { height: 38px; }

  /* Content card */
  .page-wrapper { padding: 12px; gap: 0; }

  /* Publication entries */
  .text,
  div[style*="margin-left:20pt"],
  div[style*="margin-left:20.0pt"] {
    font-size: 14px !important;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Page title */
  h1.gdl-page-title { font-size: 18px; }
}

@media (max-width: 480px) {
  :root { --gutter: 12px; }

  .container.main.content-container {
    margin: 12px auto;
    padding: 0 var(--gutter);
  }

  /* Header tighter on small phones */
  .header-outer-wrapper { padding: 10px 0; }
  .logo-wrapper img { height: 32px; }

  /* Search sidebar: single column on small phones */
  .left-sidebar-wrapper form {
    grid-template-columns: 1fr;
  }
  .left-sidebar-wrapper input[type="submit"] {
    grid-column: 1;
  }

  /* Pub entries */
  .text,
  div[style*="margin-left:20pt"],
  div[style*="margin-left:20.0pt"] {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }

  h1.gdl-page-title { font-size: 16px; }

  /* Social share icons wrap */
  .social-shares ul { flex-wrap: wrap; }
}

/* ── Utility: hide legacy junk from old theme ─────────────────────────────── */
.gdl-divider { border: none !important; }
.gdl-page-item,
.gdl-page-float-left,
.gdl-page-item > div,
.sixteen.columns.mt30,
.header-content-wrapper,
.content-wrapper.sidebar-included { border: none !important; outline: none !important; }
br.clear { display: none; }
.pt30 { padding-top: 0 !important; }