/* Tanya Praktisi mengikuti identitas deck kuliah "From Notebook to Production":
   tinta navy, satu aksen oranye untuk aksi utama, Nunito Sans + Trebuchet MS, maskot panda/kapibara.
   Dial: ENERGY 2 / RHYTHM 1 / MOTION 1 (hanya transisi hover/fokus). */

@font-face {
  font-family: "Nunito Sans";
  src: url("/static/fonts/nunito-sans-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
  --ink: #1f2a44;          /* navy deck: judul, header, status aktif */
  --bg: #f3f6fb;           /* "sheet" deck */
  --surface: #ffffff;
  --surface-2: #e9eef6;
  --text: #22293a;
  --muted: #5b6476;
  --line: #d7dce5;
  --field: #8792a8;        /* tepi input: kontras >= 3:1 terhadap putih */
  --accent: #f28c28;       /* oranye deck: hanya tombol aksi utama */
  --accent-ink: #1f2a44;
  --accent-text: #a85a12;  /* oranye untuk teks, lolos AA di atas putih */
  --answer: #e3ecfb;
  --answer-line: #c5d4f2;
  --open: #8a4f00;
  --open-bg: #fff1d6;
  --done: #146c3a;
  --done-bg: #e2f5e8;
  --closed: #4d5566;
  --closed-bg: #e6e9ef;
  --danger: #b42318;
  --code-bg: #f1f4f9;
  --head-bg: #1f2a44;
  --head-text: #ffffff;
  --head-muted: #c9d3e6;
  --focus: #1f2a44;
  --mascot-bg: transparent;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7ecf5;
    --bg: #121826;
    --surface: #1a2233;
    --surface-2: #222c40;
    --text: #e7ecf5;
    --muted: #9aa6bd;
    --line: #2c374d;
    --field: #56627a;
    --accent-text: #f59a3d;
    --answer: #1e2c47;
    --answer-line: #2f4268;
    --open: #f5b94a;
    --open-bg: #3a2c10;
    --done: #6ee7a0;
    --done-bg: #123122;
    --closed: #b4bdcc;
    --closed-bg: #283146;
    --danger: #ff8a7a;
    --code-bg: #0e1422;
    --head-bg: #0b1020;
    --focus: #f59a3d;
    --mascot-bg: #e9eef6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e7ecf5;
  --bg: #121826;
  --surface: #1a2233;
  --surface-2: #222c40;
  --text: #e7ecf5;
  --muted: #9aa6bd;
  --line: #2c374d;
  --field: #56627a;
  --accent-text: #f59a3d;
  --answer: #1e2c47;
  --answer-line: #2f4268;
  --open: #f5b94a;
  --open-bg: #3a2c10;
  --done: #6ee7a0;
  --done-bg: #123122;
  --closed: #b4bdcc;
  --closed-bg: #283146;
  --danger: #ff8a7a;
  --code-bg: #0e1422;
  --head-bg: #0b1020;
  --focus: #f59a3d;
  --mascot-bg: #e9eef6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; padding-bottom: 40px; }
a { color: var(--ink); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, .display { font-family: "Trebuchet MS", "Nunito Sans", system-ui, sans-serif; color: var(--ink); }
.k { color: var(--accent-text); font-style: normal; }   /* motif deck: satu kata kunci oranye di judul */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* header: bar navy solid, sama dengan blok judul di deck */
.top { position: sticky; top: 0; z-index: 10; background: var(--head-bg); color: var(--head-text); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.top :focus-visible { outline-color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--head-text); text-decoration: none; min-width: 0; }
.brand-mark { flex: none; width: 38px; height: 38px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; }
.brand-mark img { width: 30px; height: auto; margin-top: 4px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: "Trebuchet MS", "Nunito Sans", sans-serif; font-size: 17px; }
.brand-text small { color: var(--head-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 8px; flex: none; }
.nav .btn.ghost { color: var(--head-text); border-color: rgb(255 255 255 / 35%); background: transparent; }
.nav .btn.ghost:hover { border-color: #fff; }
.staff-bar { background: var(--surface); border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; }
.staff-in { display: flex; gap: 4px 16px; align-items: center; min-height: 44px; flex-wrap: wrap; }
.staff-in span { font-weight: 800; margin-right: auto; color: var(--ink); }
.staff-in a { min-height: 40px; display: inline-flex; align-items: center; }
.banner { background: var(--open-bg); color: var(--open); text-align: center; padding: 8px 16px; font-size: 14px; font-weight: 600; }
/* titik oranye = ada jawaban baru untuk pertanyaanmu (state nyata, tanpa animasi) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--field); background: var(--surface); color: var(--text);
  text-decoration: none; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #f59a3d; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; font-weight: 700; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }

/* gate */
.gate { max-width: 400px; margin: 6vh auto 0; text-align: center; }
.mascot { display: block; margin: 0 auto; width: 128px; height: auto; border-radius: 50%; background: var(--mascot-bg); }
.gate h1 { font-size: 32px; line-height: 1.15; margin: 12px 0 8px; }
.gate p { color: var(--muted); margin: 0 0 24px; }
.code-input { text-transform: uppercase; text-align: center; letter-spacing: .08em; font-weight: 800; font-size: 20px; }

/* forms */
.field { display: block; margin-bottom: 18px; }
.field > span:first-child { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.field > span:first-child em { font-style: normal; font-weight: 400; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--field); background: var(--surface); }
textarea.input { min-height: 160px; resize: vertical; font-family: inherit; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--ink); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hint code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.over { color: var(--danger) !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; margin: 8px 0 0; min-height: 1em; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.anon { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--field);
  border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 700; font-size: 14px; }
.chip-toggle:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip-toggle input { accent-color: var(--ink); }

.similar { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 10px; background: var(--surface-2); }
.similar p { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 700; }
.similar a { display: block; padding: 6px 0; font-size: 15px; }
.similar a small { color: var(--muted); margin-left: 6px; }

/* list */
h1.page { font-size: 26px; line-height: 1.2; margin: 24px 0 14px; }
.tabs { display: flex; gap: 0; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 46px; padding: 0 10px; font-size: 15px; border-bottom: 3px solid transparent; color: var(--muted);
  font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.filters .search { grid-column: 1 / -1; }
.filters .input { min-height: 44px; padding: 8px 12px; font-size: 15px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card:hover { border-color: var(--field); }
.card.hidden-q { opacity: .6; border-style: dashed; }
.card-main { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.card-main h2 { font-family: "Nunito Sans", system-ui, sans-serif; font-size: 16.5px; font-weight: 800; line-height: 1.4; margin: 0 0 6px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.meta .who { color: var(--text); font-weight: 700; }
.vote { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 54px; min-height: 58px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface);
  cursor: pointer; color: var(--ink); font-weight: 800; padding: 4px; transition: background-color .15s; }
.vote svg { width: 18px; height: 18px; }
.vote:hover { border-color: var(--ink); }
.vote[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.vote:disabled { cursor: default; }
.vote.wide { flex-direction: row; width: auto; min-height: 44px; gap: 8px; padding: 0 14px; font-weight: 700; }
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.badge.open { color: var(--open); background: var(--open-bg); }
.badge.answered { color: var(--done); background: var(--done-bg); }
.badge.closed { color: var(--closed); background: var(--closed-bg); }
.badge.faq { color: var(--ink); background: var(--answer); }
.badge.plain { color: var(--muted); background: var(--surface-2); }

/* state kosong / gagal: maskot deck + penyebab + satu aksi */
.empty { text-align: center; color: var(--muted); padding: 28px 16px 32px; }
.empty img { width: 112px; height: auto; display: block; margin: 0 auto 10px; border-radius: 50%; background: var(--mascot-bg); }
.empty strong { display: block; font-family: "Trebuchet MS", "Nunito Sans", sans-serif; color: var(--ink); font-size: 19px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* detail */
.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; margin-top: 8px; }
.q-head h1 { font-size: 24px; line-height: 1.3; margin: 6px 0 10px; overflow-wrap: anywhere; }
.q-body { margin: 16px 0; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 18px 0 24px; }
.answer { background: var(--answer); border: 1px solid var(--answer-line); border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; }
.answer-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.answer-head strong { color: var(--ink); font-size: 15px; }
.waiting { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: var(--muted); font-size: 15px; }
.admin-box { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 16px; }
.admin-box h2 { font-size: 18px; margin: 0 0 10px; }
.admin-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 12px; }
.md a { color: var(--ink); }
.md pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.5; -webkit-overflow-scrolling: touch; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.md :not(pre) > code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1.05em; margin: 16px 0 8px; }

/* rekap */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 28px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi b { display: block; font-family: "Trebuchet MS", "Nunito Sans", sans-serif; font-size: 28px; color: var(--ink); }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi.focus { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.bar { display: grid; grid-template-columns: 9.5em 1fr 2.5em; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ink); }
.bar b { text-align: right; color: var(--ink); }
h2.sec { font-size: 17px; margin: 0 0 10px; }

/* pengaturan */
.cat-row { display: flex; gap: 8px; margin-bottom: 8px; }
.cat-row .input { flex: 1; min-width: 0; }

/* toast + footer */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 700;
  max-width: calc(100% - 32px); z-index: 20; box-shadow: 0 6px 24px rgb(0 0 0 / 22%); } /* melayang di atas konten */
.foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; color: var(--muted);
  padding-top: 18px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.foot #foot-note { flex: 1 1 100%; }
.foot a, .foot button { min-height: 36px; display: inline-flex; align-items: center; }
.foot .linkish { font-weight: 600; font-size: 13px; color: var(--muted); }

/* loading: kilau hanya selama data dimuat */
.skeleton { height: 86px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

@media (min-width: 640px) {
  .filters { grid-template-columns: 2fr 1fr 1fr; }
  .filters .search { grid-column: auto; }
  .kpis { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .q-head h1 { font-size: 28px; }
  .gate h1 { font-size: 36px; }
}
@media (max-width: 400px) {
  .brand-text small { display: none; }
  .nav .btn { padding: 0 12px; }
  .row2 { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 7.5em 1fr 2em; }
  .tab { padding: 0 7px; }
  .staff-in { gap: 0 11px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .btn, .vote { transition: none; }
}
