/* KohistanExpress.pk — independent travel information portal
   Design tokens first; dark mode via prefers-color-scheme and [data-theme]. */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f6f9;
  --bg-card: #ffffff;
  --ink: #0b1f3a;
  --ink-soft: #3f5068;
  --ink-mute: #66768c;
  --line: #e1e6ee;
  --accent: #0f7a55;
  --accent-ink: #ffffff;
  --accent-soft: #e5f4ee;
  --blue: #1d5fbf;
  --warn-bg: #fff7e0;
  --warn-ink: #6b4a00;
  --warn-line: #f2d78a;
  --bad-bg: #fdecec;
  --bad-ink: #8a1c1c;
  --ok-bg: #e5f4ee;
  --ok-ink: #0b5c3f;
  --shadow: 0 1px 2px rgba(11, 31, 58, .06), 0 4px 16px rgba(11, 31, 58, .06);
  --radius: 14px;
  --radius-sm: 8px;
  --max: 1160px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1422; --bg-soft: #101c2e; --bg-card: #13213a; --ink: #e8eef7; --ink-soft: #bac6d8;
    --ink-mute: #8d9bb1; --line: #22324d; --accent: #3cc28f; --accent-ink: #06231a; --accent-soft: #123528;
    --blue: #7fb0ff; --warn-bg: #2e2510; --warn-ink: #f1d48a; --warn-line: #5a4716; --bad-bg: #3a1717;
    --bad-ink: #f3b0b0; --ok-bg: #123528; --ok-ink: #9be3c4; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1422; --bg-soft: #101c2e; --bg-card: #13213a; --ink: #e8eef7; --ink-soft: #bac6d8;
  --ink-mute: #8d9bb1; --line: #22324d; --accent: #3cc28f; --accent-ink: #06231a; --accent-soft: #123528;
  --blue: #7fb0ff; --warn-bg: #2e2510; --warn-ink: #f1d48a; --warn-line: #5a4716; --bad-bg: #3a1717;
  --bad-ink: #f3b0b0; --ok-bg: #123528; --ok-ink: #9be3c4; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--font); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); margin: 1.6em 0 .55em; }
h1 { font-size: clamp(1.75rem, 4.2vw, 2.6rem); margin-top: .3em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 2.8vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p, ul, ol { margin: 0 0 1em; }
li { margin-bottom: .35em; }
small, .muted { color: var(--ink-mute); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: 8px; background: var(--ink); color: var(--bg); padding: .6em 1em; z-index: 100; transform: translateY(-200%); }
.skip:focus { transform: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.hdr { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span small { display: block; font-weight: 500; font-size: .68rem; color: var(--ink-mute); letter-spacing: .02em; }
.nav { margin-left: auto; }
.nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.nav a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-soft); text-decoration: none; font-size: .92rem; font-weight: 600; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--bg-soft); color: var(--ink); }
.hdr-actions { display: flex; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-card); color: var(--ink); cursor: pointer; text-decoration: none; font: 600 .8rem var(--font); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }
.install-btn { min-height: 40px; padding: 6px 12px; font-size: .85rem; }
.install-btn svg { width: 18px; height: 18px; }
.install-btn[hidden], [data-install][hidden] { display: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); cursor: pointer; text-decoration: underline; }
.install-tip { position: fixed; inset-inline: 16px; bottom: 16px; z-index: 60; max-width: 420px; margin-inline: auto; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.install-tip p { margin: 0 0 8px; }
.wa-float { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 55; display: inline-flex; align-items: center; gap: 8px; background: #25d366; color: #06301a; font-weight: 700; text-decoration: none; padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); font-size: .9rem; }
.wa-float svg { width: 22px; height: 22px; }
@media print { .wa-float, .install-tip { display: none !important; } }
@media (max-width: 1080px) {
  .menu-btn { display: inline-grid; }
  .nav { position: fixed; inset: 64px 0 auto 0; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); display: none; max-height: calc(100vh - 64px); overflow: auto; }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; padding: 8px 16px 16px; }
  .nav a { padding: 12px; font-size: 1rem; }
  .hdr-actions { margin-left: auto; }
}
.nav .nav-search { display: none; }
@media (max-width: 480px) {
  .hdr { gap: 8px; }
  .brand { font-size: .95rem; gap: 8px; }
  .brand svg { width: 30px; height: 30px; }
  .brand span small { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  .hdr-actions .search-link { display: none; }
  .install-btn { padding: 6px 9px; }
  .install-btn span { display: none; }
  .nav .nav-search { display: block; }
}

/* Independent notice */
.notice-bar { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--warn-line); font-size: .86rem; }
.notice-bar .wrap { padding-block: 7px; }
.notice-bar a { color: inherit; font-weight: 700; }
.offline-bar { display: none; background: var(--bad-bg); color: var(--bad-ink); font-size: .9rem; text-align: center; padding: 8px 16px; }
body.is-offline .offline-bar { display: block; }

/* Breadcrumbs */
.crumbs { font-size: .85rem; color: var(--ink-mute); padding-top: 18px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0; }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--ink-mute); }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--bg-soft), var(--bg)); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding-block: 40px 48px; }
.hero p.lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 60ch; }
.hero-art { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--bg-card); }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; } }
.page-hero { padding-block: 6px 22px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.page-hero p.lead { font-size: 1.08rem; color: var(--ink-soft); max-width: 70ch; margin-bottom: 0; }

/* Forms */
.search-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--ink-soft); }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--bad-ink); }
.field-err { color: var(--bad-ink); font-size: .82rem; min-height: 1.2em; margin-top: 3px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: 700 .95rem var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--bg-card); color: var(--ink); border-color: var(--line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0; }
.form-note { font-size: .82rem; color: var(--ink-mute); margin: 10px 0 0; }

/* Cards & grids */
.section { padding: 34px 0; }
.section.alt { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section > .wrap > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; color: inherit; text-decoration: none; transition: transform .12s, border-color .12s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.route-card .cities { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.08rem; }
.route-card .cities svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.route-card .meta { font-size: .86rem; color: var(--ink-mute); margin-top: 6px; }

/* Badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.badge.unverified { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.badge.verified { background: var(--ok-bg); color: var(--ok-ink); }
.badge.conflicting, .badge.inactive { background: var(--bad-bg); color: var(--bad-ink); }
.badge.estimate { background: var(--accent-soft); color: var(--accent); }

/* Callouts */
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.2em 0; }
.callout.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.callout.warn a { color: inherit; font-weight: 700; }
.callout p:last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-card); margin: 1em 0 1.4em; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack td { display: grid; grid-template-columns: 42% 1fr; gap: 8px; border: 0; padding: 5px 12px; }
  table.stack td::before { content: attr(data-label); font-weight: 700; color: var(--ink-soft); font-size: .8rem; }
}
.empty { padding: 18px; color: var(--ink-mute); text-align: center; }

/* Layout with sidebar */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
.layout aside .card { position: sticky; top: 84px; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } .layout aside .card { position: static; } }
.toc ul { padding-left: 1.1em; margin: 0; font-size: .92rem; }
article.prose { max-width: 75ch; }
article.prose h2 { padding-top: .2em; }

/* FAQ */
details.faq { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-card); margin-bottom: 10px; }
details.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-weight: 800; color: var(--accent); }
details.faq[open] summary::after { content: "–"; }
details.faq > div { padding: 0 16px 14px; color: var(--ink-soft); }

/* Tools */
.tool-result { margin-top: 16px; padding: 16px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); display: none; }
.tool-result.show { display: block; }
.tool-result .big { font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist input { width: 20px; min-height: 20px; height: 20px; margin-top: 3px; flex: none; }
.checklist li.done label { text-decoration: line-through; color: var(--ink-mute); }
.checklist label { font-weight: 500; color: var(--ink); margin: 0; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.countdown div { background: var(--bg-card); border-radius: var(--radius-sm); padding: 10px 4px; border: 1px solid var(--line); }
.countdown b { display: block; font-size: 1.7rem; }
.split-rows .row { display: grid; grid-template-columns: 1fr 120px 40px; gap: 8px; margin-bottom: 8px; }

/* Ads — hidden until AdSense is configured in data/site.js */
.ad-slot { display: none; margin: 28px auto; min-height: 120px; max-width: var(--max); border: 1px dashed var(--line); border-radius: var(--radius-sm); text-align: center; font-size: .72rem; color: var(--ink-mute); padding: 6px; }
body.ads-on .ad-slot { display: block; }
.ad-slot::before { content: "Advertisement"; display: block; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }

/* Footer */
.site-footer { margin-top: 48px; background: var(--bg-soft); border-top: 1px solid var(--line); font-size: .92rem; }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; padding-block: 36px 20px; }
.foot-grid h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 0 0 10px; }
.foot-grid ul { list-style: none; padding: 0; margin: 0; }
.foot-grid a { color: var(--ink-soft); text-decoration: none; }
.foot-grid a:hover { color: var(--ink); text-decoration: underline; }
.foot-bottom { border-top: 1px solid var(--line); padding-block: 16px 26px; color: var(--ink-mute); font-size: .84rem; }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > div:first-child { grid-column: 1 / -1; } }

/* Search results */
.results { list-style: none; padding: 0; }
.results li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.results a { font-weight: 700; font-size: 1.05rem; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0 0 1em; }
.kv dt { font-weight: 700; color: var(--ink-soft); }
.kv dd { margin: 0; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }

/* RTL (Urdu) */
[dir="rtl"] body, body[dir="rtl"] { font-family: var(--font-ur), var(--font); line-height: 2.1; }
[dir="rtl"] .nav { margin-left: 0; margin-right: auto; }
[dir="rtl"] .callout { border-left: 0; border-right: 4px solid var(--accent); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .crumbs li + li::before { content: "‹"; margin: 0 0 0 4px; }

@media print { .site-header, .site-footer, .ad-slot, .notice-bar, .hdr-actions { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
