Colvin, Justice. This case requires us to determine whether a child charged with delinquency based on an alleged violation of Georgia’s Criminal Code may assert an affirmative defense of insanity or delusional compulsion, under OCGA §§ 16-3-2 or 16-3-3, in a juvenile-court proceeding. The Juvenile Code does not expressly state whether affirmative defenses provided for in the Criminal Code are available in juvenile court. Based on the Juvenile Code’s text and structure, however, we conclude that insanity and delusional-compulsion defenses are available in most delinquency proceedings. As explained below, we specifically hold that, in a delinquency proceeding, a child may assert an insanity or delusional-compulsion defense under OCGA §§ 16-3-2 or 16-3-3 when the child’s delinquency charge is based on an allegation that the child committed “[a]n act . . . designated a crime by the laws of this state.” OCGA § 15-11-2 (19) (A). Because the juvenile court erred in concluding that a child could never raise an insanity or delusional- compulsion defense in a delinquency proceeding, we vacate the court’s order denying the motion of T.B., a minor, which sought a forensic psychological evaluation for purposes of raising a defense under OCGA §§ 16-3-2 or 16-3-3, and we remand the case for further proceedings consistent with this opinion. 1. In 2019, the State filed a delinquency petition in juvenile court, alleging that T.B. was a delinquent child. According to the petition, on January 24, 2019, T.B., who was then 16 years old, attempted to evade the police by entering a hotel in Savannah and locking himself in the hotel’s storage closet. When officers attempted to remove T.B. from the closet, the petition alleged, T.B. pushed the officers, attempted to strike and bite the officers, and assaulted one officer with liquid glass cleaner, which T.B. poured on the officer’s face such that some of the liquid went down the officer’s throat. The petition further alleged that officers found marijuana and marijuana-related paraphernalia in T.B.’s possession. Based on these allegations, the petition charged T.B. with aggravated assault on a peace officer, see OCGA § 16-5-21, aggravated battery, see OCGA § 16-5-24, two counts of obstruction of an officer, see OCGA § 16-10-24 (b), possession of less than an ounce of marijuana, see OCGA § 16-13-30 (j), two counts of possession of drug related objects, see OCGA § 16-13-32.2, and two counts of criminal trespass, see OCGA § 16-7-21 (a) and (b). Following a detention hearing, the juvenile court ordered that T.B. receive a psychological evaluation and be released the next day on house arrest with conditions. Before he was released, however, T.B. was involuntarily hospitalized for several days, pursuant to OCGA § 37-3-41 (a),[1] because he was experiencing symptoms of psychosis, including delusions. Approximately four months later, a forensic psychologist performed a competency evaluation. The psychologist noted that T.B. had previously been diagnosed with, among other things, Unspecified Schizophrenia Spectrum and Other Psychotic Disorders, Substance Induced Psychotic Disorder, Oppositional Defiant Disorder, and Schizotypal Personality Disorder. The psychologist diagnosed T.B. with Schizophreniform Disorder, in Partial Remission, and concluded that T.B. understood the nature of the proceedings and was capable of assisting his attorney with his defense. Based on the competency evaluation, the juvenile court found T.B. competent to proceed. Prior to the adjudication hearing, T.B. filed a notice of intent to offer a defense of insanity or delusional compulsion and moved the juvenile court to order a forensic psychological evaluation to determine whether he was incapable of appreciating the wrongfulness of his acts when the incident occurred. During a hearing on the matter, T.B.’s counsel acknowledged that the Juvenile Code did not specifically address whether insanity and delusional-compulsion defenses were available in delinquency proceedings. Relying in part on constitutional principles of due process and equal protection, however, counsel argued that T.B. should be permitted to assert such a defense.[2] The juvenile court rejected T.B.’s arguments and ruled that insanity and delusional- compulsion defenses are unavailable in juvenile-court proceedings. The court reasoned that insanity is irrelevant in a delinquency proceeding because an insanity defense seeks to establish that a defendant is not “guilty,” and delinquency proceedings do not adjudicate “guilt.” The court further reasoned that the Juvenile Code does not expressly provide for an insanity defense, even though it refers to an alibi defense, and that children do not have a constitutional right to raise an insanity defense in delinquency proceedings. Accordingly, the court prohibited T.B. from asserting such defenses and denied his request for a forensic evaluation.[3] 2. As a general matter, delinquency proceedings operate in a manner analogous to criminal cases. They begin when the State files “[a] petition alleging delinquency” in juvenile court. OCGA § 15-11-520. The case then moves to an adjudication phase, where the juvenile court holds a hearing to determine whether the child committed “the delinquent acts” alleged in the delinquency petition. Id. § 15-11-582 (b) (1), (d), (e). If the court finds “beyond a reasonable doubt” that the “child has committed a delinquent act,” the case proceeds to a disposition phase, where the court will enter a disposition order if it finds that the child is “in need of treatment or rehabilitation.” Id. §§ 15-11-582 (e); 15-11-600 (b); 15-11-601 (a). The question here is whether, during the adjudication phase of a juvenile-court proceeding, a child who has been charged with having committed a “delinquent act” by virtue of having committed a crime under state law may raise an affirmative defense of insanity or delusional compulsion. Georgia’s Criminal Code incorporates two insanity defenses. See Clark v. State, 245 Ga. 629, 629 (1) (266 SE2d 466) (1980); see also OCGA § 17-7-131 (a) (1) (defining “[i]nsane at the time of the crime” as “meeting the criteria of Code Section 16-3-2 or 16-3-3″). First, OCGA § 16-3-2 recognizes a defense of insanity based on mental incapacity, providing that [a] person shall not be found guilty of a crime if, at the time of the act, omission, or negligence constituting the crime, the person did not have mental capacity to distinguish between right and wrong in relation to such act, omission, or negligence. OCGA § 16-3-2. Second, OCGA § 16-3-3 recognizes an insanity defense based on delusional compulsion, providing that [a] person shall not be found guilty of a crime when, at the time of the act, omission, or negligence constituting the crime, the person, because of mental disease, injury, or congenital deficiency, acted as he did because of a delusional compulsion as to such act which overmastered his will to resist committing the crime. OCGA § 16-3-3. The delusional-compulsion defense applies only when a defendant both “suffer[ed] under delusions of an absurd and unfounded nature” and “was compelled by that delusion to act in a manner that would have been lawful and right if the facts had been as the defendant imagined them to be.” McElrath v. State, 308 Ga. 104, 107 (1) (b) (839 SE2d 573) (2020) (citation and punctuation omitted). Georgia’s insanity defenses are “affirmative defenses.” See McClure v. State, 306 Ga. 856, 857-858 (1) (834 SE2d 96) (2019) (noting that many affirmative defenses are found in Chapter 3 of Georgia’s Criminal Code, where the insanity defenses are codified); Jackson v. State, 301 Ga. 878, 881 (3) (804 SE2d 357) (2017) (discussing a defendant’s burden to prove the “affirmative defense of insanity”). In other words, by raising an affirmative defense of insanity or delusional compulsion under OCGA §§ 16-3-2 or 16-3-3, “a defendant argues that he should be acquitted of the offense regardless of whether he committed the act charged because of circumstances other than those that make out the material allegations of the charging instrument.” McClure, 306 Ga. at 859860 (1). 3. Juvenile-court proceedings are governed by the Juvenile Code, OCGA § 15-11-1 et seq. Accordingly, to determine whether insanity defenses under OCGA §§ 16-3-2 and 16-3-3 are available to children charged with delinquency in juvenile-court proceedings, we turn first to the Juvenile Code’s text. See In the Interest of K.S., 303 Ga. 542, 543 (814 SE2d 324) (2018). “[W]e must give the statutory text its plain and ordinary meaning, viewing it in the context in which it appears, and reading it in its most natural and reasonable way.” Id. “For context, we may look to other provisions of the same statute, the structure and history of the whole statute, and the other law—constitutional, statutory, and common law alike—that forms the legal background of the statutory provision in question.” Id. at 543-544 (punctuation omitted). Although “our interpretive task [often] begins and ends with the text itself,” Bell v. Hargrove, 313 Ga. 30, 32 (2) (867 SE2d 101) (2021), the Juvenile Code does not expressly address whether a child may raise an insanity defense in a delinquency proceeding. The juvenile court reasoned that the Code’s reference to an alibi defense in OCGA § 15-11-543 implied that affirmative defenses, such as insanity, are unavailable in delinquency proceedings. This rationale, however, misconstrues the Code, which does not expressly state that any defenses or affirmative defenses are available in delinquency proceedings. True, we can infer that an alibi defense must be available in delinquency proceedings from the fact that the Juvenile Code sets out specific notice requirements for raising and rebutting an alibi defense. See id. § 15-11-543 (a)-(e).[4] But we cannot infer from the fact that the Code incorporates specific procedural rules applicable to one defense that other defenses are unavailable. Moreover, such reasoning would lead to a counterintuitive result contrary to the statement of legislative purpose in the Juvenile Code’s codified preamble, which states that the Code seeks to “mitigate the adult consequences of criminal behavior” and “accord due process of law to each child who is accused of having committed a delinquent act.” OCGA § 15-11-470 (1), (2). See also City of Marietta v. Summerour, 302 Ga. 645, 652 n.3 (2) (807 SE2d 324) (2017) (“[C]odified preambles are part of the [statutory] act and appropriate to read in pari materia.” (emphasis, citation, and punctuation omitted)). “By contrast [with affirmative defenses], a defense such as alibi . . . directly challenge [s] elements of the offense.” McClure, 306 Ga. at 860 n.7 (1). Thus, if the Code’s single reference to the alibi defense meant that a child could not raise any other defenses, the result would be that a child without an alibi defense could not raise any challenge to a delinquency charge, even a defense that challenged the elements of the charged offense. Aside from being a strained reading of the Juvenile Code and likely unconstitutional, such an interpretation would conflict with the codified preamble to the Juvenile Code.[5] Given that the Juvenile Code does not expressly address whether a child may raise an insanity or delusional-compulsion defense in a delinquency proceeding, we must carefully analyze the Code’s text and structure to determine whether the “most natural and reasonable” interpretation of the statute affords children a right to assert such defenses. K.S., 303 Ga. at 543. We begin with the meaning of the term “[d]elinquent act,” which the Juvenile Code defines as including: An act committed by a child designated a crime by the laws of this state, or by the laws of another state if the act occurred in that state, under federal laws, or by local ordinance, and the act is not an offense applicable only to a child or a juvenile traffic offense[.] OCGA § 15-11-2 (19) (A) (emphasis supplied).[6] Here, the key question is whether a child who commits a criminal offense while insane or under a delusional compulsion has committed “[a]n act . . . designated a crime by the laws of this state.” Id. If not, we can infer that the Juvenile Code permits a child to raise an insanity or delusional-compulsion defense, which, if successful, would defeat a finding that the child in fact committed a “delinquent act.” Several interpretive principles bear on our construction of OCGA § 15-11-2 (19) (A)’s phrase “[a]n act . . . designated a crime.” First, the “elementary rule of statutory construction that statutes relating to the same subject matter are ‘in pari materia’” suggests that this phrase “must be construed together and harmonized” with provisions of the Criminal Code. Land USA, LLC v. Georgia Power Co., 297 Ga. 237, 241 (1) (773 SE2d 236) (2015). This is so because OCGA § 15-11-2 (19) (A) references “the laws of this state” addressing “crime,” and such laws are primarily found in the Criminal Code, rather than the Juvenile Code. See OCGA § 16-1-4 (“No conduct constitutes a crime unless it is described as a crime in this title [Title 16 (the Criminal Code)] or in another statute of this state.”).[7] Second, “where a term is specifically defined in a law, we must apply that definition.” Rockdale County v. U.S. Enterprises, Inc., 312 Ga. 752, 764 n.12 (3) (b) (865 SE2d 135) (2021). Although neither the Juvenile Code nor the Criminal Code defines the term “act” and the Juvenile Code does not define the term “crime,” the Criminal Code defines “crime” as “a violation of a statute of this state in which there is a joint operation of an act or omission to act and intention or criminal negligence.” See OCGA § 16-2-1 (a). Given that the Criminal Code defines the word “crime” without specifying that the statutory definition applies only within the Criminal Code,[8]and we generally construe related statutes “in pari materia,” Land USA, 297 Ga. at 241 (1), we must afford “crime” its statutory definition when interpreting OCGA § 15-11-2 (19) (A), see Rockdale County, 312 Ga. at 764 n.12 (3) (b). Finally, “where a word has a technical as well as a popular meaning, [we] will generally accord to it its popular signification, unless the nature of the subject indicates, or the context suggests, that the word is used in a technical sense.” Ga. Motor Trucking Assn. v. Ga. Dept. of Revenue, 301 Ga. 354, 356 (2) (801 SE2d 9) (2017) (citation and punctuation omitted). Here, the undefined term “act” has both a popular meaning and a technical meaning. The ordinary meaning of “act” is “a thing done” or “something done by a person pursuant to his volition.” Webster’s Seventh New Collegiate Dictionary 9 (1971); Funk & Wagnalls Standard College Dictionary 14 (1977) (defining “act” as “[s]omething done; a deed; action”); The American Heritage Dictionary of the English Language 13 (1970) (defining “act” as “[t]he process of doing or performing something; an action”; “[s]omething that is done or performed”; “[t]o carry out an action; do something”); Black’s Law Dictionary 24 (5th ed. 1979) (explaining that the word “act” “[d]enotes [an] external manifestation of [an] actor’s will,” and that, “[i]n its most general sense, this noun signifies something done voluntarily by a person”). “In a more technical sense, [the word 'act'] means something done voluntarily by a person, and of such a nature that certain legal consequences attach to it.” Black’s Law Dictionary 24 (5th ed. 1979) (emphasis supplied). Accordingly, we presume that the word “act” carries its popular meaning in OCGA § 15-11-2 (19) (A), unless the context rebuts that presumption, see Ga. Motor Trucking Assn., 301 Ga. at 356 (2), which is the case here. Applying these interpretive principles, we conclude that the Criminal Code’s definition of “crime” rebuts the presumption that the term “act” bears its popular meaning in OCGA § 15-11-2 (19) (A)’s phrase “[a]n act . . . designated a crime.” As an initial matter, two things are clear from the Criminal Code’s definition of “crime” as “a violation of a statute . . . in which there is a joint operation of [1] an act or omission to act and [2] intention or criminal negligence.” OCGA § 16-2-1 (a) (emphasis supplied). First, conduct cannot be characterized as a “crime” unless, at a minimum, the conduct satisfies both the “act” element and the “intention” element of a statutory offense. Id. Second, as used in the definition of “crime,” the word “act” clearly corresponds to what is commonly referred to as a “criminal act,” a term that adopts the popular sense of the word “act” for use in the criminal context. Compare Black’s Law Dictionary 24 (5th ed. 1979) (defining “[c]riminal act” as an “[e]xternal manifestation of one’s will which is prerequisite to criminal responsibility,” and stating that “[t]here can be no crime without some act, affirmative or negative” (emphasis supplied)), with Webster’s Seventh New Collegiate Dictionary 9 (1971) (defining “act” as “something done by a person pursuant to his volition”). As a result, transposing the definition of “crime” into OCGA § 15-11-2 (19) (A) while retaining the popular definition of “act” makes the definition of “delinquent act” unintelligible. This is so because no “act” alone could be “designated a crime” when a crime requires both “an act” and a specific mental state. By contrast, applying the technical definition of “act” in “[a]n act . . . designated a crime” permits a sensible interpretation of OCGA § 15-11-2 (19) (A)’s phrase that does not preclude the possibility that a child’s “act” might be characterized as a “crime.” Unlike the popular definition of “act” (“something done voluntarily by a person”), which at most might correspond to the “act” element of a statutory offense, the technical definition of “act” further specifies that the “something done voluntarily by a person” must be “of such a nature that certain legal consequences attach to it.” Black’s Law Dictionary 24 (5th ed. 1979). This latter part of the technical definition does not specify what the “nature” of a person’s conduct must be in order for “certain legal consequences to attach to it.” Id. As a result, the technical definition of “act” does not preclude consideration of a person’s mental state, which the definition of “crime” clarifies is a basic prerequisite for the person’s conduct to constitute a “crime.” See OCGA § 16-2-1 (a). Because the popular definition of “act” renders the phrase “[a]n act . . . designated a crime” nonsensical, whereas applying the technical definition of that term renders the phrase intelligible, we afford “act” its technical sense in OCGA § 15-11-2 (19) (A). See Zaldivar v. Prickett, 297 Ga. 589, 595 n.5 (1) (774 SE2d 688) (2015) (rejecting a statutory interpretation that “would make no sense” and would render another provision “nonsense”).[9] This does not end our inquiry, however. We must still determine whether, applying the technical definition of “act” in the context of OCGA § 15-11-2 (19) (A), a child who is insane or under a delusional compulsion at the time of an offense has committed “[a]n act . . . designated a crime.” In other words, we must determine whether the scope of the word “act” is broad enough to permit consideration not only of whether conduct satisfies the act and intent elements of an offense but also consideration of affirmative defenses of insanity and delusional compulsion. Based on the technical definition of “act” and the Juvenile Code’s codified purpose—both of which focus on the consequences attending a child’s behavior—we conclude that a child has not committed “[a]n act . . . designated a crime” if an insanity or delusional-compulsion defense applies. First, as noted above, the fact that “certain legal consequences attach to [conduct]” is an essential aspect of what it means for conduct to constitute an “ act,” in the technical sense of the term. Black’s Law Dictionary 24 (5th ed. 1979). Several consequences flow from a verdict of not guilty by reason of insanity. Among other things, such a verdict obligates a court to “order such person to be detained in a state mental health facility . . . for a period not to exceed 30 days . . . for evaluation of the defendant’s present mental condition,” OCGA § 17-7-131 (d), which may result in commitment for inpatient treatment or conditional release contingent on participation in outpatient involuntary treatment, see OCGA § 177-131 (e). While these consequences can be significant, they do not “attach to” the charged conduct, Black’s Law Dictionary 24 (5th ed. 1979), because a verdict of not guilty by reason of insanity excuses the person’s prior conduct and results in outright acquittal. See OCGA §§ 17-7-131 (d) (“Whenever a defendant is found not guilty by reason of insanity at the time of the crime, . . . the person [is] acquitted . . . .”); 16-1-2 (1) (noting that the Criminal Code only seeks “[t]o forbid and prevent conduct which unjustifiably and inexcusably causes or threatens substantial harm to individual or public interests.” (emphasis supplied)).[10] Rather, the consequences flowing from a verdict of not guilty by reason of insanity attach to the finding of insanity itself, which triggers a concern about the person’s “present mental condition.” OCGA § 17-7-131 (d).[11] The technical definition of “act,” therefore, suggests that a child has not committed “[a]n act . . . designated a crime” if the child was insane or under a delusional compulsion at the time of the charged offense. Second, the Juvenile Code’s codified preamble indicates that a child’s conduct should not be adjudicated “delinquent” if the child can establish an affirmative defense of insanity or delusional compulsion. Specifically, the Code states that a “purpose” of delinquency proceedings is “to hold a child committing delinquent acts accountable for his or her actions, taking into account such child’s . . . mental and physical condition, . . . but to mitigate the adult consequences of criminal behavior[.]“ OCGA § 15-11-470 (1) (emphasis supplied). If the definition of “delinquent act” excluded from consideration insanity and delusional-compulsion defenses, children in delinquency proceedings could face serious consequences, including detention in “a secure residential facility,” OCGA § 15-11-601 (b) (2), for conduct that would be entirely excused if committed by an adult and without regard to the child’s mental condition. Such an interpretation would not only impose consequences on a child’s conduct where legal consequences ordinarily would not attach, but would also exacerbate rather than mitigate the adult consequences of a child’s behavior.[12] Accordingly, interpreting the statutory language in the most reasonable way in the context in which it appears, we conclude that a child whose action is excused by reason of insanity or delusional compulsion under OCGA §§ 16-3-2 or 16-3-3 has not committed an “act . . . designated a crime,” and therefore has not committed a “delinquent act.” OCGA § 15-11-2 (19) (A).[13] That being the case, we hold that a child defending against a charge of having committed a “delinquent act” based on an alleged violation of Georgia’s Criminal Code must be permitted to raise a defense of insanity or delusional compulsion.[14] 4. For the reasons stated above, the juvenile court erred in concluding that a child in a delinquency proceeding may never raise an insanity defense under OCGA §§ 16-3-2 or 16-3-3. We therefore vacate the juvenile court’s order denying T.B.’s motion seeking a forensic psychological evaluation to determine whether he was insane or under a delusional compulsion when the acts underlying his delinquency charge occurred. On remand, the juvenile court should reconsider T.B.’s motion consistent with this opinion. Judgment vacated and case remanded. All the Justices concur, except Bethel, J., who concurs in judgment only.