/* Homeless Child — shared styles (supplements Tailwind CDN)
   Colour pairs used here meet WCAG 2.1 AA contrast (4.5:1 text, 3:1 UI). */

:root {
  --navy-950: #0a1726;
  --navy-900: #0f2238;
  --navy-800: #16304d;
  --amber-400: #f7b84b;
  --amber-500: #f2a024;
  --teal-600: #0f766e;
  --teal-700: #0b5e58;
  --slate-700: #334155;
}

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Skip-link target should not draw a focus ring around the whole page */
main:focus { outline: none; }

/* Layout container */
.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}
@media (min-width: 640px)  { .wrap { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .wrap { padding-inline: 2rem; } }

/* Accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 100;
  background: var(--navy-900);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
}
.skip-link:focus { left: 0.75rem; outline: 3px solid var(--amber-400); }

:focus-visible {
  outline: 3px solid var(--teal-600);
  outline-offset: 3px;
  border-radius: 0.25rem;
}
.on-dark :focus-visible,
.site-footer :focus-visible { outline-color: var(--amber-400); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.8rem 1.6rem;
  border: 2px solid transparent;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.925rem; min-height: 2.5rem; }

.btn-primary { background: var(--amber-400); color: var(--navy-900); }
.btn-primary:hover { background: var(--amber-500); }

.btn-navy { background: var(--navy-900); color: #fff; }
.btn-navy:hover { background: var(--navy-800); }

.btn-teal { background: var(--teal-600); color: #fff; }
.btn-teal:hover { background: var(--teal-700); }

.btn-outline-light { border-color: rgba(255, 255, 255, 0.7); color: #fff; }
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }

.btn-outline-dark { border-color: var(--navy-900); color: var(--navy-900); }
.btn-outline-dark:hover { background: var(--navy-900); color: #fff; }

/* Header */
.site-header { transition: box-shadow 0.2s ease; }
.site-header.is-scrolled { box-shadow: 0 8px 24px -16px rgba(15, 34, 56, 0.45); }

.nav-link {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--slate-700);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.nav-link:hover { color: var(--navy-900); background: #f1f5f9; }
.nav-link[aria-current="page"] {
  color: var(--navy-900);
  box-shadow: inset 0 -3px 0 var(--amber-400);
  border-radius: 0;
}

/* Menu button icon swap */
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
html:not(.js) .nav-toggle { display: none !important; }

/* Mobile navigation: smooth height animation, removed from tab order + a11y tree when closed.
   Without JavaScript the menu simply stays open below 1024px. */
.mobile-nav-inner { overflow: hidden; min-height: 0; }
@media (max-width: 1023.98px) {
  .mobile-nav { display: grid; grid-template-rows: 1fr; }
  .js .mobile-nav {
    grid-template-rows: 0fr;
    visibility: hidden;
    border-top-width: 0;
    transition: grid-template-rows 0.28s ease, visibility 0s linear 0.28s;
  }
  .js .mobile-nav.is-open {
    grid-template-rows: 1fr;
    visibility: visible;
    border-top-width: 1px;
    transition: grid-template-rows 0.28s ease, visibility 0s linear 0s;
  }
  .mobile-nav.is-open { max-height: calc(100vh - 4.5rem); overflow-y: auto; }
}
@media (min-width: 1024px) {
  .mobile-nav { display: none; }
}

/* Hero backdrop */
.hero-bg {
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgba(247, 184, 75, 0.22), transparent 60%),
    radial-gradient(40rem 25rem at -10% 110%, rgba(15, 118, 110, 0.35), transparent 60%),
    linear-gradient(160deg, #0a1726 0%, #0f2238 55%, #16304d 100%);
}
.page-hero-bg {
  background:
    radial-gradient(40rem 20rem at 90% -20%, rgba(247, 184, 75, 0.2), transparent 60%),
    linear-gradient(160deg, #0a1726 0%, #0f2238 60%, #16304d 100%);
}

/* Donate dialog */
dialog.donate-dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 0;
  border-radius: 1.25rem;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 30px 80px -20px rgba(10, 23, 38, 0.6);
  overflow: auto;
}
dialog.donate-dialog::backdrop {
  background: rgba(10, 23, 38, 0.72);
  backdrop-filter: blur(3px);
}
dialog.donate-dialog[open] { animation: dialog-in 0.2s ease-out; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.give-option {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 2px solid #cbd5e1;
  border-radius: 0.875rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.give-option:hover { border-color: var(--teal-600); background: #f0faf8; }

/* Scroll reveal (classes are added by main.js only when motion is allowed) */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; will-change: auto; }
@media print { .reveal { opacity: 1 !important; transform: none !important; } }

/* Donation box */
.give-seg-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 9999px;
  background: #e2e8f0;
}
.give-seg, .give-amt { position: relative; display: block; }
.give-seg input, .give-amt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.give-seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border-radius: 9999px;
  font-weight: 700;
  color: #334155;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.give-seg input:checked + span {
  background: #fff;
  color: var(--navy-900);
  box-shadow: 0 1px 4px rgba(15, 34, 56, 0.3);
}
.give-amt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  border: 2px solid #64748b;
  border-radius: 0.75rem;
  background: #fff;
  font-weight: 700;
  color: var(--navy-900);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.give-amt:hover span { border-color: var(--teal-600); }
.give-amt input:checked + span { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.give-seg input:focus-visible + span,
.give-amt input:focus-visible + span { outline: 3px solid var(--teal-600); outline-offset: 2px; }
.give-custom {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 1.75rem;
  border: 1.5px solid #64748b;
  border-radius: 0.625rem;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 600;
}
.give-custom:focus { outline: 3px solid rgba(15, 118, 110, 0.45); outline-offset: 0; border-color: var(--teal-600); }
.give-custom[aria-invalid="true"] { border-color: #b91c1c; }
.donation-box .field-error:empty { display: none; }

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
  color: #334155;
}
.trust-badges li { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Forms */
.field label { display: block; font-weight: 600; margin-bottom: 0.375rem; color: #0f172a; }
.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #64748b;
  border-radius: 0.625rem;
  background: #fff;
  color: #0f172a;
  font: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.45);
  outline-offset: 0;
  border-color: var(--teal-600);
}
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: #b91c1c; }
.field-error { color: #b91c1c; font-size: 0.875rem; margin-top: 0.25rem; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* FAQ */
details.faq { border: 1px solid #cbd5e1; border-radius: 0.875rem; background: #fff; }
details.faq + details.faq { margin-top: 0.75rem; }
details.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--navy-900);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+";
  font-size: 1.5rem;
  line-height: 1;
  color: var(--teal-600);
  flex-shrink: 0;
}
details.faq[open] summary::after { content: "\2212"; }
details.faq .faq-body { padding: 0 1.25rem 1.1rem; color: #475569; }

/* Legal / long-form pages */
.legal h2 {
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--navy-900);
  margin: 2.25rem 0 0.75rem;
}
.legal h3 { font-size: 1.1rem; font-weight: 700; color: var(--navy-900); margin: 1.5rem 0 0.5rem; }
.legal p, .legal li { color: #334155; line-height: 1.75; }
.legal p { margin-bottom: 1rem; }
.legal ul { list-style: disc; padding-left: 1.5rem; margin-bottom: 1rem; }
.legal li { margin-bottom: 0.4rem; }
.legal a { color: var(--teal-600); text-decoration: underline; text-underline-offset: 3px; }
.legal a:hover { color: var(--teal-700); }

/* Footer links (padded so each link has a comfortable tap target) */
.footer-link {
  display: inline-block;
  padding-block: 0.3rem;
  color: #cbd5e1;
  text-decoration: none;
}
.footer-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.site-footer address a.footer-link { padding-block: 0.15rem; }

/* Subtle card lift */
.lift { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.lift:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -16px rgba(15, 34, 56, 0.35); }
/* Cards that both reveal on scroll and lift on hover */
.reveal.lift { transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.2s ease; transition-delay: var(--reveal-delay, 0ms); }
.reveal.lift.is-visible { transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; transition-delay: 0ms; }
.reveal.lift.is-visible:hover { transform: translateY(-3px); }

body.modal-open { overflow: hidden; }

/* Windows high-contrast / forced colours: keep borders and focus visible */
@media (forced-colors: active) {
  .btn { border-color: ButtonText; }
  .nav-link[aria-current="page"] { text-decoration: underline; box-shadow: none; }
}

@media print {
  .site-header, .skip-link, dialog, [data-donate] { display: none !important; }
  .site-footer { background: #fff !important; color: #000 !important; }
  .site-footer a, .site-footer h2 { color: #000 !important; }
}
