/* ENTRY-01/LANDING-02 landing /hoi-lang (World). Mobile-first (390 px), system fonts, no external resources (CSP default-src 'self').
 * No inline styles anywhere: everything visual is here; JS only toggles classes / [hidden] / disabled. */
:root {
  --paper: #f7f1e6;
  --panel: #fffaf1;
  --ink: #2a2118;
  --muted: #5a4f43;
  --rule: #d9cbb4;
  --accent: #8a2f1d;
  --accent-dark: #6d2315;
  --on-accent: #ffffff;
  --err: #a1261a;
  --ok: #2f6b2a;
  --focus: #1d4f91;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--panel); padding: 8px 12px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--rule); background: var(--panel);
}
.brand { font-weight: 800; letter-spacing: .02em; }
.top-login { font-weight: 700; padding: 10px 4px; min-height: 44px; display: inline-flex; align-items: center; }

main { max-width: 680px; margin: 0 auto; padding: 0 16px 24px; }
h1 { font-size: 26px; line-height: 1.25; margin: 20px 0 10px; }
h2 { font-size: 20px; line-height: 1.3; margin: 0 0 8px; }
.lede { margin: 0 0 14px; color: var(--muted); }
figure { margin: 12px 0 0; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.hero-img img { width: 100%; border-radius: 6px; border: 1px solid var(--rule); }

.entry {
  margin: 16px 0 8px; padding: 16px; background: var(--panel);
  border: 1px solid var(--rule); border-radius: 8px;
}
.terms { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; }
.terms input, .login-remember input, .login-terms input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.terms label { cursor: pointer; }
.terms[hidden], .login-terms[hidden] { display: none; }
.terms.is-required { outline: 2px solid var(--err); outline-offset: 4px; border-radius: 4px; }
.cf { margin: 10px 0 0; min-height: 0; }
.cf:not(:empty) { min-height: 65px; }

.btn {
  display: block; width: 100%; min-height: 48px; margin-top: 12px;
  font: inherit; font-size: 17px; font-weight: 800; border-radius: 6px; border: 0; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not([disabled]) { background: var(--accent-dark); }
.btn { -webkit-tap-highlight-color: transparent; }
.btn[disabled] { opacity: .6; cursor: default; }
#kg-login-submit[disabled] { opacity: .45; }
.btn-primary[disabled] { background: var(--accent); color: var(--on-accent); }
.btn[aria-busy="true"] { cursor: progress; }

.status { margin: 10px 0 0; min-height: 1.6em; font-size: 15px; }
.status:empty { min-height: 0; margin: 0; }
.status-warn, .status.is-error { color: var(--err); font-weight: 600; }
.status.is-progress { color: var(--muted); }
.status.is-ok { color: var(--ok); font-weight: 600; }
.login-line { margin: 12px 0 0; text-align: center; }
.login-line a { font-weight: 700; font-size: 17px; display: inline-block; padding: 8px 4px; min-height: 44px; }

.block { margin-top: 28px; }
h3 { font-size: 17px; line-height: 1.35; margin: 0 0 4px; }
.items { list-style: none; margin: 0; padding: 0; }
.item { margin: 0 0 18px; }
.item figure { margin-top: 8px; }
.faq { margin: 0 0 14px; }
.block p { margin: 0 0 8px; }
.block img { border-radius: 6px; border: 1px solid var(--rule); max-width: min(100%, 560px); }

.foot { max-width: 760px; margin: 0 auto; padding: 16px 16px 32px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--muted); }
.foot p { margin: 0 0 4px; }

/* Login popup: native <dialog> (focus trap + Esc from the browser), one column, touch targets >= 44 px */
.login {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 0; border: 1px solid var(--rule); border-radius: 10px; background: var(--panel); color: var(--ink);
}
.login::backdrop { background: rgba(20, 14, 8, .55); }
.login-form { position: relative; display: flex; flex-direction: column; padding: 20px 18px 18px; }
.login-close {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 44px;
  font-size: 28px; line-height: 1; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 6px;
}
.login-title { font-size: 19px; margin: 4px 40px 6px 0; }
.login-hint { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.login-label { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.login-input {
  width: 100%; height: 46px; padding: 0 12px; margin: 0 0 12px;
  font: inherit; font-size: 16px; /* >= 16 px: iOS does not zoom on focus */
  color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 6px;
}
.login-input[aria-invalid="true"] { border-color: var(--err); }
.login-remember { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.login-terms { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin: 0 0 4px; }
.login-terms label { cursor: pointer; }
.login-terms.is-required { outline: 2px solid var(--err); outline-offset: 2px; border-radius: 4px; }
.login-cf { margin: 6px 0 12px; }
.login-error { margin: 10px 0 0; font-size: 14px; color: var(--err); }
.login-error:empty { margin: 0; }
.login-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

.rules { padding-top: 8px; }
.rules-version { color: var(--muted); margin: 0 0 12px; }

@media (min-width: 720px) {
  h1 { font-size: 32px; }
  .entry { padding: 20px 24px; }
}
/* desktop: entry box next to the picture, above the fold */
@media (min-width: 960px) {
  main { max-width: 1080px; }
  .hero {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 32px;
    grid-template-areas: "title img" "lede img" "entry img"; align-items: start;
  }
  .hero h1 { grid-area: title; }
  .hero .lede { grid-area: lede; }
  .hero .hero-img { grid-area: img; margin-top: 24px; }
  .hero .entry { grid-area: entry; margin-top: 4px; }
  .block { max-width: 760px; margin-left: auto; margin-right: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color .15s; }
}

/* pre.js adds .kg-auto only while a signed-in visitor may be sent into the village; visibility keeps layout. pre.js is a tiny render-blocking script for everyone, but only signed-in visitors get the class (hidden content is no LCP candidate until shown); signed-out visitors and crawlers see the page at once */
html.kg-auto body { visibility: hidden; }
