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

/* Base */
html { height: 100%; }
body {
  font-family: verdana, arial, helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fff;
  color: #222;
}

/* Typography */
a { color: #00008b; }
a:visited { color: #551a8b; }
h1 { font-size: 1.4em; color: #800080; margin: 1em 0 0.5em; }
h2 { font-size: 1.15em; color: #00008b; margin: 0.75em 0 0.4em; }
h3 { font-size: 1em; color: #555; margin: 0.5em 0 0.25em; }
p { margin: 0.5em 0; }
ul { margin: 0.5em 0; padding-left: 1.25em; }
li { margin: 0.2em 0; }

/* Layout */
.site-header, main, .site-footer { width: 100%; }
.container { max-width: 800px; margin: 0 auto; padding: 0 12px; }
main.container { padding-bottom: 2em; }

/* Header */
.site-header { padding: 12px 0; }
.site-header nav { display: flex; justify-content: space-between; align-items: center; }
.site-header .site-title { font-size: 1.3em; font-weight: bold; color: #00008b; text-decoration: none; }
.site-header .nav-links { font-size: 0.9em; }

/* Search */
.search-wrapper { position: relative; margin-top: 8px; }
[data-search-input] {
  width: 100%;
  padding: 6px 10px;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 3px;
}
[data-search-input]:focus { outline: none; border-color: #00008b; }
/* Keyboard hints inside the search box: "/" while idle, arrows while results
   are open (left/right only when there are tag/category chips). Hidden on
   touch devices. */
.search-hint {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  gap: 3px;
  pointer-events: none;
}
.search-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 5px;
  font: 600 0.8em/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #444;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-bottom-width: 2px;
  border-radius: 4px;
}
.search-hint svg { width: 0.75em; height: 0.75em; }
.search-hint-arrows { display: none; }
/* Leave room for the clear (×) button in browsers that draw one (not Firefox) */
@supports selector(::-webkit-search-cancel-button) {
  .search-hint-arrows { right: 30px; }
}
[data-search-input]:focus ~ .search-hint-slash,
[data-search-input]:not(:placeholder-shown) ~ .search-hint-slash { display: none; }
.search-wrapper:has([data-search-results]:not([hidden]) .search-result) .search-hint-arrows { display: flex; }
.search-wrapper:not(:has(.search-chip)) .search-hint-sideways { display: none; }
@media (hover: none) { .search-hint { display: none !important; } }
[data-search-results] {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 10;
}
.search-result {
  display: block;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: #222;
}
.search-result:hover, .search-result.active { background: #f5f5f5; }
.search-result strong { display: block; color: #00008b; }
.search-result span { display: block; font-size: 0.85em; color: #666; margin-top: 2px; }
.search-result .search-meta { color: #800080; }
.search-result mark { background: #fff3a8; color: inherit; }
.search-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-bottom: 1px solid #eee; }
.search-result.search-chip {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #00008b;
}
.search-chip small { color: #888; }
.search-empty { padding: 8px 10px; color: #666; }

/* Footer */
.site-footer {
  padding: 12px;
  border-top: 1px solid #ddd;
  font-size: 0.85em;
  color: #666;
  display: flex;
  justify-content: space-between;
}

/* Index page */
.index-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2em;
}

/* Tags */
.tag {
  display: inline-block;
  background: #f0f0f0;
  padding: 2px 6px;
  margin: 0 4px 4px 0;
  border-radius: 3px;
  font-size: 0.85em;
  color: #555;
  text-decoration: none;
}
.tag:hover { background: #e0e0e0; }

/* Breadcrumb */
.breadcrumb {
  font-size: 0.85em;
  color: #666;
  padding: 6px 0;
  margin-bottom: 0.5em;
  border-bottom: 1px solid #eee;
}

/* Listing detail */
article > p { margin: 0.4em 0; }
article > h1 { margin-bottom: 0.25em; }
.listing-meta { color: #555; }
.listing-verified {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  margin: 0.25em 0 0.75em;
}
.listing-map {
  margin-top: 1.25em;
  padding: 1em;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 3px;
}
#map { height: 200px; }

/* Listing cards (category pages) */
.listing-card {
  padding: 1em 0;
  border-bottom: 1px solid #eee;
}
.listing-card:last-child { border-bottom: none; }
.listing-card h2 { margin: 0 0 0.2em; }
.listing-card p { margin: 0.3em 0; }

/* Listings rendered from markdown (tag pages) */
.listing-list > h2 {
  margin-top: 0;
  padding-top: 1em;
  border-top: 1px solid #eee;
}
.listing-list > h2:first-of-type {
  border-top: none;
  padding-top: 0;
}
.listing-list > p { margin: 0.3em 0; }
.listing-list > p em { color: #666; font-size: 0.85em; }

/* Muted text */
.muted { color: #666; font-size: 0.85em; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Mobile */
@media (max-width: 600px) {
  .site-header nav { flex-direction: column; gap: 8px; text-align: center; }
  .index-grid { grid-template-columns: 1fr; }
}

/* View transitions: animate real link navigations between pages.
   Progressive enhancement — browsers without support just navigate normally. */
@view-transition { navigation: auto; }

/* Keep the header and footer steady across navigations (they're identical on
   every page); only the main content cross-fades. */
.site-header { view-transition-name: site-header; }
.site-footer { view-transition-name: site-footer; }

/* The default (root) cross-fade covers the main content. Keep it quick. */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.2s; }

/* Respect users who prefer no motion. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
