@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root{
  --bg: #0a0f1c;
  --bg-panel: #111a2c;
  --bg-panel-2: #16223a;
  --line: rgba(150,175,210,0.14);
  --text: #edeff4;
  --text-dim: #93a0b8;
  --text-dimmer: #5f6d87;
  --gold: #e8b84b;
  --gold-soft: rgba(232,184,75,0.15);
  --teal: #4fd1c5;
  --teal-soft: rgba(79,209,197,0.15);
  --red-soft: #e8785f;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection{ background: var(--gold-soft); color: var(--gold); }

.wrap{ max-width: 1120px; margin: 0 auto; padding: 0 28px; }

/* ---------- Hero ---------- */
.hero{
  position: relative;
  padding: 72px 0 40px;
  overflow: hidden;
}
.hero-grid{
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
}
.eyebrow{
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.eyebrow::before{
  content:"";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}
h1{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 5.4vw, 66px);
  line-height: 1.03;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
h1 em{
  font-style: italic;
  font-weight: 600;
  background: linear-gradient(95deg, var(--gold), #f3d38a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub{
  font-size: 17px;
  color: var(--text-dim);
  max-width: 46ch;
  margin: 0 0 32px;
}
.hero-globe-wrap{
  position: relative;
  aspect-ratio: 1/1;
  max-width: 480px;
  margin: 0 auto;
}
#globe{ width: 100%; height: 100%; display:block; }

/* ---------- Search ---------- */
.search-panel{
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 22px 20px;
}
.search-label{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.search-wrap{ position: relative; }
#searchInput{
  width: 100%;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px; /* Updated to 16px to prevent iOS Safari auto-zoom */
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#searchInput:focus{
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
#searchInput::placeholder{ color: var(--text-dimmer); }

.suggestions{
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
  z-index: 20;
  display: none;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
}
.suggestions.open{ display: block; }
.suggestion{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14.5px;
  border-bottom: 1px solid var(--line);
}
.suggestion:last-child{ border-bottom: none; }
.suggestion:hover{ background: rgba(232,184,75,0.08); }
.sugg-native{ margin-left: auto; color: var(--text-dimmer); font-size: 13px; text-align: right; }

.chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  min-height: 4px;
}
.chip{
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--gold-soft);
  border: 1px solid rgba(232,184,75,0.35);
  color: var(--gold);
  padding: 6px 8px 6px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  animation: chipIn .25s ease;
}
.chip-flag{ font-size: 15px; line-height: 1; }
.chip button{
  background: none; border: none; color: var(--gold);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px;
  opacity: 0.7;
}
.chip button:hover{ opacity: 1; }
@keyframes chipIn{
  from{ opacity:0; transform: scale(0.85) translateY(4px); }
  to{ opacity:1; transform: scale(1) translateY(0); }
}

.hint-row{
  display:flex; justify-content: space-between; align-items:center;
  margin-top: 14px; font-size: 12.5px; color: var(--text-dimmer);
}

/* ---------- Results ---------- */
.results-section{ padding: 56px 0 100px; }
.results-header{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.results-header h2{
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 0;
}
#resultsCount{
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dimmer);
}

.empty-state{
  text-align: center;
  padding: 70px 20px;
  color: var(--text-dimmer);
  border: 1px dashed var(--line);
  border-radius: 18px;
}
.empty-state .es-icon{ font-size: 34px; margin-bottom: 12px; }
.empty-state p{ font-size: 15px; max-width: 40ch; margin: 6px auto 0; }
.hidden{ display: none !important; }

.results-grid{
  display: none;
  flex-direction: column;
  gap: 10px;
}
.results-section.active .results-grid{ display: flex; }
.results-section.active .empty-state{ display: none; }

.result-card{
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  opacity: 0;
  animation: cardIn .5s ease forwards;
  animation-delay: var(--delay, 0ms);
}
@keyframes cardIn{
  from{ opacity:0; transform: translateY(10px); }
  to{ opacity:1; transform: translateY(0); }
}
.rc-rank{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dimmer);
  width: 26px;
  flex-shrink: 0;
}
.rc-main{ flex: 1; min-width: 0; }
.rc-top{ display: flex; align-items: center; gap: 12px; }
.rc-flag{ font-size: 26px; flex-shrink: 0; }
.rc-names{ flex: 1; min-width: 0; }
.rc-name{ font-weight: 600; font-size: 16px; }
.rc-native{ font-size: 13px; color: var(--text-dimmer); }
.rc-score{ text-align: right; flex-shrink: 0; }
.rc-score-num{ font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.rc-tier{
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 2px;
}
.tier-easy{ background: var(--teal-soft); color: var(--teal); }
.tier-moderate{ background: var(--gold-soft); color: var(--gold); }
.tier-hard{ background: rgba(232,120,95,0.15); color: var(--red-soft); }
.tier-expert{ background: rgba(150,120,220,0.15); color: #a98af0; }

.rc-bar-track{
  height: 5px; border-radius: 4px; background: var(--bg-panel-2);
  margin: 10px 0 8px; overflow: hidden;
}
.rc-bar-fill{
  height: 100%; border-radius: 4px; width: 0;
  animation: fillBar 1s cubic-bezier(.2,.8,.2,1) forwards;
  animation-delay: calc(var(--delay,0ms) + .15s);
}
@keyframes fillBar{ to{ width: var(--target); } }
.tier-easy.rc-bar-fill{ background: var(--teal); }
.tier-moderate.rc-bar-fill{ background: var(--gold); }
.tier-hard.rc-bar-fill{ background: var(--red-soft); }
.tier-expert.rc-bar-fill{ background: #a98af0; }

.rc-why{ font-size: 13px; color: var(--text-dim); }

/* ---------- Footer / methodology ---------- */
.methodology{
  border-top: 1px solid var(--line);
  padding: 40px 0 70px;
  color: var(--text-dimmer);
  font-size: 13.5px;
}
.methodology h3{
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.methodology ul{ margin: 0; padding-left: 18px; }
.methodology li{ margin-bottom: 6px; }

/* ---------- Media Queries ---------- */
@media (max-width: 860px){
  .hero-grid{ grid-template-columns: 1fr; gap: 24px; }
  .hero-globe-wrap{ max-width: 320px; margin: 0 auto; }
  .hero{ padding-top: 48px; }
}

@media (max-width: 600px){
  .wrap { padding: 0 16px; }
  
  h1 { font-size: clamp(32px, 8vw, 40px); margin-bottom: 12px; }
  .hero-sub { font-size: 15px; margin-bottom: 24px; }
  .hero { padding-top: 32px; padding-bottom: 24px; }
  
  .search-panel { padding: 16px; }
  #searchInput { padding: 12px 14px; }
  .hint-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  
  .results-section { padding: 32px 0 60px; }
  .results-header h2 { font-size: 22px; }
  
  /* Stack the result cards better on small screens */
  .result-card {
    padding: 14px;
    gap: 12px;
  }
  .rc-rank { width: 20px; font-size: 12px; }
  .rc-flag { font-size: 22px; }
  .rc-name { font-size: 15px; }
  .rc-score-num { font-size: 18px; }
  .rc-why { font-size: 12px; }
}
.github-link {
  text-decoration: none;
  color: inherit; 
  opacity: 0.8;
  transition: opacity 0.2s;
}
.github-link:hover {
  opacity: 1;
  text-decoration: underline;
}

@media (max-width: 1000px) {
  /* This targets your main container classes to add padding on the left and right */
  .wrap {
    padding: 10px 40px; /* Increased from the default 28px, adjust as you see fit! */
  }
}
