/* ==========================================================================
   Pakistan provinces guide: /provinces, /provinces/:slug and its admin.
   CUPA's purple palette, with the map in the ink-and-purple theme of the
   Issue Map (see "CUPA theme for the map" in issues.css).
   Prefixes: pv- public pages, pa- admin.
   ========================================================================== */

.pv {
  --pv-paper: #FBFAF7;
  --pv-rule: #E3DFE8;
  --pv-text: #23202A;
  --pv-grey: #6A6672;
  --pv-sea: #1A1030;
  --pv-land: #3A2A57;
  --pv-border: #5E4A82;
  --pv-province: #6E42A6;
  --pv-province-hover: #8B5FC6;
  --pv-territory: #9277C0;
  --pv-territory-hover: #AB93D6;
  background: var(--pv-paper);
  color: var(--pv-text);
}
.pv a { color: inherit; }
.pv-wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--s-3); }
.pv-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pv-i { display: inline-block; vertical-align: -2px; flex-shrink: 0; }
.pv-muted { color: var(--pv-grey); }

.pv-preview { background: #FFF4D6; border-bottom: 1px solid #E8D49A; font-size: 0.9rem; padding: 0.6rem 0; color: #4A3B10; }
.pv-preview a { font-weight: 600; text-decoration: underline; }

/* ------------------------------------------------------------- Hero + map */

.pv-hero { background: var(--ink); color: var(--on-ink); padding: var(--s-4) 0 var(--s-5); }
.pv-crumbs ol { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 var(--s-3); padding: 0; list-style: none; font-size: 0.84rem; color: var(--pv-grey); }
.pv-crumbs li:not(:last-child)::after { content: "/"; margin-left: 0.4rem; opacity: 0.6; }
.pv-crumbs a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.pv-crumbs a:hover { text-decoration-color: currentColor; }
.pv-hero .pv-crumbs ol { color: var(--on-ink-muted); }

.pv-kicker {
  display: flex; align-items: center; gap: 0.6em; margin: 0 0 var(--s-2);
  font-size: 0.76rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-dark);
}
.pv-kicker::before { content: ""; width: 28px; height: 2px; background: var(--accent); }
.pv-hero .pv-kicker { color: var(--accent-soft); }
.pv-title {
  margin: 0 0 var(--s-3); max-width: 20ch;
  font-family: var(--font-serif); font-size: clamp(2.3rem, 5vw, 4rem); font-weight: 400; line-height: 1.04; letter-spacing: -0.02em;
  color: var(--ink);
}
.pv-hero .pv-title { color: #fff; }
.pv-intro { max-width: 62ch; font-family: var(--font-serif); font-size: clamp(1.1rem, 1.6vw, 1.28rem); line-height: 1.55; }
.pv-intro p { margin: 0 0 0.8em; }
.pv-intro a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.pv-mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: var(--s-3); margin-top: var(--s-4); align-items: start; }
.pv-map { position: relative; margin: 0; }
.pv-svg { display: block; width: 100%; height: auto; border-radius: 4px; background: var(--pv-sea); }
.pv-map figcaption { margin-top: 0.8rem; }
.pv-hint { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--on-ink-muted); }
.pv-nomap { padding: var(--s-4) var(--s-3); background: var(--pv-sea); border-radius: 4px; color: var(--on-ink); }

/* Map layers */
.pv-sea { fill: var(--pv-sea); }
.pv-ctx { fill: var(--pv-land); stroke: var(--pv-border); stroke-width: 1.2; stroke-linejoin: round; }
.pv-jk-base { fill: #5A3E85; }
.pv-unit path { fill: var(--pv-province); stroke: #E7DEF2; stroke-width: 1.6; stroke-linejoin: round; transition: fill 0.15s; }
.pv-unit.is-administrative-territory path, .pv-unit.is-federal-territory path { fill: var(--pv-territory); }
.pv-unit:hover path, .pv-unit.is-active path { fill: var(--pv-province-hover); }
.pv-unit.is-administrative-territory:hover path, .pv-unit.is-federal-territory:hover path,
.pv-unit.is-administrative-territory.is-active path, .pv-unit.is-federal-territory.is-active path { fill: var(--pv-territory-hover); }
.pv-unit:focus { outline: none; }
.pv-unit:focus-visible path { fill: var(--pv-province-hover); stroke: #fff; stroke-width: 4; }
.pv-hit { fill: transparent; }
.pv-top { pointer-events: none; }
.pv-rivers path { fill: none; stroke: #9CC0EA; stroke-width: 1.6; stroke-opacity: 0.55; stroke-linejoin: round; stroke-linecap: round; }
.pv-hatch-line { stroke: var(--accent-soft); stroke-opacity: 0.6; }
.pv-disputed { stroke: var(--accent-soft); stroke-width: 1; stroke-opacity: 0.5; }
.pv-line { fill: none; stroke: #E7DEF2; stroke-width: 2.4; stroke-dasharray: 8 5; stroke-linecap: round; }
.pv-line-siachen { stroke-dasharray: 3 5; }
.pv-outline use { fill: none; stroke: #fff; stroke-width: 4; stroke-linejoin: round; }
.pv-capital { fill: #fff; stroke: var(--ink); stroke-width: 2.5; }
.pv-label {
  fill: #fff; font-family: var(--font); font-weight: 600; letter-spacing: 0.01em;
  paint-order: stroke; stroke: rgba(42, 27, 69, 0.85); stroke-width: 5px; stroke-linejoin: round;
}
.pv-label.is-small { font-weight: 700; }
.pv-label-short { display: none; }
.pv-ctx-label { fill: #9C8BBE; font-family: var(--font); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.pv-ctx-label.is-water { fill: #8E7BB0; font-style: italic; font-weight: 400; letter-spacing: 0.06em; text-transform: none; }

/* Hover / tap card */
.pv-card {
  position: absolute; z-index: 5; width: 250px; padding: 0.9rem 1rem 0.85rem;
  background: #fff; color: var(--pv-text); border-radius: 4px; box-shadow: 0 10px 34px rgba(10, 4, 24, 0.45);
  font-size: 0.86rem; line-height: 1.4;
}
.pv-card[hidden] { display: none; }
.pv-card p { margin: 0; }
.pv-card-type { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-dark); }
.pv-card-name { margin-top: 0.15rem !important; font-family: var(--font-serif); font-size: 1.3rem; line-height: 1.15; color: var(--ink); }
.pv-card-capital { margin-top: 0.3rem !important; color: var(--pv-grey); }
.pv-card-state { margin-top: 0.45rem !important; font-size: 0.78rem; font-weight: 600; color: var(--accent-dark); }
.pv-card-figs { margin: 0.35rem 0 0; padding: 0; list-style: none; }
.pv-card-figs li { padding: 0.2rem 0; border-top: 1px solid var(--pv-rule); }
.pv-card-link { display: inline-flex; align-items: center; gap: 0.35em; margin-top: 0.6rem; font-weight: 600; color: var(--accent-dark) !important; }
.pv-card-link:hover { text-decoration: underline; }

/* Legend */
.pv-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin: 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--on-ink); }
.pv-legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.pv-key { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 2px; flex-shrink: 0; }
.pv-key-province { background: var(--pv-province); box-shadow: inset 0 0 0 1px #E7DEF2; }
.pv-key-territory { background: var(--pv-territory); box-shadow: inset 0 0 0 1px #E7DEF2; }
.pv-key-disputed { background: #4A3570 repeating-linear-gradient(135deg, rgba(201, 184, 222, 0.75) 0 1.5px, transparent 1.5px 4.5px); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.pv-key-loc { height: 0; width: 1.3rem; border-top: 2px dashed #E7DEF2; border-radius: 0; }
.pv-key-capital { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--ink); margin: 0 0.15rem; }

/* Unit list beside the map */
.pv-list { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-dark); border-radius: 4px; padding: 1rem 1rem 0.6rem; }
.pv-list-h { margin: 0 0 0.6rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-ink-muted); }
.pv-list-group { margin: 0.8rem 0 0.3rem; font-size: 0.78rem; font-weight: 600; color: var(--accent-soft); }
.pv-list ul { margin: 0; padding: 0; list-style: none; }
.pv-list a {
  display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem; align-items: center;
  padding: 0.5rem 0.55rem; margin: 0 -0.55rem; border-radius: 3px; text-decoration: none; transition: background 0.15s;
}
.pv-list a:hover, .pv-list a.is-active, .pv-list a:focus-visible { background: rgba(255, 255, 255, 0.08); }
.pv-list-name { font-weight: 600; color: #fff; }
.pv-list-meta { grid-column: 1; font-size: 0.8rem; color: var(--on-ink-muted); }
.pv-list .pv-badge { grid-column: 2; grid-row: 1 / span 2; }

.pv-badge {
  display: inline-block; padding: 0.15em 0.6em; border-radius: 99px; white-space: nowrap;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
  background: rgba(201, 184, 222, 0.16); color: var(--accent-soft);
}
.pv-badge.is-live { background: var(--accent); color: #fff; }

/* -------------------------------------------------------------- Sections */

.pv-section { padding: var(--s-5) 0; border-bottom: 1px solid var(--pv-rule); }
.pv-h2 { margin: 0 0 var(--s-2); font-family: var(--font-serif); font-size: clamp(1.6rem, 2.4vw, 2.1rem); font-weight: 400; line-height: 1.15; color: var(--ink); }
.pv-h3 { margin: 0 0 var(--s-2); font-family: var(--font-serif); font-size: 1.35rem; font-weight: 400; color: var(--ink); }
.pv-h4 { margin: 0 0 0.5rem; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-dark); }
.pv-lede { max-width: 70ch; margin: 0 0 var(--s-3); color: var(--pv-grey); }

.pv-table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--pv-rule); border-radius: 4px; background: #fff; }
.pv-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.pv-table th, .pv-table td { padding: 0.75rem 0.9rem; text-align: left; border-bottom: 1px solid var(--pv-rule); vertical-align: top; }
.pv-table thead th { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pv-grey); background: #F6F3F9; white-space: nowrap; }
.pv-table tbody tr:last-child > * { border-bottom: 0; }
.pv-table tbody th { font-weight: 600; white-space: nowrap; }
.pv-table tbody th a { color: var(--accent-dark); text-decoration: none; }
.pv-table tbody th a:hover { text-decoration: underline; }
.pv-table .pv-num { white-space: nowrap; }
.pv-table sup a { margin-left: 0.15em; color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.pv-year { color: var(--pv-grey); font-size: 0.85em; }
.pv-empty { color: #A8A3B0; }
.pv-needed { display: inline-block; margin-left: 0.3em; padding: 0.05em 0.5em; border-radius: 99px; background: #FFF0D9; color: #8A5A00; font-size: 0.72rem; font-weight: 600; }
.pv-notes { margin: var(--s-2) 0 0; padding-left: 1.4rem; font-size: 0.84rem; color: var(--pv-grey); }
.pv-notes li { margin: 0.2rem 0; }
.pv-notes a { color: var(--accent-dark); }

.pv-downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: var(--s-3) 0 0; font-size: 0.86rem; }
.pv-btn {
  display: inline-flex; align-items: center; gap: 0.4em; padding: 0.5em 0.95em; border: 1px solid var(--accent); border-radius: 2px;
  font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--accent-dark); background: #fff; text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pv-btn:hover { background: var(--accent); color: #fff; }

.pv-about-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s-5); }
.pv-prose { max-width: 68ch; font-size: 1.02rem; line-height: 1.65; }
.pv-prose h2 { margin: 1.6em 0 0.4em; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 400; color: var(--ink); }
.pv-prose h2:first-child { margin-top: 0; }
.pv-prose h3 { margin: 1.4em 0 0.4em; font-size: 1.05rem; color: var(--ink); }
.pv-prose p { margin: 0 0 1em; }
.pv-prose a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.pv-prose ul, .pv-prose ol { padding-left: 1.3rem; }
.pv-mapnotes { align-self: start; padding: var(--s-3); background: #F4F0F8; border-radius: 4px; font-size: 0.9rem; line-height: 1.55; }
.pv-mapnotes ul { margin: 0; padding-left: 1.1rem; }
.pv-mapnotes li { margin: 0 0 0.6em; }

/* ------------------------------------------------------------- Unit page */

.pv-uhero { background: #fff; border-bottom: 1px solid var(--pv-rule); padding: var(--s-4) 0; }
.pv-uhero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: var(--s-4); align-items: center; }
.pv-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 0; }
.pv-meta div { min-width: 0; }
.pv-meta dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pv-grey); }
.pv-meta dd { margin: 0.15rem 0 0; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.pv-status-note { max-width: 60ch; margin: var(--s-3) 0 0; padding: 0.8rem 1rem; border-left: 3px solid var(--accent); background: #F4F0F8; font-size: 0.92rem; line-height: 1.5; }
.pv-locator { margin: 0; }
.pv-locator figcaption { margin-top: 0.6rem; }
.pv-locator .pv-legend { color: var(--pv-grey); font-size: 0.74rem; }
.pv-legend.is-compact .pv-key-loc { border-top-color: var(--pv-grey); }
.pv-key-this { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pv-key-other { background: #5A447E; }
.pv-loc-unit { fill: #5A447E; stroke: var(--pv-border); stroke-width: 1.4; }
.pv-loc-this { fill: var(--accent-soft); }
.pv-loc-edge { fill: none; stroke: #fff; stroke-width: 4; stroke-linejoin: round; }
.pv-loc-ring { fill: none; stroke: #fff; stroke-width: 4; }

.pv-ubody { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s-5); padding-top: var(--s-4); padding-bottom: var(--s-4); }
.pv-usec { padding: 0 0 var(--s-4); margin: 0 0 var(--s-4); border-bottom: 1px solid var(--pv-rule); }
.pv-usec:last-child { border-bottom: 0; }
.pv-placeholder { margin: 0 0 var(--s-3); padding: 0.7rem 1rem; border: 1px dashed #D8C9A0; background: #FFFBEF; color: #7A6320; font-size: 0.88rem; }

.pv-notice { margin: 0 0 var(--s-4); padding: var(--s-3); border: 1px solid var(--pv-rule); border-left: 4px solid var(--accent); background: #fff; border-radius: 3px; }
.pv-notice p { margin: 0 0 0.7em; max-width: 64ch; line-height: 1.6; }
.pv-notice p:last-child { margin-bottom: 0; }
.pv-notice-h { font-family: var(--font-serif); font-size: 1.45rem; color: var(--ink); }
.pv-notice a { color: var(--accent-dark); font-weight: 600; }

.pv-figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1px; margin: 0; padding: 0; list-style: none; background: var(--pv-rule); border: 1px solid var(--pv-rule); }
.pv-fig { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.1rem; background: #fff; }
.pv-fig-value { font-family: var(--font-serif); font-size: 1.85rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pv-fig-label { font-weight: 600; font-size: 0.92rem; }
.pv-fig-meta { margin-top: auto; padding-top: 0.35rem; font-size: 0.78rem; color: var(--pv-grey); overflow-wrap: anywhere; }
.pv-fig-meta a { color: var(--accent-dark); }
.pv-fig-meta sup a { margin-left: 0.15em; text-decoration: none; font-weight: 600; }

.pv-related { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-3); }
.pv-rel-group ul { margin: 0; padding: 0; list-style: none; }
.pv-rel-group li { padding: 0.45rem 0; border-top: 1px solid var(--pv-rule); font-size: 0.95rem; line-height: 1.4; }
.pv-rel-group a { color: var(--ink); font-weight: 600; text-decoration: none; }
.pv-rel-group a:hover { color: var(--accent-dark); text-decoration: underline; }

.pv-sources { margin: 0; padding-left: 1.4rem; font-size: 0.92rem; line-height: 1.5; }
.pv-sources li { margin: 0 0 0.45em; overflow-wrap: anywhere; }
.pv-sources a { color: var(--accent-dark); }
.pv-sources li:target { background: #FFF4D6; }

.pv-cite { padding: 1rem 1.1rem; background: #F4F0F8; border-radius: 3px; }
.pv-cite-label { margin: 0 0 0.3rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-dark); }
.pv-cite-text { margin: 0 0 0.7rem; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }

.pv-uside { display: flex; flex-direction: column; gap: var(--s-3); }
.pv-side-card { padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--pv-rule); border-radius: 3px; }
.pv-side-card p { margin: 0 0 0.5rem; font-size: 0.88rem; }
.pv-side-h { font-size: 0.7rem !important; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-dark); }
.pv-side-list { margin: 0 0 0.6rem; padding: 0; list-style: none; }
.pv-side-list a { display: block; padding: 0.35rem 0.5rem; margin: 0 -0.5rem; border-radius: 2px; text-decoration: none; font-size: 0.93rem; }
.pv-side-list a:hover { background: #F4F0F8; }
.pv-side-list a[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 600; }
.pv-side-all { display: inline-flex; align-items: center; gap: 0.35em; color: var(--accent-dark) !important; font-weight: 600; text-decoration: none; }
.pv-uside .pv-downloads { margin: 0; }

.pv-pager { display: flex; justify-content: space-between; gap: var(--s-2); padding-top: var(--s-3); padding-bottom: var(--s-5); }
.pv-pager a { display: flex; flex-direction: column; gap: 0.15rem; font-weight: 600; color: var(--accent-dark); text-decoration: none; }
.pv-pager a:hover { text-decoration: underline; }
.pv-pager .pv-muted { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.pv-pager-next { text-align: right; margin-left: auto; }

/* -------------------------------------------------------------- Responsive */

@media (max-width: 960px) {
  .pv-mapgrid { grid-template-columns: minmax(0, 1fr); }
  .pv-about-grid, .pv-uhero-grid, .pv-ubody { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .pv-locator { max-width: 520px; }
}
@media (max-width: 640px) {
  .pv-wrap { padding: 0 var(--s-2); }
  .pv-hero { padding: var(--s-3) 0 var(--s-4); }
  .pv-mapgrid { margin-top: var(--s-3); padding: 0; }
  .pv-map .pv-svg { border-radius: 0; }
  .pv-map figcaption, .pv-list { margin-left: var(--s-2); margin-right: var(--s-2); }
  .pv-label-full, .pv-ctx-label { display: none; }
  .pv-label-short { display: inline; }
  .pv-card { width: min(250px, calc(100% - 1.5rem)); }
  .pv-section { padding: var(--s-4) 0; }
  .pv-table th, .pv-table td { padding: 0.6rem 0.7rem; }
  .pv-fig-value { font-size: 1.55rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pv-unit path, .pv-list a, .pv-btn { transition: none; }
}

/* ------------------------------------------------------------------ Admin */

.pa-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem; }
.pa-errors { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.pa-meter { display: inline-flex; gap: 3px; vertical-align: middle; }
.pa-meter span { width: 14px; height: 8px; border-radius: 2px; background: #E4E1EA; }
.pa-meter span.is-on { background: var(--accent); }
