/* blog.moradoklanna.com — brand red #B11F24, grey cards. Navigation plan (plan/blog/NAV.md) 2026-10-12:
   sticky nav + drawer, search dialog, sticky TOC with scroll-spy, share, prev/next, footer menu, dark mode, print. */

/* Noto Sans Thai (SIL OFL), self-hosted variable font — SEO plan D16 */
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/noto-sans-thai.woff2') format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/noto-sans-thai-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Tilok'; src: url('/assets/fonts/LN_TILOK_V6_05.TTF') format('truetype'); font-display: swap; }

:root {
  --red: #B11F24; --red-soft: #f7e9e9; --bg: #fff; --surface: #fcfbfa; --card: #E7E7E7; --text: #222; --text-2: #444;
  --muted: #6A6A6A; --line: #ddd; --code: #f1eee8; --mark: #ffe58a;
  --tip: #eef8f1; --tip-b: #1f7a3a; --warn: #fff6e5; --warn-b: #c47a00; --info: #eef3fd; --info-b: #2563eb;
  --nav-h: 56px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red: #e05a5f; --red-soft: #3a2224; --bg: #141312; --surface: #1d1b19; --card: #262320; --text: #ece8e1; --text-2: #cfc8bd;
    --muted: #a39d93; --line: #3a3631; --code: #2a2723; --mark: #6b5a12;
    --tip: #17281c; --tip-b: #5cc47e; --warn: #2e2412; --warn-b: #e6a23c; --info: #16203a; --info-b: #7aa2ff;
    color-scheme: dark;
  }
  .nav__logo img, .hero__logo img { filter: brightness(1.35) saturate(1.1); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.75 "Noto Sans Thai", system-ui, sans-serif; }
a { color: var(--red); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 3px; }

/* C1: skip link */
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--red); color: #fff; padding: 8px 14px; border-radius: 4px; }
.skip:focus { left: 8px; }

/* A6: reading progress */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 40; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--red); transition: width .1s linear; }

/* B1: sticky navigation */
.nav { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.nav__inner { display: flex; align-items: center; gap: 14px; height: var(--nav-h); }
.nav__logo img { display: block; height: 38px; width: auto; }
.nav__links { display: flex; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.nav__links a, .nav__dict { text-decoration: none; color: var(--text-2); font-size: 15px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.nav__links a:hover, .nav__dict:hover, .nav__links a.is-current { background: var(--red-soft); color: var(--red); }
.nav__links small { color: var(--muted); font-size: 12px; margin-left: 2px; }
.nav__search { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 12px; font-size: 14px; background: var(--surface); cursor: pointer; font-family: inherit; }
.nav__search kbd { font: 12px system-ui; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.nav__drawer { display: none; }
.nav__drawer summary { list-style: none; cursor: pointer; font-size: 24px; padding: 4px 8px; color: var(--text-2); }
.nav__drawer summary::-webkit-details-marker { display: none; }
.nav__drawer > div { position: absolute; right: 0; left: 0; top: var(--nav-h); background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px 16px 16px; box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.nav__drawer > div a { display: block; padding: 10px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
@media (max-width: 860px) {
  .nav__links, .nav__dict { display: none; }
  .nav__drawer { display: block; margin-left: auto; }
  .nav__search { margin-left: auto; } .nav__search kbd, .nav__search span { display: none; }
  .nav__drawer { margin-left: 0; }
}

/* hub hero + chips */
.hero { padding: 24px 0 8px; }
.hero__logo img { display: block; width: 300px; max-width: 70vw; height: auto; }
.tagline { margin: 6px 0 16px; color: var(--text-2); }
.dict-btn { display: block; text-align: center; background: #B11F24; color: #fff; text-decoration: none; font-weight: 600;
  padding: 10px 16px; border-radius: 4px; margin-bottom: 16px; }
.dict-btn:hover { filter: brightness(1.1); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chips a { text-decoration: none; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: 14px; background: var(--surface); }
.chips a:hover, .chips a.is-current { border-color: var(--red); color: var(--red); background: var(--red-soft); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 8px; }
.card { display: flex; background: var(--card); text-decoration: none; color: var(--text); min-height: 130px; border-radius: 2px; overflow: hidden; }
.card:hover .card__title { text-decoration: underline; }
.card__img { flex: 0 0 130px; background: var(--line); }
.card__img picture { display: block; height: 100%; }
.card__img img { width: 130px; height: 100%; object-fit: cover; display: block; }
.card__text { padding: 12px 16px; min-width: 0; }
.card__title { margin: 0; font-size: 20px; line-height: 1.4; color: var(--red); font-weight: 600; }
.card__meta { font-size: 13px; color: var(--muted); }
.card__desc { margin: 4px 0 0; font-size: 15px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* B6: featured newest post */
.card--featured { grid-column: 1 / -1; flex-direction: column; }
.card--featured .card__img { flex: none; height: auto; }
.card--featured .card__img img { width: 100%; height: auto; max-height: 420px; aspect-ratio: 16 / 9; }
.card--featured .card__title { font-size: 26px; }
.card--featured .card__desc { -webkit-line-clamp: 3; font-size: 16px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; }

.page-title { font-size: 26px; margin: 8px 0 12px; }
.category-intro { max-width: 860px; color: var(--text-2); margin: 0 0 20px; }

/* breadcrumbs (A2) */
.crumbs { font-size: 14px; color: var(--muted); margin: 14px 0 8px; display: flex; flex-wrap: nowrap; gap: 6px; min-width: 0; }
.crumbs a { color: var(--muted); white-space: nowrap; } .crumbs span { flex: none; }
.crumbs .crumbs__here { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* article layout: content + sticky TOC (A1) */
.layout { display: block; }
@media (min-width: 1100px) {
  .layout--toc { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; align-items: start; }
  .layout--toc .toc { display: none; }
}
.toc-aside { display: none; }
@media (min-width: 1100px) {
  .toc-aside { display: block; position: sticky; top: calc(var(--nav-h) + 20px); max-height: calc(100vh - var(--nav-h) - 40px); overflow: auto; }
}
.toc-aside__inner { border: 1px solid var(--line); border-radius: 10px; padding: 14px 12px; background: var(--surface); }
.toc-aside__label { margin: 0 0 8px 8px; font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.toc-aside ol, .toc ol { list-style: none; margin: 0; padding: 0; }
.toc-aside a { display: block; text-decoration: none; color: var(--text-2); font-size: 14px; line-height: 1.5; padding: 6px 8px; border-radius: 6px; border-left: 2px solid transparent; }
.toc-aside a:hover { color: var(--red); }
.toc-aside a.is-active { color: var(--red); background: var(--red-soft); border-left-color: var(--red); font-weight: 600; }
.toc-aside .toc__h3 a, .toc .toc__h3 a { padding-left: 22px; font-size: 13px; }
.toc { margin: 8px 0 24px; max-width: 860px; }
.toc details { border: 1px solid var(--line); border-radius: 6px; padding: 8px 16px; background: var(--surface); }
.toc summary { font-weight: 600; cursor: pointer; }
.toc li { margin: 4px 0; } .toc a { text-decoration: none; }
.toc .lanna-text, .toc-aside .lanna-text { font-size: 20px; }

/* post */
.post__image { display: block; width: 100%; height: auto; max-height: 520px; object-fit: cover; }
.post picture { display: block; }
.post__credit { margin: 4px 0 0; font-size: 12px; color: var(--muted); text-align: right; } .post__credit a { color: var(--muted); }
.post__title { font-size: 34px; line-height: 1.3; margin: 16px 0 4px; }
.post__meta { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.post__meta a { color: var(--muted); }
.post__body { max-width: 860px; }
.post__body h2 { font-size: 24px; margin: 32px 0 8px; }
.post__body h3 { font-size: 20px; margin: 24px 0 6px; }
.post__body blockquote { margin: 16px 0; padding: 8px 16px; border-left: 4px solid var(--red); background: var(--surface); }
.post__body figure { margin: 24px 0; } .post__body figcaption { text-align: center; color: var(--muted); font-size: 14px; }
.post__body figure img { display: block; width: 100%; border-radius: 6px; } .post__body figcaption a { color: var(--muted); }
.post__dict { margin-top: 32px; }
.table-wrap { overflow-x: auto; } table { border-collapse: collapse; } th, td { border: 1px solid var(--line); padding: 6px 10px; }
.post__body code { background: var(--code); padding: 1px 5px; border-radius: 4px; }

/* B7 tags + A5 share + A4 prev/next */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0 0; max-width: 860px; }
.tags a { font-size: 13px; text-decoration: none; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.tags a:hover { color: var(--red); border-color: var(--red); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 20px 0 0; max-width: 860px; font-size: 14px; color: var(--muted); }
.share a, .share button { font: inherit; font-size: 14px; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px;
  color: var(--text); background: var(--surface); cursor: pointer; }
.share .share--line { background: #06c755; border-color: #06c755; color: #fff; }
.share .share--fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 32px 0 0; max-width: 860px; }
.prevnext a { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; text-decoration: none; color: var(--text); background: var(--surface); }
.prevnext a:hover { border-color: var(--red); } .prevnext small { display: block; color: var(--muted); font-size: 13px; }
.prevnext .prevnext__next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .prevnext { grid-template-columns: 1fr; } .prevnext .prevnext__next { grid-column: 1; } }

.lanna-text { font-family: 'Tilok', sans-serif; font-size: 28px; line-height: 1.5; }

/* components */
.callout { border-left: 4px solid var(--muted); background: var(--surface); padding: 10px 16px; margin: 20px 0; border-radius: 4px; }
.callout__label { font-weight: 600; font-size: 14px; }
.callout--tip { border-color: var(--tip-b); background: var(--tip); } .callout--warning { border-color: var(--warn-b); background: var(--warn); }
.callout--info { border-color: var(--info-b); background: var(--info); }
.details { border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; margin: 16px 0; }
.details summary { cursor: pointer; font-weight: 600; }
.tabs { margin: 20px 0; } .tabs__nav { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--red); }
.tabs__btn { font: inherit; border: 0; background: var(--card); color: var(--text); padding: 6px 14px; cursor: pointer; border-radius: 4px 4px 0 0; }
.tabs__btn.is-active { background: var(--red); color: #fff; } .tabs__panel { padding: 8px 0; }
.word-card { border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: 6px; padding: 14px 18px; margin: 20px 0; background: var(--surface); }
.word-card__lanna { font-size: 40px; line-height: 1.4; }
.word-card__word { font-size: 22px; font-weight: 600; }
.word-card__meaning { margin: 6px 0; } .word-card__en { color: var(--muted); font-style: italic; }
.word-card__link { font-size: 14px; } .word-card--missing { border-top-color: var(--muted); color: var(--muted); }

.more { margin-top: 48px; } .more h2 { font-size: 20px; }
.notfound { padding: 48px 0; text-align: center; }
.btn { display: inline-block; padding: 8px 16px; border: 1px solid var(--red); border-radius: 4px; text-decoration: none; margin: 4px; }

/* B2: search dialog + B4 results page */
.search { width: min(680px, calc(100vw - 24px)); max-height: min(80vh, 720px); margin: 10vh auto auto; padding: 0; border: 1px solid var(--line);
  border-radius: 14px; background: var(--bg); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.search::backdrop { background: rgba(0,0,0,.45); }
.search__form { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search__form input, .search-page input { flex: 1; font: inherit; font-size: 18px; border: 0; outline: 0; background: transparent; color: var(--text); padding: 6px 4px; }
.search__close { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.search__results { list-style: none; margin: 0; padding: 6px; overflow: auto; max-height: calc(min(80vh, 720px) - 110px); }
.search__results a, .results a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
.search__results a:hover, .search__results a.is-active { background: var(--red-soft); }
.search__results b, .results b { color: var(--red); font-weight: 600; }
.search__results small, .results small { display: block; color: var(--muted); font-size: 13px; }
.search__results .search__dict a { color: var(--red); font-weight: 600; }
.search__hint { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-page form { display: flex; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--surface); max-width: 680px; }
.search-page button { font: inherit; border: 0; background: var(--red); color: #fff; border-radius: 6px; padding: 6px 16px; cursor: pointer; }
.results { list-style: none; padding: 0; max-width: 860px; }

/* A6: back to top */
.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 20; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red); color: #fff; text-decoration: none; font-size: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.is-visible { opacity: .9; pointer-events: auto; }

/* B5: footer */
.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 15px; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; padding-top: 28px; padding-bottom: 12px; }
.footer__grid b { display: block; color: var(--text); margin-bottom: 6px; }
.footer__grid ul { list-style: none; margin: 0; padding: 0; } .footer__grid li { margin: 3px 0; }
.footer__grid a { color: var(--text-2); text-decoration: none; } .footer__grid a:hover { color: var(--red); text-decoration: underline; }
.footer__copy { padding-top: 12px; padding-bottom: 28px; font-size: 13px; color: var(--muted); }
@media (max-width: 700px) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__grid > div:first-child { grid-column: 1 / -1; } }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .post__title { font-size: 28px; }
  .card__img { flex-basis: 100px; } .card__img img { width: 100px; }
  .card__title { font-size: 18px; } .card--featured .card__title { font-size: 22px; }
  .card--featured .card__img img { width: 100%; }
}

/* C2: print */
@media print {
  .nav, .skip, .progress, .toc-aside, .toc, .share, .prevnext, .more, .to-top, .search, .site-footer nav, .chips, .crumbs { display: none !important; }
  body { font-size: 12pt; background: #fff; color: #000; }
  .layout--toc { display: block; }
  .post__body a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; word-break: break-all; }
  .word-card, .callout, .details { break-inside: avoid; }
}
