/* Sanaloka Almanack — minimalist editorial design.
   Headings/UI: Plus Jakarta Sans (matches the main Sanaloka site).
   Body copy: Source Serif 4, for comfortable long-form reading.
   Monochrome ink/paper, with the Sanaloka terracotta reserved for the wordmark only. */

:root {
  --paper: #faf9f6;
  --ink: #1c1a17;
  --ink-soft: #514e46;
  --muted: #8a8578;
  --rule: #e6e3da;
  --rule-strong: #cdc8ba;
  --brand: #B5614A;
  --strong-kuat: #1c1a17;
  --strong-sedang: #71695a;
  --strong-lemah: #a39d8a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --ink: #ece8de;
    --ink-soft: #bcb6a5;
    --muted: #877f6c;
    --rule: #2c2924;
    --rule-strong: #423d34;
    --brand: #d98a71;
    --strong-kuat: #ece8de;
    --strong-sedang: #b0a892;
    --strong-lemah: #756e5c;
  }
}

/* Explicit overrides driven by assets/theme.js (toggle button), which take
   priority over the OS-level @media query above in both directions. */
:root[data-theme="dark"] {
  --paper: #171512;
  --ink: #ece8de;
  --ink-soft: #bcb6a5;
  --muted: #877f6c;
  --rule: #2c2924;
  --rule-strong: #423d34;
  --brand: #d98a71;
  --strong-kuat: #ece8de;
  --strong-sedang: #b0a892;
  --strong-lemah: #756e5c;
}
:root[data-theme="light"] {
  --paper: #faf9f6;
  --ink: #1c1a17;
  --ink-soft: #514e46;
  --muted: #8a8578;
  --rule: #e6e3da;
  --rule-strong: #cdc8ba;
  --brand: #B5614A;
  --strong-kuat: #1c1a17;
  --strong-sedang: #71695a;
  --strong-lemah: #a39d8a;
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }

/* Toggle button injected by assets/theme.js — styled with this page's own
   ink/paper tokens instead of the shared assets/theme.css (which isn't
   loaded here, since Almanack has its own complete palette already). */
.sl-theme-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.14);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
}
.sl-theme-toggle:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.18); }
.sl-theme-toggle:active { transform: translateY(0); }
.sl-theme-toggle svg { display: block; }
@media (max-width: 640px) {
  .sl-theme-toggle { right: 14px; bottom: 14px; width: 38px; height: 38px; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Charter, Georgia, serif;
  font-size: 1.09rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .wordmark, .card-title, .tag-chip, .tag, .catalog-search label,
.post-eyebrow, .tldr-block .label, .evidence-strip, .catalog-count,
.card-meta, .post-foot-meta, .feedback-link {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- Masthead ---------- */

.masthead {
  padding: 2.25rem 1.5rem 1.5rem;
  max-width: 42rem;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.wordmark {
  display: block;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.wordmark .brand { color: var(--brand); }
.wordmark .divider { color: var(--rule-strong); font-weight: 400; margin: 0 0.25em; }
.wordmark .suffix { font-weight: 500; color: var(--ink-soft); }

.tagline {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.35rem;
  max-width: 26rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
}

.feedback-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
  padding-bottom: 1px;
}
.feedback-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- Search + tag filter ---------- */

.catalog-search {
  max-width: 42rem;
  margin: 0.5rem auto 0;
  padding: 0 1.5rem;
}

.catalog-search input {
  width: 100%;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: 0.55rem 0.05rem;
}
.catalog-search input::placeholder { color: var(--muted); }

.catalog-count {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.tag-filter {
  max-width: 42rem;
  margin: 1.1rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-chip {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  background: none;
  border: 1px solid var(--rule-strong);
  color: var(--ink-soft);
  padding: 0.3em 0.7em;
  border-radius: 999px;
  cursor: pointer;
}
.tag-chip:hover { border-color: var(--ink); color: var(--ink); }
.tag-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Catalog list ---------- */

.catalog {
  max-width: 42rem;
  margin: 1.5rem auto 5rem;
  padding: 0 1.5rem;
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 1.6rem 0;
  border-top: 1px solid var(--rule);
}
.catalog .card:first-child { border-top: none; }
.card.is-hidden { display: none; }

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin-bottom: 0.3rem;
}

.card-tagline {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin-bottom: 0.5rem;
}

.card-tldr {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 0.75rem;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }

.tag {
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag::after { content: "·"; margin-left: 0.4rem; color: var(--rule-strong); }
.tag:last-child::after { content: none; }

.card-meta { font-size: 0.72rem; color: var(--muted); }

.empty-state, .catalog-error {
  max-width: 42rem;
  margin: 2rem auto;
  padding: 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: none;
}
.empty-state.is-visible, .catalog-error { display: block; }

/* ---------- Article ---------- */

.crumb-bar { max-width: 42rem; margin: 0 auto; padding: 1.5rem 1.5rem 0; }
.crumb { font-family: "Plus Jakarta Sans", sans-serif; font-size: 0.78rem; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); }

#post-app { max-width: 42rem; margin: 0 auto; padding: 1.25rem 1.5rem 6rem; }

.post-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.post-title {
  font-size: 2.15rem;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.7rem;
}

.post-dek {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-soft);
  line-height: 1.5;
  text-wrap: balance;
  margin: 0 0 1.3rem;
}

.tldr-block {
  border-left: 3px solid var(--brand);
  padding: 0.15rem 0 0.15rem 1rem;
  margin: 0 0 1.6rem;
  font-size: 1rem;
  color: var(--ink-soft);
}
.tldr-block .label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.3rem;
}

.evidence-strip {
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.75rem 0;
  margin: 0 0 2.2rem;
}
.evidence-strip strong { color: var(--ink); font-weight: 700; }
.evidence-strip .dot { display: inline-block; width: 0.5em; height: 0.5em; border-radius: 50%; margin-right: 0.4em; vertical-align: middle; }
.dot-kuat { background: var(--strong-kuat); }
.dot-sedang { background: var(--strong-sedang); }
.dot-lemah { background: transparent; border: 1px solid var(--strong-lemah); }

.post-body h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; margin: 2.4rem 0 1rem; text-wrap: balance; }
.post-body h2:first-child { margin-top: 0; }
.post-body h3 { font-size: 1.1rem; font-weight: 700; margin: 1.8rem 0 0.8rem; }
.post-body p { margin: 0 0 1.15rem; }
.post-body ul, .post-body ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
.post-body li { margin-bottom: 0.5rem; }
.post-body strong { font-weight: 700; }
.post-body em { color: var(--ink-soft); }
.post-body hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
.post-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; background: var(--rule); padding: 0.1em 0.35em; border-radius: 3px; }

.table-wrap { overflow-x: auto; margin: 0 0 1.6rem; border: 1px solid var(--rule); }
table.evidence-table { border-collapse: collapse; width: 100%; font-size: 0.86rem; min-width: 34rem; font-family: "Source Serif 4", Georgia, serif; }
table.evidence-table th {
  text-align: left;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--rule-strong);
}
table.evidence-table td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 1.5; }
table.evidence-table tr:last-child td { border-bottom: none; }

.strength-kuat, .strength-sedang, .strength-lemah {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.78rem;
  white-space: nowrap;
}
.strength-kuat { color: var(--strong-kuat); font-weight: 700; }
.strength-sedang { color: var(--strong-sedang); }
.strength-lemah { color: var(--strong-lemah); }

ul.refs { list-style: none; margin: 0; padding: 0; font-size: 0.92rem; color: var(--ink-soft); }
ul.refs li { padding-left: 1.6rem; text-indent: -1.6rem; margin-bottom: 0.85rem; line-height: 1.5; }
ul.refs a { text-decoration: underline; text-decoration-color: var(--rule-strong); }

.post-foot-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }

footer.site-footer { border-top: 1px solid var(--rule); padding: 1.75rem 1.5rem 2.5rem; margin-top: 2rem; }
footer.site-footer .footer-inner {
  max-width: 42rem;
  margin: 0 auto;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
footer.site-footer a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--rule-strong); }
footer.site-footer a:hover { color: var(--ink); }

@media (max-width: 30rem) {
  .post-title { font-size: 1.7rem; }
  .wordmark { font-size: 1.15rem; }
}

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