/* ============================================================
   style.css — CrisisWin
   Design: Emergency-red + deep navy palette | Nunito + Playfair
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Playfair+Display:wght@700;900&display=swap');

/* ── CSS Variables (Design Tokens) ──────────────────────────*/
:root {
  --bg:          #f8f7f4;          /* warm off-white page background */
  --surface:     #ffffff;          /* card / panel background */
  --navy:        #0d1b2a;          /* deep navy – primary dark */
  --navy-mid:    #1b2d40;          /* slightly lighter navy */
  --red:         #e63946;          /* crisis red – CTA / accent */
  --red-dark:    #c1121f;          /* darker red for hover */
  --teal:        #06b6d4;          /* secondary accent – links */
  --teal-dark:   #0891b2;
  --text:        #1a1a2e;          /* main body text */
  --text-muted:  #5a6577;          /* secondary / caption text */
  --border:      #dde1e7;          /* subtle borders */
  --shadow-sm:   0 2px 8px rgba(13,27,42,0.08);
  --shadow-md:   0 6px 24px rgba(13,27,42,0.12);
  --shadow-lg:   0 12px 48px rgba(13,27,42,0.18);
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   22px;
  --header-h:    64px;
  --footer-h:    80px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Nunito', 'Segoe UI', sans-serif;
  --transition:  all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-h);   /* offset for fixed header */
  padding-bottom: var(--footer-h);
}

a {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: var(--transition);
}
a:hover { color: var(--teal-dark); }

img { max-width: 100%; display: block; }

/* ── Scrollbar Styling ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ────────────────────────────────────────────────────────── */
/*  HEADER                                                    */
/* ────────────────────────────────────────────────────────── */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

/* Logo in header */
#header-logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

/* Nav links */
#site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  color: #c8d6e5;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

/* Search bar in header */
#search-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid #c084fc;         /* purple outline as in design */
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  min-width: 220px;
}

#search-input {
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--text);
  width: 100%;
}

#search-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
}
#search-btn:hover { color: var(--red); }

/* Search autocomplete dropdown */
#search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
}

#search-dropdown.open { display: block; }

.search-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f0f4ff; }
.search-item .tag {
  font-size: 0.7rem;
  background: var(--navy);
  color: #fff;
  padding: 1px 6px;
  border-radius: 99px;
}

/* ── Mobile nav toggle ───────────────────────────────────── */
#nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ────────────────────────────────────────────────────────── */
/*  FOOTER                                                    */
/* ────────────────────────────────────────────────────────── */
#site-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-h);
  background: var(--navy);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 0 2.5rem;
  z-index: 1000;
  border-top: 2px solid var(--red);
}

#footer-logo { height: 30px; }

#footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
#footer-links a {
  color: #a8b8cc;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#footer-links a:hover { color: #fff; }

#footer-copy {
  text-align: right;
  color: #a8b8cc;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ────────────────────────────────────────────────────────── */
/*  MAIN CONTENT AREA                                         */
/* ────────────────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
#breadcrumb {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}
#breadcrumb a { color: var(--teal); }
#breadcrumb .sep { color: var(--text-muted); }
#breadcrumb .current { color: var(--text); font-weight: 700; }

/* ────────────────────────────────────────────────────────── */
/*  HOME PAGE — CONTINENT GRID                               */
/* ────────────────────────────────────────────────────────── */
#continent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  padding: 1rem 0;
}

.continent-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  min-height: 160px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  gap: 0.75rem;
}

.continent-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(230,57,70,0.04), rgba(6,182,212,0.04));
  opacity: 0;
  transition: var(--transition);
}

.continent-card:hover {
  border-color: var(--red);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  color: var(--text);
}
.continent-card:hover::before { opacity: 1; }

/* SVG continent shape inside card */
.continent-card .continent-shape {
  width: 90px;
  height: 70px;
  color: var(--navy-mid);
  transition: var(--transition);
}
.continent-card:hover .continent-shape { color: var(--red); }

.continent-card .continent-label {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
}

/* Tooltip on hover (continent name) */
.continent-card .tooltip {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}
.continent-card:hover .tooltip { opacity: 1; }

/* Antarctica centered spanning full row */
.continent-card.antarctica {
  grid-column: 2 / 3;
}

/* ────────────────────────────────────────────────────────── */
/*  CONTINENT PAGE — COUNTRY GRID                           */
/* ────────────────────────────────────────────────────────── */
#country-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1rem 0;
}

.country-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  min-height: 80px;
  text-align: center;
  transition: var(--transition);
}
.country-card:hover {
  border-color: var(--red);
  background: #fff8f8;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
  color: var(--text);
}

/* ────────────────────────────────────────────────────────── */
/*  COUNTRY PAGE — DETAILS + HELPLINES                      */
/* ────────────────────────────────────────────────────────── */
#country-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.info-item { display: flex; flex-direction: column; gap: 0.2rem; }
.info-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }
.info-value { font-size: 1rem; font-weight: 700; color: var(--text); }

#country-flag {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Helplines grid */
#helplines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* Each state/region card */
.state-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.state-card:hover { box-shadow: var(--shadow-md); }

.state-header {
  background: var(--navy);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.75rem 1.1rem;
}

.state-body { padding: 0.75rem 1.1rem; }

.helpline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 0.5rem;
}
.helpline-row:last-child { border-bottom: none; }

.helpline-name {
  font-size: 0.88rem;
  color: var(--text-muted);
  flex: 1;
}

.helpline-number {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--red);
  white-space: nowrap;
  text-decoration: none;
}
.helpline-number:hover { color: var(--red-dark); }

/* No data placeholder */
.no-data {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}
.no-data strong { display: block; font-size: 1.3rem; margin-bottom: 0.5rem; color: var(--text); }

/* ────────────────────────────────────────────────────────── */
/*  ABOUT PAGE                                               */
/* ────────────────────────────────────────────────────────── */
#about-page {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem 0;
}

#about-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  color: var(--navy);
  margin-bottom: 1.5rem;
}

#about-description {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 2.5rem;
  text-align: justify;
}

#about-logo-wrap {
  display: flex;
  justify-content: center;
}

#about-logo-img {
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  object-fit: cover;
}

/* ────────────────────────────────────────────────────────── */
/*  TEAM PAGE                                                */
/* ────────────────────────────────────────────────────────── */
#team-page { padding: 2rem 0; }

.team-section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  text-align: center;
  color: var(--navy);
  margin-bottom: 2rem;
}

/* Maintainer card */
#maintainer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.avatar-lg {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--red);
  box-shadow: var(--shadow-md);
}

.maintainer-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--navy);
}

.maintainer-username {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.portfolio-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--red);
  color: #fff !important;
  text-decoration: none !important;
  padding: 0.4rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: var(--transition);
}
.portfolio-link:hover { background: var(--red-dark); transform: scale(1.03); }

/* Contributors grid */
#contributors-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
}

.contributor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}
.contributor-card:hover { transform: translateY(-3px); }

.avatar-sm {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.contributor-card:hover .avatar-sm { border-color: var(--teal); }

.contributor-username {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 80px;
  word-break: break-all;
}

/* Loading state */
.loading-text {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.95rem;
}

/* ────────────────────────────────────────────────────────── */
/*  ANIMATIONS                                               */
/* ────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeUp 0.4s ease both; }
.fade-in-delay-1 { animation-delay: 0.05s; }
.fade-in-delay-2 { animation-delay: 0.1s; }
.fade-in-delay-3 { animation-delay: 0.15s; }

/* ────────────────────────────────────────────────────────── */
/*  UTILITY                                                  */
/* ────────────────────────────────────────────────────────── */
.page-hidden { display: none !important; }

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.5rem 0 1rem;
}

/* ────────────────────────────────────────────────────────── */
/*  RESPONSIVE — TABLET (≤ 900px)                           */
/* ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  main { padding: 1.25rem 1rem; }

  #continent-grid,
  #country-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .continent-card.antarctica { grid-column: auto; }

  #country-info { grid-template-columns: repeat(2, 1fr); }

  #site-footer {
    grid-template-columns: 1fr;
    height: auto;
    padding: 0.75rem 1.5rem;
    gap: 0.4rem;
    text-align: center;
    position: relative;
  }

  #footer-logo { margin: 0 auto; }
  #footer-copy { text-align: center; }

  body { padding-bottom: 0; }
}

/* ────────────────────────────────────────────────────────── */
/*  RESPONSIVE — MOBILE (≤ 600px)                           */
/* ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --header-h: 56px; }

  #site-header { padding: 0 1rem; }

  #site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--navy-mid);
    flex-direction: column;
    padding: 0.5rem 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  #site-nav.open { display: flex; }
  .nav-link { padding: 0.75rem 1.5rem; border-radius: 0; width: 100%; }

  #nav-toggle { display: block; }

  #search-wrapper { min-width: 140px; }

  #continent-grid,
  #country-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .continent-card { min-height: 120px; padding: 1rem 0.5rem; }
  .continent-card .continent-shape { width: 60px; height: 48px; }
  .continent-card .continent-label { font-size: 0.85rem; }

  #country-info { grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 1rem; }

  #helplines-grid { grid-template-columns: 1fr; }

  #about-title { font-size: 2rem; }

  .team-section-title { font-size: 1.8rem; }
}
