/* Sibun site: cream, dot-paper notebook. Self-hosted fonts only (OFL: see assets/fonts). No third-party requests. */
@font-face {
  font-family: "Gaegu";
  src: url("/assets/fonts/Gaegu-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Mali";
  src: url("/assets/fonts/Mali-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #FBF6EC;
  --dot: #DFD2BA;
  --card: #FFFDF8;
  --ink: #4A3426;
  --muted: #76614F;
  --line: #E8DCC6;
  --link: #4E6B36;
  --accent: #A8C38B;
  --cell: #F1E9DA;
  --cell-on: #8FB07A;
  --washi: #FFD6DE;
  --shadow: rgba(74, 52, 38, 0.10);
  --hand: "Gaegu", "Mali", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --body: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #2B2420;
    --dot: #463B31;
    --card: #342B26;
    --ink: #F5EBDD;
    --muted: #B9A996;
    --line: #54473A;
    --link: #B5D49A;
    --accent: #7E9C66;
    --cell: #463B31;
    --cell-on: #8FB07A;
    --washi: #6B4A52;
    --shadow: rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[lang="vi"] { --hand: "Mali", ui-rounded, "SF Pro Rounded", system-ui, sans-serif; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.3px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.65;
}

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

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { padding: 18px 0 8px; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--hand); font-weight: 700; font-size: 1.9rem; line-height: 1; }
html[lang="vi"] .brand { font-size: 1.6rem; font-weight: 600; }
.brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 1px 3px var(--shadow); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 0.95rem; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 999px; }
.nav a:hover { background: var(--cell); }
.nav a[aria-current="page"] { background: var(--cell); font-weight: 600; }
.nav .lang { border: 1.5px solid var(--line); margin-left: 4px; }

/* Page card */
main { padding: 12px 0 40px; }
.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 36px 28px 30px;
  margin-top: 18px;
  box-shadow: 0 6px 18px var(--shadow);
}
.card::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 28px;
  width: 92px;
  height: 24px;
  background: var(--washi);
  opacity: 0.9;
  transform: rotate(-3deg);
  border-radius: 3px;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0 6px, transparent 6px 12px);
}
@media (prefers-color-scheme: dark) {
  .card::before { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 6px, transparent 6px 12px); }
}

h1, h2, h3 { font-family: var(--hand); line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: 2.6rem; font-weight: 700; }
h2 { font-size: 1.7rem; font-weight: 700; margin-top: 1.7em; }
h3 { font-size: 1.35rem; font-weight: 700; margin-top: 1.4em; }
html[lang="vi"] h1 { font-size: 2.1rem; font-weight: 600; }
html[lang="vi"] h2 { font-size: 1.45rem; font-weight: 600; }
html[lang="vi"] h3 { font-size: 1.2rem; font-weight: 600; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.4em; }
.meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.4em; }
.lead { font-size: 1.12rem; }
.note { background: var(--cell); border-radius: 12px; padding: 12px 16px; margin: 0 0 1em; }
strong { font-weight: 650; }

/* Home */
.hero { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: center; justify-items: center; text-align: center; }
.hero img { width: min(240px, 62vw); height: auto; }
.hero h1 { font-size: 2.9rem; margin-bottom: 0.2em; }
html[lang="vi"] .hero h1 { font-size: 2.2rem; }
.cells { display: inline-grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin: 6px 0 14px; }
.cells i { display: block; width: 26px; height: 26px; border-radius: 7px; background: var(--cell); border: 1.5px solid var(--line); }
.cells i:nth-child(-n+4) { background: var(--cell-on); border-color: var(--cell-on); }
.cells i:nth-child(5) { background: repeating-linear-gradient(135deg, var(--cell-on) 0 2px, var(--cell) 2px 6px); border-color: var(--cell-on); }
.pill { display: inline-block; background: var(--cell); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 16px; font-size: 0.95rem; }
.features { list-style: none; padding: 0; display: grid; gap: 12px; margin: 1.6em 0 0.4em; }
.features li { background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0; }
.features strong { font-family: var(--hand); font-size: 1.25rem; font-weight: 700; display: block; }
html[lang="vi"] .features strong { font-size: 1.1rem; font-weight: 600; }
@media (min-width: 720px) { .features { grid-template-columns: repeat(3, 1fr); } }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1.5px solid var(--line); vertical-align: top; }
th { font-weight: 650; background: var(--cell); }

/* Footer */
.site-footer { padding: 8px 0 40px; color: var(--muted); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

@media (max-width: 480px) {
  .card { padding: 32px 18px 24px; border-radius: 14px; }
  h1 { font-size: 2.2rem; }
  .hero h1 { font-size: 2.4rem; }
  html[lang="vi"] h1, html[lang="vi"] .hero h1 { font-size: 1.85rem; }
}
@media (prefers-reduced-motion: no-preference) { a { transition: color 0.15s; } }

/* Tidy first lines of a card; the mascot art has transparent padding */
.card > :first-child { margin-top: 0; }
.card > h2:first-child { margin-top: 0; }
.hero img { margin: -26px 0 -22px; }
