:root {
  --home-bg: #000;
  --card-bg: #06105f;
  --card-title: #5dcc00;
  --card-text: #e5e5e5;
  --card-button: #91e5f6;
  --gallery-bg: #07142d;
  --gallery-text: #edf3ff;
  --gallery-muted: #b7c5da;
  --dialog-bg: #fff;
  --dialog-text: #172233;
  --focus: #e2b01c;
}

:root[data-theme="light"] {
  --home-bg: #edf1f4;
  --card-bg: #fff;
  --card-title: #176b18;
  --card-text: #273444;
  --card-button: #08599a;
  --gallery-bg: #f8f9fb;
  --gallery-text: #172233;
  --gallery-muted: #526173;
  --dialog-bg: #fff;
  --dialog-text: #172233;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  transition: background-color .35s ease, color .35s ease;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

body.homepage #container,
#main {
  background: var(--home-bg);
  transition: background-color .35s ease;
}

#page-header {
  min-height: 8rem;
}

.institute-logo {
  width: 190px;
  height: auto;
  margin-top: .25rem;
}

.bannerhead {
  display: block;
  margin-left: 210px;
  padding-top: 0;
  font-size: clamp(1.35rem, 1.95vw, 1.85rem);
  line-height: 1.22;
}

.homepage .mission {
  margin-left: 210px;
  margin-top: .45rem;
  font-size: 1.05rem;
  line-height: 1.35;
}

.institute-controls {
  min-width: 12rem;
  padding-left: 1rem;
}

#toplinks button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #666;
  font: inherit;
  cursor: pointer;
}

#toplinks button:hover {
  text-decoration: underline;
}

.control-buttons {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

.control-button {
  min-width: 4.75rem;
  padding: .5rem .7rem;
  border: 1px solid #398000;
  border-radius: 2px;
  background: rgba(255, 255, 255, .84);
  color: #285c05;
  font: 600 .75rem/1 'Open Sans', sans-serif;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.control-button:hover {
  background: #398000;
  color: #fff;
  transform: translateY(-1px);
}

#toggle-menu {
  width: 100%;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#site-nav .main-menu.mobile-open {
  display: block;
}

#site-nav .hecc-home button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #e9c149;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

#main {
  margin-top: 0;
}

.articles-home {
  align-items: stretch;
}

.articles-home .news-card {
  position: relative;
  overflow: hidden;
  border-color: #555;
  transition: transform .35s cubic-bezier(.2,.75,.25,1), box-shadow .35s ease, border-color .35s ease, opacity .45s ease;
}

.articles-home .news-card:hover {
  z-index: 1;
  border-color: #91e5f6;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .28);
  transform: translateY(-5px);
}

.articles-home .news-card .card-block {
  position: relative;
  height: 160px;
  flex-basis: 160px;
  overflow: hidden;
  background: var(--card-bg);
}

.articles-home .news-card.two-col .card-block {
  height: 260px;
  flex-basis: 260px;
  background: var(--card-bg);
}

.articles-home .news-card .card-image {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background-color: #07103b;
  background-size: cover;
  background-position: center;
  cursor: zoom-in;
  transition: transform .65s cubic-bezier(.2,.75,.25,1), filter .35s ease;
}

.articles-home .news-card:hover .card-image {
  transform: scale(1.035);
  filter: saturate(1.08);
}

#tonga .card-image {
  background-position: center;
}

#recognition .card-image {
  background-color: #151334;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

#sympic .card-image {
  background-size: cover;
}

.articles-home .news-card .card-text {
  position: relative;
  padding: 1.2rem 1.4rem 4.3rem;
  background: var(--card-bg);
  color: var(--card-text);
  transition: background-color .35s ease, color .35s ease;
}

.articles-home .news-card h2 {
  color: var(--card-title);
  font-size: 1.32rem;
  line-height: 1.32;
  transition: color .35s ease;
}

.articles-home .news-card .card-text p {
  margin-top: .6rem;
  margin-bottom: .7rem;
}

.articles-home .news-card .card-text p:nth-last-child(2) {
  margin-bottom: 0;
}

.card-metric {
  display: flex;
  align-items: baseline;
  gap: .65rem;
  margin: .75rem 0 .35rem;
}

.card-metric strong {
  flex: none;
  color: #fff;
  font: 500 1.85rem/1 'Roboto', sans-serif;
  letter-spacing: -.02em;
}

:root[data-theme="light"] .card-metric strong {
  color: #08599a;
}

.card-metric span {
  color: var(--card-text);
  font-size: .72rem;
  line-height: 1.35;
  opacity: .82;
}

.articles-home .news-card .card-text .read-more {
  display: block;
  width: max-content;
  margin: 0;
  color: var(--card-button);
  border-color: var(--card-button);
  font: inherit;
  line-height: 1.35;
  transition: background-color .2s ease, color .2s ease;
}

.read-more button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.articles-home .news-card .card-text .read-more:hover {
  background: var(--card-button);
  color: var(--card-bg);
}

.about-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin: 1rem 0;
}

.about-numbers span {
  display: flex;
  flex-direction: column;
  border-left: 2px solid #e2b01c;
  padding-left: .55rem;
}

.about-numbers strong {
  color: #fff;
  font: 500 1.8rem/1 'Roboto', sans-serif;
}

:root[data-theme="light"] .about-numbers strong {
  color: #08599a;
}

.about-numbers small {
  margin-top: .35rem;
  font-size: .68rem;
  line-height: 1.25;
}

.hecc-banner {
  grid-template-rows: auto;
  min-height: 12rem;
  align-items: center;
  overflow: hidden;
}

.hecc-banner > div {
  align-self: center;
  margin-bottom: 0;
}

.hecc-banner h2 {
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.hecc-banner .hecc-image button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.hecc-banner .hecc-image img {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: 9rem;
  object-fit: cover;
  transition: transform .4s ease, box-shadow .4s ease;
}

.hecc-banner .hecc-image button:hover img {
  transform: scale(1.025);
  box-shadow: 0 0 24px rgba(226, 176, 28, .25);
}

.hecc-banner button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #d2e4ff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hecc-banner button:hover,
.hecc-banner a:hover {
  color: #fff;
  text-decoration: underline;
}

.gallery-section {
  background: var(--gallery-bg);
  color: var(--gallery-text);
  transition: background-color .35s ease, color .35s ease;
}

.gallery-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #398000;
  padding-bottom: 1rem;
}

.gallery-heading h2 {
  color: var(--gallery-text);
  font-size: 1.8rem;
}

.eyebrow {
  margin: 0 0 .35rem;
  color: #398000;
  font: 600 .68rem/1.3 'Open Sans', sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}

.gallery-filters button {
  padding: .45rem .75rem;
  border: 1px solid #398000;
  border-radius: 2px;
  background: transparent;
  color: var(--gallery-text);
  font: 600 .72rem/1.2 'Open Sans', sans-serif;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

.gallery-filters button:hover,
.gallery-filters button.active {
  background: #398000;
  color: #fff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 1rem;
}

.gallery-item {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #657080;
  background: #fff;
  transition: transform .35s ease, box-shadow .35s ease, opacity .25s ease;
}

.gallery-item.featured {
  grid-column: span 2;
}

.gallery-item button {
  display: block;
  width: 100%;
  height: 13rem;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #081332;
  cursor: zoom-in;
}

.gallery-item.featured button {
  height: 17rem;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s cubic-bezier(.2,.75,.25,1), filter .35s ease;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}

.gallery-item:hover img {
  transform: scale(1.045);
  filter: saturate(1.1);
}

.gallery-item figcaption {
  min-height: 3.2rem;
  padding: .65rem .75rem;
  background: var(--gallery-bg);
  color: var(--gallery-muted);
  font: .75rem/1.4 'Open Sans', sans-serif;
}

.gallery-item[hidden] {
  display: none;
}

#secondary-nav ul li button {
  display: block;
  width: 100%;
  padding: .8rem 2rem;
  border: 0;
  background: transparent;
  color: #fcfcfc;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

#secondary-nav ul li button:hover {
  background: #398000;
}

#page-footer {
  gap: 2rem;
}

#page-footer .legal img {
  width: 11rem;
  height: auto;
  margin-bottom: .75rem;
  filter: brightness(0) invert(1);
}

#page-footer .legal li {
  max-width: 62rem;
}

#sources {
  margin-top: .65rem;
  opacity: .84;
}

#container > .fir-dialog {
  width: calc(100% - 2rem);
  max-height: 90vh;
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #718096;
  border-radius: 3px;
  background: var(--dialog-bg);
  color: var(--dialog-text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .45);
}

.fir-dialog::backdrop {
  background: rgba(0, 5, 18, .78);
  backdrop-filter: blur(5px);
  animation: backdrop-in .25s ease both;
}

.fir-dialog[open] {
  animation: dialog-in .32s cubic-bezier(.2,.75,.25,1) both;
}

.dialog-close {
  position: absolute;
  z-index: 3;
  top: .65rem;
  right: .65rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  padding: 0;
  border: 1px solid #8b98a8;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #172233;
  font: 300 1.6rem/1 'Lato', sans-serif;
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease;
}

.dialog-close:hover {
  background: #e2b01c;
  transform: rotate(90deg);
}

#container > .detail-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  max-width: 72rem;
}

.detail-media {
  min-height: 100%;
  background: #07142d;
}

.detail-media button {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 28rem;
  padding: 0;
  border: 0;
  background: #07142d;
  cursor: zoom-in;
}

.detail-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 28rem;
  object-fit: contain;
}

.detail-body {
  padding: 2.25rem;
}

.detail-body h2,
.info-dialog h2 {
  color: #08599a;
  font-size: 1.65rem;
  line-height: 1.3;
}

.detail-metric {
  display: flex;
  flex-direction: column;
  margin: 1.25rem 0;
  border-left: 3px solid #398000;
  padding-left: 1rem;
}

.detail-metric strong {
  color: #08599a;
  font: 500 2rem/1.1 'Roboto', sans-serif;
}

.detail-metric span {
  margin-top: .4rem;
  color: #536273;
  font-size: .8rem;
}

.detail-body h3 {
  margin-top: 1.25rem;
  color: #398000;
  font-size: 1rem;
}

.detail-body p {
  line-height: 1.7;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1.5rem;
}

.detail-links a,
.dialog-external {
  display: inline-block;
  padding: .55rem .8rem;
  border: 1px solid #08599a;
  border-radius: 2px;
  color: #08599a;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}

.detail-links a:hover,
.dialog-external:hover {
  background: #08599a;
  color: #fff;
}

.detail-links a[hidden] {
  display: none;
}

#container > .lightbox-dialog {
  max-width: 86rem;
  overflow: visible;
  border: 0;
  background: transparent;
  color: #fff;
}

#lightbox-image {
  display: block;
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

#lightbox-caption {
  margin: .75rem 2.5rem 0;
  color: #fff;
  text-align: center;
}

#container > .info-dialog {
  max-width: 58rem;
  padding: 2.5rem;
}

.info-lead {
  margin-top: 1.25rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.about-directions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.about-directions section {
  border-top: 2px solid #398000;
  padding-top: .8rem;
}

.about-directions h3 {
  color: #08599a;
  font-size: 1rem;
}

.about-directions p {
  font-size: .88rem;
  line-height: 1.65;
}

.sources-list {
  padding-left: 1.25rem;
}

.sources-list li {
  margin: .8rem 0;
  line-height: 1.5;
}

.sources-list a {
  color: #08599a;
}

.motion-ready .news-card.reveal-pending,
.motion-ready .gallery-item.reveal-pending {
  opacity: 0;
  transform: translateY(22px);
}

.motion-ready .news-card.is-visible,
.motion-ready .gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item {
  transition: transform .35s ease, box-shadow .35s ease, opacity .4s ease;
}

.motion-ready .news-card.is-visible:hover,
.motion-ready .gallery-item.is-visible:hover {
  transform: translateY(-4px);
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 1100px) {
  .bannerhead {
    font-size: 1.5rem;
  }

  .homepage .mission {
    font-size: .92rem;
  }

  .institute-logo {
    width: 125px;
  }

  .bannerhead,
  .homepage .mission {
    margin-left: 145px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #page-header {
    grid-template-areas: "banner" "search";
    grid-template-columns: 1fr;
  }

  .institute-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .75rem 0 0;
  }

  #toplinks {
    margin: 0;
  }

  .control-buttons {
    margin: 0;
  }

  .about-directions {
    grid-template-columns: 1fr;
  }

  #container > .detail-dialog[open] {
    grid-template-columns: 1fr;
  }

  .detail-media button,
  .detail-media img {
    min-height: 16rem;
    max-height: 22rem;
  }
}

@media (max-width: 640px) {
  body {
    margin: 0;
  }

  #container {
    border: 0;
    box-shadow: none;
  }

  #container > * {
    padding: 1rem;
  }

  #page-header {
    min-height: 0;
  }

  .institute-logo {
    width: 100px;
  }

  .bannerhead,
  .homepage .mission {
    margin-left: 116px;
  }

  .bannerhead {
    font-size: 1.08rem;
  }

  .homepage .mission {
    margin-top: .35rem;
    font-size: .78rem;
  }

  #toplinks {
    padding-right: 0;
  }

  .control-button {
    min-width: 4rem;
    padding: .45rem .55rem;
  }

  .articles-home {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .articles-home .news-card.two-col {
    grid-column: span 1;
  }

  .articles-home .news-card .card-block,
  .articles-home .news-card.two-col .card-block {
    height: 190px;
    flex-basis: 190px;
  }

  .articles-home .news-card h2 {
    font-size: 1.2rem;
  }

  .card-metric {
    align-items: flex-start;
    flex-direction: column;
    gap: .35rem;
  }

  .hecc-banner {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .hecc-banner .hecc-title,
  .hecc-banner .hecc-image {
    grid-column: span 1;
  }

  .hecc-banner .hecc-image img {
    height: 8rem;
  }

  .gallery-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .gallery-filters {
    justify-content: flex-start;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-item.featured {
    grid-column: span 1;
  }

  .gallery-item button,
  .gallery-item.featured button {
    height: 14rem;
  }

  #secondary-nav ul {
    flex-wrap: wrap;
  }

  #secondary-nav ul li button,
  #secondary-nav ul li a {
    padding: .8rem 1rem;
  }

  #page-footer {
    grid-template-areas: "legal" "peeps";
    grid-template-columns: 1fr;
  }

  #page-footer .credits {
    justify-self: start;
    text-align: left;
  }

  #container > .info-dialog {
    padding: 1.5rem;
  }

  .detail-body {
    padding: 1.5rem;
  }

  .detail-body h2,
  .info-dialog h2 {
    padding-right: 1.5rem;
    font-size: 1.3rem;
  }
}

@media (max-width: 1059px) {
  #site-nav .hecc-home button {
    display: block;
    padding: .72em 1.5em;
    background: #323232;
    text-align: left;
  }
}

.bannerblock img.institute-logo {
  width: 190px !important;
  padding: 0 20px 0 0;
}

@media (max-width: 1100px) {
  .bannerblock img.institute-logo {
    width: 140px !important;
  }
}

@media (max-width: 640px) {
  .bannerblock img.institute-logo {
    width: 100px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .motion-ready .news-card.reveal-pending,
  .motion-ready .gallery-item.reveal-pending {
    opacity: 1;
    transform: none;
  }

  .fir-dialog::backdrop,
  .fir-dialog[open] {
    animation: none;
  }
}
