/* hmoob.dev: one stylesheet, light and dark, phone first. */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1c1b22;
  --muted: #62606d;
  --line: #e4e2dc;
  --accent: #3b3fb6;
  --accent-soft: #ecedfb;
  --on-accent: #ffffff;
  --mark: #fde9a8;
  --gold: #b9811c;
  --draft: #9a5b00;
  --draft-bg: #fff6e3;
  --draft-line: #ecc98a;
  --green: #1f7a55;
  --green-bg: #e4f4ec;
  --shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 6px 20px rgba(20, 20, 40, .05);
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131318;
    --surface: #1c1c23;
    --text: #ecebf2;
    --muted: #a09eae;
    --line: #2d2d38;
    --accent: #a3a7ff;
    --accent-soft: #26274a;
    --on-accent: #14142b;
    --mark: #5c4a12;
    --gold: #e6b655;
    --draft: #f0bd6a;
    --draft-bg: #2a2212;
    --draft-line: #5d4a22;
    --green: #74d3a8;
    --green-bg: #17302a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131318;
  --surface: #1c1c23;
  --text: #ecebf2;
  --muted: #a09eae;
  --line: #2d2d38;
  --accent: #a3a7ff;
  --accent-soft: #26274a;
  --on-accent: #14142b;
  --mark: #5c4a12;
  --gold: #e6b655;
  --draft: #f0bd6a;
  --draft-bg: #2a2212;
  --draft-line: #5d4a22;
  --green: #74d3a8;
  --green-bg: #17302a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

h1, h2 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 5; }
.skip:focus { left: 8px; }

.hmong { font-weight: 650; letter-spacing: .005em; }
.unknown { color: var(--muted); font-weight: 500; }

/* top bar */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; font-size: 1.05rem; color: var(--text); margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand .dim { color: var(--muted); font-weight: 500; margin-left: -8px; }
.mark { width: 14px; height: 14px; background: var(--accent); transform: rotate(45deg); border-radius: 3px; box-shadow: inset 0 0 0 3.5px var(--accent), inset 0 0 0 5px var(--surface); }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: 6px 8px; border-radius: 8px; font-size: .92rem; }
.top nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.theme { border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 8px; cursor: pointer; display: inline-flex; }
.theme:hover { color: var(--text); background: var(--bg); }

main.wrap { flex: 1; padding-top: 20px; padding-bottom: 48px; }

/* search box */
.search { display: flex; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); transition: border-color .15s; }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 1.05rem; padding: 13px 4px 13px 20px; outline: none; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search button { border: 0; background: var(--accent); color: var(--on-accent); width: 44px; height: 44px; margin: 4px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; flex: none; }
.searchbar { margin-bottom: 22px; }

/* front page */
.hero { text-align: center; padding: 9vh 0 28px; transition: padding .2s; }
.searching .hero { padding-top: 12px; }
.searching .hero .lead, .searching .hero .examples, .searching .hero .counts { display: none; }
.searching .hero h1 { font-size: 1.4rem; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2rem, 7vw, 3rem); letter-spacing: -.02em; }
.lead { color: var(--muted); font-size: 1.08rem; margin: 10px 0 24px; text-wrap: pretty; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 18px; color: var(--muted); font-size: .92rem; }
.counts { color: var(--muted); font-size: .88rem; margin-top: 26px; font-variant-numeric: tabular-nums; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .9rem; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .n { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.chip.on .n { color: inherit; opacity: .8; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

/* badges */
.badge { display: inline-block; font-size: .74rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; vertical-align: middle; }
.badge.kind { background: none; border: 1px solid var(--line); color: var(--muted); font-style: normal; font-size: .74rem; }
a.badge.kind:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.badge.dialect-green { background: var(--green-bg); color: var(--green); }
.badge.dialect-both { background: none; border: 1px solid var(--line); color: var(--muted); }
.badge.checked { background: var(--green-bg); color: var(--green); }
.badge.draft { background: var(--draft-bg); color: var(--draft); border: 1px dashed var(--draft-line); }
.kind { color: var(--muted); font-style: italic; font-size: .9em; }

/* results */
.summary { color: var(--muted); font-size: .9rem; margin: 4px 2px 12px; }
.results { display: grid; gap: 10px; }
.result { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; transition: border-color .15s, transform .15s; }
.result:hover { border-color: var(--accent); }
.result .cover { position: absolute; inset: 0; border-radius: var(--radius); z-index: 1; }
.result .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.result h2 { font-size: 1.3rem; color: var(--accent); }
.result .also { color: var(--muted); font-size: .88rem; }
.result .also .hmong { color: var(--text); }
.result .why { margin-left: auto; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.meanings { margin-top: 6px; }
.meanings li { padding: 2px 0; overflow-wrap: anywhere; }
.meanings .more { color: var(--muted); font-size: .88rem; }
.meanings .is-draft { color: var(--muted); }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 3px; }

.empty { text-align: center; padding: 40px 0; color: var(--muted); }
.empty h1, .empty h2 { color: var(--text); font-size: 1.3rem; margin-bottom: 8px; }
.empty p { max-width: 34rem; margin: 0 auto; text-wrap: pretty; }

/* a word */
.entry > header { padding: 6px 0 4px; }
.entry h1 { font-size: clamp(2.2rem, 9vw, 3.2rem); letter-spacing: -.01em; color: var(--accent); overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.otherform { margin-top: 12px; color: var(--muted); }
.otherform a, .otherform .hmong { font-size: 1.1rem; }
.sound { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 14px; color: var(--muted); font-size: .86rem; }
.sound span { border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; background: var(--surface); }
.sound b { color: var(--text); font-size: 1rem; margin-right: 3px; }

.block { margin-top: 26px; }
.block > h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.block > h2 .badge { text-transform: none; letter-spacing: 0; }
.note { color: var(--muted); font-size: .9rem; margin-bottom: 10px; text-wrap: pretty; }
.none { color: var(--muted); }

.definitions { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); counter-reset: sense; }
.definitions li { padding: 12px 16px 12px 46px; position: relative; counter-increment: sense; }
.definitions li + li { border-top: 1px solid var(--line); }
.definitions li::before { content: counter(sense); position: absolute; left: 16px; top: 13px; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.definitions .text { font-size: 1.08rem; overflow-wrap: anywhere; }
.source { color: var(--muted); font-size: .8rem; margin-top: 3px; }

.drafts .definitions, .drafts .notes { border-style: dashed; border-color: var(--draft-line); background: var(--draft-bg); }
.notes { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: grid; gap: 6px; overflow-wrap: anywhere; }

.wordlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.wordlist li { display: grid; grid-template-columns: minmax(6.5rem, 30%) 1fr; gap: 12px; padding: 9px 16px; align-items: baseline; }
.wordlist li + li { border-top: 1px solid var(--line); }
.wordlist .hmong { overflow-wrap: anywhere; }
.gloss { color: var(--muted); overflow-wrap: anywhere; }

.links { display: grid; gap: 10px; }
.links li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.links li.is-draft { border-style: dashed; border-color: var(--draft-line); background: var(--draft-bg); }
.links .pair { font-size: 1.08rem; }
.links .rel { color: var(--muted); font-size: .88rem; }
.links .phrase { margin-top: 2px; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pager a, .pager span { min-width: 38px; text-align: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-variant-numeric: tabular-nums; }
.pager .on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

main > h1 { font-size: 1.8rem; margin-top: 6px; }
main > h1 + .lead { margin-bottom: 4px; }

.prose { max-width: 65ch; }
.prose h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.prose p { margin: 10px 0; }
.prose ul { list-style: disc; padding-left: 1.25rem; display: grid; gap: 6px; }

.foot.wrap { color: var(--muted); font-size: .82rem; padding-top: 18px; padding-bottom: 28px; border-top: 1px solid var(--line); }
.foot p { max-width: 65ch; text-wrap: pretty; }

@media (max-width: 520px) {
  .brand { width: 100%; }
  .top .wrap { padding-bottom: 6px; }
  .top nav { margin-left: -8px; margin-right: auto; }
  .result .why { margin-left: 0; width: 100%; order: 5; }
  .wordlist li { grid-template-columns: 1fr; gap: 0; }
  .hero { padding-top: 5vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
