/* chat.hibira.io/legal/* and the 404 page: the parts they add on top of
   site.css. Colours come from site.css's tokens, so both themes follow. */

/* The legal texts in Chinese, Japanese, Korean and Thai use far more
   characters than the rest of the site, so they get their own font cut
   (landing/fonts/subset.py), loaded only here. */
@font-face { font-family: 'LC zh-TW legal'; src: url("/landing/font-legal-zh-TW.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'LC ja legal'; src: url("/landing/font-legal-ja.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'LC zh-CN legal'; src: url("/landing/font-legal-zh-CN.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'LC ko legal'; src: url("/landing/font-legal-ko.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'LC th legal'; src: url("/landing/font-legal-th.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
:lang(zh-TW) .prose, .prose:lang(zh-TW), .toc ol:lang(zh-TW), .lhero h1:lang(zh-TW) { font-family: 'LC Sans', 'LC zh-TW legal', 'LC zh-TW', 'PingFang TC', 'Microsoft JhengHei', sans-serif; }
:lang(ja) .prose, .prose:lang(ja), .toc ol:lang(ja), .lhero h1:lang(ja) { font-family: 'LC Sans', 'LC ja legal', 'LC ja', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif; }
:lang(zh-CN) .prose, .prose:lang(zh-CN), .toc ol:lang(zh-CN), .lhero h1:lang(zh-CN) { font-family: 'LC Sans', 'LC zh-CN legal', 'LC zh-CN', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
:lang(ko) .prose, .prose:lang(ko), .toc ol:lang(ko), .lhero h1:lang(ko) { font-family: 'LC Sans', 'LC ko legal', 'LC ko', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }
:lang(th) .prose, .prose:lang(th), .toc ol:lang(th), .lhero h1:lang(th) { font-family: 'LC Sans', 'LC th legal', 'LC th', Thonburi, 'Leelawadee UI', Tahoma, sans-serif; }
.prose:lang(en), .toc ol:lang(en), .lhero h1:lang(en) { font-family: 'LC Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.prose:lang(en) { line-height: 1.7; }

.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn.ghost:hover { background: var(--surface); filter: none; }

body.lpage { display: flex; flex-direction: column; min-height: 100vh; }
body.lpage main { flex: 1 0 auto; }

/* Title band */
.lhero { position: relative; overflow: hidden; isolation: isolate; padding: 40px 0 28px; }
.lhero::before { content: ""; position: absolute; z-index: -1; top: -240px; right: -10%; width: 60%; height: 620px; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 16%, transparent), transparent); pointer-events: none; animation: drift 14s ease-in-out infinite alternate; }
@media (min-width: 940px) { .lhero { padding: 64px 0 36px; } }
.crumbs ol { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink-2); }
.lhero h1 { line-height: 1.2; margin-top: 12px; font-size: clamp(28px, 4.6vw, 46px); font-weight: 800; letter-spacing: -.02em; max-width: 22em; }
.ltabs { display: inline-flex; gap: 4px; margin-top: 26px; padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow); }
.ltabs::-webkit-scrollbar { display: none; }
.ltabs a { flex: none; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; transition: background .2s var(--ease-out, ease), color .2s; }
.ltabs a:hover { color: var(--ink); background: var(--page-2); }
.ltabs a[aria-current] { background: var(--brand); color: var(--brand-ink); }

/* Document */
.ldoc-wrap { padding: 8px 0 72px; }
@media (min-width: 940px) { .ldoc-wrap { padding-bottom: 104px; } }
.ldoc { display: grid; gap: 24px; align-items: start; }
@media (min-width: 1000px) { .ldoc { grid-template-columns: 240px minmax(0, 1fr); gap: 48px; } }
.toc { display: none; }
@media (min-width: 1000px) {
  .toc { display: block; position: sticky; top: 84px; max-height: calc(100vh - 108px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
}
.toc-h { font: 600 12px/1.4 var(--font); letter-spacing: .02em; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); font-size: 13.5px; line-height: 1.45; }
.toc a { display: block; margin-left: -1px; padding: 6px 0 6px 14px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current] { color: var(--brand); border-left-color: var(--brand); font-weight: 600; }

.prose { min-width: 0; max-width: 820px; padding: clamp(20px, 4.4vw, 52px); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow), 0 30px 70px -40px rgba(0, 0, 0, .25); font-size: 16px; color: var(--ink-2); overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ol, .prose ul, .prose .table { margin: 0 0 1em; }
.prose strong { color: var(--ink); }
.prose h2 { scroll-margin-top: 84px; margin: 2.2em 0 .8em; padding-top: 1.4em; border-top: 1px solid var(--border); font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.005em; }
.prose ol, .prose ul { padding-left: 1.4em; }
.prose li { margin: .45em 0; padding-left: .2em; }
.prose li::marker { color: var(--brand); font-weight: 600; }
.prose ul ul, .prose ol ul { margin: .4em 0 0; }
.prose blockquote { margin: 0 0 1.6em; padding: 12px 16px 12px 44px; position: relative; border-radius: 12px; background: var(--brand-soft); color: var(--ink); font-size: 14.5px; }
.prose blockquote::before { content: "!"; position: absolute; left: 14px; top: 13px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font: 700 12px/20px var(--mono); text-align: center; }
.prose a { color: var(--brand); }
.prose code { font: .9em var(--mono); padding: 1px 5px; border-radius: 5px; background: var(--page-2); border: 1px solid var(--border); }
.prose .table { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.prose th, .prose td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th + th, .prose td + td { border-left: 1px solid var(--border); }
.prose tr:last-child td { border-bottom: 0; }
.prose th { background: var(--page-2); color: var(--ink); font-weight: 600; white-space: nowrap; }
.lnote { margin: 0 0 1.2em; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--border-strong); color: var(--muted); font-size: 14px; }

/* 404 */
.nf { position: relative; overflow: hidden; isolation: isolate; padding: 88px 0 120px; }
.nf::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 40px; width: 560px; height: 560px; margin-left: -280px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, transparent 30%, color-mix(in srgb, var(--brand) 22%, transparent) 30.4%, transparent 31%, transparent 46%, color-mix(in srgb, var(--brand) 14%, transparent) 46.4%, transparent 47%, transparent 64%, color-mix(in srgb, var(--brand) 8%, transparent) 64.4%, transparent 65%), radial-gradient(closest-side, color-mix(in srgb, var(--brand) 14%, transparent), transparent);
  animation: nf-pulse 5s var(--ease-out, ease-out) infinite; }
@keyframes nf-pulse { 0% { transform: scale(.92); opacity: .6; } 50% { opacity: 1; } 100% { transform: scale(1.06); opacity: .6; } }
.nf-code { font: 700 clamp(96px, 20vw, 168px)/1 var(--mono); letter-spacing: -.04em; background: linear-gradient(120deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #f6c27a)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nf h1 { margin-top: 18px; font-size: clamp(26px, 4vw, 36px); font-weight: 800; }
.nf .sub { margin-top: 12px; }
.nf-cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
@media (prefers-reduced-motion: reduce) { .lhero::before, .nf::before { animation: none; } }
