:root {
  --mcis-ink: #173447;
  --mcis-muted: #617180;
  --mcis-line: #dce8ee;
  --mcis-surface: #f2f8f9;
  --mcis-blue: #16779a;
  --mcis-green: #15956f;
  --mcis-gold: #d5a41d;
  --mcis-red: #c94f4f;
  --mcis-deep: #103449;
  --mcis-sky: #dff1f6;
}

body {
  background: #fbfdfd;
  color: var(--mcis-ink);
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  text-decoration: none;
}

.app-nav {
  background: #071821;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.app-brand {
  display: inline-flex;
  padding-bottom: 0.35rem;
  padding-top: 0.35rem;
}

.brand-mark {
  height: auto;
  max-height: 100px;
  object-fit: contain;
  width: auto;
}

.hero-band {
  background:
    linear-gradient(110deg, rgba(16, 52, 73, 0.96), rgba(22, 119, 154, 0.84)),
    url("/static/images/homebanner.jpg") center / cover;
  color: #ffffff;
}

.page-head {
  background:
    linear-gradient(180deg, rgba(242, 248, 249, 0.96), rgba(255, 255, 255, 0.94));
  border-bottom: 1px solid var(--mcis-line);
  padding: 2.5rem 0;
}

.surface-band {
  background: var(--mcis-surface);
  border-top: 1px solid var(--mcis-line);
  border-bottom: 1px solid var(--mcis-line);
}

.section-kicker {
  color: var(--mcis-gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid div {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 1rem;
}

.metric-grid span {
  display: block;
  font-size: 2rem;
  font-weight: 700;
}

.metric-grid small {
  color: rgba(255, 255, 255, 0.78);
}

.item-card {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  color: var(--mcis-ink);
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 1rem;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.item-card.tall {
  min-height: 280px;
}

.clickable-card {
  position: relative;
}

.item-card:hover {
  border-color: rgba(21, 149, 111, 0.42);
  box-shadow: 0 12px 30px rgba(16, 52, 73, 0.1);
  color: var(--mcis-ink);
  transform: translateY(-1px);
}

.item-media {
  background: var(--mcis-sky);
  border-radius: 6px;
  display: block;
  height: 132px;
  margin-bottom: 0.95rem;
  overflow: hidden;
  width: 100%;
}

.item-media.compact {
  height: 96px;
}

.item-media img,
.detail-image,
.directory-image,
.visual-list-row img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.item-label {
  color: var(--mcis-ink);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.item-label:hover {
  color: var(--mcis-blue);
}

.item-copy {
  color: var(--mcis-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.events-panel {
  background: #ffffff;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  padding: 1rem 1rem 0.35rem;
}

.events-panel-head {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.event-timeline {
  display: grid;
  gap: 0.85rem;
}

.event-card {
  border-top: 1px solid var(--mcis-line);
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 112px minmax(0, 1fr);
  padding-top: 0.85rem;
}

.event-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.event-year {
  color: var(--mcis-gold);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.event-body h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.event-body p {
  color: var(--mcis-muted);
  margin-bottom: 0.45rem;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.event-meta span {
  background: var(--mcis-surface);
  border: 1px solid var(--mcis-line);
  border-radius: 999px;
  color: var(--mcis-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
}

@media (max-width: 720px) {
  .event-card {
    grid-template-columns: 1fr;
  }
}

.event-source,
.event-source-text {
  font-size: 0.84rem;
}

.event-source-text {
  color: var(--mcis-muted);
}

.phase-badge {
  align-items: center;
  color: var(--mcis-ink) !important;
  display: inline-flex;
  gap: 0.35rem;
  line-height: 1;
}

.phase-badge-icon {
  background: currentColor;
  display: inline-block;
  flex: 0 0 auto;
  height: 0.95rem;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  width: 0.95rem;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.phase-badge-production .phase-badge-icon {
  mask-image: url("/static/icons/minecart-loaded.svg");
  -webkit-mask-image: url("/static/icons/minecart-loaded.svg");
}

.phase-badge-trade .phase-badge-icon {
  mask-image: url("/static/icons/arrow-left-right.svg");
  -webkit-mask-image: url("/static/icons/arrow-left-right.svg");
}

.read-more-button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--mcis-blue);
  display: inline;
  font-size: 0.84rem;
  font-weight: 700;
  margin-left: 0.35rem;
  padding: 0;
  position: relative;
  text-decoration: underline;
  text-underline-offset: 0.16rem;
  z-index: 2;
}

.read-more-button:hover,
.read-more-button:focus {
  color: var(--mcis-green);
}

.read-more-button-lg {
  font-size: 0.94rem;
}

.country-chip {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  color: var(--mcis-ink);
  display: flex;
  font-weight: 600;
  justify-content: space-between;
  min-height: 54px;
  padding: 0.85rem 1rem;
}

.country-chip:hover {
  border-color: rgba(21, 149, 111, 0.42);
  color: var(--mcis-blue);
}

.country-chip span {
  color: var(--mcis-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.country-chip-with-flag {
  gap: 0.75rem;
}

.country-chip-main {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  min-width: 0;
}

.country-chip-flag {
  background: var(--mcis-surface);
  border: 1px solid var(--mcis-line);
  border-radius: 4px;
  display: inline-flex;
  flex: 0 0 34px;
  height: 24px;
  overflow: hidden;
  width: 34px;
}

.country-chip-flag img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.country-chip-name {
  color: var(--mcis-ink);
  font-size: 0.94rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.country-chip-code {
  flex: 0 0 auto;
  margin-left: auto;
}

.country-link-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.flag-link-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  color: var(--mcis-ink);
  display: flex;
  gap: 0.8rem;
  min-height: 64px;
  padding: 0.7rem 0.85rem;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.flag-link-card:hover {
  border-color: rgba(21, 149, 111, 0.42);
  box-shadow: 0 10px 24px rgba(16, 52, 73, 0.1);
  color: var(--mcis-blue);
  transform: translateY(-1px);
}

.flag-frame {
  background: var(--mcis-surface);
  border: 1px solid var(--mcis-line);
  border-radius: 6px;
  display: inline-flex;
  flex: 0 0 46px;
  height: 34px;
  overflow: hidden;
}

.flag-frame img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.flag-link-name {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
}

.country-page-title {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.country-page-flag {
  background: #ffffff;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
  display: inline-flex;
  flex: 0 0 76px;
  height: 54px;
  overflow: hidden;
}

.country-page-flag img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.directory-head,
.detail-head {
  align-items: center;
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.directory-image,
.detail-image {
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(16, 52, 73, 0.12);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(16, 52, 73, 0.12);
  max-height: 260px;
}

.detail-image {
  background: var(--mcis-sky);
}

.product-head {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
}

.country-hero-head {
  background:
    linear-gradient(90deg, rgba(242, 248, 249, 0.98), rgba(242, 248, 249, 0.82)),
    url("/static/images/countryspace.jpg") right center / cover;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  padding: 1.25rem;
}

.country-product-image {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(16, 52, 73, 0.1);
  flex: 0 0 180px;
  margin-left: auto;
  max-width: 180px;
  object-fit: cover;
  overflow: hidden;
  width: 180px;
}

.search-row {
  display: flex;
  gap: 0.75rem;
  max-width: 760px;
}

.search-input {
  border-radius: 8px;
  max-width: 760px;
}

.chart-panel {
  background: #ffffff;
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  height: 520px;
  min-height: 420px;
  padding: 0.75rem;
}

.chart-tall {
  height: 680px;
}

.chart-map {
  height: 620px;
}

.chart-heading {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.chart-select {
  max-width: 260px;
}

.chart-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.chart-export-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.55rem;
}

.chart-export-button {
  font-weight: 700;
}

.trade-map-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-list {
  border: 1px solid var(--mcis-line);
  border-radius: 8px;
  overflow: hidden;
}

.list-row {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--mcis-line);
  color: var(--mcis-ink);
  display: flex;
  justify-content: space-between;
  min-height: 58px;
  padding: 0.85rem 1rem;
}

.visual-list-row {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 64px minmax(0, 1fr) minmax(120px, auto);
}

.visual-list-row img {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:hover {
  background: var(--mcis-surface);
  color: var(--mcis-blue);
}

.list-row span {
  font-weight: 700;
}

.list-row small {
  color: var(--mcis-muted);
  margin-left: 1rem;
  text-align: right;
}

.trade-product-accordion {
  --bs-accordion-active-bg: var(--mcis-surface);
  --bs-accordion-active-color: var(--mcis-ink);
  --bs-accordion-border-color: var(--mcis-line);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 0.18rem rgba(22, 119, 154, 0.18);
  --bs-accordion-btn-padding-x: 1rem;
  --bs-accordion-btn-padding-y: 0.85rem;
  --bs-accordion-border-radius: 8px;
  --bs-accordion-inner-border-radius: 8px;
}

.trade-product-accordion .accordion-button {
  font-weight: 700;
  gap: 0.75rem;
}

.trade-product-accordion .accordion-button small {
  color: var(--mcis-muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: auto;
  padding-right: 0.75rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.trade-product-accordion .accordion-body {
  background: #ffffff;
  padding: 0;
}

.trade-product-accordion .stack-list {
  border: 0;
  border-radius: 0;
}

.preserve-lines {
  white-space: pre-line;
}

.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--mcis-line);
  color: var(--mcis-ink);
  margin-top: 2rem;
}

.site-footer-nav {
  padding-top: 0.75rem;
}

.site-footer-row {
  align-items: center;
  border-bottom: 1px solid rgba(16, 52, 73, 0.22);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 56px;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer-links a,
.site-footer-meta a {
  color: var(--mcis-ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.site-footer-links a:hover,
.site-footer-meta a:hover {
  color: var(--mcis-blue);
}

.site-footer-social {
  display: flex;
  gap: 0.8rem;
}

.site-footer-social a {
  align-items: center;
  border: 1px solid var(--mcis-line);
  border-radius: 999px;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  transition: border-color 120ms ease, background-color 120ms ease;
  width: 34px;
}

.site-footer-social a:hover {
  background: var(--mcis-surface);
  border-color: rgba(21, 149, 111, 0.42);
}

.site-footer-social img {
  height: 16px;
  opacity: 0.82;
  width: 16px;
}

.site-footer-meta {
  align-items: center;
  color: var(--mcis-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  gap: 0.45rem;
  padding: 0.9rem 0 2rem;
}

.site-footer-brand {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(16, 52, 73, 0.94), rgba(31, 74, 80, 0.88)),
    url("/static/images/mineralstrip.jpg") center / cover;
  display: flex;
  justify-content: center;
  min-height: 150px;
  padding: 2.5rem 1rem;
}

.site-footer-brand img {
  height: 58px;
  max-width: 180px;
  width: auto;
}

@media (max-width: 767.98px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-band {
    background:
      linear-gradient(130deg, rgba(16, 52, 73, 0.96), rgba(22, 119, 154, 0.9)),
      url("/static/images/homebanner.jpg") center / cover;
  }

  .directory-head,
  .detail-head,
  .product-head {
    grid-template-columns: 1fr;
  }

  .directory-image,
  .detail-image {
    max-height: 220px;
  }

  .search-row {
    flex-direction: column;
  }

  .chart-panel,
  .chart-tall {
    height: 420px;
  }

  .chart-map {
    height: 460px;
  }

  .chart-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 0.5rem;
  }

  .chart-select {
    max-width: none;
  }

  .chart-controls {
    flex-direction: column;
  }

  .trade-map-grid {
    grid-template-columns: 1fr;
  }

  .country-link-grid {
    grid-template-columns: 1fr;
  }

  .country-page-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .country-page-flag {
    flex-basis: 62px;
    height: 44px;
  }

  .event-card {
    grid-template-columns: 1fr;
  }

  .list-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .visual-list-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .visual-list-row small {
    grid-column: 2;
  }

  .list-row small {
    margin-left: 0;
    margin-top: 0.25rem;
    text-align: left;
  }

  .site-footer-row {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.9rem 0;
  }

  .site-footer-links {
    flex-direction: column;
  }

  .site-footer-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer-meta span[aria-hidden="true"] {
    display: none;
  }
}
