/* Saint Lucia Price Tracker — public static site styles. */

:root {
  --bg: #f4f7fc;
  --bg-tint: #eaf1fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f1f3d;
  --muted: #5b6b86;
  --border: #e4e9f2;
  --primary: #1d4ed8;
  --primary-600: #2563eb;
  --primary-50: #eef4ff;
  --accent: #15a05a;
  --accent-50: #e9f8ef;
  --danger: #d1453b;
  --navy: #0b1f44;
  --navy-2: #102a57;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 31, 61, 0.06);
  --shadow: 0 8px 24px rgba(15, 31, 61, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 31, 61, 0.16);
  --maxw: 1160px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.4em; color: var(--text); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

main { display: block; min-height: 50vh; }
.section { padding: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 1.45rem; }
.section-head .section-sub { color: var(--muted); margin: 0; }

/* ---------- Demo banner ---------- */
.demo-banner {
  background: linear-gradient(90deg, #fff7ed, #fef3c7);
  color: #7c4a03;
  border-bottom: 1px solid #f3d9a4;
  font-size: 0.86rem;
}
.demo-banner .container { padding-top: 8px; padding-bottom: 8px; }
.demo-banner code { background: rgba(124, 74, 3, 0.12); padding: 1px 5px; border-radius: 5px; }

/* ---------- Data freshness notice ---------- */
.data-freshness { margin: 0 0 16px; }
.data-freshness p { margin: 0; font-size: 0.9rem; line-height: 1.45; }
.data-freshness-stale {
  background: #fffbeb;
  border: 1px solid #f3e8c4;
  color: #6b5608;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.data-freshness-missing {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { display: inline-flex; }
.brand-name { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name strong { font-size: 1.02rem; font-weight: 700; }
.brand-name span { font-size: 0.82rem; color: var(--muted); }

.primary-nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-link {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.94rem;
  padding: 8px 12px;
  border-radius: 8px;
}
.nav-link:hover { color: var(--primary); background: var(--primary-50); text-decoration: none; }
.nav-link.is-active { color: var(--primary); background: var(--primary-50); font-weight: 600; }

.header-search { position: relative; display: flex; align-items: center; margin-left: auto; }
.header-search svg { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.header-search input {
  width: 210px;
  padding: 9px 12px 9px 32px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font: inherit;
  font-size: 0.9rem;
}
.header-search input:focus { outline: 2px solid var(--primary-600); outline-offset: 1px; background: #fff; }

.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: 0; cursor: pointer; padding: 8px; margin-left: auto; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

/* ---------- Typeahead ---------- */
.has-typeahead { position: relative; }
.typeahead-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  max-height: 340px;
  overflow: auto;
}
.typeahead-item { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.typeahead-item:hover { background: var(--primary-50); }
.ta-name { font-weight: 600; font-size: 0.92rem; }
.ta-meta { font-size: 0.8rem; color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(1100px 460px at 78% -10%, var(--bg-tint), transparent 60%),
    linear-gradient(180deg, #ffffff, var(--bg));
  border-bottom: 1px solid var(--border);
}
.hero-inner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; padding: 56px 0 48px; }
.hero h1 { font-size: 2.9rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.2em; }
.hero h1 .accent-line { color: var(--primary); display: block; }
.hero-lede { font-size: 1.12rem; color: var(--muted); max-width: 36ch; margin-bottom: 24px; }

.hero-search { position: relative; display: flex; gap: 8px; max-width: 520px; }
.hero-search .field { position: relative; flex: 1; display: flex; align-items: center; }
.hero-search .field svg { position: absolute; left: 14px; color: var(--muted); }
.hero-search input {
  width: 100%;
  padding: 15px 16px 15px 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.hero-search input:focus { outline: 2px solid var(--primary-600); outline-offset: 1px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-chips a {
  font-size: 0.85rem; color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px;
}
.hero-chips a:hover { color: var(--primary); border-color: var(--primary); text-decoration: none; }

.hero-art {
  background: linear-gradient(160deg, var(--primary), #3b82f6);
  border-radius: var(--radius);
  color: #fff;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-art h3 { color: #fff; font-size: 1.05rem; }
.hero-art p { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; margin-bottom: 0; }
.hero-art .island {
  position: absolute; right: -30px; bottom: -40px; width: 220px; height: 220px;
  opacity: 0.18; transform: rotate(-8deg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 13px 20px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.01em; }
.stat-card .stat-label { color: var(--muted); font-size: 0.9rem; }
.stat-card .stat-icon {
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--primary-50); color: var(--primary); margin-bottom: 10px;
}

.mini-stat-grid { display: flex; flex-wrap: wrap; gap: 24px; }
.mini-stat { display: flex; flex-direction: column; }
.mini-num { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.mini-label { color: var(--muted); font-size: 0.88rem; }

/* ---------- Category cards ---------- */
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.category-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; color: var(--text); box-shadow: var(--shadow-sm); transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.category-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfe0fb; }
.category-card.wide { flex-direction: row; align-items: center; gap: 14px; }
.category-card.wide .category-body { display: flex; flex-direction: column; }
.category-card.is-empty { opacity: 0.6; box-shadow: none; }
.category-card.is-empty:hover { transform: none; box-shadow: none; border-color: var(--border); }
.category-icon {
  width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--primary-50); color: var(--primary); flex: none;
}
.category-name { font-weight: 700; }
.category-count { color: var(--muted); font-size: 0.86rem; }
.category-examples { color: var(--muted); font-size: 0.78rem; }
.category-card.wide .category-go { margin-left: auto; color: var(--primary); font-weight: 700; }

/* ---------- Product cards (recent) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.product-card {
  display: flex; flex-direction: column; gap: 8px; align-items: stretch; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; font: inherit; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfe0fb; }
.product-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product-price { font-weight: 800; color: var(--text); }
.product-name { font-weight: 600; }
.product-meta { color: var(--muted); font-size: 0.82rem; }

.badge {
  display: inline-block; font-size: 0.74rem; font-weight: 600; color: var(--primary);
  background: var(--primary-50); padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Track page ---------- */
.toolbar {
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr) auto; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); align-items: end;
}
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.field-group input, .field-group select {
  padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.92rem; background: var(--surface); color: var(--text);
}
.field-group input:focus, .field-group select:focus { outline: 2px solid var(--primary-600); outline-offset: 1px; }
.toolbar .search-field { position: relative; }
.results-meta { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 12px; gap: 12px; flex-wrap: wrap; }
#result-count { font-weight: 600; color: var(--muted); }

.results-table, .history-table, .latest-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.results-table thead th {
  text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); background: var(--surface-2); padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.results-table th.num { text-align: right; }
.results-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.result-row { cursor: pointer; }
.result-row:hover { background: var(--primary-50); }
.result-row:focus-visible { outline: 2px solid var(--primary-600); outline-offset: -2px; }
.result-name { font-weight: 600; }

/* ---------- States ---------- */
.state { padding: 28px; border-radius: var(--radius); text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.state-loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.state-error { border-color: #f3d2cf; background: #fef5f4; color: #7a2820; text-align: left; }
.state-error strong { font-size: 1.05rem; color: #9b2c20; }
.state-hint { font-size: 0.85rem; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border);
  border-top-color: var(--primary); animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.callout {
  display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start;
  background: linear-gradient(180deg, #fff, var(--surface-2));
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 20px 22px;
}
.callout .callout-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-50); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.callout h3 { margin-bottom: 6px; }
.callout p { margin-bottom: 0; color: var(--muted); }

.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.trust-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.trust-item .trust-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-50); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.trust-item h3 { font-size: 1rem; }
.trust-item p { color: var(--muted); font-size: 0.88rem; margin-bottom: 0; }

/* ---------- Markets ---------- */
.market-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.market-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.market-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.market-head h2 { margin: 0; font-size: 1.2rem; }
.market-key { font-size: 0.78rem; color: var(--muted); background: var(--surface-2); padding: 3px 9px; border-radius: 6px; }
.market-stats { display: flex; gap: 26px; margin: 16px 0; }
.market-stats .ms-num { display: block; font-size: 1.25rem; font-weight: 800; color: var(--text); }
.market-stats .ms-label { font-size: 0.82rem; color: var(--muted); }
.market-locations h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.loc-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.loc-list li { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; font-size: 0.9rem; }
.loc-id { color: var(--muted); font-size: 0.8rem; }
.text-link { font-weight: 600; }

/* ---------- Product detail modal ---------- */
body.modal-open { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; background: rgba(11, 31, 68, 0.5); z-index: 90; }
.modal-dialog {
  position: fixed; z-index: 91; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 26px;
}
.modal-close {
  position: absolute; top: 14px; right: 16px; border: 0; background: var(--surface-2);
  width: 34px; height: 34px; border-radius: 50%; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.detail-header { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; padding-right: 40px; }
.detail-image { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; background: var(--surface-2); flex: none; }
.detail-image.placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 800; color: var(--primary); background: var(--primary-50); }
.detail-header h2 { margin: 0 0 2px; font-size: 1.35rem; }
.fact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 20px; margin: 0 0 22px; }
.fact dt { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 2px; }
.fact dd { margin: 0; font-weight: 500; }
.big-price { font-size: 1.45rem; font-weight: 800; }
.history-block { margin-bottom: 22px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-block h4 { margin: 0 0 8px; font-size: 1rem; }
.delta { font-size: 0.82rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.delta-up { color: var(--danger); background: #fdecea; }
.delta-down { color: var(--accent); background: var(--accent-50); }
.delta-flat { color: var(--muted); background: var(--surface-2); }
.single-point { margin-bottom: 4px; }
.history-table, .latest-table { margin-top: 10px; font-size: 0.9rem; }
.history-table th, .history-table td, .latest-table th, .latest-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.history-table th.num, .history-table td.num, .latest-table th.num, .latest-table td.num { text-align: right; }
.transparency-note { margin-top: 8px; font-size: 0.85rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }

/* Price chart */
.price-chart { width: 100%; height: auto; }
.chart-line { stroke: var(--primary); stroke-width: 2.5; }
.chart-dot { fill: #fff; stroke: var(--primary); stroke-width: 2; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; }

/* ---------- Page intro ---------- */
.page-intro { background: linear-gradient(180deg, #ffffff, var(--bg)); border-bottom: 1px solid var(--border); padding: 40px 0 30px; }
.page-intro h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.page-intro p { color: var(--muted); max-width: 60ch; margin-bottom: 18px; }
.footer-updated { color: #a8bddf; }

/* ---------- About ---------- */
.prose { max-width: 760px; }
.prose h2 { font-size: 1.4rem; margin-top: 32px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.fact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.fact-list li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.fact-list svg { color: var(--accent); margin-top: 3px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #c4d2ee; margin-top: 56px; }
.site-footer .container { padding-top: 44px; padding-bottom: 28px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.footer-brand .brand-logo { display: inline-flex; background: #fff; border-radius: 8px; padding: 4px; }
.footer-title { color: #fff; font-weight: 700; margin: 10px 0 6px; }
.footer-tagline { font-size: 0.88rem; color: #93a6cc; max-width: 34ch; }
.footer-col h3 { color: #fff; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { color: #c4d2ee; font-size: 0.9rem; }
.footer-col a:hover { color: #fff; }
.footer-notes li { font-size: 0.86rem; color: #93a6cc; }
.footer-bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--navy-2); margin-top: 28px; padding-top: 18px; font-size: 0.82rem; color: #8195bd; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .stat-grid, .category-grid, .product-grid, .trust-grid { grid-template-columns: repeat(2, 1fr); }
  .market-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .fact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 10px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .primary-nav.is-open { display: flex; }
  .header-search { display: none; }
  .hero h1 { font-size: 2.2rem; }

  /* Stacked, card-style table rows on small screens */
  .results-table, .results-table thead, .results-table tbody, .results-table th, .results-table td, .results-table tr { display: block; }
  .results-table thead { position: absolute; left: -9999px; }
  .results-table tr { border-bottom: 1px solid var(--border); padding: 6px 0; }
  .results-table td { border: 0; padding: 6px 16px; display: flex; justify-content: space-between; gap: 16px; }
  .results-table td::before { content: attr(data-label); font-weight: 600; color: var(--muted); }
  .results-table td.num { text-align: left; }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .page-intro { padding: 28px 0 22px; }
  .page-intro h1 { font-size: 1.75rem; }
  .stat-grid, .category-grid, .product-grid, .trust-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition: none !important; scroll-behavior: auto; }
}
