/* Base reset & typography */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; line-height: 1.6; font-size: 16px; }

/* Theme tokens */
:root {
  --bg: #ffffff;
  --fg: #141414;
  --link: #0047a3;
  --link-hover: #003b88;
  --border: #e5e5e5;
  --muted: #f7f7f7;
  --focus: #005fcc;
  --button-bg: #f2f2f2;
  --button-fg: #111111;
  --button-border: #111111;
}

html[data-theme="light"] {
  --bg: #ffffff;
  --fg: #000000;
  --link: #0047a3;
  --link-hover: #003b88;
  --border: #dcdcdc;
  --muted: #f7f7f7;
  --focus: #005fcc;
  --button-bg: #f2f2f2;
  --button-fg: #000000;
  --button-border: #000000;
}

html[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --link: #8ab4ff;
  --link-hover: #a8c8ff;
  --border: #2a2f36;
  --muted: #1c222b;
  --focus: #9ec1ff;
  --button-bg: #1c222b;
  --button-fg: #ffffff;
  --button-border: #8a99ad;
}

html[data-theme="yellow"] {
  --bg: #fff176;
  --fg: #000000;
  --link: #0000ee;
  --link-hover: #0000bb;
  --border: #cdbb00;
  --muted: #ffec80;
  --focus: #000000;
  --button-bg: #ffec80;
  --button-fg: #000000;
  --button-border: #000000;
}

/* Apply tokens */
body { background: var(--bg); color: var(--fg); }
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
a:visited { color: var(--link); }
a:focus, button:focus, input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

/* Layout */
header { border-bottom: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; padding: .75rem 1rem; align-items: center; }
header [data-brand="logo"] img { width: 400px; height: 400px; max-width: 180px; height: auto; }
@media (min-width: 640px) { header [data-brand="logo"] img { max-width: 240px; } }
@media (min-width: 960px) { header [data-brand="logo"] img { max-width: 320px; } }
header nav { max-width: 100%; }
header nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
header nav a { text-decoration: none; padding: .4rem .6rem; border-radius: .5rem; color: var(--fg); }
header nav a[aria-current="page"] { background: var(--muted); }
header [data-utils="controls"] form { display: inline-block; margin-left: .5rem; }
header [data-utils="controls"] fieldset { border: 1px solid var(--border); padding: .25rem .5rem; border-radius: .5rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
footer { border-top: 1px solid var(--border); padding: 1rem; margin-top: 2rem; }
footer .legal { font-size: .9rem; }

/* Forms & tables */
form { display: grid; gap: .75rem; max-width: 720px; }
label { font-weight: 600; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="date"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; padding: .5rem .6rem; border: 1px solid #bbb; border-radius: .35rem; background: var(--bg); color: var(--fg);
}
button, input[type="submit"] {
  padding: .6rem 1rem; border: 1px solid var(--button-border); background: var(--button-bg); color: var(--button-fg); border-radius: .5rem; cursor: pointer;
}
button:hover, input[type="submit"]:hover { filter: brightness(0.96); }
img { max-width: 100%; height: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--border); padding: .5rem; text-align: left; }
th { background: var(--muted); }

/* Skip link */
.skip-link { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus { position: static; width: auto; height: auto; padding: .5rem 1rem; background: #fffcbb; border: 2px solid #b59a00; display: inline-block; }

/* Search results */
#search-results[aria-live] > .result { padding: .5rem 0; border-bottom: 1px solid var(--border); }
#search-results .result a { font-weight: 700; }

/* ===== Accessible Font Tools (global) ===== */
:root { --scale: 1; }
html { font-size: calc(100% * var(--scale)); }

.font-tools { display: inline-flex; gap: .5rem; align-items: center; vertical-align: middle; }
.font-tools button {
  padding: .25rem .5rem;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-fg);
  border-radius: .5rem;
  line-height: 1;
}
.font-tools button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.font-tools [aria-pressed="true"] { box-shadow: 0 0 0 2px var(--focus) inset; }

/* Place the font tools next to search/theme controls in header */
header [data-utils="controls"] .font-tools { margin-left: .5rem; }

/* === EACNGA: Nav icon alignment & states (header/footer) === */
header nav a,
footer nav a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

/* Space icons consistently */
header nav a .icon,
footer nav a .icon,
header nav a .bi,
footer nav a .bi {
  margin-right: .35rem;
  line-height: 1;
  font-size: 1.05em;
  transform: translateY(0); /* keep centered with text */
}

/* Use link tokens for color states */
header nav a,
footer nav a {
  color: var(--link, currentColor);
  text-decoration: none;
}

header nav a:hover,
header nav a:focus,
footer nav a:hover,
footer nav a:focus {
  color: var(--link-hover, var(--link));
  text-decoration: underline;
}

/* Active page */
header nav a[aria-current="page"] {
  font-weight: 600;
  text-decoration: underline;
}

/* Smooth transition for icon + text */
header nav a,
header nav a .bi,
footer nav a,
footer nav a .bi {
  transition: color .15s ease-in-out, opacity .15s ease-in-out, text-decoration-color .15s ease-in-out;
}


/* Specific adjustment for Saint George icon */
.saint-george-icon {
  width: 1.1em;
  height: 1.1em;
}


/* Banner image for Saint George Church page */
.saint-george-banner {
  text-align: center;
  margin: 1rem 0;
}
.saint-george-banner-img {
  width: 100%;
  max-width: clamp(160px, 50vw, 360px);
  height: auto;
}


/* === Responsive adjustments for Saint George icon and banner === */

/* Icon in nav should scale with text */
.saint-george-icon {
  width: 1.25em;
  height: 1.25em;
}

/* Banner image should be fluid */
.saint-george-banner-img {
  max-width: 100%;
  height: auto;
}


/* Responsive tweaks */
@media (max-width: 480px) {
  header nav ul { gap: .35rem; }
  header [data-brand="logo"] img { max-width: 70vw; }
}

@media (min-width: 1200px) {
  .saint-george-banner-img { max-width: 420px; }
}


/* === Footer Navigation === */
.footer-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-nav li {
  display: inline-block;
  margin-right: 1em;
}
