Files
sprinkler-calculation/intro-irre/css/docs.css
T
Bkk1234 4f74a509d5 intro-irre: แปลงตำราวิศวกรรมชลประทานเบื้องต้นเป็นเว็บเอกสาร 10 บท
- tools/extract.py: PDF 300 หน้า -> extracted/pages.json + crop ภาพ/ตาราง/สมการ 423 รูป
  (ถอด PUA วรรณยุกต์ไทย, รวมสระอำ, แยกหัวข้อที่ระดับ span)
- tools/build.py: generator หน้า docs แบบ static (สารบัญซ้าย/เนื้อหา/ในหน้านี้)
- index.html + chapters/ch01..10.html + css/docs.css + js/docs.js
  (ธีม K2D, ค้นหาเต็มเล่มผ่าน data/search.json, dark mode, drawer มือถือ)
- README.md: วิธี build และข้อจำกัดที่รู้อยู่
2026-11-19 01:34:49 +07:00

468 lines
17 KiB
CSS

/* ==========================================================================
วิศวกรรมชลประทานเบื้องต้น — docs theme
Base: "Swiss Modernism 2.0" (ui-ux-pro-max) + knowledge-blue palette
Values are tokens below; nothing else in the file hardcodes a colour.
========================================================================== */
@font-face {
font-family: "K2D";
src: url("../fonts/k2d-400-thai.woff2") format("woff2");
font-weight: 400; font-style: normal; font-display: swap;
unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
font-family: "K2D";
src: url("../fonts/k2d-400-latin.woff2") format("woff2");
font-weight: 400; font-style: normal; font-display: swap;
unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
font-family: "K2D";
src: url("../fonts/k2d-500-thai.woff2") format("woff2");
font-weight: 500; font-style: normal; font-display: swap;
unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
font-family: "K2D";
src: url("../fonts/k2d-500-latin.woff2") format("woff2");
font-weight: 500; font-style: normal; font-display: swap;
unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
font-family: "K2D";
src: url("../fonts/k2d-700-thai.woff2") format("woff2");
font-weight: 700; font-style: normal; font-display: swap;
unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
font-family: "K2D";
src: url("../fonts/k2d-700-latin.woff2") format("woff2");
font-weight: 700; font-style: normal; font-display: swap;
unicode-range: U+0000-00FF, U+2000-206F;
}
:root {
--brand: #1e3a8a;
--brand-2: #2563eb;
--brand-ink: #172554;
--soft: #eff6ff;
--soft-2: #e0ebff;
--bg: #f8fafc;
--surface: #ffffff;
--ink: #0f172a;
--muted: #475569;
--faint: #64748b;
--line: #e2e8f0;
--line-strong: #cbd5e1;
--ok: #166534;
--warn: #b45309;
--shadow: 0 1px 2px rgba(15, 23, 42, .06);
--topbar-h: 60px;
--side-w: 288px;
--toc-w: 232px;
--radius: 10px;
--font: "K2D", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-theme="dark"] {
--brand: #93b4ff;
--brand-2: #7ba2fb;
--brand-ink: #dbe6ff;
--soft: #12203a;
--soft-2: #17294a;
--bg: #0b1220;
--surface: #101a2c;
--ink: #e8eefb;
--muted: #a3b2c9;
--faint: #8595ad;
--line: #1e2b44;
--line-strong: #2a3a58;
--shadow: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
margin: 0;
font-family: var(--font);
font-size: 16px;
line-height: 1.7;
color: var(--ink);
background: var(--bg);
-webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible {
outline: 2px solid var(--brand-2);
outline-offset: 2px;
border-radius: 4px;
}
.sr {
position: absolute; width: 1px; height: 1px;
padding: 0; margin: -1px; overflow: hidden;
clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
position: absolute; left: 12px; top: -60px;
padding: 10px 16px; background: var(--brand); color: #fff;
border-radius: 0 0 8px 8px; z-index: 200; transition: top .15s ease;
}
.skip:focus { top: 0; color: #fff; }
/* ------------------------------------------------------------------ topbar */
.topbar {
position: sticky; top: 0; z-index: 60;
height: var(--topbar-h);
display: flex; align-items: center; gap: 14px;
padding: 0 20px;
background: color-mix(in srgb, var(--surface) 88%, transparent);
backdrop-filter: saturate(140%) blur(10px);
border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark { color: var(--brand-2); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; letter-spacing: .08em; color: var(--faint); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-btn {
display: flex; align-items: center; gap: 8px;
height: 36px; padding: 0 10px 0 12px;
font: inherit; font-size: 13.5px; color: var(--muted);
background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px;
cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.search-btn:hover { border-color: var(--brand-2); color: var(--ink); background: var(--soft); }
kbd {
font: inherit; font-size: 11px; line-height: 1;
padding: 3px 5px; border-radius: 4px;
background: var(--surface); border: 1px solid var(--line-strong); color: var(--faint);
}
.icon-btn {
display: inline-flex; align-items: center; justify-content: center;
width: 36px; height: 36px; border-radius: 8px;
background: transparent; border: 1px solid transparent; color: var(--muted);
cursor: pointer; transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--soft); color: var(--brand); }
.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }
/* ------------------------------------------------------------------ layout */
.layout {
display: grid;
grid-template-columns: var(--side-w) minmax(0, 1fr);
max-width: 1560px;
margin: 0 auto;
}
@media (min-width: 1240px) {
.layout { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); }
}
/* ----------------------------------------------------------------- sidebar */
.side {
border-right: 1px solid var(--line);
background: var(--surface);
padding: 18px 12px 48px;
max-height: calc(100vh - var(--topbar-h));
overflow-y: auto;
position: sticky; top: var(--topbar-h);
scrollbar-width: thin;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { border-radius: 8px; }
.nav-group > summary {
display: flex; align-items: baseline; gap: 8px;
padding: 9px 10px; border-radius: 8px;
cursor: pointer; list-style: none;
color: var(--ink); font-size: 14px; font-weight: 500;
transition: background .15s ease;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--soft); }
.nav-num { font-size: 11.5px; font-weight: 700; color: var(--brand-2); letter-spacing: .02em; white-space: nowrap; }
.nav-title { color: var(--muted); font-weight: 500; }
.nav-group.is-active > summary { background: var(--soft); }
.nav-group.is-active .nav-title { color: var(--brand); font-weight: 700; }
.nav-group ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 10px; border-left: 1px solid var(--line); margin-left: 14px; }
.nav-group li { margin: 0; }
.nav-link {
display: block; padding: 5px 8px; border-radius: 6px;
font-size: 13px; color: var(--muted); line-height: 1.5;
transition: background .12s ease, color .12s ease;
}
.nav-link:hover { background: var(--soft); color: var(--brand); text-decoration: none; }
/* -------------------------------------------------------------------- main */
.main { min-width: 0; padding: 34px 40px 80px; }
@media (max-width: 720px) { .main { padding: 24px 20px 64px; } }
.doc { max-width: 74ch; }
.breadcrumb {
display: flex; gap: 8px; align-items: center;
font-size: 12.5px; color: var(--faint); margin: 0 0 10px;
}
.breadcrumb span { color: var(--line-strong); }
.doc-title {
font-size: clamp(23px, 3.2vw, 30px);
line-height: 1.35; font-weight: 700; color: var(--brand-ink);
margin: 0 0 6px; letter-spacing: -.01em;
}
.doc-meta { margin: 0 0 30px; font-size: 13px; color: var(--faint); }
.doc-section { margin: 0 0 40px; }
.doc-section > h2 {
margin: 6px 0 16px;
font-size: clamp(18px, 2vw, 21px);
font-weight: 700; line-height: 1.45; color: var(--brand);
padding-bottom: 8px; border-bottom: 1px solid var(--line);
display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.doc-section .anchor { color: inherit; }
.doc-section .anchor:hover { text-decoration: none; color: var(--brand-2); }
.page-ref {
margin-left: auto;
font-size: 11.5px; font-weight: 500; color: var(--faint);
background: var(--soft); border: 1px solid var(--line);
border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.doc h3 {
margin: 26px 0 10px; font-size: 16.5px; font-weight: 700;
color: var(--ink); line-height: 1.5;
}
.doc p {
margin: 0 0 14px;
font-size: 17px; line-height: 1.95; color: var(--ink);
text-wrap: pretty;
}
.doc p .bullet { display: block; padding-left: 1em; text-indent: -1em; }
figure { margin: 22px 0 26px; }
figure img {
display: block; max-width: 100%; height: auto;
background: #fff; border: 1px solid var(--line);
border-radius: var(--radius); padding: 6px;
}
figcaption {
margin-top: 8px; font-size: 13px; line-height: 1.6;
color: var(--faint); text-align: center;
}
.pager {
display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
margin: 48px 0 0; padding-top: 22px; border-top: 1px solid var(--line);
}
.pager-link {
display: flex; flex-direction: column; gap: 3px;
padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
background: var(--surface); color: var(--ink);
transition: border-color .15s ease, background .15s ease;
}
.pager-link:hover { border-color: var(--brand-2); background: var(--soft); text-decoration: none; }
.pager-link span { font-size: 12px; color: var(--faint); }
.pager-link strong { font-size: 14px; font-weight: 500; }
.pager-link.next { text-align: right; }
/* --------------------------------------------------------------- page toc */
.page-toc {
position: sticky; top: var(--topbar-h);
align-self: start;
max-height: calc(100vh - var(--topbar-h));
overflow-y: auto;
padding: 34px 20px 40px 4px;
font-size: 12.5px;
}
.page-toc-label {
margin: 0 0 10px; font-size: 11px; font-weight: 700;
letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
}
.page-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.page-toc li { margin: 0; }
.page-toc li.sub { padding-left: 10px; }
.page-toc a {
display: block; padding: 4px 0 4px 12px; margin-left: -1px;
color: var(--muted); border-left: 2px solid transparent; line-height: 1.5;
}
.page-toc a:hover { color: var(--brand); text-decoration: none; border-left-color: var(--line-strong); }
.page-toc a.is-active { color: var(--brand); border-left-color: var(--brand-2); font-weight: 500; }
/* -------------------------------------------------------------------- home */
.home { max-width: 1180px; margin: 0 auto; padding: 48px 32px 72px; }
@media (max-width: 720px) { .home { padding: 32px 20px 56px; } }
.hero {
display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr);
gap: 48px; align-items: start;
padding-bottom: 46px; border-bottom: 1px solid var(--line);
}
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 28px; } }
.eyebrow {
margin: 0 0 12px; font-size: 12px; font-weight: 700;
letter-spacing: .12em; text-transform: uppercase; color: var(--brand-2);
}
.hero h1 {
margin: 0 0 8px; font-size: clamp(30px, 5vw, 46px);
line-height: 1.2; letter-spacing: -.02em; color: var(--brand-ink);
}
.hero-sub { margin: 0 0 16px; font-size: 16px; color: var(--faint); font-weight: 500; }
.hero-lead { margin: 0 0 24px; font-size: 16.5px; line-height: 1.85; color: var(--muted); max-width: 56ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.btn {
display: inline-flex; align-items: center; justify-content: center;
min-height: 44px; padding: 0 20px; border-radius: 9px;
font: inherit; font-size: 14.5px; font-weight: 500;
border: 1px solid transparent; cursor: pointer;
transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); color: #fff; text-decoration: none; }
[data-theme="dark"] .btn.primary { background: #2f5bd0; color: #fff; }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--soft); border-color: var(--brand-2); }
.stats { display: flex; gap: 34px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { font-size: 12px; color: var(--faint); }
.stats dd { margin: 0; font-size: 26px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.hero-cover { margin: 0; }
.hero-cover img {
display: block; width: 100%; height: auto;
border: 1px solid var(--line-strong); border-radius: 4px; background: #fff;
}
.hero-cover figcaption { text-align: left; font-size: 12px; }
.chapters { margin: 48px 0 0; }
.chapters h2, .about h2 {
font-size: 20px; font-weight: 700; color: var(--brand-ink);
margin: 0 0 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.chapter-grid {
list-style: none; margin: 0; padding: 0;
display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.chapter-card a {
display: flex; flex-direction: column; gap: 6px; height: 100%;
padding: 18px 18px 16px; border-radius: var(--radius);
background: var(--surface); border: 1px solid var(--line);
color: var(--ink); transition: border-color .15s ease, background .15s ease;
}
.chapter-card a:hover { border-color: var(--brand-2); background: var(--soft); text-decoration: none; }
.card-num { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--brand-2); text-transform: uppercase; }
.card-title { font-size: 16.5px; font-weight: 700; line-height: 1.45; color: var(--brand-ink); }
.card-meta { font-size: 12.5px; color: var(--faint); }
.card-cta {
display: inline-flex; align-items: center; gap: 6px;
margin-top: auto; padding-top: 12px; font-size: 13px; font-weight: 500; color: var(--brand-2);
}
.about { margin: 56px 0 0; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; }
.about h3 { margin: 0 0 8px; font-size: 14.5px; font-weight: 700; color: var(--brand); }
.about p { margin: 0; font-size: 14.5px; line-height: 1.85; color: var(--muted); }
.home-foot {
margin: 56px 0 0; padding-top: 20px; border-top: 1px solid var(--line);
display: flex; flex-wrap: wrap; gap: 6px 24px;
}
.home-foot p { margin: 0; font-size: 12.5px; color: var(--faint); }
/* ------------------------------------------------------------------ search */
.scrim {
position: fixed; inset: 0; z-index: 90;
background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
}
.search-modal {
position: fixed; z-index: 91;
left: 50%; top: 12vh; transform: translateX(-50%);
width: min(760px, calc(100vw - 32px));
max-height: 70vh;
display: flex; flex-direction: column;
background: var(--surface); border: 1px solid var(--line-strong);
border-radius: 14px; overflow: hidden;
box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
.search-head {
display: flex; align-items: center; gap: 10px;
padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line);
color: var(--faint);
}
.search-head input {
flex: 1; min-width: 0; border: 0; background: transparent;
font: inherit; font-size: 16px; color: var(--ink); padding: 8px 0;
}
.search-head input:focus { outline: none; }
.search-head input::placeholder { color: var(--faint); }
.search-results { overflow-y: auto; padding: 8px; }
.search-hint { margin: 18px 12px 22px; font-size: 13.5px; color: var(--faint); }
.result {
display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink);
border: 1px solid transparent;
}
.result:hover, .result:focus-visible { background: var(--soft); border-color: var(--line); text-decoration: none; }
.result .r-crumb { font-size: 11.5px; color: var(--brand-2); font-weight: 500; }
.result .r-title { font-size: 14px; font-weight: 700; color: var(--brand-ink); margin: 1px 0 3px; }
.result .r-text { font-size: 13px; line-height: 1.65; color: var(--muted); }
.result mark { background: var(--soft-2); color: var(--brand); padding: 0 2px; border-radius: 3px; }
/* ------------------------------------------------------------------ mobile */
.only-mobile { display: none; }
@media (max-width: 900px) {
.only-mobile { display: inline-flex; }
.layout { grid-template-columns: minmax(0, 1fr); }
.side {
position: fixed; z-index: 95; top: var(--topbar-h); left: 0; bottom: 0;
width: min(320px, 86vw); max-height: none;
transform: translateX(-102%); transition: transform .2s ease;
border-right: 1px solid var(--line-strong);
}
.side.is-open { transform: none; }
.topbar-actions .search-btn span { display: none; }
.topbar-actions .search-btn kbd { display: none; }
.pager { grid-template-columns: 1fr; }
.doc p { font-size: 16.5px; }
}
@media (max-width: 1239px) { .page-toc { display: none; } }
@media (prefers-reduced-motion: reduce) {
* { animation-duration: .001ms !important; transition-duration: .001ms !important; }
html { scroll-behavior: auto; }
}
@media print {
.topbar, .side, .page-toc, .pager, .skip, .scrim, .search-modal { display: none !important; }
.layout { grid-template-columns: 1fr; }
.main { padding: 0; }
.doc { max-width: none; }
figure img { border: 0; }
}
/* native search clear button duplicates our close control */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }