:root {
  --ink: #2b241b;
  --paper: #f7f1e3;
  --paper-dark: #e8dcc0;
  --accent: #8a3324;
  --accent-light: #b85c46;
  --border: #d4c4a0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 4px double var(--accent);
}
.site-header .brand { font-size: 1.4rem; font-weight: bold; letter-spacing: 0.5px; }
.site-header nav a { color: var(--paper); text-decoration: none; margin-left: 1.5rem; font-size: 0.95rem; }
.site-header nav a:hover, .site-header nav a.active { text-decoration: underline; color: var(--accent-light); }

.layout { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; padding: 2rem; max-width: 1200px; margin: 0 auto; }
.search-panel h1 { font-size: 1.7rem; margin-bottom: 0.25rem; }
.subtitle { color: #5c5344; margin-top: 0; margin-bottom: 1.5rem; }

#search-form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
#search-form input { padding: 0.6rem; border: 1px solid var(--border); background: #fff; font-family: inherit; flex: 1 1 160px; }
#search-form button { padding: 0.6rem 1.4rem; background: var(--accent); color: #fff; border: none; cursor: pointer; font-family: inherit; }
#search-form button:hover { background: var(--accent-light); }

.usage-banner { background: var(--paper-dark); border: 1px solid var(--border); padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; }

.paywall { background: #fff3e0; border: 1px solid #d9a441; padding: 1.2rem; margin-bottom: 1.5rem; text-align: center; }
.paywall button { margin-top: 0.5rem; padding: 0.6rem 1.4rem; background: var(--accent); color: #fff; border: none; cursor: pointer; }

.result-card { border: 1px solid var(--border); background: #fff; padding: 1rem; margin-bottom: 1rem; display: flex; gap: 1rem; }
.result-card img { width: 90px; height: 120px; object-fit: cover; background: #ddd; flex-shrink: 0; }
.result-card h3 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.result-card .meta { font-size: 0.8rem; color: #766c5a; margin-bottom: 0.4rem; }
.result-card .snippet { font-size: 0.9rem; color: #3a3227; }
.result-card .save-btn { font-size: 0.8rem; margin-top: 0.5rem; background: none; border: 1px solid var(--border); padding: 0.3rem 0.6rem; cursor: pointer; }

.ad-slot { background: repeating-linear-gradient(45deg, #eee, #eee 10px, #e2e2e2 10px, #e2e2e2 20px); border: 1px dashed #999; display: flex; align-items: center; justify-content: center; color: #777; font-size: 0.85rem; }
.ad-header { height: 90px; margin: 0 2rem; }
.ad-sidebar { min-height: 250px; }

.site-footer { padding: 2rem; text-align: center; font-size: 0.8rem; color: #766c5a; border-top: 1px solid var(--border); margin-top: 2rem; }
.site-footer .footer-links { margin-top: 0.6rem; }
.site-footer .footer-links a { color: #766c5a; margin: 0 0.5rem; }

.legal-layout { max-width: 720px; margin: 0 auto; padding: 2rem; line-height: 1.7; }
.legal-layout h1 { font-size: 1.8rem; margin-bottom: 0.2rem; }
.legal-updated { color: #766c5a; font-size: 0.85rem; margin-top: 0; }
.legal-notice { background: #fff3e0; border: 1px solid #d9a441; padding: 1rem 1.2rem; margin: 1.2rem 0 2rem; font-size: 0.9rem; }
.legal-layout h2 { font-size: 1.2rem; margin-top: 2rem; }
.legal-layout ul { padding-left: 1.4rem; }
.legal-layout section { margin-bottom: 1.5rem; }

.pricing-layout, .account-layout { max-width: 900px; margin: 2rem auto; padding: 0 2rem; }
.plans { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.plan-card { flex: 1 1 220px; border: 1px solid var(--border); background: #fff; padding: 1.5rem; text-align: center; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.plan-card .price { font-size: 1.8rem; font-weight: bold; margin: 0.5rem 0; }
.plan-card ul { list-style: none; padding: 0; text-align: left; font-size: 0.9rem; }
.plan-card ul li::before { content: "✓ "; color: var(--accent); }
.plan-card button { width: 100%; padding: 0.7rem; background: var(--accent); color: #fff; border: none; cursor: pointer; margin-top: 1rem; }
.save-note { font-size: 0.8rem; color: var(--accent); }

#login-form, #signup-form { display: flex; flex-direction: column; gap: 0.6rem; max-width: 320px; margin-bottom: 2rem; }
#login-form input, #signup-form input { padding: 0.6rem; border: 1px solid var(--border); }
#login-form button, #signup-form button { padding: 0.6rem; background: var(--accent); color: #fff; border: none; cursor: pointer; }

/* ---------- Ask / Research page ---------- */
.ask-layout { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.ask-intro h1 { font-size: 1.8rem; margin-bottom: 0.2rem; }
.ask-intro .subtitle { color: #5c5344; margin-top: 0; }

#ask-form { display: flex; gap: 0.6rem; margin-bottom: 0.8rem; }
#ask-form textarea { flex: 1; padding: 0.8rem; border: 1px solid var(--border); font-family: inherit; font-size: 1rem; resize: vertical; background: #fff; }
#ask-form button { padding: 0.8rem 1.6rem; background: var(--accent); color: #fff; border: none; cursor: pointer; align-self: flex-start; }
#ask-form button:hover { background: var(--accent-light); }

.example-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.chip { font-size: 0.82rem; padding: 0.4rem 0.8rem; background: var(--paper-dark); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; color: var(--ink); font-family: inherit; }
.chip:hover { background: var(--border); }

/* ---------- Filter panel ---------- */
.filter-panel { border: 1px solid var(--border); background: #fff; margin-bottom: 1.5rem; }
.filter-panel summary { cursor: pointer; padding: 0.7rem 1rem; font-weight: bold; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.filter-panel summary::-webkit-details-marker { display: none; }
.filter-panel summary::before { content: "▸"; display: inline-block; transition: transform 0.15s; }
.filter-panel[open] summary::before { transform: rotate(90deg); }
.filter-count { color: var(--accent); font-size: 0.7rem; }

.filter-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; padding: 0 1rem 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.filter-group { border: none; margin: 0; padding: 0; }
.filter-group legend { font-size: 0.8rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.4rem; padding: 0; }
.filter-hint { font-weight: normal; text-transform: none; color: #766c5a; font-size: 0.75rem; letter-spacing: normal; }
.filter-group label { display: block; font-size: 0.88rem; margin-bottom: 0.3rem; cursor: pointer; }
.filter-group input[type="checkbox"] { margin-right: 0.4rem; }
.filter-group-narrow .inline-label { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.filter-group-narrow input[type="number"], .filter-group-narrow input[type="text"] { width: 100px; padding: 0.35rem; border: 1px solid var(--border); font-family: inherit; }
.filter-group-narrow input[type="text"] { width: 140px; }
.filter-group-narrow select { padding: 0.35rem; border: 1px solid var(--border); font-family: inherit; }

.location-hierarchy .inline-label { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.45rem; font-size: 0.88rem; }
.location-hierarchy select, .location-hierarchy input[type="text"] { padding: 0.35rem; border: 1px solid var(--border); font-family: inherit; width: 160px; }
.location-hierarchy input:disabled { background: var(--paper-dark); color: #999; cursor: not-allowed; }
.filter-note { font-size: 0.76rem; color: #766c5a; font-style: italic; margin: 0.4rem 0 0; }

.filter-actions { padding: 0 1rem 1rem; }
.filter-actions button { font-size: 0.8rem; background: none; border: 1px solid var(--border); padding: 0.4rem 0.8rem; cursor: pointer; }
.filter-actions button:hover { background: var(--paper-dark); }

.applied-filters { font-size: 0.85rem; color: #766c5a; margin: 0 0 1rem; font-style: italic; }

.loading-state { text-align: center; padding: 3rem 0; color: #766c5a; }
.pin-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 1rem; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 3rem 1rem; color: #5c5344; max-width: 480px; margin: 0 auto; }

.ask-results { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }

/* The "typed memo pinned to a corkboard" signature element */
.memo-sheet {
  background: #fffef9;
  border: 1px solid var(--border);
  box-shadow: 2px 3px 0 rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.02);
  padding: 2rem 2.2rem;
  position: relative;
}
.memo-sheet::before {
  content: "";
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}
.memo-sheet h2 { font-size: 1.4rem; margin-top: 0.4rem; border-bottom: 2px double var(--border); padding-bottom: 0.6rem; }
.memo-body { line-height: 1.75; font-size: 1.02rem; }

.citation-group { font-size: 0.7em; margin-left: 1px; }
.citation-tab {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  padding: 0 4px;
  border-radius: 3px;
  font-weight: bold;
}
.citation-tab:hover { background: var(--accent-light); }

.narrative-locked { background: #fff3e0; border: 1px solid #d9a441; padding: 1.4rem; text-align: center; }
.narrative-locked button { margin-top: 0.6rem; padding: 0.6rem 1.4rem; background: var(--accent); color: #fff; border: none; cursor: pointer; }

.uncertain-box { margin-top: 1rem; background: #f2ece0; border-left: 3px solid var(--accent); padding: 0.8rem 1rem; font-size: 0.9rem; }
.uncertain-box h4 { margin: 0 0 0.4rem; font-size: 0.9rem; }
.uncertain-box ul { margin: 0; padding-left: 1.2rem; }

.corkboard-column h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: #766c5a; margin: 1.4rem 0 0.6rem; }
.corkboard-column h3:first-child { margin-top: 0; }

.timeline { display: flex; flex-direction: column; border-left: 2px solid var(--border); padding-left: 1rem; margin-left: 0.4rem; }
.timeline-entry { position: relative; padding: 0.4rem 0; cursor: pointer; display: flex; gap: 0.6rem; align-items: baseline; }
.timeline-entry:hover .timeline-label { color: var(--accent); }
.timeline-dot { position: absolute; left: -1.32rem; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline-year { font-weight: bold; font-size: 0.85rem; min-width: 3em; }
.timeline-label { font-size: 0.85rem; color: #5c5344; }
.timeline-empty { font-size: 0.85rem; color: #766c5a; }

.research-map { height: 220px; border: 1px solid var(--border); background: var(--paper-dark); }

.clippings-list { display: flex; flex-direction: column; gap: 0.7rem; }
.clip-card { display: flex; gap: 0.6rem; background: #fff; border: 1px solid var(--border); padding: 0.7rem; font-size: 0.85rem; transition: background 0.3s; }
.clip-card.clip-highlight { background: #fff3e0; }
.clip-thumb { width: 50px; height: 65px; object-fit: cover; flex-shrink: 0; background: var(--paper-dark); }
.clip-number { flex-shrink: 0; width: 22px; height: 22px; background: var(--accent); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: bold; }
.clip-meta { color: #766c5a; font-size: 0.78rem; margin-bottom: 0.2rem; }
.clip-snippet { line-height: 1.4; margin-bottom: 0.3rem; }

.results-toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.6rem; }
.graphics-toggle-btn { font-size: 0.8rem; background: none; border: 1px solid var(--border); padding: 0.4rem 0.8rem; cursor: pointer; font-family: inherit; }
.graphics-toggle-btn:hover { background: var(--paper-dark); }

.suggestions-box { margin-top: 1.2rem; background: #fff; border: 1px solid var(--border); padding: 1rem; }
.suggestions-box h4 { margin: 0 0 0.6rem; font-size: 0.9rem; color: #766c5a; text-transform: uppercase; letter-spacing: 0.04em; }
.suggestions-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.suggestion-chip { font-size: 0.82rem; padding: 0.45rem 0.9rem; background: var(--paper-dark); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; color: var(--ink); font-family: inherit; }
.suggestion-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 800px) {
  .ask-results { grid-template-columns: 1fr; }
}

/* ---------- Travel Guide page ---------- */
.travel-layout { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.travel-intro h1 { font-size: 1.8rem; margin-bottom: 0.2rem; }
.travel-intro .subtitle { color: #5c5344; margin-top: 0; }

.location-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.location-controls #geo-btn { padding: 0.7rem 1.2rem; background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 0.95rem; }
.location-controls #geo-btn:hover { background: var(--accent-light); }
.or-divider { color: #766c5a; font-size: 0.85rem; }
#place-form { display: flex; gap: 0.5rem; flex: 1; min-width: 240px; }
#place-form input { flex: 1; padding: 0.6rem; border: 1px solid var(--border); font-family: inherit; }
#place-form button { padding: 0.6rem 1.2rem; background: var(--ink); color: #fff; border: none; cursor: pointer; }
.geo-status { font-size: 0.85rem; color: #8a3324; margin: 0.3rem 0 0; }

.loading-inline { padding: 1.5rem 0; }

.breadcrumb-trail { margin: 1.2rem 0; font-size: 0.9rem; }
.breadcrumb-item { background: none; border: none; color: var(--accent); text-decoration: underline; cursor: pointer; font-family: inherit; font-size: 0.9rem; padding: 0.1rem 0.2rem; }
.breadcrumb-item:last-child { color: var(--ink); text-decoration: none; font-weight: bold; cursor: default; }
.breadcrumb-sep { margin: 0 0.4rem; color: #766c5a; }

.travel-results { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }

.focus-card { background: #fff; border: 1px solid var(--border); display: flex; gap: 1rem; padding: 1.2rem; margin-bottom: 1rem; }
.focus-card .focus-thumb { width: 120px; height: 120px; object-fit: cover; flex-shrink: 0; }
.focus-card h2 { margin: 0 0 0.3rem; font-size: 1.3rem; }
.era-badge { display: inline-block; background: var(--paper-dark); border: 1px solid var(--border); font-size: 0.72rem; padding: 0.15rem 0.5rem; border-radius: 999px; margin-bottom: 0.4rem; }
.nrhp-badge { display: inline-block; background: #e8f3ea; color: #2d6a3e; border: 1px solid #a8d4b0; font-size: 0.72rem; padding: 0.15rem 0.5rem; border-radius: 999px; margin-bottom: 0.4rem; margin-left: 0.4rem; font-weight: bold; }
.nrhp-check { color: #2d6a3e; font-weight: bold; }
.wiki-check { display: inline-block; color: #6b6b6b; background: var(--paper-dark); border-radius: 3px; padding: 0 4px; font-size: 0.7rem; font-weight: bold; }
.attribution-line { font-size: 0.76rem; color: #766c5a; margin-top: 0.6rem; }
.attribution-line a { color: #766c5a; text-decoration: underline; }

.storyline-actions { display: flex; gap: 0.6rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.storyline-actions button { padding: 0.55rem 1rem; background: var(--ink); color: #fff; border: none; cursor: pointer; font-size: 0.88rem; }
.storyline-actions button:hover { background: #45392a; }

#custom-ask-form { display: flex; gap: 0.5rem; margin-bottom: 1.2rem; }
#custom-ask-form input { flex: 1; padding: 0.55rem; border: 1px solid var(--border); font-family: inherit; }
#custom-ask-form button { padding: 0.55rem 1rem; background: var(--accent); color: #fff; border: none; cursor: pointer; }

.landmarks-column h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: #766c5a; margin: 0 0 0.8rem; }
.landmark-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.landmark-card { display: flex; gap: 0.7rem; align-items: center; background: #fff; border: 1px solid var(--border); padding: 0.6rem; cursor: pointer; text-align: left; font-family: inherit; width: 100%; }
.landmark-card:hover { background: var(--paper-dark); }
.landmark-card img, .landmark-thumb-placeholder { width: 50px; height: 50px; object-fit: cover; flex-shrink: 0; background: var(--paper-dark); }
.landmark-card-title { font-size: 0.88rem; font-weight: bold; }
.landmark-card-meta { font-size: 0.76rem; color: #766c5a; }
.landmark-upsell { font-size: 0.82rem; color: #766c5a; font-style: italic; margin-top: 0.6rem; }

.historical-maps-list { display: flex; flex-direction: column; gap: 0.5rem; }
.historical-map-card { display: flex; align-items: center; gap: 0.7rem; background: #fff; border: 1px solid var(--border); padding: 0.6rem; text-decoration: none; color: var(--ink); }
.historical-map-card:hover { background: var(--paper-dark); }
.historical-map-year { font-weight: bold; font-size: 0.85rem; background: var(--paper-dark); border: 1px solid var(--border); padding: 0.2rem 0.5rem; border-radius: 3px; flex-shrink: 0; min-width: 2.5em; text-align: center; }
.historical-map-title { font-size: 0.82rem; }

@media (max-width: 800px) {
  .travel-results { grid-template-columns: 1fr; }
  .focus-card { flex-direction: column; }
}



/* Brand logo link — overrides default anchor blue/purple now that it links home */
.site-header .brand { color: var(--paper) !important; text-decoration: none !important; }
.site-header .brand:visited { color: var(--paper) !important; }
.site-header .brand:hover { color: var(--accent-light) !important; }

.bullets-list { padding-left: 1.4rem; margin: 0; }
.bullets-list li { margin-bottom: 0.6rem; line-height: 1.6; }

.wikivoyage-block { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.wikivoyage-block h3 { font-size: 0.95rem; margin: 0 0 0.5rem; color: #766c5a; }

.example-city-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.example-city-chips button { background: var(--paper-dark); border: 1px solid var(--border); border-radius: 999px; padding: 0.3rem 0.8rem; font-size: 0.85rem; cursor: pointer; }
.example-city-chips button:hover { background: var(--accent-light); }

.correction-notice { background: #fff3e0; border: 1px solid #d9a441; padding: 0.6rem 0.9rem; font-size: 0.9rem; margin: 0.6rem 0; border-radius: 4px; }
.correction-notice a { color: #8a5a00; text-decoration: underline; cursor: pointer; }

.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); border: 1px solid var(--border); border-top: none; max-height: 220px; overflow-y: auto; z-index: 20; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.autocomplete-dropdown div { padding: 0.5rem 0.8rem; cursor: pointer; }
.autocomplete-dropdown div:hover, .autocomplete-dropdown div.active { background: var(--accent-light); }

.quick-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0.6rem 0; padding: 0.6rem 0.9rem; background: var(--paper-dark); border-radius: 4px; font-size: 0.9rem; }
.quick-facts dt { font-weight: bold; color: #766c5a; }
.quick-facts dd { margin: 0; }

.nps-block { margin-top: 1rem; padding: 0.8rem 0.9rem; border-left: 4px solid #35563b; background: #f0f4ef; border-radius: 0 4px 4px 0; }
.nps-block h3 { font-size: 0.95rem; margin: 0 0 0.4rem; color: #35563b; }
.nps-block p { margin: 0.3rem 0; font-size: 0.9rem; }

.quick-facts-block h3 { font-size: 0.95rem; margin: 0 0 0.4rem; color: #766c5a; }
