/*
 * Durham University Brand Colors and Styling
 * Following Durham University Brand Guidelines
 */

:root {
  /* Durham Brand Colors */
  --durham-purple: #68246d;
  --durham-ink: #002a41;
  --durham-yellow: #ffd53a;
  --durham-sky: #a5c8d0;
  --durham-stone: #dacda2;
  --durham-gold: #afa961;
  --durham-concrete: #b3bdb1;

  /* Additional shades for gradients and hover states */
  --durham-purple-light: #7d3582;
  --durham-purple-dark: #551d5a;
  --durham-ink-light: #003d5c;
}

/* Hero Section Styling */
.hero-section {
  margin: -2rem -1rem 2rem -1rem;
  padding: 0;
  background: linear-gradient(135deg, var(--durham-purple) 0%, var(--durham-ink) 100%);
  position: relative;
  overflow: hidden;
}

@media screen and (min-width: 76.25em) {
  .hero-section {
    margin: -2rem -2rem 2rem -2rem;
  }
}

.hero-image {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
}

@media screen and (min-width: 60em) {
  .hero-image {
    height: 600px;
  }
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: brightness(0.8);
}

.hero-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0, 42, 65, 0.3) 0%, rgba(104, 36, 109, 0.6) 50%, rgba(104, 36, 109, 0.9) 100%);
  pointer-events: none;
}

.image-attribution {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 42, 65, 0.6);
  padding: 4px 8px;
  border-radius: 3px;
  margin: 0;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.image-attribution a {
  color: var(--durham-yellow);
  text-decoration: none;
  font-weight: 500;
}

.image-attribution a:hover {
  color: #f5ca1a;
  text-decoration: underline;
}

.hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.5rem;
  color: white;
  background: transparent;
  z-index: 2;
}

@media screen and (min-width: 60em) {
  .hero-content {
    padding: 3rem 4rem;
  }
}

.hero-content h1 {
  color: white;
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@media screen and (min-width: 60em) {
  .hero-content h1 {
    font-size: 3rem;
  }
}

.hero-content h2 {
  color: var(--durham-gold);
  font-size: 1.3rem;
  margin: 0 0 1rem 0;
  font-weight: 500;
  border: none;
  padding: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

@media screen and (min-width: 60em) {
  .hero-content h2 {
    font-size: 1.5rem;
  }
}

.hero-description {
  padding: 2rem 1.5rem;
  color: white;
  background: linear-gradient(135deg, var(--durham-purple-dark) 0%, var(--durham-ink) 100%);
}

@media screen and (min-width: 60em) {
  .hero-description {
    padding: 3rem 4rem;
  }
}

.hero-description p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  max-width: 900px;
}

@media screen and (min-width: 60em) {
  .hero-description p {
    font-size: 1.1rem;
  }
}

/* Base Typography - Open Sans with Durham guidelines */
body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--durham-ink);
  text-align: left;
  font-weight: 400;
}

/* Headers using Durham Purple */
h1, h2, h3, h4, h5, h6 {
  color: var(--durham-purple);
  font-weight: 600;
}

/* Primary color overrides */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: var(--durham-purple);
  --md-primary-fg-color--light: var(--durham-purple-light);
  --md-primary-fg-color--dark: var(--durham-purple-dark);
  --md-primary-bg-color: #fff;
  --md-primary-bg-color--light: #ffffffb3;

  /* Accent colors */
  --md-accent-fg-color: var(--durham-yellow);
  --md-accent-fg-color--transparent: rgba(255, 213, 58, 0.1);
  --md-accent-bg-color: var(--durham-ink);

  /* Text colors */
  --md-typeset-color: var(--durham-ink);
  --md-default-fg-color: var(--durham-ink);
  --md-default-fg-color--light: rgba(0, 42, 65, 0.54);
  --md-default-fg-color--lighter: rgba(0, 42, 65, 0.32);
  --md-default-fg-color--lightest: rgba(0, 42, 65, 0.07);

  /* Code colors */
  --md-code-fg-color: var(--durham-purple);
  --md-code-bg-color: rgba(104, 36, 109, 0.05);

  /* Link colors */
  --md-typeset-a-color: var(--durham-purple);
}

/* Navigation header with gradient */
.md-header {
  background: linear-gradient(135deg, var(--durham-purple) 0%, var(--durham-purple-dark) 100%);
  box-shadow: 0 2px 8px rgba(104, 36, 109, 0.2);
}

/* Navigation tabs */
.md-tabs {
  background: linear-gradient(180deg, var(--durham-purple-dark) 0%, var(--durham-purple) 100%);
  border-bottom: 2px solid var(--durham-gold);
}

.md-tabs__link {
  font-weight: 500;
  opacity: 0.85;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  opacity: 1;
  color: var(--durham-yellow);
}

/* Search bar */
.md-search__input {
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.md-search__input:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Sidebar navigation */
.md-nav__item--active > .md-nav__link {
  color: var(--durham-purple);
  font-weight: 600;
}

.md-nav__link:hover {
  color: var(--durham-purple);
}

/* Buttons and links */
.md-button {
  background-color: var(--durham-purple);
  border-color: var(--durham-purple);
  color: white;
  font-weight: 500;
}

.md-button:hover,
.md-button:focus {
  background-color: var(--durham-purple-dark);
  border-color: var(--durham-purple-dark);
}

.md-button--primary {
  background-color: var(--durham-yellow);
  border-color: var(--durham-yellow);
  color: var(--durham-ink);
  font-weight: 600;
}

.md-button--primary:hover,
.md-button--primary:focus {
  background-color: #f5ca1a;
  border-color: #f5ca1a;
}

/* Admonitions using Durham colors */
.md-typeset .admonition.note,
.md-typeset .admonition.info {
  border-left-color: var(--durham-sky);
}

.md-typeset .admonition.note > .admonition-title,
.md-typeset .admonition.info > .admonition-title {
  background-color: rgba(165, 200, 208, 0.1);
}

.md-typeset .admonition.warning,
.md-typeset .admonition.attention {
  border-left-color: var(--durham-yellow);
}

.md-typeset .admonition.warning > .admonition-title,
.md-typeset .admonition.attention > .admonition-title {
  background-color: rgba(255, 213, 58, 0.1);
}

.md-typeset .admonition.tip,
.md-typeset .admonition.success {
  border-left-color: var(--durham-gold);
}

.md-typeset .admonition.tip > .admonition-title,
.md-typeset .admonition.success > .admonition-title {
  background-color: rgba(175, 169, 97, 0.1);
}

/* Tables */
.md-typeset table:not([class]) {
  border: 1px solid var(--durham-concrete);
}

.md-typeset table:not([class]) th {
  background-color: var(--durham-purple);
  color: white;
  font-weight: 600;
}

.md-typeset table:not([class]) tr:hover {
  background-color: rgba(165, 200, 208, 0.1);
}

/* Horizontal rules */
.md-typeset hr {
  border-bottom: 1px solid var(--durham-concrete);
}

/* Code blocks */
.md-typeset code {
  background-color: rgba(104, 36, 109, 0.05);
  color: var(--durham-purple);
  border: 1px solid rgba(104, 36, 109, 0.1);
}

.md-typeset pre > code {
  background-color: var(--durham-ink);
}

/* Footer */
.md-footer {
  background: linear-gradient(135deg, var(--durham-ink) 0%, var(--durham-ink-light) 100%);
  color: white;
}

.md-footer-meta {
  background-color: rgba(0, 42, 65, 0.9);
}

.md-footer__link:hover,
.md-footer__link:focus {
  color: var(--durham-yellow);
}

/* Tags (for future use) */
.md-tag {
  background-color: var(--durham-sky);
  color: var(--durham-ink);
  font-weight: 500;
}

.md-tag:hover {
  background-color: #8fb5c0;
}

/* Dividers and borders */
.md-typeset .md-content__inner > :first-child {
  margin-top: 0;
}

/* Enhanced readability */
.md-typeset {
  line-height: 1.7;
  font-size: 0.9rem;
}

.md-typeset h1 {
  font-size: 2rem;
  margin: 2rem 0 1rem;
}

.md-typeset h2 {
  font-size: 1.5rem;
  margin: 1.5rem 0 0.8rem;
  border-bottom: 2px solid var(--durham-gold);
  padding-bottom: 0.3rem;
}

.md-typeset h3 {
  font-size: 1.25rem;
  margin: 1.2rem 0 0.6rem;
}

/* Strong emphasis using brand colors */
.md-typeset strong {
  color: var(--durham-purple);
  font-weight: 600;
}

/* Lists */
.md-typeset ul, .md-typeset ol {
  margin-left: 1.5rem;
}

.md-typeset li {
  margin-bottom: 0.5rem;
}

/* Blockquotes */
.md-typeset blockquote {
  border-left: 4px solid var(--durham-gold);
  background-color: rgba(175, 169, 97, 0.05);
  padding: 0.5rem 1rem;
}

/* Navigation icons */
.md-nav__icon {
  color: var(--durham-purple);
}

/* Table of contents */
.md-nav--secondary .md-nav__link--active {
  color: var(--durham-purple);
  border-left-color: var(--durham-yellow);
}

/* Back to top button */
.md-top {
  background-color: var(--durham-purple);
  color: var(--durham-yellow);
}

.md-top:hover,
.md-top:focus {
  background-color: var(--durham-purple-dark);
  color: #f5ca1a;
}

.md-top svg {
  fill: var(--durham-yellow);
}

.md-top:hover svg,
.md-top:focus svg {
  fill: #f5ca1a;
}

/* Improve spacing and readability for content */
.md-content {
  padding: 2rem 1rem;
}

@media screen and (min-width: 76.25em) {
  .md-content {
    padding: 2rem 4rem;
  }
}

/* Widen main content column on desktop */
@media screen and (min-width: 76.25em) {
  .md-grid {
    max-width: 1400px;
  }

  .md-main__inner {
    max-width: none;
  }

  /* Add padding to sidebars to bring them inwards from page edges */
  .md-sidebar--primary {
    padding-left: 2rem;
  }

  .md-sidebar--secondary {
    padding-right: 2rem;
  }

  /* Right-align sidebar navigation text */
  .md-sidebar--primary .md-nav {
    direction: rtl;
  }

  .md-sidebar--primary .md-nav__item {
    direction: rtl;
  }

  .md-sidebar--primary .md-nav__link {
    direction: ltr;
    display: flex;
    justify-content: flex-end;
  }
}

/* Archive notice styling (for future use) */
.archive-notice {
  background-color: var(--durham-stone);
  border: 1px solid var(--durham-gold);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
}

/* Prominent call-to-action links */
.md-typeset .cta-link {
  display: inline-block;
  background-color: var(--durham-yellow);
  color: var(--durham-ink);
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 2px solid var(--durham-gold);
}

.md-typeset .cta-link:hover {
  background-color: #f5ca1a;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(104, 36, 109, 0.2);
}

/* Project Logos Styling */
.project-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  margin: 2rem 0;
  padding: 2rem 1rem;
  background: white;
  border: 1px solid var(--durham-concrete);
  border-radius: 8px;
  flex-wrap: wrap;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.partner-logo {
  max-height: 80px;
  width: auto;
  display: block;
}

.durham-logo {
  width: 200px;
  height: auto;
}

.ukri-logo {
  max-width: 180px;
  max-height: none;
  height: auto;
  width: auto;
}

@media screen and (max-width: 60em) {
  .project-logos {
    gap: 2rem;
    padding: 1.5rem 1rem;
  }

  .partner-logo {
    max-height: 60px;
  }

  .durham-logo {
    width: 160px;
    height: auto;
  }

  .ukri-logo {
    max-width: 140px;
    max-height: none;
    height: auto;
    width: auto;
  }
}

/* Logo styling in other contexts */
.md-typeset img.partner-logo {
  margin: 0;
  vertical-align: middle;
}

/* Image Grid Styling */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.image-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  border: 1px solid var(--durham-concrete);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-item img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.image-item em {
  text-align: center;
  font-size: 0.9rem;
  color: var(--durham-ink);
  font-style: italic;
  line-height: 1.4;
}

@media screen and (max-width: 60em) {
  .image-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Ensure images maintain aspect ratio */
.md-typeset .image-item img {
  max-width: 100%;
  display: block;
}

/* Profile Picture Styling - Durham Branding */
.profile-section {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.profile-picture {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 0 0 50% 0;
  object-fit: cover;
  border: 2px solid var(--durham-concrete);
}

.profile-content {
  flex: 1;
}

@media screen and (max-width: 60em) {
  .profile-section {
    flex-direction: column;
    gap: 1rem;
  }

  .profile-picture {
    width: 100px;
    height: 100px;
  }
}
