/* Trang tìm kiếm: trang chủ chào theo giờ, trang kết quả là danh sách web. */

:root {
  --bg: #fff;
  --text: #1d1d1f;
  --muted: #6e7780;
  --line: #e6e6e6;
  --link: #1a0dab;
  --link-visited: #660099;
  --url: #006621;
  --accent: #6001d2;
  --mark: #fff3a3;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14vh 16px 0;
}

.logo {
  color: var(--accent);
  font-size: 3.4rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.04em;
  text-decoration: none;
  line-height: 1;
}

.search-form {
  display: flex;
  margin-top: 1.75rem;
  align-items: stretch;
  width: 100%;
  max-width: 584px;
  gap: 8px;
}
.search-wrap { position: relative; flex: 1; }
.search-input {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  font: inherit;
  color: var(--text);
  border: 1px solid #ccc;
  border-radius: 22px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.search-input:focus { border-color: var(--accent); }
.search-btn {
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 22px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.search-btn:hover { filter: brightness(1.08); }

.suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.suggest li { padding: 8px 16px; cursor: pointer; }
.suggest li.active, .suggest li:hover { background: #f6f6f8; }

.account { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.account:empty { display: none; }
body:not(.has-query) .account { position: absolute; top: 16px; right: 20px; }
.who { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}
.btn.ghost { color: var(--text); background: #fff; border-color: #ccc; }

.main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 1.5rem 16px 2rem; }
.footer {
  padding: 12px 20px;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}

body.has-query .header {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}
body.has-query .logo { font-size: 1.7rem; }
body.has-query .search-form { flex: 1; max-width: 640px; margin-top: 0; }
body.has-query .search-input,
body.has-query .search-btn { height: 40px; }
body.has-query .account { margin-left: auto; position: static; }
body.has-query .main { margin: 0; max-width: none; padding: 16px 20px 32px 168px; }
body.has-query .main > * { max-width: 600px; }

.meta .count { margin: 0 0 12px; color: var(--muted); font-size: 0.85rem; }
.didyoumean { margin: 0 0 8px; }
.didyoumean a { color: var(--link); font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.tools .seg { display: inline-flex; gap: 4px; }
.tools .time {
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 16px;
  border: 1px solid #ccc;
  background: #fff;
}

.facets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.facets:empty { display: none; }
.chip {
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 12px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
}
.chip span { color: var(--muted); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.on span { color: #fff; }
.facet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
.facet-label { color: var(--muted); font-size: 0.85rem; }

.results[aria-busy="true"] { opacity: 0.5; }
.results-list { list-style: none; margin: 0; padding: 0; }
.result { margin: 0 0 22px; }
.result-url {
  font-size: 0.82rem;
  color: var(--url);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-url .date { color: var(--muted); }
.result-url .date::before { content: " · "; }
.result-title {
  display: inline;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--link);
  text-decoration: none;
}
a.result-title:visited { color: var(--link-visited); }
a.result-title:hover { text-decoration: underline; }
.result-title mark { background: none; font-weight: 700; }
.snippet { margin: 4px 0 0; color: #444; font-size: 0.92rem; }
.snippet mark { background: var(--mark); }
.why { margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; }
.prompts h2 { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.prompts div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.prompts a { color: var(--link); text-decoration: none; }
.prompts a:hover { text-decoration: underline; }
.tag {
  margin-left: 6px;
  padding: 0 6px;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.result .more {
  display: inline-block;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.result .more:hover { text-decoration: underline; }
.similar { margin: 6px 0 0 8px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 0.9rem; }
.similar ul { margin: 0; padding: 0; list-style: none; }
.similar a { color: var(--link); }
.similar .date, .similar .muted, .muted { color: var(--muted); }

.related { margin-top: 28px; }
.related h2 { font-size: 1rem; margin: 0 0 8px; }
.related div { display: flex; flex-direction: column; gap: 6px; }
.related a { color: var(--link); text-decoration: none; }
.related a:hover { text-decoration: underline; }

.notice { color: var(--muted); }
.notice.error { color: #b00020; }
.gate { text-align: center; padding: 2rem 0; }

.pager { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pg {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  color: var(--link);
  text-decoration: none;
}
.pg.cur { color: var(--text); font-weight: 700; }

@media (max-width: 760px) {
  .header { padding-top: 10vh; }
  .logo { font-size: 2.6rem; }
  .search-form { flex-direction: column; }
  .search-btn { width: 100%; }
  body.has-query .header { flex-wrap: wrap; }
  body.has-query .search-form { flex-direction: row; order: 3; flex-basis: 100%; max-width: none; }
  body.has-query .search-btn { width: auto; }
  body.has-query .main { padding-left: 16px; }
}
