:root {
  color-scheme: light;
  --ink: #241d17;
  --muted: #686158;
  --olive: #586317;
  --olive-dark: #46500f;
  --olive-soft: #eef0dc;
  --paper: #fdfaf6;
  --page: #fdfaf6;
  --line: #e5e0d5;
  --card: #fbfaf5;
  --chip: #f1f0e4;
  --shadow: rgba(55, 46, 35, .10);
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--olive);
  text-decoration: none;
  text-underline-offset: .18em;
}

a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
audio:focus-visible {
  outline: 3px solid rgba(88, 99, 23, .34);
  outline-offset: 2px;
}

.site-shell {
  width: 100%;
  min-height: 100vh;
  background: var(--paper);
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.header-content {
  width: min(calc(100% - 40px), var(--max-width));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink);
  font-family: "Lora", Georgia, serif;
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -.035em;
}

.brand:hover { text-decoration: none; }

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(22, 39, 50, .18);
}

.container {
  width: min(calc(100% - 52px), var(--max-width));
  min-height: calc(100vh - 180px);
  margin: 0 auto;
  padding: 18px 0 44px;
}

h1, h2, h3 {
  margin-top: 0;
  color: var(--ink);
  font-family: "Lora", Georgia, serif;
  line-height: 1.18;
  letter-spacing: -.035em;
}

h1 {
  margin-bottom: .8rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

h2 {
  margin-bottom: .85rem;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
}

p { margin: .5rem 0; }

section { margin: 1.7rem 0; }

.search {
  position: relative;
  display: flex;
  margin-left: auto;
}

.search input {
  width: min(27vw, 270px);
  min-height: 38px;
  padding: .58rem .9rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d9d5cc;
  border-right: 0;
  border-radius: 9px 0 0 9px;
  font: inherit;
}

.search input::placeholder { color: #777168; }

.search button {
  min-height: 38px;
  padding: .55rem 1.15rem;
  color: #fff;
  background: linear-gradient(180deg, #647121, #4e5a12);
  border: 0;
  border-radius: 0 9px 9px 0;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}

.search button:hover { background: var(--olive-dark); }

.search.big {
  width: min(100%, 480px);
  margin: 2rem auto 0;
  gap: 7px;
}

.search.big input {
  width: auto;
  min-height: 48px;
  flex: 1;
  padding-inline: 1rem;
  border-right: 1px solid #d9d5cc;
  border-radius: 10px;
  font-size: 1rem;
}

.search.big button {
  min-height: 48px;
  padding-inline: 1.5rem;
  border-radius: 10px;
  font-size: .94rem;
  box-shadow: 0 2px 4px rgba(55, 67, 14, .12);
}

.typeahead-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + .35rem);
  left: 0;
  right: 0;
  max-height: 24rem;
  margin: 0;
  padding: .3rem;
  overflow-y: auto;
  list-style: none;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(40, 34, 26, .15);
}

.typeahead-results:empty { display: none; }

.typeahead-results a {
  display: block;
  padding: .55rem .7rem;
  color: var(--ink);
  border-radius: 7px;
}

.typeahead-results a:hover,
.typeahead-results a:focus,
.typeahead-results a.active {
  background: var(--olive-soft);
  text-decoration: none;
}

.typeahead-results .search-ipa {
  display: block;
  margin-top: .08rem;
  color: var(--muted);
  font-size: .8rem;
}

.hero {
  min-height: 365px;
  margin: 0;
  padding: 96px 24px 55px;
  text-align: center;
}

.hero h1 {
  margin-bottom: .8rem;
  font-size: clamp(2.8rem, 6vw, 4.1rem);
  font-weight: 600;
}

.hero > p {
  max-width: 520px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.phoneme-hub,
.guide-hub,
.phoneme,
.search-results,
.static,
.error {
  padding: clamp(1.4rem, 3vw, 2.1rem);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.phoneme-hub {
  max-width: 1040px;
  margin: 0 auto;
  padding: 27px 30px 25px;
}

.guide-hub {
  border: 0;
  border-radius: 0;
}

.phoneme-hub h2 { margin-bottom: 1.25rem; }

.phoneme-list,
.word-index {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.phoneme-list a,
.word-index li a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: .32rem .68rem;
  color: var(--ink);
  background: var(--chip);
  border: 1px solid #e9e6d8;
  border-radius: 7px;
  font-weight: 500;
}

.phoneme-list a:hover,
.word-index li a:hover {
  color: var(--olive);
  border-color: #cdd1aa;
  text-decoration: none;
}

.guide-link { margin-top: 1.75rem; }

.guide-link a {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-size: .9rem;
}

.guide-link svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 1.65rem;
  padding: 0;
  list-style: none;
  color: var(--olive);
  font-size: .82rem;
}

.breadcrumbs li:not(:last-child)::after {
  content: " ›";
  margin-left: .45rem;
  color: #a6a18f;
}

.word { padding: 0 7px; }

.word-hero {
  margin-bottom: 1.45rem;
  padding: 7px 7px 23px;
  border-bottom: 1px solid var(--line);
}

.word-hero h1 {
  margin-bottom: .75rem;
  font-size: clamp(2rem, 4vw, 2.65rem);
  font-weight: 600;
}

.word-hero h1 strong { font-weight: 600; }

.eyebrow {
  margin: 0 0 .45rem;
  color: var(--olive);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.ipa span,
.variants span,
.recording-transcription,
.search-ipa {
  font-family: "Noto Sans", "Charis SIL", "Doulos SIL", sans-serif;
}

.ipa {
  color: var(--muted);
  font-size: .9rem;
}

.ipa span { color: var(--ink); }

.variants {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  color: var(--muted);
  font-size: .82rem;
}

.variants span,
.recording-transcription {
  display: inline-block;
  padding: .2rem .55rem;
  color: #4d501f;
  background: var(--chip);
  border: 1px solid #e7e4d6;
  border-radius: 7px;
}

.samples,
.definitions,
.usage { margin-top: 1.35rem; }

.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.sample {
  padding: .8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 7px rgba(55, 46, 35, .04);
}

.recording-transcription { margin: 0 0 .25rem; }

.sample audio {
  display: block;
  width: 100%;
  height: 36px;
  color-scheme: light;
}

.quality {
  margin: .05rem 0 .45rem;
  color: var(--muted);
  font-size: .72rem;
}

.definitions > h2,
.usage > h2,
.samples > h2 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 500;
}

.definitions ul,
.usage ul { padding: 0; }

.definitions ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.definitions li,
.usage li {
  list-style: none;
  padding: .95rem 1.05rem;
  background: rgba(255, 253, 248, .45);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 2px 7px rgba(55, 46, 35, .025);
}

.meaning {
  margin-top: 0;
  font-family: "Lora", Georgia, serif;
  font-size: .93rem;
  line-height: 1.45;
}

.example {
  margin: .35rem 0;
  color: var(--muted);
  font-family: "Lora", Georgia, serif;
  font-size: .84rem;
  font-style: italic;
}

.related {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  margin-top: .7rem;
  font-size: .72rem;
}

.related b { margin-right: .15rem; color: var(--ink); }

.related-phrase {
  display: inline-flex;
  gap: .2rem;
  padding: .13rem .47rem;
  background: var(--olive-soft);
  border-radius: 10px;
}

.related a { color: #4b5119; }

.usage ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.usage li {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.usage .sentence { flex: 1; }
.usage audio { width: 170px; height: 36px; }

.search-results .search.big { margin-left: 0; }

.search-results .word-index {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1.5rem;
}

.search-results .word-index li { margin: 0; }

.search-results .word-index li a {
  display: block;
  min-height: 100%;
  padding: .75rem .9rem;
}

.search-results .search-ipa {
  display: block;
  margin-top: .15rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 400;
}

.phoneme-table {
  width: 100%;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: .88rem;
}

.phoneme-table th,
.phoneme-table td {
  padding: .75rem .9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.phoneme-table th {
  background: var(--olive-soft);
  font-weight: 700;
}

.phoneme-table tr:last-child td { border-bottom: 0; }
.phoneme-table tbody tr:hover { background: var(--card); }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.pagination a {
  padding: .4rem .8rem;
  color: #fff;
  background: var(--olive);
  border-radius: 8px;
}

.static { max-width: 900px; margin: 0 auto; }
.static h2 { margin-top: 2rem; }

.site-footer {
  width: min(calc(100% - 52px), var(--max-width));
  margin: 0 auto;
  padding: 1.2rem 0 1.7rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .78rem;
}

@media (max-width: 800px) {
  .header-content {
    width: min(calc(100% - 32px), var(--max-width));
    min-height: 64px;
  }
  .container {
    width: min(calc(100% - 36px), var(--max-width));
    padding: 16px 0 36px;
  }
  .hero { min-height: 325px; padding: 75px 18px 45px; }
  .sample-grid,
  .definitions ul,
  .usage ul,
  .search-results .word-index { grid-template-columns: 1fr; }
  .phoneme-table { display: block; overflow-x: auto; }
  .site-footer { width: min(calc(100% - 36px), var(--max-width)); }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .header-content {
    width: min(calc(100% - 28px), var(--max-width));
    flex-wrap: wrap;
    gap: .7rem;
    padding: 11px 0;
  }
  .brand img { width: 36px; height: 36px; }
  .search { width: 100%; margin-left: 0; }
  .search input { width: auto; min-width: 0; flex: 1; }
  .container {
    width: min(calc(100% - 26px), var(--max-width));
    padding: 13px 0 30px;
  }
  .hero { min-height: 300px; padding: 62px 8px 38px; }
  .hero h1 { font-size: clamp(2.45rem, 13vw, 3.2rem); }
  .hero > p { font-size: 1rem; }
  .search.big { width: 100%; }
  .search.big button { padding-inline: 1rem; }
  .phoneme-hub,
  .guide-hub,
  .phoneme,
  .search-results,
  .static,
  .error { padding: 1.15rem; }
  .phoneme-hub { padding: 20px 18px; }
  .phoneme-list { gap: .55rem; }
  .word { padding: 0; }
  .word-hero { padding-inline: 0; }
  .variants { align-items: flex-start; }
  .usage li { display: block; }
  .usage audio { width: 100%; margin-top: .65rem; }
  .site-footer { width: min(calc(100% - 26px), var(--max-width)); }
}
