/* landing.css — Styles for the SEC-IMS landing page.
 *
 * Shares the colour tokens already used by the data-catalog and map
 * viewer (--blue, --blue-dark, --grey-100 etc.) so the three pages
 * read as one product.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --blue: #0057a8;
  --blue-dark: #003f7a;
  --blue-soft: #e9f1fb;
  --grey-100: #f5f5f5;
  --grey-200: #e0e0e0;
  --grey-300: #cccccc;
  --grey-500: #888888;
  --grey-700: #555555;
  --grey-800: #424242;
  --border: #bdbdbd;
  --text: #212121;
  --text-muted: #666666;
  --radius: 4px;
  --radius-lg: 6px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.10);
  --font: 'Segoe UI', Arial, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--grey-100);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

[x-cloak] { display: none !important; }

/* ── Header (matches existing pages) ─────────────────────────────── */

.site-header {
  background: var(--blue);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 24px;
  height: 60px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.site-header .logo { height: 44px; margin-right: 12px; }
.site-header .title {
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1px;
  flex: 1;
}
.site-header nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.site-header nav a,
.site-header nav button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #fff;
  text-decoration: none;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}
.site-header nav a:hover,
.site-header nav button:hover {
  background: transparent;
  color: #fff;
  text-decoration: underline;
}
.site-header nav a:active,
.site-header nav button:active {
  background: rgba(0, 0, 0, 0.15);
  text-decoration: underline;
}

main { flex: 1; }

/* ── Hero ────────────────────────────────────────────────────────── */

.hero {
  background: linear-gradient(180deg, #fff 0%, var(--grey-100) 100%);
  padding: 56px 24px 40px;
  border-bottom: 1px solid var(--grey-200);
}
.hero-inner {
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}
.hero h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 0.75rem;
}
.hero p.lede {
  font-size: 1rem;
  color: var(--grey-700);
  line-height: 1.5;
  max-width: 740px;
  margin: 0 auto 2rem;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: visible;
}
.search-bar:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 87, 168, 0.18);
}
.search-bar .search-icon {
  padding: 0 0.75rem 0 1rem;
  display: flex;
  align-items: center;
  color: var(--grey-500);
  font-size: 1.1rem;
}
.search-bar input {
  flex: 1;
  border: 0;
  font-size: 1rem;
  font-family: var(--font);
  padding: 0.85rem 0.25rem;
  background: transparent;
  outline: none;
}
.search-bar button {
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 1.5rem;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  cursor: pointer;
  transition: background 0.15s;
}
.search-bar button:hover { background: var(--blue-dark); }

/* Typeahead dropdown — anchored to .search-bar (position:relative). */
.search-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
}
.search-suggest .suggest-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--grey-100, #f1f3f5);
  cursor: pointer;
}
.search-suggest .suggest-row:last-child { border-bottom: 0; }
.search-suggest .suggest-row.is-selected,
.search-suggest .suggest-row:hover {
  background: var(--blue-soft);
}
.search-suggest .suggest-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--blue-dark);
  background: var(--grey-100, #f1f3f5);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.search-suggest .suggest-title {
  font-size: 0.92rem;
  color: var(--grey-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-examples {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--grey-700);
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}
.search-examples .label { color: var(--grey-500); }
.search-examples .chip {
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  border: 0;
  font-family: var(--font);
  font-size: 0.85rem;
  transition: background 0.15s;
}
.search-examples .chip:hover { background: var(--grey-200); }

.ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.5rem 1rem;
  background: var(--grey-200);
  color: var(--grey-700);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: not-allowed;
  opacity: 0.85;
}
.ai-pill .coming-soon {
  font-size: 0.75rem;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 0.5rem;
}

/* ── Search results (inline, replaces featured when active) ──────── */

.search-results {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 24px;
}
.search-results .results-actions {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.search-results .results-actions a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.search-results .results-actions a:hover { text-decoration: underline; }
.search-results .link-btn {
  background: transparent;
  border: 0;
  color: var(--grey-700);
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  font-size: 0.9rem;
  text-decoration: underline;
}
.search-results .link-btn:hover { color: var(--blue-dark); }

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.result-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.result-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(0, 87, 168, 0.08);
}
.result-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}
.result-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--grey-100, #f1f3f5);
  color: var(--grey-700);
  flex-shrink: 0;
}
.result-badge[data-source="document"] {
  background: #eef4fa;
  color: var(--blue-dark);
}
.result-badge[data-source="attribute"] {
  background: #fff4e3;
  color: #8a5a00;
}
.result-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--grey-900, #212529);
}
.result-snippet {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--grey-700);
}
.result-snippet b {
  background: #fff4b1;
  font-weight: 600;
  padding: 0 1px;
}
.result-meta {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--grey-500);
}

.results-empty {
  font-size: 0.95rem;
  color: var(--grey-700);
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.results-empty a { color: var(--blue); }

/* ── Featured datasets ───────────────────────────────────────────── */

.featured {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 24px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
}
.section-head h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--blue-dark);
}
.section-head a {
  font-size: 0.85rem;
  color: var(--blue);
  text-decoration: none;
}
.section-head a:hover { text-decoration: underline; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.featured-card {
  background: #fff;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}
.featured-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.featured-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-500);
  font-size: 0.85rem;
}
.featured-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Generic document glyph rendered when a featured record has no
   geometry to draw a bbox preview from (typical for PDFs, spreadsheets
   and other nonGeographicDataset entries). */
.featured-card .thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-500);
}
.featured-card .thumb-fallback svg {
  width: 40%;
  max-width: 80px;
  height: auto;
}

.featured-card .meta {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.featured-card .meta h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.featured-card .meta .sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.featured-card .meta .updated {
  font-size: 0.75rem;
  color: var(--grey-500);
}

.featured-card .actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.4rem;
}
.featured-card .actions a,
.featured-card .actions span.disabled {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}
.featured-card .actions a.primary {
  background: var(--blue);
  color: #fff;
}
.featured-card .actions a.primary:hover { background: var(--blue-dark); }
.featured-card .actions a.secondary {
  background: var(--grey-200);
  color: var(--grey-800);
}
.featured-card .actions a.secondary:hover { background: var(--border); }
.featured-card .actions span.disabled {
  background: var(--grey-100);
  color: var(--grey-500);
  cursor: not-allowed;
}

.featured .error-banner {
  background: #ffeaea;
  color: #8a1c1c;
  border: 1px solid #f5b8b8;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ── Footer ──────────────────────────────────────────────────────── */

.site-footer {
  background: #fff;
  border-top: 1px solid var(--grey-200);
  padding: 1.75rem 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}
.site-footer .institutions,
.site-footer .software {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
.site-footer .software a {
  color: var(--blue);
  text-decoration: none;
}
.site-footer .software a:hover { text-decoration: underline; }
.site-footer .meta-row {
  margin-top: 0.5rem;
}
.site-footer .meta-row a {
  color: var(--grey-700);
  text-decoration: none;
}
.site-footer .meta-row a:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}
.site-footer .sep { color: var(--grey-300); }

/* ── Sign-in modal ───────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.modal-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
}
.modal-card p.modal-lede {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}
.modal-card input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  font-family: var(--font);
}
.modal-card .modal-error {
  font-size: 0.8rem;
  color: #c62828;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}
.modal-card .modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.modal-card button {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 0;
  cursor: pointer;
}
.modal-card button.primary {
  background: var(--blue);
  color: #fff;
}
.modal-card button.primary:hover { background: var(--blue-dark); }
.modal-card button.secondary {
  background: var(--grey-200);
  color: var(--grey-800);
}
.modal-card button.secondary:hover { background: var(--border); }

/* ── Responsive tweaks ───────────────────────────────────────────── */

@media (max-width: 600px) {
  .hero { padding: 36px 16px 28px; }
  .hero h1 { font-size: 1.4rem; }
  .featured { margin: 32px auto; }
  .site-header { padding: 0 12px; }
  .site-header .title { font-size: 1rem; letter-spacing: 0.5px; }
}
