/* ===== Base ===== */
body, body * {
  font-family: Corbel, "Helvetica Neue", Helvetica, Arial, FreeSans, "Liberation Sans", sans-serif !important;
}
body {
  background: #f2f2f2;
  color: #333;
  margin: 0;
}
a { color: #36C; text-decoration: none; }
a:hover, a:focus { color: #ED1A09; text-decoration: underline; }

/* Neutralize Drupal/Olivero's own full-height layout containers so our footer follows content, not the viewport */
#page-wrapper, #main-wrapper, #main, .layout-main, .layout-main-wrapper {
  min-height: 0 !important;
  height: auto !important;
}

/* ===== Page wrapper ===== */
.grima-page-wrapper {
  max-width: 1180px;
  margin: 20px auto;
  background: #fff;
  border: 1px solid #ccc;
}

/* ===== Nav bar ===== */
.grima-nav-bar {
  background-color: #d9d9d9;
  border-bottom: 1px solid #333;
  height: 35px !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
}
.grima-nav-inner ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.grima-nav-inner ul li {
  display: inline-block;
  white-space: nowrap;
}
.grima-nav-inner ul li a {
  display: inline-block !important;
  padding: 0 3px !important;
  margin: 0 !important;
  border: none !important;
  line-height: 2.2em !important;
  font-size: 1.05em !important;
  color: #333;
  font-weight: bold;
  text-decoration: none;
}
.grima-nav-inner ul li a:hover,
.grima-nav-inner ul li a.is-active {
  background: #333;
  color: #fff;
}
#block-grima-theme-search-form-narrow {
  display: none !important;
}

/* ===== Banner ===== */
.grima-banner { background:#2b1e3a; } .grima-banner img { width:100%; height:auto; display:block; }
.grima-rule-top {
  height: 5px;
  background: #ccc;
  border: 0;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
  margin: 0;
}

/* ===== Content area ===== */
.grima-content-area {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}
.grima-title h1 {
  margin: 0 0 18px;
  padding-bottom: 6px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  border-bottom: 3px solid #bbbbbb;
}
.grima-title h1, h1.title.page-title { display: block !important; width: 100% !important; box-sizing: border-box !important; }
.grima-main p {
  max-width: 900px;
  margin: 0 0 24px;
  font-size: 17px;
  line-height: 1.7;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}
.grima-main img { display: block !important; float: none !important; width: 100% !important; max-width: 1000px !important; height: auto !important; margin: 28px auto !important; }
.text-content img, .field--name-body img { display: block; margin: 0 0 22px 0; max-width: 100%; height: auto; }
.grima-main img[data-entity-type="file"] { width:100% !important; max-width:1000px !important; height:auto !important; display:block !important; }
.grima-main, .grima-title {
  width: 100%;
  max-width: 100%;
}
.grima-main h3, .text-content h3, .field--name-body h3 { border-bottom: 1px solid #ccc; padding-bottom: 4px; margin: 10px 0 6px 0; font-weight: normal; color: #444; }
h3 + p, h3 + ul { margin-top: 0 !important; }
.region-content, .layout--content-medium, .grid-full {
  display: block !important;
  grid-template-columns: none !important;
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 20px !important;
}

/* ===== Footer ===== */
.grima-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 60px;
  padding: 26px 24px;
  border-top: 1px solid #ddd;
}
.grima-footer img {
  height: 46px;
  width: auto;
}

/* ===== Mobile responsiveness ===== */
@media (max-width: 768px) {
  .grima-page-wrapper {
    margin: 0 auto;
    border-left: none;
    border-right: none;
  }
  .grima-nav-bar {
    height: 44px !important;
    overflow: visible !important;
    align-items: center !important;
  }
  .grima-nav-inner {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .grima-nav-inner ul {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .grima-nav-inner ul li {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .grima-nav-inner ul li a {
    font-size: 0.85em !important;
    padding: 6px 6px !important;
    line-height: 1.4em !important;
  }
  .grima-content-area {
    padding: 20px 16px 32px;
  }
  .grima-title h1 {
    font-size: 22px;
    margin: 0 0 16px;
    padding-bottom: 10px;
  }
  .grima-main p {
    font-size: 16px;
    max-width: 100%;
  }
  .grima-main img {
    max-width: 100% !important;
  }
  .grima-footer {
    flex-direction: column;
    gap: 16px;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .grima-nav-inner ul li a {
    font-size: 0.85em !important;
    padding: 5px 6px !important;
  }
  .grima-title h1 {
    font-size: 20px;
  }
}

/* Computational Tools page (node 6): no underline under tool-name headings */
article[data-history-node-id="6"] h3 {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* Computational Tools page (node 6): no underline under tool-name headings */
article[data-history-node-id="6"] h3 {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* Computational Tools page (node 6): bold tool-name headings */
article[data-history-node-id="6"] h3 {
  font-weight: bold !important;
}

/* Small gap between nav bar and banner below it */
.grima-nav-bar {
  margin-bottom: 5px;
}

/* Tighten nav menu item spacing (desktop only) */
@media (min-width: 769px) {
  .grima-nav-inner ul {
    display: flex !important;
  }
  .grima-nav-inner ul li a {
    padding: 0 2px !important;
  }
}

/* Soft shadow under nav bar instead of a hard line */
.grima-nav-bar {
  border-bottom: none !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.35);
}

/* Match Edinburgh's tighter, non-bold nav text (desktop only) */
@media (min-width: 769px) {
  .grima-nav-inner ul li a {
    font-size: 0.9em !important;
    font-weight: 600 !important;
    line-height: 1.4em !important;
  }
}
