:root {
  --nav-color: rgb(40, 125, 209);
  --nav-dark: rgb(21, 77, 133);
  --accent: rgb(240, 180, 70);
  --text-dark: rgb(28, 43, 58);
  --text-light: #fffaf0;
  --background-color: rgb(247, 255, 247);
  --surface: #ffffff;
  --surface-soft: rgb(235, 244, 250);
  --border-color: rgb(21, 77, 133);
  --border-width: 0.2rem;
  --radius: 0.75rem;
  --shadow: 0 8px 24px rgba(21, 77, 133, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  color: var(--text-dark);
  scroll-behavior: smooth;
}

body {
  padding: 0;
  margin: 0;
  background: var(--background-color);
}

.main-container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* NAVIGATION */
header {
  width: 100%;
  position: relative;
}

nav {
  background: var(--nav-color);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem clamp(1rem, 4vw, 3rem);
  border-bottom: var(--border-width) solid var(--border-color);
  box-shadow: 0 3px 10px rgba(21, 77, 133, 0.16);
}

.logo {
  display: block;
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.continent-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.continent-nav li {
  border-left: 1px solid rgba(255, 255, 255, 0.65);
  text-align: center;
}
.continent-nav li:first-child {
  border-left: none;
}

.continent-nav a {
  display: block;
  color: var(--text-light);
  text-decoration: none;
  font-size: clamp(1rem, 1.8vw, 1.45rem);
  font-weight: 600;
  padding: 0.7rem 0.9rem;
  border-radius: 0.4rem;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.continent-nav a:hover,
.continent-nav .active a {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

/* CONTINENT PAGE */
.continent-main {
  flex: 1;
  width: min(1400px, 94%);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) 0 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-heading {
  text-align: center;
  margin-bottom: clamp(1.5rem, 3vw, 3rem);
}

.eyebrow {
  display: block;
  color: var(--nav-color);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.page-heading h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  margin: 0;
  color: var(--nav-dark);
}

.page-heading p,
.section-heading p {
  margin: 0.75rem 0 0;
  color: #536575;
  font-size: 1.05rem;
}

.africa-map {
  display: block;
  width: min(100%, 900px);
  height: auto;
  margin: 0 auto 3rem;
  filter: drop-shadow(0 10px 12px rgba(21, 77, 133, 0.12));
}

.africa-map path {
  transition:
    fill 0.15s,
    filter 0.15s;
}

path:hover,
path.country-hover {
  fill: var(--accent) !important;
  filter: brightness(1.05);
  cursor: pointer;
}

.country-section {
  width: min(100%, 1100px);
}

.section-heading {
  text-align: center;
  margin-bottom: 1rem;
}

.section-heading h2 {
  display: inline-block;
  margin: 0;
  color: var(--nav-dark);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.country-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  background: var(--surface);
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid rgba(21, 77, 133, 0.2);
  border-top: 5px solid var(--nav-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.column {
  min-width: 0;
  list-style: none;
  text-align: center;
  margin: 0;
  padding: 0;
  font-size: 1.05rem;
}

.column li:not(.letter) {
  padding: 0.22rem 0.25rem;
  border-radius: 0.3rem;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.column li:not(.letter):hover {
  background: var(--surface-soft);
  color: var(--nav-dark);
  cursor: pointer;
}

.letter {
  color: var(--nav-color);
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0.9rem 0 0.25rem;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid rgba(40, 125, 209, 0.2);
}

.column .letter:first-child {
  margin-top: 0;
}

/* COUNTRY PROFILE PAGE STYLES */
.country-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.country-header h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  color: var(--nav-dark);
  margin: 0.25rem 0 0;
  text-transform: capitalize;
}

.stats-grid {
  width: min(100%, 1000px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid rgba(21, 77, 133, 0.15);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(21, 77, 133, 0.18);
}

.stat-card.highlight {
  border-top: 4px solid var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nav-color);
}

.stat-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
  word-break: break-word;
}

/* Ensure empty/loading state text displays cleanly */
.stat-value:empty::before {
  content: "—";
  color: #94a3b8;
}

/* ABOUT PAGE STYLES */
.about-section {
  width: min(100%, 1000px);
  margin-bottom: 3.5rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  background: var(--surface);
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid rgba(21, 77, 133, 0.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.about-text h2 {
  color: var(--nav-dark);
  font-size: 1.8rem;
  margin: 0 0 1rem;
}

.about-text p {
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 1.05rem;
  margin: 0;
}

.about-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.about-img {
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--radius) - 0.25rem);
  object-fit: cover;
}

/* Responsive adjustment for About page */
@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .about-grid.reverse .about-text {
    order: 1;
  }

  .about-grid.reverse .about-image-wrapper {
    order: 2;
  }
}

/* FOOTER */
footer {
  background: var(--nav-dark);
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  border-top: var(--border-width) solid var(--nav-color);
}

.footer-links {
  display: flex;
  gap: clamp(2rem, 6vw, 5rem);
}

.contact-us,
.about {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

footer h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

footer a {
  color: var(--text-light);
}

footer span,
footer .copyright {
  color: rgba(255, 250, 240, 0.82);
}

.copyright {
  margin: 0;
  font-size: 0.9rem;
}

/* HOME PAGE */
.main-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
}

.main-box h1 {
  font-size: clamp(3.5rem, 9vw, 6rem);
  margin: 0;
  color: var(--nav-dark);
}

.main-box p {
  font-size: 1.25rem;
  margin: 1rem 0 2rem;
}

.search-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  width: min(90%, 550px);
}

.search-form label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--nav-dark);
}

.search-input {
  display: flex;
  width: 100%;
}

.search-input input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
}

.search-input input:focus {
  box-shadow: 0 0 0 3px rgba(40, 125, 209, 0.2);
}

.search-input button {
  padding: 0.85rem 1.3rem;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--nav-color);
  color: white;
  border: 2px solid var(--border-color);
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-input button:hover {
  background: var(--nav-dark);
}

/* MOBILE */
@media (max-width: 850px) {
  nav {
    flex-direction: column;
    padding: 0.75rem 1rem;
  }

  .continent-nav {
    width: 100%;
  }
  .continent-nav li {
    border-left: none;
  }
  .continent-nav a {
    text-align: center;
  }

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

  .africa-map {
    margin-bottom: 2rem;
  }

  footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  .contact-us,
  .about {
    align-items: center;
  }
}

@media (max-width: 600px) {
  .continent-nav a {
    font-size: 1.1rem;
  }

  .continent-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .continent-nav li {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
  }

  .continent-nav li:nth-child(odd) {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
  }

  .main-box h1 {
    font-size: 3.5rem;
  }

  .search-input {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-input input,
  .search-input button {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
  }
}
