
552 F.3d 604 (2009)
Gregory STURGEON, Petitioner-Appellant,
v.
Nedra CHANDLER, Warden, Respondent-Appellee.
No. 06-3934.
United States Court of Appeals, Seventh Circuit.
Argued January 9, 2008.
Decided January 13, 2009.
*607 Sean W. Collins-Stapleton (argued), Office of the State Appellate Defender, Chicago, IL, for Petitioner-Appellant.
Michael M. Glick, Retha Stotts (argued), Office of the Attorney General, Chicago, IL, for Respondent-Appellee.
Before WOOD, SYKES, and TINDER, Circuit Judges.
SYKES, Circuit Judge.
Gregory Sturgeon pleaded guilty to aggravated sexual assault and was sentenced to 45 years in prison. He unsuccessfully pursued a motion to withdraw his guilty plea, a direct appeal, and a full round of postconviction proceedings in Illinois state court, and then filed a petition for a writ of habeas corpus under 28 U.S.C. § 2254, claiming violations of his Fourteenth Amendment right to due process and his Sixth Amendment right to effective assistance of trial and appellate counsel. His claims center on the question of his entitlement to a hearing on the issue of his competency. The district court denied the writ but granted a certificate of appealability on the due-process claim. We later expanded the certificate to include Sturgeon's claims for ineffective assistance of trial and appellate counsel.
We affirm. The record did not raise a bona fide doubt as to Sturgeon's mental fitness. To the contrary, four examining doctors declared him competent notwithstanding his history of mental illness and use of psychotropic medication. Accordingly, the decision of the Illinois Appellate Court affirming the denial of postconviction relief was neither an unreasonable determination of the facts nor an unreasonable application of federal law.

I. Background
Sturgeon was charged in June 1994 with beating and raping a woman on an elevated train platform in Evanston, Illinois. Two years later he pleaded guilty to two counts of aggravated sexual assault and was sentenced to 45 years in prison. During the protracted pretrial proceedings, Sturgeon's competency to stand trial was evaluated by four court-appointed doctors. The first ordered evaluation came immediately after counsel was appointed; it could not be completed, however, because Sturgeon *608 told the doctor that he did not want to participate in the examination without first talking to his lawyer. At his next court appearance, Sturgeon told Judge Robert Nix that he would give the court "fifty million dollars" if the court would order a "legal injection." Judge Nix ordered another competency evaluation and appointed Dr. Stafford Henry, who concluded after a clinical examination that Sturgeon was fit to stand trial.
In October 1994 Sturgeon appeared before Judge Marcia Orr and announced that he wanted to plead guilty and had instructed counsel to begin plea negotiations with the prosecutor. However, Sturgeon's counsel first asked the court to order another fitness evaluation based on Sturgeon's apparent obsession with lethal injection (not an applicable penalty) and his willingness to plead guilty no matter what sentence might result. Judge Orr questioned whether a new evaluation was necessary but ordered one anyway; the judge also subpoenaed Sturgeon's records from the Illinois Department of Mental Health. After reviewing the mental-health records and conducting a new clinical evaluation, Dr. Henry reported that Sturgeon had a history of hearing voices (especially when under the influence of drugs and alcohol) but was presently taking medication (Haldol) and was "alert, oriented and superficially cooperative." The doctor noted, however, that Sturgeon was not completely forthright in answering questions about his history. Regardless, Sturgeon understood the nature, purpose, and details of the court proceedings against him, and Dr. Henry again concluded he was competent to stand trial as long as he continued to take his medication.
Sturgeon's odd in-court behavior continued throughout the next few months. At one point he announced that he was responsible for the "O.J. Simpson" murders of Nicole Brown Simpson and Ronald Goldman. Judge Daniel Jordan granted defense counsel's request for a third psychiatric exam, this time conducted by Dr. Roni Seltzberg. Before her evaluation, Dr. Seltzberg reviewed 12 different sets of mental-health records from Sturgeon's file. Like Dr. Henry, she reported that Sturgeon was "alert and oriented" and had good understanding of the particulars of the court proceedings against him. She noted that Sturgeon suffered from polysubstance dependence and was HIV positive, and diagnosed him with a personality disorder and a psychotic disorder "in remission with medication." On the basis of her review of his medical records and her clinical examination, Dr. Seltzberg declared Sturgeon fit to stand trial.[1]
At the next hearing, Sturgeon's counsel refused to stipulate to Dr. Seltzberg's findings and asked the court to schedule a hearing at which the doctor could be cross-examined. The court instead ordered yet another fitness evaluation. Conducted by Dr. Dawna Gutzmann, this examination was only slightly different from the previous three. Sturgeon told Dr. Gutzmann that he had stopped taking his medication because he didn't like the side effects but was nevertheless "doing fine." Dr. Gutzmann found "no evidence of hallucinations" and stated that Sturgeon's reasoning, judgment, and impulse control were all intact. Sturgeon knew the details of his case and the nature of the court proceedings against him. Dr. Gutzmann concluded Sturgeon was competent to proceed.
Following the return of Dr. Gutzmann's report, Sturgeon's counsel advised the court that Sturgeon was prepared to plead *609 guilty. Before proceeding, however, counsel asked the court to appoint a doctor to evaluate whether Sturgeon had been competent to understand his Miranda warnings when being questioned by police. Dr. Stipesthe first court-appointed doctor conducted this evaluation. Sturgeon was taking Haldol and Cogentin as of the time of this examination, and Dr. Stipes reported that he was oriented, cooperative, and generally coherent. Based on his review of his own prior report and those of the other doctors, as well as the police report and a clinical examination, Dr. Stipes opined that Sturgeon was competent to understand his Miranda rights when he was interviewed by police. A change-of-plea hearing was scheduled.
At the guilty-plea hearing, the prosecutor and Sturgeon's counsel agreed that the psychiatric reports generally found Sturgeon competent to proceed as long as he remained on medication. Judge Nix confirmed that Sturgeon had taken his medication before coming to court. The judge then accepted Sturgeon's guilty pleas to two counts of aggravated sexual assault and sentenced him to 45 years in prison. A few weeks later, Sturgeon moved to withdraw his guilty pleas, claiming he was not in his "right mind" when he entered them. The motion was denied, and Sturgeon's convictions were affirmed on direct appeal. His subsequent motion for postconviction relief was also denied, and this decision was likewise affirmed on appeal. The Illinois Supreme Court denied review. Sturgeon then filed this habeas petition.

II. Discussion
Under the Antiterrorism and Effective Death Penalty Act ("AEDPA"), a federal court may not grant habeas relief from a state-court conviction unless the state-court decision "was contrary to, or involved an unreasonable application of, clearly established Federal law, as determined by the Supreme Court of the United States" or "was based on an unreasonable determination of the facts in light of the evidence presented in the State court proceeding." 28 U.S.C. § 2254(d)(1)-(2). The factual determinations of the state court are presumed correct, and this presumption may be rebutted only by clear and convincing evidence. Id. § 2254(e)(1). The burden is on the petitioner to show that the state court's determination of fact or its application of federal law was unreasonable. Id.; Harding v. Sternes, 380 F.3d 1034, 1043 (7th Cir.2004). We review the district court's legal conclusions de novo and its factual findings for clear error. Eckstein v. Kingston, 460 F.3d 844, 848 (7th Cir.2006).
Sturgeon contends that his due-process rights were violated when the state court failed to conduct a mental-fitness hearing. See Pate v. Robinson, 383 U.S. 375, 385, 86 S.Ct. 836, 15 L.Ed.2d 815 (1966); 725 ILL. COMP. STAT. 5/104-11. He also argues that his Sixth Amendment right to effective assistance of counsel was violated both in the trial court and on appeal; this argument is based on trial counsel's failure to secure a fitness hearing and appellate counsel's failure to raise this claim in his direct appeal. The state responds that Sturgeon's due-process claim was procedurally defaulted because he did not fairly present this argument to the state courts. The state also argues that Sturgeon's ineffective-assistance-of-trial-counsel claim is unreviewable because the Illinois Appellate Court resolved it on an adequate and independent state ground, holding that Sturgeon waived this claim by not presenting it on direct appeal.

A. Procedural Default; Adequate and Independent State Ground
At the time of Sturgeon's pretrial proceedings, Illinois law mandated a competency *610 hearing if the defendant was taking psychotropic drugs. 725 ILL. COMP. STAT. 5/104-21 (1994);[2]People v. Guttierez, 271 Ill.App.3d 301, 208 Ill.Dec. 6, 648 N.E.2d 928, 931-32 (1995). Independent of section 104-21, however, Illinois law also requires a competency hearing if "a bona fide doubt of the defendant's fitness is raised." 725 ILL. COMP. STAT. 5/104-11(a). Though both provisions are designed to protect a prisoner's right not to stand trial unless mentally competent, only section 104-11 protects a constitutional right. See Robinson, 383 U.S. at 385, 86 S.Ct. 836. The section 104-21 hearing, which was required if the defendant was taking psychotropic drugs, "is merely a statutory right granted by the legislature." People v. Mitchell, 189 Ill.2d 312, 245 Ill.Dec. 1, 727 N.E.2d 254, 265 (2000). The Illinois Appellate Court held that Sturgeon's section 104-21 claim was not cognizable on collateral review because it was merely a statutory right. People v. Burt, 205 Ill.2d 28, 275 Ill.Dec. 477, 792 N.E.2d 1250, 1257 (2001); see also Burt v. Uchtman, 422 F.3d 557, 567 (7th Cir.2005). Sturgeon does not challenge this ruling.
Instead, Sturgeon advances a more general due-process claim based on section 104-11 and the alleged existence of a bona fide doubt as to his competency to proceed. Before Sturgeon may present this claim to the federal courts, he must first have exhausted all available state remedies. 28 U.S.C. § 2254(b)(1)(A). This required Sturgeon to fully and fairly present all his federal claims to each level of review in the state system. Baldwin v. Reese, 541 U.S. 27, 29, 124 S.Ct. 1347, 158 L.Ed.2d 64 (2004); Chambers v. McCaughtry, 264 F.3d 732, 737 (7th Cir.2001). "The petitioner must have placed both the operative facts and the controlling legal principles before the state courts. A mere passing reference to a constitutional issue certainly does not suffice." Chambers, 264 F.3d at 738 (citations omitted) (internal quotation marks omitted). The argument must be placed in the petitioner's brief to the court; the "requirement is not met if a judge must go outside the four corners of the document in order to understand the contention's nature and basis." Lockheart v. Hulick, 443 F.3d 927, 929 (7th Cir.2006) (citing Baldwin, 541 U.S. 27, 124 S.Ct. 1347, 158 L.Ed.2d 64).
Sturgeon's state postconviction documents are hardly the model of clarity. On numerous occasions he references his rights under both sections 104-11 and 104-21 without distinguishing between the two. However, at each level of the state's postconviction proceedings, Sturgeon cited both standards (based on "bona fide doubt" as to his competency, and alternatively, his receipt of psychotropic drugs) and identified enough case law to put the court on notice that he was asserting his federal due-process right to a fitness hearing as well as a statutory claim. During the hearing on the state's motion to dismiss his postconviction petition, Sturgeon's counsel drew the court's attention to Pate v. Robinson, 383 U.S. 375, 86 S.Ct. 836, 15 L.Ed.2d 815 (holding that the "bona fide doubt" standard adequately protects a prisoner's due-process right to be tried only if mentally fit), and reiterated the applicability of the "bona fide doubt" standard. *611 Sturgeon did the same in his brief to the Illinois Appellate Court, and he repeated these arguments in his petition for leave to appeal to the Illinois Supreme Court. This is enough (though barely) to satisfy his obligation to fairly present his due-process claim to all levels of the state-court system. Accordingly, this claim was not procedurally defaulted.
The Illinois Appellate Court held that Sturgeon waived his claim for ineffective assistance of trial counsel because he did not raise it on direct appeal. When reviewing a petition for a writ of habeas corpus, a federal court will not review a question of federal law if the state decision rested on an adequate and independent state ground for dismissal, including a state procedural rule. Page v. Frank, 343 F.3d 901, 905 (7th Cir.2003). A finding of waiver by the state postconviction court is enough to establish an adequate and independent state ground. Daniels v. Knight, 476 F.3d 426, 431 (7th Cir.2007).
Under Illinois law, "[f]ailure to raise a claim which could have been addressed on direct appeal is a procedural default which results in a bar to consideration of the claim's merits in a post-conviction proceeding." People v. Erickson, 161 Ill.2d 82, 204 Ill.Dec. 231, 641 N.E.2d 455, 458 (1994). An exception applies to this general rule "in instances where the facts relating to the claim do not appear on the face of the original appellate record." People v. Whitehead, 169 Ill.2d 355, 215 Ill.Dec. 164, 662 N.E.2d 1304, 1312 (1996). "[I]t is not so much that such a claim could not have been presented or raised by a party on direct appeal, but rather that such a claim could not have been considered by the reviewing court because the claim's evidentiary basis was de hors the record." Id. (internal quotation marks omitted); see also Schaff v. Snyder, 190 F.3d 513, 524-25 (7th Cir.1999).
It is undisputed that Sturgeon did not raise his claim of ineffective assistance of trial counsel on direct review. Sturgeon argues, however, that the state decision is not based on an adequate and independent state ground because the state court did not acknowledge the "extra record evidence" he submitted on his postconviction motionnamely, a psychiatrist's affidavit and his mental-health records from Cermak Hospital. However, the exception applies only where the evidentiary basis for the claim is outside the record. By Sturgeon's own admission, the evidence bearing on his mental competency (e.g., his erratic behavior and use of psychotropic medication) is readily apparent in the record of his various pretrial hearings and in the four different psychological examinations the trial court ordered. All of this information was within the scope of the appellate court's review on direct appeal. See Whitehead, 215 Ill.Dec. 164, 662 N.E.2d at 1314 ("The underlying purpose of the exception recognized in Thomas [People v. Thomas, 38 Ill.2d 321, 231 N.E.2d 436 (1967)] was to permit post-conviction review of matters which were unreviewable on direct appeal because those matters depended upon facts not within the trial record."). The Illinois Appellate Court's determination that Sturgeon's ineffective-assistance-of-trial-counsel claim was waived is thus an adequate and independent state ground, and this claim is unreviewable on federal habeas.

B. Merits
Sturgeon argues that the Illinois Appellate Court did not reach the merits of his due-process claim on collateral review. AEDPA's deferential standard of review applies only to claims that were "adjudicated on the merits in State court proceedings." 28 U.S.C. § 2254(d); see also Moore v. Parke, 148 F.3d 705, 708 *612 (7th Cir.1998). Although the state appellate court mentioned the due-process claim and the "bona fide doubt" standard for determining whether a competency hearing is required, the court ultimately merged the statutory and constitutional bases of Sturgeon's right-to-a-hearing claim and resolved the issue against him on statutory grounds. The court did, however, evaluate whether the evidence established a bona fide doubt as to Sturgeon's competency when it resolved Sturgeon's claim of ineffective assistance of appellate counsel. The court held that no bona fide doubt existed about Sturgeon's competency to stand trial and therefore he had not established either prong of the Strickland v. Washington standard for ineffective assistance of counsel. 466 U.S. 668, 104 S.Ct. 2052, 80 L.Ed.2d 674 (1984). The court could not have decided the same "bona fide doubt" question any differently in the context of Sturgeon's due-process claim, so the merits were effectively reached.
Accordingly, both of Sturgeon's remaining claimshis due-process claim based on the trial court's failure to conduct a competency hearing and his claim for ineffective assistance of appellate counsel based on counsel's failure to raise this issue on direct appealmay be addressed by reviewing the state appellate court's application of the "bona fide doubt" standard. That is, the due-process and ineffective-assistance-of-counsel standards effectively present the same question: whether there was substantial or "bona fide" reason to doubt Sturgeon's competency to stand trial. If the record does not establish a bona fide doubt as to his competency, then Sturgeon could not have suffered a due-process violation, nor could his appellate counsel have rendered deficient performance by failing to raise the issue on direct appeal. Moreover, Sturgeon was required to demonstrate that he was prejudiced by his appellate counsel's failure to raise the issue on direct appeal. Id. at 691-96, 104 S.Ct. 2052. To do so, he must likewise have established that bona fide doubt about his fitness existed, and if so, that there was a reasonable probability that he was not fit to stand trial. Eddmonds v. Peters, 93 F.3d 1307, 1316-17 (7th Cir.1996).
Again, our review of the state court's decision is deferential. The "state court's factual determinations are presumed to be correct"a presumption that can be rebutted only by clear and convincing evidence; the "`unreasonable application' prong [of AEDPA] in particular is difficult to show." Woods v. McBride, 430 F.3d 813, 816-17 (7th Cir.2005). "`[U]nreasonable' in this context means `something like lying well outside the boundaries of permissible differences of opinion.'" Id. (quoting Hardaway v. Young, 302 F.3d 757, 762 (7th Cir.2002)).
Where there is "`substantial reason to doubt the defendant's fitness,' due process obligates the trial judge sua sponte to order a competency hearing." Eddmonds, 93 F.3d at 1316 (quoting Phillips v. Lane, 787 F.2d 208, 216 (7th Cir. 1986)); see also Burt v. Uchtman, 422 F.3d at 564. The inquiry is highly individualized. "There are ... no fixed or immutable signs which invariably indicate the need for further inquiry to determine fitness to proceed; the question is often a difficult one in which a wide range of manifestations and subtle nuances are implicated." Drope v. Missouri, 420 U.S. 162, 180, 95 S.Ct. 896, 43 L.Ed.2d 103 (1975). Relevant factors include any evidence of irrational behavior, the defendant's demeanor in court, and any medical opinions on the defendant's competency to stand trial. Id.
*613 The Illinois Appellate Court traced, in considerable detail, Sturgeon's documented history of mental illness, his receipt of psychotropic medications, his occasional erratic in-court behavior (noted above), and the results of the court-ordered competency evaluations. Ultimately, the court relied on the unanimity among the medical experts in concluding that Sturgeon had not demonstrated a bona fide doubt as to his competency. On this record, this conclusion is unassailable. Sturgeon hasn't presented clear and convincing evidence to contradict the doctors' conclusions. The state court's reliance on the medical opinionsfrom four doctors who conducted five separate competency examinations was well within the bounds of permissible differences of opinion. Accordingly, the state court's decision was neither an unreasonable determination of the facts nor an unreasonable application of the "bona fide" or "substantial reason to" doubt standard.
For all the foregoing reasons, the judgment of the district court denying habeas relief is AFFIRMED.
NOTES
[1]  Dr. Seltzberg and Dr. Henry also evaluated Sturgeon for a possible insanity defense. Both concluded he was sane at the time of the offense.
[2]  That version of the statute provided: "A defendant who is receiving psychotropic drugs or other medications under medical direction is entitled to a hearing on the issue of his fitness while under medication." 725 ILL. COMP. STAT. 5/104-21 (1994). The provision now reads: "A defendant who is receiving psychotropic drugs shall not be presumed to be unfit to stand trial solely by virtue of the receipt of those drugs or medications." Id. 5/104-21 (2008); see also People v. Hill, 297 Ill.App.3d 500, 231 Ill.Dec. 762, 697 N.E.2d 316, 325 (1998) (noting the changes in statutory language).
