/* potha.org */
:root {
  --paper: #faf7f1; --card: #ffffff; --ink: #1d2433; --muted: #5d6676; --line: #e6dfd2;
  --accent: #a8431f; --accent-dark: #86330f; --accent-soft: #fbeee6; --green: #1f6b4a; --green-soft: #e6f3ec;
  --warn: #8a5a00; --warn-soft: #fff4d6; --err: #a3231d; --err-soft: #fdecea;
  --radius: 10px; --shadow: 0 1px 2px rgba(29,36,51,.06), 0 6px 20px rgba(29,36,51,.06);
  --font-ui: 'Inter', 'Noto Sans Sinhala', system-ui, sans-serif;
  --font-head: 'Source Serif 4', 'Noto Serif Sinhala', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.65; }
body.lang-si { font-size: 16.5px; line-height: 1.8; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.3; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.muted { color: var(--muted); } small { color: var(--muted); font-size: .85em; }
.lead { font-size: 1.08rem; color: #3b4454; max-width: 62ch; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 99; }
.hp { position: absolute !important; left: -9999px !important; height: 0; overflow: hidden; }
:focus-visible { outline: 3px solid #e0a070; outline-offset: 2px; border-radius: 4px; }

/* header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 1rem; padding: .8rem 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--accent); text-decoration: none; }
.search { display: flex; flex: 1 1 260px; max-width: 460px; margin-inline: auto; }
.search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; padding: .55rem 1rem; font: inherit; background: var(--paper); }
.search button { border: 1px solid var(--line); border-left: 0; border-radius: 0 999px 999px 0; background: var(--paper); padding: 0 .9rem; cursor: pointer; color: var(--muted); }
.search-big { max-width: 640px; margin: 0 0 1.5rem; gap: .5rem; } .search-big input { border-right: 1px solid var(--line); border-radius: 999px; }
.header-side { display: flex; align-items: center; gap: .9rem; margin-left: auto; }
.langlink { text-decoration: none; font-weight: 500; color: var(--muted); }
.mainnav { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .55rem; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { white-space: nowrap; text-decoration: none; color: var(--ink); padding: .35rem .85rem; border-radius: 999px; font-weight: 500; font-size: .95rem; }
.mainnav a:hover { background: var(--accent-soft); } .mainnav a.on { background: var(--accent); color: #fff; }
.pill { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; margin-left: .25rem; }
.mainnav a.on .pill { background: #fff; color: var(--accent); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border-radius: 999px; padding: .55rem 1.25rem; border: 1.5px solid transparent; line-height: 1.3; }
.btn-primary { background: var(--accent); color: #fff; } .btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); } .btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--err); color: #fff; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

main { padding: 1.6rem 0 3rem; min-height: 55vh; }
section { margin-top: 2.4rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; border-bottom: 2px solid var(--line); padding-bottom: .4rem; }
.section-head h2 { margin: 0; } .section-head a { white-space: nowrap; font-weight: 500; text-decoration: none; }
.page-head { margin-bottom: 1.4rem; }

/* hero */
.hero { margin-top: .5rem; background: linear-gradient(135deg, #fff 0%, var(--accent-soft) 100%); border: 1px solid var(--line); border-radius: 16px; padding: clamp(1.4rem, 4vw, 2.8rem); }
.hero h1 { max-width: 22ch; } .hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1.2rem 0; }
.promises { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }
.promises li { background: rgba(255,255,255,.75); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.promises strong { display: block; color: var(--green); } .promises span { font-size: .93rem; color: #3b4454; }

/* book grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.4rem 1.1rem; }
.card { min-width: 0; } .card-link { text-decoration: none; color: inherit; display: block; }
.card-title { font-size: .98rem; margin: .55rem 0 .1rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-link:hover .card-title { color: var(--accent); }
.card-author { margin: 0; font-size: .87rem; } .card-author a { color: var(--muted); text-decoration: none; } .card-author a:hover { text-decoration: underline; }
.card-meta { margin: .35rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.cover { display: block; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); background: #ddd; transition: transform .15s; }
.card-link:hover .cover { transform: translateY(-3px); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-gen { display: flex; flex-direction: column; justify-content: space-between; padding: 12% 10%; color: #fff;
  background: linear-gradient(160deg, hsl(var(--h) 42% 34%), hsl(calc(var(--h) + 28) 48% 22%)); border-left: 5px solid rgba(0,0,0,.22); }
.cover-title { font-family: var(--font-head); font-weight: 700; font-size: clamp(.85rem, 1.6vw, 1.02rem); line-height: 1.35; overflow-wrap: anywhere; }
.cover-author { font-size: .74rem; opacity: .88; border-top: 1px solid rgba(255,255,255,.4); padding-top: .4rem; }
.cover-lg { max-width: 300px; margin-inline: auto; } .cover-lg .cover-title { font-size: 1.4rem; } .cover-lg .cover-author { font-size: .95rem; }
.badge, .chip { display: inline-block; font-size: .7rem; font-weight: 600; border-radius: 4px; padding: .08rem .42rem; letter-spacing: .02em; }
.badge-open { background: var(--green-soft); color: var(--green); } .badge-cc { background: #e8eefb; color: #24448f; }
.chip { background: #f0ece3; color: var(--muted); font-weight: 500; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.3rem; text-align: center; }
.result-count { color: var(--muted); margin: 0 0 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.2rem; align-items: end; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .2rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1.2rem; margin-top: 2rem; } .pager a { text-decoration: none; font-weight: 600; }
.catlist { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .55rem; }
.catlist li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .95rem; }
.catlist a { text-decoration: none; color: var(--ink); font-weight: 500; } .catlist a:hover { color: var(--accent); }
.catlist-big { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } .catlist-big li { border-radius: var(--radius); padding: .8rem 1rem; display: flex; justify-content: space-between; }
.count { color: var(--muted); font-size: .82rem; }

/* book page */
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 1.2rem; } .crumbs a { color: var(--muted); }
.book { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: 2.4rem; align-items: start; }
.title-alt { color: var(--muted); margin: -.3rem 0 .4rem; font-size: 1.05rem; } .byline { font-size: 1.08rem; margin: 0 0 1.2rem; }
.downloads { display: flex; flex-wrap: wrap; gap: .7rem; margin: 0 0 1.6rem; }
.dl { flex-direction: column; align-items: flex-start; border-radius: var(--radius); padding: .6rem 1.3rem; min-width: 150px; }
.dl-format { font-size: 1.05rem; } .dl-note { font-size: .78rem; font-weight: 400; opacity: .92; }
.rights { background: var(--green-soft); border: 1px solid #c4e2d2; border-radius: var(--radius); padding: 1rem 1.2rem; margin-top: 0; }
.rights h2 { font-size: 1.05rem; color: var(--green); } .rights p { margin: .35rem 0; }
.prose { max-width: 70ch; } .prose h2 { margin-top: 1.8rem; } .prose li { margin-bottom: .4rem; }
.page { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: clamp(1.2rem, 4vw, 2.6rem); max-width: 820px; margin-inline: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.2rem; margin: 1.6rem 0; font-size: .95rem; } .facts dt { color: var(--muted); } .facts dd { margin: 0; }
.report { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; font-size: .93rem; } .report summary { cursor: pointer; color: var(--muted); }
.lic { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; } .lic h2 { font-size: 1.1rem; margin-top: 0; }
.lic-flags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .9rem; }
.lic-flags .yes::before { content: '✓ '; color: var(--green); font-weight: 700; } .lic-flags .no::before { content: '✕ '; color: var(--err); font-weight: 700; }

/* forms */
form label { display: block; margin: 0 0 1rem; font-weight: 500; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: .3rem; font: inherit; color: inherit; padding: .55rem .75rem; border: 1px solid #cfc7b8; border-radius: 8px; background: #fff; }
input[type=file] { display: block; margin-top: .4rem; font: inherit; max-width: 100%; }
label small { display: block; font-weight: 400; margin-top: .25rem; }
textarea { resize: vertical; }
.form-box, .center-box { max-width: 460px; margin: 1.5rem auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.8rem; box-shadow: var(--shadow); }
.center-box { text-align: center; max-width: 560px; } .form-links { text-align: center; margin: 1.2rem 0 0; font-size: .93rem; }
.bigform { max-width: 780px; } fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 1.1rem 1.3rem .4rem; margin: 0 0 1.4rem; }
legend { font-family: var(--font-head); font-weight: 700; padding: 0 .5rem; font-size: 1.08rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; align-items: end; } .row-links { grid-template-columns: 130px 1fr 190px; }
.check, .radio { display: flex !important; gap: .6rem; align-items: flex-start; font-weight: 400; } .check input, .radio input { margin-top: .35rem; flex: none; }
.radio { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; } .radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.inline-form { display: inline; margin-top: .8rem; }
.flash { border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1.1rem; border: 1px solid; } .flash ul { margin: 0; padding-left: 1.1rem; }
.flash-ok { background: var(--green-soft); border-color: #c4e2d2; color: #14492f; } .flash-err { background: var(--err-soft); border-color: #f2c1bd; color: var(--err); }
.flash-warn { background: var(--warn-soft); border-color: #ecd391; color: var(--warn); }

/* account + admin */
.subnav, .tabs { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: .7rem; margin-bottom: 1.5rem; font-weight: 500; }
.subnav a, .tabs a { text-decoration: none; } .subnav form { margin-left: auto; } .tabs a.on { color: var(--ink); border-bottom: 2px solid var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-top: 1.4rem; } .panel-quiet { background: transparent; border-style: dashed; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.4rem; } .two-col .panel { margin-top: 0; }
.steps li { margin-bottom: .7rem; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; } .table th, .table td { text-align: left; padding: .6rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; background: var(--paper); } .table tr:last-child td { border-bottom: 0; }
.status { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: .1rem .65rem; }
.status-draft { background: #eee9de; color: var(--muted); } .status-pending { background: var(--warn-soft); color: var(--warn); } .status-approved { background: var(--green-soft); color: var(--green); }
.status-rejected { background: var(--err-soft); color: var(--err); } .status-withdrawn { background: #e9e9ee; color: #555; }
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; }
.stats li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; } .stats a { text-decoration: none; color: inherit; }
.stats strong { display: block; font-size: 1.6rem; font-family: var(--font-head); color: var(--accent); } .stats span { color: var(--muted); font-size: .88rem; }
.decision { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; align-items: end; }
blockquote { margin: .8rem 0; padding: .6rem 1rem; border-left: 3px solid var(--line); background: var(--paper); }
code { background: #f0ece3; padding: .05rem .35rem; border-radius: 4px; font-size: .9em; }

/* footer */
.site-footer { background: #20283a; color: #cfd5e0; padding: 2.2rem 0 1.4rem; font-size: .93rem; }
.site-footer a { color: #fff; text-decoration: none; } .site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; } .footer-grid nav { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1.5rem; align-content: start; }
.footer-brand { font-family: var(--font-head); font-size: 1.3rem; color: #fff; margin: 0 0 .3rem; } .footer-note { margin-top: 1.6rem; color: #8e98aa; font-size: .85rem; }

@media (max-width: 720px) {
  .book { grid-template-columns: 1fr; gap: 1.4rem; } .cover-lg { max-width: 210px; }
  .footer-grid { grid-template-columns: 1fr; } .row-links { grid-template-columns: 1fr; }
  .header-side .btn { padding: .4rem .85rem; font-size: .9rem; } .search { order: 3; flex-basis: 100%; max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 1.1rem .8rem; }
}
@media print { .site-header, .site-footer, .report, .downloads { display: none; } }
