/* SinonimKata — sistem tampilan untuk katalog alat. */

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #14201f;
  --muted: #5b6a68;
  --line: #dde4e2;
  --wash: #eef3f1;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe9;
  --danger: #a02c2c;
  --warn: #9a6a08;
  --sans: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 32, 31, .05), 0 8px 24px -16px rgba(20, 32, 31, .25);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1413;
    --surface: #151d1b;
    --ink: #e9efed;
    --muted: #9aaca8;
    --line: #263230;
    --wash: #1b2623;
    --accent: #5fd0b6;
    --accent-ink: #07201b;
    --accent-soft: #17352e;
    --danger: #f08a8a;
    --warn: #d9a441;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

h1, h2, h3 { text-wrap: balance; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4.2vw, 2.8rem); font-weight: 600; letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-size: clamp(1.3rem, 2.4vw, 1.65rem); font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

p { margin: 0 0 .9em; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}

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

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.big { font-size: 1.15rem; }
.error { color: var(--danger); font-weight: 600; }

/* ---------- header ---------- */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.head-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 37px; height: 37px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.3rem; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-weight: 600; font-size: 1.15rem; }
.brand-text small { font-weight: 400; font-size: .74rem; color: var(--muted); letter-spacing: .04em; }
.head-search { display: flex; gap: .4rem; flex: 1 1 240px; max-width: 420px; min-width: 0; }
.head-search input {
  flex: 1 1 auto; min-width: 0; padding: .45rem .7rem; font: inherit; font-size: .88rem;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.head-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.btn-small { padding: .42rem .8rem; font-size: .84rem; }
.site-nav { display: flex; gap: 1.1rem; font-size: .95rem; flex: 0 0 auto; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding: 2.8rem 0 1.6rem; }
.eyebrow {
  margin: 0 0 .7rem; font-size: .74rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent); font-weight: 600;
}
.hero h1 { max-width: 24ch; }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 64ch; margin-bottom: 1.4rem; }

.stats { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 0 0 1rem; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--serif); font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.about-block { padding: 1.2rem 0; border-top: 1px solid var(--line); }
.about-block p { color: var(--muted); max-width: 72ch; }

/* ---------- katalog ---------- */
.catalog { padding: 1.6rem 0 2rem; border-top: 1px solid var(--line); }
.catalog-head { margin-bottom: 1.2rem; }
.catalog-controls { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: .9rem; }
.search { flex: 1 1 260px; min-width: 0; }
.search input {
  width: 100%; padding: .6rem .8rem; font: inherit; font-size: .92rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px;
}
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  font: inherit; font-size: .78rem; padding: .36rem .7rem; cursor: pointer;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
}
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.count { font-size: .78rem; color: var(--muted); margin: .8rem 0 0; font-variant-numeric: tabular-nums; }

.cat-block { margin-top: 2rem; }
.cat-title {
  display: flex; align-items: baseline; gap: .6rem;
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  padding-bottom: .5rem; border-bottom: 1px solid var(--line); margin-bottom: .9rem;
}
.cat-no { color: var(--accent); font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .6rem; }
.grid-small { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.tool-card {
  display: flex; gap: .7rem; padding: .85rem .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
  transition: border-color .12s ease, transform .12s ease;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.tool-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-no { font-family: var(--serif); font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .12rem; }
.tool-body { display: flex; flex-direction: column; min-width: 0; }
.tool-name { font-weight: 600; font-size: .98rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tool-desc { font-size: .86rem; color: var(--muted); line-height: 1.45; margin-top: .15rem; }

.badge {
  display: inline-block; font-size: .62rem; line-height: 1.6;
  letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  padding: 0 .38rem; border-radius: 4px; white-space: nowrap;
}
.badge-db { color: var(--accent); background: var(--accent-soft); }

.empty-state { margin-top: 2rem; padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- halaman alat ---------- */
.crumbs { margin: 1.4rem 0 1rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; font-size: .78rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: .4rem; color: var(--line); }
.crumbs a { color: var(--muted); }

.tool-hero { padding-bottom: 1.2rem; }
.tool-hero h1 { margin-bottom: .4rem; }
.tool-hero .lede { margin-bottom: .6rem; }

.hint { font-size: .86rem; color: var(--muted); }
.hint-db { border-left: 2px solid var(--accent); padding-left: .7rem; }

.tool-app {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1.6rem;
}

.tool-form { display: grid; gap: .8rem; margin-bottom: 1rem; }
.field { display: grid; gap: .3rem; }
.field label { font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%; padding: .6rem .75rem; font: inherit; font-size: .95rem;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent;
}

.form-actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.btn {
  display: inline-block; font: inherit; font-size: .9rem; font-weight: 600;
  padding: .5rem .95rem; cursor: pointer; text-decoration: none;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 8px;
}
.btn:hover { filter: brightness(1.05); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.secondary { background: transparent; color: var(--accent); }
.form-error { color: var(--danger); font-size: .82rem; }

.tool-body { font-size: .95rem; }
.tool-body:empty { display: none; }

.res-block { padding: .9rem 0; border-top: 1px solid var(--line); }
.res-block:first-child { border-top: 0; padding-top: 0; }
.res-block h3 { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }

.pill-list { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.pill-list li { background: var(--wash); border: 1px solid var(--line); border-radius: 999px; padding: .18rem .6rem; font-size: .86rem; }
.plain-list { margin: 0; padding-left: 1.1rem; }
.plain-list li { margin-bottom: .25rem; }

.result-text { font-family: var(--serif); font-size: 1.12rem; line-height: 1.55; }
.word-big { font-family: var(--serif); font-size: 1.7rem; margin: .2rem 0; }
.score { font-family: var(--serif); font-size: 1.6rem; }

.table-scroll { overflow-x: auto; }
.res-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.res-table th, .res-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.res-table th { font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.pantun-line { font-family: var(--serif); font-size: 1.05rem; margin: .15rem 0; }

/* peta kata */
.wordmap { width: 100%; height: auto; display: block; }
.wordmap .edge { stroke-width: 1.3; opacity: .55; }
.wordmap .edge.sinonim { stroke: var(--accent); }
.wordmap .edge.antonim { stroke: var(--danger); stroke-dasharray: 4 3; }
.wordmap .node circle { fill: var(--wash); stroke: var(--line); stroke-width: 1.5; }
.wordmap .node.pusat circle { fill: var(--accent); stroke: var(--accent); }
.wordmap .node.pusat text { fill: var(--accent-ink); font-weight: 600; }
.wordmap .node.sinonim circle { fill: var(--accent-soft); }
.wordmap text { font-family: var(--sans); font-size: 11px; fill: var(--ink); text-anchor: middle; }

/* wordle */
.wordle { display: grid; gap: 6px; margin: .6rem 0 1rem; }
.wrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 300px; }
.wcell {
  aspect-ratio: 1; display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: 6px;
  font-weight: 700; text-transform: uppercase; font-size: 1.1rem;
}
.wcell.hit { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.wcell.near { background: #d8b04a; color: #241a00; border-color: #d8b04a; }
.wcell.miss { background: var(--wash); color: var(--muted); }
.inline-form { display: flex; gap: .5rem; max-width: 320px; }
.inline-form input {
  flex: 1; min-width: 0; padding: .5rem .65rem; font: inherit; text-transform: uppercase;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
}

/* kuis */
.quiz-progress { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.quiz-opts { display: grid; gap: .45rem; margin-top: .8rem; }
.quiz-opt {
  font: inherit; text-align: left; padding: .6rem .8rem; cursor: pointer;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
}
.quiz-opt:hover { border-color: var(--accent); }
.quiz-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* flashcard */
.flashcard {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); padding: 1.4rem; cursor: pointer; text-align: center;
}
.flashcard:hover { border-color: var(--accent); }
.row { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }

.code {
  background: var(--wash); border: 1px solid var(--line); border-radius: 8px;
  padding: .7rem .8rem; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem; line-height: 1.5; word-break: break-word; white-space: pre-wrap;
}

.tool-help { padding: 1rem 0; border-top: 1px solid var(--line); }
.related { padding: 1.4rem 0 2rem; border-top: 1px solid var(--line); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.az-links {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .55rem;
  padding-block: .9rem .7rem; border-bottom: 1px solid var(--line);
  font-size: .82rem;
}
.az-label { color: var(--muted); }
.az-links a { color: var(--muted); text-decoration: none; padding: .1rem .2rem; }
.az-links a:hover { color: var(--accent); }
.foot-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.4rem; font-size: .82rem; color: var(--muted); }
.foot-links { display: flex; gap: 1rem; }
.foot-links a { color: var(--muted); }

@media (max-width: 700px) {
  .head-inner { padding-block: .55rem; }
  .head-search { order: 3; flex-basis: 100%; max-width: none; }
}

@media (max-width: 620px) {
  /* 16px mencegah Safari iOS memperbesar halaman saat input difokuskan. */
  .field input, .field select, .field textarea, .search input, .head-search input { font-size: 16px; }
  .hero { padding-top: 2rem; }
  .head-inner { min-height: 56px; }
  .site-nav { gap: .8rem; font-size: .9rem; }
  .grid { grid-template-columns: 1fr; }
  .stats { gap: 1.1rem; }
}

/* Mobile: tap target lebih lega dan teks konten kamus lebih terbaca. */
@media (max-width: 620px) {
  .chip,
  .legacy-page .prefixListOdd,
  .legacy-page .prefixListEven,
  .legacy-page .paging,
  .legacy-page .alat-terkait a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
  .legacy-page .lemmas tr:first-child a {
    padding: .3rem .72rem;
    font-size: .9rem;
  }
  .legacy-page .lemmas tr:nth-child(2) td:nth-child(3) { font-size: .88rem; }
  .site-nav a { padding-block: .2rem; }
  .site-nav a[href$="source.php"] { display: none; }
}

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