/* ==========================================================================
   SOME — Country gate
   A non-dismissible, searchable country selector.
   Themed with the SOME palette (navy / brass gold / warm chalk).
   Every colour is a CSS variable so the Nigeria site can re-skin it.
   ========================================================================== */

:root {
  --cg-ink: #060b15;
  --cg-ink-soft: #0f1a2e;
  --cg-line: #ece4d3;
  --cg-paper: #ffffff;
  --cg-paper-2: #fdfcf9;
  --cg-accent: #b87a1d;
  --cg-accent-soft: #faf4e3;
  --cg-accent-line: rgba(184, 122, 29, .28);
  --cg-text: #1e293b;
  --cg-muted: #64748b;
  --cg-radius: 26px;
}

/* ---------------------------------------------------------------- shell -- */
.cgate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(184, 122, 29, .22), transparent 60%),
    rgba(6, 11, 21, .90);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}
.cgate.is-open { display: flex; }

body.cgate-locked { overflow: hidden !important; }

/* ----------------------------------------------------------------- card -- */
.cgate-card {
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cg-paper);
  border-radius: var(--cg-radius);
  box-shadow:
    0 40px 90px -20px rgba(6, 11, 21, .55),
    0 0 0 1px rgba(255, 255, 255, .06);
  animation: cgate-rise .38s cubic-bezier(.22, 1, .36, 1);
}
@keyframes cgate-rise {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- head -- */
.cgate-head {
  padding: 26px 26px 18px;
  background:
    linear-gradient(180deg, var(--cg-paper-2), var(--cg-paper));
  border-bottom: 1px solid var(--cg-line);
}
.cgate-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cgate-mark img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}
.cgate-mark span {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .01em;
  color: var(--cg-ink-soft);
}
.cgate-head h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(21px, 4.6vw, 27px);
  line-height: 1.2;
  font-weight: 700;
  color: var(--cg-ink-soft);
  margin: 0 0 8px;
}
.cgate-head p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--cg-muted);
  margin: 0 0 16px;
  max-width: 46ch;
}

/* --------------------------------------------------------------- search -- */
.cgate-search { position: relative; }
.cgate-search i {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: #9aa6b6;
  font-size: 14px;
  pointer-events: none;
}
.cgate-search input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  font: inherit;
  font-size: 15px;
  color: var(--cg-text);
  background: var(--cg-paper-2);
  border: 1.5px solid var(--cg-line);
  border-radius: 999px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.cgate-search input::placeholder { color: #a3adba; }
.cgate-search input:focus {
  background: #fff;
  border-color: var(--cg-accent);
  box-shadow: 0 0 0 4px var(--cg-accent-soft);
}

/* ----------------------------------------------------------------- list -- */
.cgate-list {
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 12px;
  scrollbar-width: thin;
}
.cgate-list::-webkit-scrollbar { width: 8px; }
.cgate-list::-webkit-scrollbar-thumb {
  background: #dfd7c6; border-radius: 8px;
}

.cgate-group {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #96a1b0;
  background: linear-gradient(180deg, #fff 68%, rgba(255, 255, 255, 0));
}

.cgate-opt {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 11px 14px;
  margin: 2px 0;
  font: inherit;
  text-align: left;
  color: var(--cg-text);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}
.cgate-opt:hover,
.cgate-opt.is-active { background: var(--cg-paper-2); }
.cgate-opt.is-active { border-color: var(--cg-line); }
.cgate-opt:focus-visible {
  outline: 2px solid var(--cg-accent);
  outline-offset: 2px;
}
.cgate-opt[aria-selected="true"] {
  background: var(--cg-accent-soft);
  border-color: var(--cg-accent-line);
}

.cgate-flag {
  font-size: 22px;
  line-height: 1;
  width: 28px;
  flex: 0 0 28px;
  text-align: center;
  /* keep emoji flags rendering on Windows, which has no flag glyphs */
  font-family: 'Twemoji Country Flags', 'Noto Color Emoji', 'Apple Color Emoji',
               'Segoe UI Emoji', sans-serif;
}
.cgate-name {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 500;
}
.cgate-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #0d7b6b;
  background: rgba(13, 123, 107, .1);
  border-radius: 999px;
  white-space: nowrap;
}
.cgate-tick {
  flex: 0 0 18px;
  font-size: 13px;
  color: var(--cg-accent);
  opacity: 0;
  transition: opacity .14s;
}
.cgate-opt[aria-selected="true"] .cgate-tick { opacity: 1; }

.cgate-empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--cg-muted);
  font-size: 14px;
  line-height: 1.6;
}
.cgate-empty strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--cg-text);
}

/* ----------------------------------------------------------------- foot -- */
.cgate-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--cg-paper-2);
  border-top: 1px solid var(--cg-line);
}
.cgate-status {
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.45;
  color: var(--cg-muted);
}
.cgate-status b { color: var(--cg-text); font-weight: 700; }

.cgate-go {
  flex: 0 0 auto;
  padding: 12px 24px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--cg-ink);
  background: linear-gradient(135deg, #d4a853, var(--cg-accent));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, opacity .16s;
  box-shadow: 0 10px 24px -10px rgba(184, 122, 29, .8);
}
.cgate-go:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -10px rgba(184, 122, 29, .9);
}
.cgate-go:disabled {
  opacity: .42;
  cursor: not-allowed;
  box-shadow: none;
}
.cgate-go:focus-visible { outline: 3px solid var(--cg-ink); outline-offset: 2px; }

/* ------------------------------------------------------- the region chip -- */
.region-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.region-chip:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.region-chip u {
  text-decoration: none;
  color: var(--cg-accent);
  font-weight: 700;
}
.region-chip .cgate-flag { font-size: 14px; width: auto; flex: none; }
.region-chip.on-light {
  color: #475569;
  background: #f6f2e8;
  border-color: #ece4d3;
}
.region-chip.on-light:hover { background: #efe8da; color: #1e293b; }

/* --------------------------------------------------------------- toasts -- */
.cgate-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 2147482000;
  max-width: min(92vw, 460px);
  padding: 13px 20px;
  font-size: 14px;
  color: #fff;
  background: var(--cg-ink-soft);
  border-radius: 999px;
  box-shadow: 0 18px 40px -12px rgba(6, 11, 21, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.cgate-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 560px) {
  .cgate { padding: 0; }
  .cgate-card {
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .cgate-head { padding: 20px 18px 14px; }
  .cgate-head p { font-size: 13.5px; margin-bottom: 14px; }
  .cgate-list { padding: 6px 8px 10px; }
  .cgate-foot { flex-wrap: wrap; padding: 14px 16px; }
  .cgate-status { flex: 1 1 100%; order: 1; }
  .cgate-go { flex: 1 1 100%; order: 2; padding: 14px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .cgate-card { animation: none; }
  .cgate-go, .cgate-opt, .cgate-toast { transition: none; }
}
