/* Lastro — busca (apps/web)
   Same palette and type as apps/landing/styles.css: warm ivory paper,
   near-black ink, one clay accent. Kept as its own file rather than shared —
   the two pages ship separately (Firebase Hosting vs the API origin). */

:root {
  --ink:          #191817;
  --ink-soft:     #403c35;
  --ink-muted:    #655f52;
  --paper:        #faf9f5;
  --paper-alt:    #f0eee6;
  --surface:      #ffffff;
  --rule:         #e6e1d4;
  --rule-strong:  #cfc8b6;
  --clay:         #b04e22;
  --clay-deep:    #8f3a14;
  --clay-tint:    #f6e7de;
  --on-clay:      #fffdf9;
  --green:        #2f6f4f;

  --font-display: "Newsreader", ui-serif, Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 720px;
  --pad: 24px;
  --radius: 4px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--clay); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; border-radius: 2px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- search shell ---------- */

.shell { padding-inline: var(--pad); }

.shell-inner {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  letter-spacing: -0.022em;
  line-height: 1;
}
.mark-glyph { color: var(--clay); flex: none; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search:focus-within {
  border-color: var(--clay);
  box-shadow: 0 1px 10px rgba(25, 24, 23, 0.06);
}
.search-glyph { width: 19px; height: 19px; flex: none; color: var(--ink-muted); }

#q {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  padding: 10px 0;
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  letter-spacing: -0.008em;
}
#q::placeholder { color: var(--ink-muted); opacity: 0.85; }
#q:focus { outline: none; }
#q::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-submit {
  flex: none;
  border: 1px solid var(--clay);
  background: var(--clay);
  color: var(--on-clay);
  border-radius: 999px;
  padding: 9px 22px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.search-submit:hover { background: var(--clay-deep); border-color: var(--clay-deep); }

.tagline {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  text-align: center;
  text-wrap: balance;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ink-muted);
}
.chip {
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 4px 13px;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--clay); color: var(--clay-deep); background: var(--clay-tint); }

/* --- home state: everything centred, nothing else on the page --- */

.is-home .shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 40px 15vh;   /* optical centring: sits a touch above the middle */
}
.is-home .mark { flex-direction: column; gap: 14px; margin-bottom: 10px; }
.is-home .mark-glyph { width: 46px; height: 46px; }
.is-home .mark-name { font-size: clamp(2.5rem, 8vw, 3.5rem); }

/* --- results state: the shell docks to the top --- */

.has-results .shell {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 249, 245, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
  padding-block: 14px;
}
.has-results .shell-inner {
  flex-direction: row;
  align-items: center;
  gap: 18px;
  max-width: 940px;
}
.has-results .mark-glyph { width: 22px; height: 22px; }
.has-results .mark-name { font-size: 1.3125rem; }
.has-results .search { padding: 3px 4px 3px 16px; }
.has-results #q { padding: 7px 0; font-size: 1rem; }
.has-results .search-submit { padding: 7px 18px; }
.has-results .tagline,
.has-results .examples { display: none; }

@media (max-width: 620px) {
  .has-results .mark-name { display: none; }
  .has-results .shell-inner { gap: 12px; }
}

/* ---------- results ---------- */

.results {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 0 var(--pad);
}
.is-home .results { display: none; }
.has-results .results { padding-block: 22px 56px; }

.results-meta {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  padding-bottom: 18px;
}

.hits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 26px;
  max-width: var(--measure);
}

.hit-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-bottom: 3px;
}
.hit-domain {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--paper-alt);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--ink-soft);
}

.hit-title {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.3125rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.014em;
  margin: 0 0 4px;
}
.hit-title a { color: var(--clay-deep); text-decoration-color: rgba(176, 78, 34, 0.4); }
.hit-title a:hover { color: var(--ink); text-decoration-color: currentColor; }

.hit-ref {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 5px;
  margin-left: 7px;
  vertical-align: 2px;
  white-space: nowrap;
}

.hit-trecho {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
  border-left: 2px solid var(--rule);
  padding-left: 13px;
  max-width: 68ch;
}
.hit-trecho b { color: var(--ink); font-weight: 600; background: var(--clay-tint); }

/* situação — the one place a colour carries meaning, so keep it quiet */
.badge {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
  border: 1px solid var(--rule-strong);
  background: var(--paper-alt);
  color: var(--ink-muted);
}
.badge-vigente { border-color: rgba(47, 111, 79, 0.3); background: #eaf2ed; color: var(--green); }
.badge-revogado, .badge-sem_eficacia { border-color: rgba(176, 78, 34, 0.3); background: var(--clay-tint); color: var(--clay-deep); }

/* ---------- empty / error / loading ---------- */

.notice {
  max-width: var(--measure);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.notice-error { border-left-color: var(--clay); }
.notice strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.notice code { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink); }

.results[aria-busy="true"] .hits { opacity: 0.4; }

/* ---------- footer ---------- */

.page-footer {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  background: var(--paper-alt);
  padding: 18px var(--pad);
  text-align: center;
  font-size: 0.8125rem;
}
.page-footer a { color: var(--ink-muted); text-decoration: none; }
.page-footer a:hover { color: var(--clay); text-decoration: underline; }

@media (max-width: 480px) {
  :root { --pad: 18px; }
  .search-submit { padding-inline: 16px; }
}
