/* ==========================================================================
   India Geodata — Main Stylesheet
   https://yashveeeeeer.github.io/india-geodata/
   ========================================================================== */

/* --- Variables --- */
:root {
  --color-primary:       #1e3a5f;
  --color-primary-light: #2d5a8e;
  --color-accent:        #f59e0b;
  --color-accent-hover:  #d97706;
  --color-bg:            #ffffff;
  --color-bg-light:      #f8fafc;
  --color-text:          #1a1a2e;
  --color-muted:         #64748b;
  --color-border:        #e2e8f0;
  --color-code-bg:       #1e293b;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  --header-height: 56px;
  --container-max: 960px;
  --radius:    8px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-accent-hover); }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
code, pre { font-family: var(--font-mono); }

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-primary);
  color: #fff;
  height: var(--header-height);
  display: flex;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.header-inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-title {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.site-title:hover { color: #fff; opacity: 0.9; }
.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
  font-weight: 500;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.site-nav a:hover { color: #fff; border-bottom-color: var(--color-accent); }

/* --- Container --- */
.container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 24px; }
main { flex: 1; }

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  padding: 48px 24px 40px;
  text-align: center;
}
.hero-inner { max-width: var(--container-max); margin: 0 auto; }
.hero h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.hero-subtitle { font-size: 1.05rem; color: rgba(255,255,255,0.82); max-width: 720px; margin: 0 auto 28px; }
.hero-stats { display: flex; justify-content: center; gap: 48px; }
.stat-item { text-align: center; }
.stat-number { display: block; font-size: 1.8rem; font-weight: 700; color: var(--color-accent); line-height: 1.2; }
.stat-label { display: block; font-size: 0.78rem; color: rgba(255,255,255,0.65); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* --- Catalog Section --- */
.catalog-section { max-width: var(--container-max); margin: 0 auto; padding: 32px 24px 48px; }

/* --- Search --- */
.search-box {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.93rem;
  font-family: var(--font-family);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-box::placeholder { color: var(--color-muted); }
.search-box:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(245,158,11,0.12); }

/* --- Category Pills --- */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.pill {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: var(--color-bg);
  color: var(--color-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.pill:hover { border-color: var(--color-accent); color: var(--color-text); }
.pill.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pill-count {
  font-size: 0.72rem;
  background: rgba(0,0,0,0.08);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}
.pill.active .pill-count { background: rgba(255,255,255,0.2); }

/* --- Result Count --- */
.result-count { font-size: 0.84rem; color: var(--color-muted); margin-bottom: 8px; }

/* --- Category Groups --- */
.category-group { margin-bottom: 36px; }
.category-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding-top: 8px;
}
.category-summary {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-bottom: 16px;
}

/* --- Dataset Cards --- */
.dataset-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  padding: 14px 16px;
  transition: box-shadow var(--transition);
}
.dataset-card:hover { box-shadow: var(--shadow-sm); }
.dataset-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  cursor: pointer;
  gap: 12px;
}
.dataset-title { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.dataset-desc { font-size: 0.86rem; color: var(--color-muted); margin-top: 3px; }
.dataset-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

/* --- Tags --- */
.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.6;
  white-space: nowrap;
}
.tag-geojson, .tag-geojsonl  { background: #d1fae5; color: #065f46; }
.tag-parquet   { background: #dbeafe; color: #1e40af; }
.tag-pmtiles   { background: #fed7aa; color: #9a3412; }
.tag-shapefile { background: #e9d5ff; color: #6b21a8; }
.tag-csv       { background: #f1f5f9; color: #475569; }
.tag-zip       { background: #f1f5f9; color: #475569; }
.tag-dta       { background: #f1f5f9; color: #475569; }
.tag-gif       { background: #fce7f3; color: #9d174d; }
.tag-license   { background: #dbeafe; color: #1e40af; }
.tag-geojsonl7z { background: #d1fae5; color: #065f46; }

/* --- Action Buttons --- */
.dataset-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: all var(--transition);
}
.btn-download {
  background: var(--color-accent);
  color: var(--color-text);
}
.btn-download:hover {
  background: var(--color-accent-hover);
  color: var(--color-text);
}
.btn-github {
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  background: var(--color-bg);
}
.btn-github:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

/* --- Expand / Collapse --- */
.expand-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  color: var(--color-muted);
  transition: background var(--transition), transform var(--transition);
}
.expand-toggle:hover { background: var(--color-bg-light); }
.dataset-card.expanded .expand-toggle svg { transform: rotate(180deg); }
.dataset-files {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.dataset-card.expanded .dataset-files { max-height: 3000px; }

/* --- File Table --- */
.file-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.file-table-wrap::-webkit-scrollbar { width: 6px; }
.file-table-wrap::-webkit-scrollbar-thumb { background: var(--color-muted); border-radius: 3px; }
.file-table-wrap::-webkit-scrollbar-track { background: var(--color-bg-light); }
.file-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.file-table thead th {
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  padding: 6px 8px;
  border-bottom: 2px solid var(--color-border);
  font-size: 0.72rem;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 1;
}
.file-table tbody tr:nth-child(even) { background: var(--color-bg-light); }
.file-table tbody td { padding: 6px 8px; vertical-align: middle; }
.btn-file-dl {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.btn-file-dl:hover { text-decoration: underline; }

/* --- External Notice --- */
.external-notice { padding: 12px 0; font-size: 0.88rem; color: var(--color-muted); }

/* --- Release Link --- */
.release-link { margin-top: 10px; font-size: 0.84rem; }
.release-link a { color: var(--color-accent); }
.release-link a:hover { text-decoration: underline; }

/* --- Release Download Box (for datasets without individual files) --- */
.release-download-box {
  padding: 16px 0;
  font-size: 0.88rem;
  color: var(--color-text);
}
.release-download-box p { margin-bottom: 8px; }
.release-download-actions { margin: 10px 0; }
.release-hint { font-size: 0.8rem; color: var(--color-muted); margin-top: 4px; }

/* --- Footer --- */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.75);
  text-align: center;
  padding: 20px 24px;
  margin-top: 0;
  font-size: 0.84rem;
}
.site-footer a { color: var(--color-accent); }
.site-footer a:hover { color: #fff; }

/* ==========================================================================
   About Page
   ========================================================================== */
.about-page { max-width: 640px; margin: 0 auto; padding: 40px 24px 60px; }
.about-page h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 16px; }
.about-page h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}
.about-page p { margin-bottom: 12px; font-size: 0.95rem; line-height: 1.7; color: var(--color-text); }
.about-page a { color: var(--color-accent); text-decoration: underline; text-decoration-color: rgba(245,158,11,0.35); text-underline-offset: 2px; }
.about-page a:hover { text-decoration-color: var(--color-accent); }

.social-links { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  text-decoration: none;
  transition: all var(--transition);
}
.social-link:hover { border-color: var(--color-accent); color: var(--color-accent); }
.social-link svg { flex-shrink: 0; }

.about-page pre {
  background: var(--color-code-bg);
  color: #e2e8f0;
  padding: 12px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 8px 0 12px;
}
.about-page pre code { color: inherit; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .site-header { height: auto; padding: 10px 0; }
  .header-inner { flex-direction: column; gap: 6px; padding: 0 16px; }
  .site-nav { gap: 16px; flex-wrap: wrap; justify-content: center; }

  .hero { padding: 32px 16px 28px; }
  .hero h1 { font-size: 1.6rem; }
  .hero-subtitle { font-size: 0.92rem; }
  .hero-stats { gap: 24px; }
  .stat-number { font-size: 1.4rem; }

  .catalog-section { padding: 20px 16px 36px; }
  .category-heading { font-size: 1.1rem; }

  .dataset-card { padding: 12px; }
  .dataset-title { font-size: 0.93rem; }
  .dataset-actions { gap: 6px; }
  .btn { font-size: 0.76rem; padding: 5px 10px; }

  .about-page { padding: 24px 16px 40px; }
  .about-page h1 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.35rem; }
  .hero-stats { flex-direction: column; gap: 12px; }

  .dataset-header { flex-direction: column; gap: 6px; }
  .expand-toggle { align-self: flex-end; }
  .dataset-actions { flex-direction: column; }
  .btn { justify-content: center; }

  .social-links { flex-direction: column; }
}
