:root {
  --bglv00: #000000;
  --bglv0: #0a0a0a;
  --bglv1: #181818;
  --bglv2: #1c1c1c;
  --bglv3: #202020;
  --bglv4: #414141;
  --fglv0: #ece8e8;
  --fglv1: #c2c4c6;
  --fglv2: #a4a7a7;
  --fglv3: #777777;
  --fglink: #74bde8;
  --borderColor: #323232;
  --bgactive: #cfd741;
  --fgactive: #000000;
  --radii: 4px;
}

/* Support iOS dynamic type */
@supports (-webkit-touch-callout: none) {
  :root {
    font: -apple-system-body;
  }
}

html {
  font-size: 13px;
}

body,
button,
textarea,
input {
  font-family: system-ui, sans-serif;
  color: var(--fglv0);
}

select,
button {
  box-sizing: border-box;
}

body {
  word-wrap: break-word;
  font-size: 1.02rem;
  margin: 20px;
  padding: 0;
  background: var(--bglv0);
  background-repeat: repeat;
  background-size: 100px 100px;
  line-height: 1.7em;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
}

a { 
  text-underline-offset: 0.2em;
  color: var(--fglink);
}

footer,
main,
header {
  text-align: center;
  margin: 20px auto;
}

footer,
header,
main {
  width: 100%;
  max-width: 48em;
  margin: auto;
}

footer {
  padding: 2em 0;
}

label {
  display: block;
}

textarea,
select,
input,
button {
  font-size: inherit;
  border-radius: var(--radii);
  padding: 16px; 
  background: var(--bglv0);
  border: 0.5px solid var(--borderColor);
  box-shadow: 1px 1px 0 0px var(--bglv0);
  transform: scale(1, 0.97);
  color: var(--fglv0);
  letter-spacing: 1px;
}

*::placeholder {
  color: var(--fglv3);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 1em 0;
}

button, .button {
  padding: 14px 16px 18px;
  border-radius: 3px;
  font-size: inherit;
  background: var(--bglv1);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 1px 1px 0 0px var(--bglv0);
}

button:focus, .button:focus, select:focus, input:focus {
  box-shadow: none;
}

select:disabled {
  opacity: 0.7;
}

a.button {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

button[type="submit"], .button\:type-submit {
  background: var(--bglv2);
}

code, pre, .code {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;  
  font-size: 0.95em;
}

em {
  color: var(--fglv2);
}

blockquote {
  border: 0;
  padding: 20px 25px;
  position: relative;
  background: none;
  word-wrap: break-word;
  max-width: 100%;
  margin: 10px 0;
}

blockquote:before {
  left: 0;
  top: 0;
  border-image-width: 20px 0 0 20px;
}

blockquote:after {
  right: 0;
  bottom: 0;
  border-image-width: 0 20px 20px 0;
}

blockquote ~ cite {
  border-left: 4px solid var(--borderColor);
  padding-left: 16px;
}

pre {
  border: 1px solid var(--borderColor);
  overflow: auto;
  padding: 0.4em 0.8em;
  white-space: pre-wrap;
}

.h2 {
  text-wrap: balance;
  margin: 80px 0;
  font-family: monospace;
  display: inline-block;
  font-size: 1.2rem;
  color: var(--fglv1);
  transform: scale(1, 0.92);
  border-image: url('/assets/rec.png') 45 / 20px round ;
  border-image-width: 0 0 20px 0;
  padding: 0 2px 8px;
  letter-spacing: 1px;
}

.bordered {
  border-image: url('/assets/border.png') 45 / 20px round ;
  border-image-width: 0 0 20px 0;
}

h3 {
  margin: 1.6em 0;
}

.h2 + h3 {
  margin-top: 0;
}

.submit {
  white-space: nowrap;
  margin: 0 0.4em;
}

.title {
  max-width: 12em;
}

.links {
  display: inline-flex;
  gap: 1em;
  flex-wrap: wrap;
  align-items: center;
}

.links a {
  white-space: nowrap;
}

.relevant-links {
  text-align: center;
}

@media (max-width: 500px) {
  input, button, select {
    font-size: max(16px, 1rem);
  }

  select {
    width: 100%;
  }

  .images {
    flex-wrap: wrap;
  }
}

*:focus-visible {
  outline: 4px solid var(--borderColor);
  outline-offset: 2px;
}

dialog {
  border: 0;
  background: transparent;
  text-align: center;
  box-sizing: border-box;
  padding: 0;
}

.text-mw {
  width: 28em;
  max-width: 100%;
  text-align: left;
  margin: 1em auto;
}

.note {
  font-size: 0.9em;
  margin-bottom: 0.4em;
}

.touch-link {
  align-self: center;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}

.text-link svg,
.touch-link svg {
  position: relative;
  top: -1.5px;
  margin-left: 0em;
  height: 1ch;
}

[data-name-map]:after { content: ' - ' }

.petition {
  text-align: left;
  margin-bottom: 1em;
}

.sr-only {
	border: 0 !important;
	clip: rect(1px, 1px, 1px, 1px) !important;
	-webkit-clip-path: inset(50%) !important
  clip-path: inset(50%) !important;
	height: 1px !important;
	margin: -1px !important;
	overflow: hidden !important;
	padding: 0 !important;
	position: absolute !important;
	width: 1px !important;
	white-space: nowrap !important;
}

.eligibility label {
  font-size: 1.1em;
  margin-bottom: 0.4em;
}

.eligibility input {
  vertical-align: center;
  position: relative;
  margin-right: 0.4em;
}

.non-district {
  padding: 0;
  margin: 2em 0;
}

.person {
  display: flex;
  gap: 1em;
  align-items: start;
  padding: 1em 0;
  margin-bottom: 1em;
}

.person .avatar {
  max-width: 20vw;
  width: 100px;
  filter: sepia();
  border-radius: 50%;
}

.person h3 {
  margin: 0 0 0.4em;
}

.quote {
  text-align: left;
  flex: 1 1 auto;
}

.party {
  margin-top: -0.6em;
  font-size: 0.9em;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

body:has(dialog[open]) {
  filter: blur(0.1rem);
}

body:has(dialog[open]) main {
  opacity: 0.3;
}

cite { font-style: normal; }
cite:after { content: '[]'; vertical-align: super; font-size: 0.4em; line-height: 0; }
cite > a:after { content: '' !important; }

a[href^='http']:not([target], .button, [href^='https://bafu.tw/']) {
  margin-right: 0.2em;
}

a[href^='http']:not([target], .button, [href^='https://bafu.tw/']):after {
  content: '┓' / ', external';
  font-size: 0.5em;
  text-decoration: none;
  position: absolute;
  margin-top: -1.05em;
}

svg:has(use) {
  overflow: visible;
}

.dialog-wrap {
  border: 1px solid var(--borderColor);
  padding: 25px;
  background-color: var(--bglv0);
  color: var(--fglv1);
  border-radius: var(--radii);
}

.search-form > * {
  text-align: left;
}

.search-form label {
  margin-bottom: 0em;
  font-size: 0.9em;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  text-align: center;
  align-items: end;
}

select {
  padding: 14px 36px 18px 16px;
  appearance: none;
  background: var(--bglv0);
  background-image: url(/assets/triangle.svg);
  background-repeat: no-repeat;
  background-size: 10px;
  background-position: calc(100% - 10px) center;
}

.block-links {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: stretch;
}

.clickable {
  background-color: var(--bglv1);
  border: 1px solid var(--bglv3);
  border-radius: var(--radii);
}

.block-links a {
  flex: 1 0 auto;
  padding: 15px 10px;
}

.block-links path {
  fill: unset !important;
  stroke: currentColor;
}

.map {
  display: flex;
  font-weight: bold;
  font-size: 1.1em;
  align-items: center;
  justify-content: center;
  gap: 1em;
  letter-spacing: 1px;
  line-height: 2em;
  transition: transform 0.3s;
}

.map:hover { color: var(--fglink); transform: scale(1.05) }
.map path { fill: currentColor; }

h1.h1-vid {
  margin: 80px auto 60px;
}

.video-logo {
  margin-top: 0px;
  height: 100px;
}

.pane {
  border: 1px solid var(--borderColor);
  border-radius: var(--radii);
  background: var(--bglv2);
  padding: 20px;
}

.subtitle {
  margin-bottom: 4px;
  color: var(--fglv2);
}

hr {
  margin: 25px 0;
  border-style: dotted;
  border-top: 0;
  border-color: var(--borderColor);
}

button[aria-label="關閉"] {
  border: 0;
  background: transparent;
  color: var(--fglv2);
  padding: 0;
  font-size: 18px;
  font-weight: normal;
  position: absolute;
  right: 0;
  box-shadow: none;
  line-height: 0px;
  top: 0;
  height: 25px;
  border-radius: 50%;
  margin: 10px;
  aspect-ratio: 1;
}

body:has(:target):not(:has([data-default]:target)) .to-top-link {
  display: block;
}

.to-top-link {
  display: none;
  position: fixed;
  background-color: var(--bglv1);
  border: 1px solid var(--bglv0);
  border-radius: var(--radii);
  text-align: center;
  padding: 10px 20px;
  bottom: 20px;
  right: 20px;
  z-index: 1;
}

@media (max-width: 500px) {
  .to-top-link { 
    left: 20px;
    border-radius: 0;
    border: 1px solid var(--borderColor);
    background-color: var(--bglv1);
  }
}
