/* Paper Trail Politics link & button system v1 (owner-approved Nov 25-26, 2026).
   Rules are scoped to html.ptp-ls-test; add ?ptp-links=off to a page address to see it without them.
   Source: assets/components/link-system-v1/. Review pages: /prototypes/archetype-review/buttons/. */
html.ptp-ls-test {
  --ls-navy: #082f49; --ls-teal: #16766f; --ls-teal-hover: #105f59; --ls-teal-edge: #0a4945; --ls-teal-tint: #edf5f3;
  --ls-gold-ink: #876019; --ls-gold-paper: #f2ce83; --ls-gold-hover: #dfb45d; --ls-gold-edge: #8f6c2d; --ls-fold: #174d68;
  --ls-dark-gold: #e0bd68; --ls-dark-mint: #6fcfbf; --ls-dark-sky: #8ec5ff; --ls-ring-dark: #f2c76d;
}

/* Page icon P3: lowered P, color follows the text beside it */
html.ptp-ls-test .ptp-inline-page-mark {
  --ptp-inline-page-mark-color: currentColor !important;
  border-color: currentColor !important; color: currentColor !important;
}
html.ptp-ls-test .ptp-inline-page-mark::after { transform: translate(-1px, 2px) !important; }

/* Box icon replaces the "↗" external arrow everywhere */
html.ptp-ls-test .ptp-external-link-icon {
  display: inline-block !important; width: 14px !important; height: 14px !important; flex: 0 0 14px;
  margin-left: 5px; font-size: 0 !important; line-height: 0 !important; vertical-align: -2px;
  overflow: hidden; align-self: center;
  color: inherit !important; background: currentColor !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 2.5h4v4'/%3E%3Cpath d='M13.5 2.5L7.5 8.5'/%3E%3Cpath d='M12.5 9.5v3.2a.8.8 0 0 1-.8.8H3.3a.8.8 0 0 1-.8-.8V4.3a.8.8 0 0 1 .8-.8h3.2'/%3E%3C/svg%3E") center / 14px 14px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 2.5h4v4'/%3E%3Cpath d='M13.5 2.5L7.5 8.5'/%3E%3Cpath d='M12.5 9.5v3.2a.8.8 0 0 1-.8.8H3.3a.8.8 0 0 1-.8-.8V4.3a.8.8 0 0 1 .8-.8h3.2'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
}

/* Text links by destination (light backgrounds) */
html.ptp-ls-test a.ls-ext { color: var(--ls-navy) !important; text-decoration-color: currentColor; }
html.ptp-ls-test a.ls-ext, html.ptp-ls-test a.ls-ext > span:not(.ptp-external-link-icon) { text-decoration-line: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
html.ptp-ls-test a.ls-page { color: var(--ls-teal) !important; }
html.ptp-ls-test a.ls-page .ptp-internal-link-icon { color: inherit !important; }
html.ptp-ls-test a.ls-tool { color: var(--ls-gold-ink) !important; text-decoration: underline; text-underline-offset: 3px; }
/* D1 on dark backgrounds */
html.ptp-ls-test a.ls-ext.ls-dark { color: var(--ls-dark-sky) !important; }
html.ptp-ls-test a.ls-page.ls-dark { color: var(--ls-dark-mint) !important; }
html.ptp-ls-test a.ls-tool.ls-dark { color: var(--ls-dark-gold) !important; }

/* 7A / 10C: card footers ("Open Election Page") — page icon + label + arrow, centered, all teal */
html.ptp-ls-test :is(.precinct-race-card, .precinct-measure-card) strong {
  justify-content: center !important; align-items: center !important; gap: 8px !important; color: var(--ls-teal);
}
html.ptp-ls-test :is(.precinct-race-card, .precinct-measure-card) strong i { color: currentColor !important; margin-left: 0 !important; }
html.ptp-ls-test .precinct-race-card.is-inactive strong { color: #5f6f72; }

/* 2B: raised gold with folded corner for site tools (non-page places) */
html.ptp-ls-test :is(.sh-jump, .ptp-action.primary) {
  position: relative; border-radius: 0 !important; border: 1px solid var(--ls-gold-edge) !important;
  color: var(--ls-navy) !important; padding-right: 30px !important;
  background: linear-gradient(to bottom left, transparent 50%, var(--ls-fold) 50%) top right / 14px 14px no-repeat, var(--ls-gold-paper) !important;
  clip-path: polygon(-1px -1px, calc(100% - 14px) -1px, calc(100% + 1px) 14px, calc(100% + 1px) calc(100% + 4px), -1px calc(100% + 4px));
  box-shadow: none !important; filter: drop-shadow(0 3px 0 var(--ls-gold-edge)); transition: background-color 120ms ease;
}
html.ptp-ls-test :is(.sh-jump, .ptp-action.primary):hover {
  background: linear-gradient(to bottom left, transparent 50%, var(--ls-fold) 50%) top right / 14px 14px no-repeat, var(--ls-gold-hover) !important;
}
html.ptp-ls-test a.ptp-page-link {
  clip-path: polygon(-1px -1px, calc(100% - var(--ptp-page-link-corner)) -1px, calc(100% + 1px) var(--ptp-page-link-corner), calc(100% + 1px) calc(100% + 4px), -1px calc(100% + 4px)) !important;
  filter: drop-shadow(0 3px 0 var(--ls-gold-edge));
}
html.ptp-ls-test :is(.sh-jump, .ptp-action.primary, a.ptp-page-link):active { transform: translateY(2px); filter: drop-shadow(0 1px 0 var(--ls-gold-edge)); }

/* 3A: external action buttons are white raised with the box icon */
html.ptp-ls-test .election-registration-link {
  background: #fff !important; color: var(--ls-navy) !important; border: 1px solid #aabcbf !important; border-radius: 4px !important;
  box-shadow: 0 3px 0 #8b9fa3 !important; text-decoration: none !important;
}
html.ptp-ls-test .election-registration-link:hover { background: var(--ls-teal-tint) !important; border-color: var(--ls-teal) !important; }
html.ptp-ls-test .election-registration-link:active { transform: translateY(2px); box-shadow: 0 1px 0 #8b9fa3 !important; }

/* 1A: teal page buttons, raised with the locked 3px edge */
html.ptp-ls-test :is(.county-picker-open, .county-preview-link) {
  border-radius: 4px !important; box-shadow: 0 3px 0 var(--ls-teal-edge) !important;
}
html.ptp-ls-test :is(.county-picker-open, .county-preview-link):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ls-teal-edge) !important; }

/* 5A: filter chips are pills; the selected chip is navy */
html.ptp-ls-test .election-office-filter button { border-radius: 999px !important; }
html.ptp-ls-test .election-office-filter button:is(.is-active, [aria-pressed="true"]) {
  background: var(--ls-navy) !important; border-color: var(--ls-navy) !important; color: #fff !important;
}
html.ptp-ls-test .election-office-filter button:not(:disabled):not(.is-active):hover { background: var(--ls-teal-tint) !important; border-color: var(--ls-teal) !important; }
html.ptp-ls-test .state-stat-option:is(.is-active, [aria-pressed="true"]) {
  background: var(--ls-navy) !important; color: #fff !important; border-color: var(--ls-navy) !important;
}

/* 8A: surface-aware focus rings */
html.ptp-ls-test :is(a, button, summary, select, input, [tabindex]):focus-visible {
  outline: 3px solid var(--ls-navy) !important; outline-offset: 3px !important;
}
html.ptp-ls-test [data-ls-focus="dark"]:focus-visible { outline-color: var(--ls-ring-dark) !important; }

/* ---- Round 2 (owner feedback, Nov 26) ---- */

/* 1. One drawn arrow (13x10, whole pixels) for every "→" on page links and buttons */
html.ptp-ls-test :is(.ptp-internal-link-icon, .state-organizations-arrow),
html.ptp-ls-test :is(.precinct-race-card, .precinct-measure-card) strong i {
  position: relative !important; display: inline-block !important; width: 13px !important; height: 10px !important;
  flex: 0 0 13px !important; overflow: hidden !important; font-size: 0 !important; line-height: 0 !important;
  text-indent: 0 !important; vertical-align: 0 !important; color: inherit !important; margin-left: 0 !important;
}
html.ptp-ls-test :is(.ptp-internal-link-icon, .state-organizations-arrow)::before,
html.ptp-ls-test :is(.precinct-race-card, .precinct-measure-card) strong i::before {
  content: "" !important; position: absolute !important; top: 4px !important; left: 0 !important; right: auto !important;
  width: 11px !important; height: 2px !important; background: currentColor !important; border: 0 !important; transform: none !important;
}
html.ptp-ls-test :is(.ptp-internal-link-icon, .state-organizations-arrow)::after,
html.ptp-ls-test :is(.precinct-race-card, .precinct-measure-card) strong i::after {
  content: "" !important; position: absolute !important; top: 5px !important; right: 1px !important; left: auto !important;
  width: 6px !important; height: 6px !important; box-sizing: content-box !important; background: none !important;
  border: 0 solid currentColor !important; border-top-width: 2px !important; border-right-width: 2px !important;
  transform: translateY(-50%) rotate(45deg) !important;
}

/* 2. Jump-within-this-page buttons: gold rectangle with folded corner, icon left, up/down arrow right */
html.ptp-ls-test a.ls-jump {
  position: relative; display: inline-flex !important; align-items: center !important; gap: 8px !important;
  min-height: 42px; padding: 8px 32px 8px 15px !important; border-radius: 0 !important;
  border: 1px solid var(--ls-gold-edge) !important; color: var(--ls-navy) !important; font-weight: 800 !important;
  text-decoration: none !important; box-shadow: none !important;
  background: linear-gradient(to bottom left, transparent 50%, var(--ls-fold) 50%) top right / 14px 14px no-repeat, var(--ls-gold-paper) !important;
  clip-path: polygon(-1px -1px, calc(100% - 14px) -1px, calc(100% + 1px) 14px, calc(100% + 1px) calc(100% + 4px), -1px calc(100% + 4px));
  filter: drop-shadow(0 3px 0 var(--ls-gold-edge));
}
html.ptp-ls-test a.ls-jump:hover {
  background: linear-gradient(to bottom left, transparent 50%, var(--ls-fold) 50%) top right / 14px 14px no-repeat, var(--ls-gold-hover) !important;
}
html.ptp-ls-test a.ls-jump:active { transform: translateY(2px); filter: drop-shadow(0 1px 0 var(--ls-gold-edge)); }
html.ptp-ls-test a.ls-jump svg { flex: 0 0 auto; }
.ls-jump-arrow { position: relative; display: inline-block; width: 10px; height: 13px; flex: 0 0 10px; }
.ls-jump-arrow::before { content: ""; position: absolute; left: 4px; top: 0; width: 2px; height: 11px; background: currentColor; }
.ls-jump-arrow::after {
  content: ""; position: absolute; left: 1.5px; top: 4px; width: 7px; height: 7px; box-sizing: border-box;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.ls-jump-arrow.is-up { transform: rotate(180deg); }

/* 3. News stories link to outside sites: dark blue, not teal */
html.ptp-ls-test .news-card :is(.news-card-source, strong) { color: var(--ls-navy) !important; }
html.ptp-ls-test .news-card:hover strong { text-decoration: underline; text-underline-offset: 3px; }

/* ---- Round 3 (Riverside County, Nov 26): buttons sorted by destination ---- */
/* 1A: link to another page = teal raised, white page icon + arrow */
html.ptp-ls-test a.ls-btn.ls-btn-page {
  background: var(--ls-teal) !important; color: #fff !important; border: 1px solid #0e5a54 !important;
  border-radius: 4px !important; clip-path: none !important; filter: none !important;
  box-shadow: 0 3px 0 var(--ls-teal-edge) !important; text-decoration: none !important;
  display: inline-flex !important; align-items: center !important; justify-content: center; gap: 8px !important;
}
html.ptp-ls-test a.ls-btn.ls-btn-page.ptp-page-link { padding: 7px 14px !important; }
html.ptp-ls-test a.ls-btn.ls-btn-page.ptp-page-link::before { display: none !important; }
html.ptp-ls-test a.ls-btn.ls-btn-page:hover { background: var(--ls-teal-hover) !important; color: #fff !important; }
html.ptp-ls-test a.ls-btn.ls-btn-page:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ls-teal-edge) !important; }
/* 3A/4A: link to an outside site = white raised, navy text, box icon, sentence case */
html.ptp-ls-test a.ls-btn.ls-btn-ext {
  background: #fff !important; color: var(--ls-navy) !important; border: 1px solid #aabcbf !important; border-radius: 4px !important;
  box-shadow: 0 3px 0 #8b9fa3 !important; text-decoration: none !important; text-transform: none !important; letter-spacing: normal !important;
  display: inline-flex !important; align-items: center !important; gap: 6px !important;
}
html.ptp-ls-test a.ls-btn.ls-btn-ext:hover { background: var(--ls-teal-tint) !important; border-color: var(--ls-teal) !important; }
html.ptp-ls-test a.ls-btn.ls-btn-ext:active { transform: translateY(2px); box-shadow: 0 1px 0 #8b9fa3 !important; }
html.ptp-ls-test a.ls-btn.ls-btn-ext .ptp-external-link-icon { margin-left: 2px; }
/* 2B: site tools (Government Atlas, Find an Error) = gold with folded corner */
html.ptp-ls-test a.ls-btn.ls-btn-tool:not(.ptp-page-link) {
  display: inline-flex !important; align-items: center !important; gap: 8px !important;
  border-radius: 0 !important; border: 1px solid var(--ls-gold-edge) !important; color: var(--ls-navy) !important;
  padding-right: 30px !important; box-shadow: none !important;
  background: linear-gradient(to bottom left, transparent 50%, var(--ls-fold) 50%) top right / 14px 14px no-repeat, var(--ls-gold-paper) !important;
  clip-path: polygon(-1px -1px, calc(100% - 14px) -1px, calc(100% + 1px) 14px, calc(100% + 1px) calc(100% + 4px), -1px calc(100% + 4px));
  filter: drop-shadow(0 3px 0 var(--ls-gold-edge));
}
/* map attribution and controls are left alone */
html.ptp-ls-test .leaflet-container .ptp-external-link-icon[data-ls-added] { display: none !important; }

/* ---- Round 3b ---- */
html.ptp-ls-test a.ls-btn-page svg { display: none !important; }            /* the P page icon replaces other page glyphs */
html.ptp-ls-test:not(#ls-specificity) a.ls-inline .ptp-internal-link-icon { margin-left: 6px !important; }
html.ptp-ls-test:not(#ls-specificity) a.ls-inline .ptp-inline-page-mark { margin-right: 5px !important; }
html.ptp-ls-test .ls-sel { background: var(--ls-navy) !important; border-color: var(--ls-navy) !important; color: #fff !important; }
html.ptp-ls-test .ls-sel * { color: inherit !important; }

/* ---- Round 4 (other page families, Nov 27): breadcrumbs stay plain text links, no page icon or arrow ---- */
html.ptp-ls-test :is(nav[aria-label="Breadcrumb" i], .breadcrumbs, .breadcrumb, .ptp-breadcrumbs, .ptp-breadcrumb, .entity-breadcrumbs, .rei-crumbs, .candidate-breadcrumbs, .family-breadcrumbs, .story-breadcrumbs, .directory-breadcrumbs, .candidate-directory-breadcrumbs, .offices-breadcrumbs) :is(.ptp-inline-page-mark, .ptp-internal-link-icon) { display: none !important; }
html.ptp-ls-test a.ls-page + a.ls-page { margin-left: 14px !important; }
