/* ==========================================================================
   Nate's 2nd Chance Housing — Design System (tokens, reset, shared components)
   ========================================================================== */

:root {
  /* Brand palette — warm, dignified, trustworthy */
  --navy-900: #0d1b2a;
  --navy-800: #16283d;
  --navy-700: #1f3a54;
  --teal-600: #2a6f6b;
  --teal-500: #368a84;
  --gold-500: #d9a441;
  --gold-400: #e6b95e;
  --cream-100: #f7f3ec;
  --cream-200: #efe8dc;
  --ink-900: #16202b;
  --ink-600: #45525f;
  --ink-400: #6b7885;
  --white: #ffffff;
  --line: #e3ddd1;
  --success: #2f855a;

  /* Semantic */
  --bg: var(--cream-100);
  --bg-alt: var(--white);
  --text: var(--ink-900);
  --muted: var(--ink-600);
  --brand: var(--teal-600);
  --brand-dark: var(--navy-800);
  --accent: var(--gold-500);

  /* Typography */
  --font-head: "Georgia", "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Radii & shadows */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(13, 27, 42, .06);
  --shadow-md: 0 10px 30px rgba(13, 27, 42, .10);
  --shadow-lg: 0 24px 60px rgba(13, 27, 42, .16);

  /* Layout */
  --maxw: 1160px;
  --gap: clamp(1rem, 3vw, 2rem);
  --section-y: clamp(3.5rem, 8vw, 7rem);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: clamp(1rem, .96rem + .2vw, 1.075rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; font-weight: 700; color: var(--brand-dark); letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 1rem + .8vw, 1.5rem); }
p { color: var(--ink-600); }
ul { padding-left: 1.1rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gap); }
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--navy-900); color: var(--cream-100); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--white); }
.section--dark p { color: #c4cdd6; }
.eyebrow {
  display: inline-block; font-family: var(--font-body); font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em; font-size: .78rem;
  color: var(--brand); margin-bottom: .9rem;
}
.section--dark .eyebrow { color: var(--gold-400); }
.lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); color: var(--ink-600); max-width: 62ch; }
.center { text-align: center; margin-inline: auto; }
.grid { display: grid; gap: clamp(1rem, 2.5vw, 2rem); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem;
  padding: .85rem 1.6rem; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  text-align: center; line-height: 1.2;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: var(--navy-900); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--gold-400); color: var(--navy-900); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; border-color: currentColor; color: var(--brand-dark); }
.section--dark .btn--ghost { color: var(--cream-100); }
.btn--ghost:hover { background: rgba(255,255,255,.08); }
.btn--dark { background: var(--brand-dark); color: var(--white); }
.btn--dark:hover { background: var(--navy-700); color: var(--white); }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: clamp(1.4rem, 3vw, 2rem); box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card__icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--cream-200); color: var(--brand); margin-bottom: 1rem;
}
.card__icon svg { width: 26px; height: 26px; }
.card h3 { margin-bottom: .5rem; }
.card p { margin: 0; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(247,243,236,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .65rem; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--brand-dark); }
.brand:hover { color: var(--brand-dark); }
.brand__mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, var(--teal-600), var(--navy-800));
  color: var(--gold-400); display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.brand__sub { display: block; font-family: var(--font-body); font-weight: 500; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav__links { display: flex; align-items: center; gap: .35rem; list-style: none; padding: 0; margin: 0; }
.nav__links a {
  display: inline-block; padding: .5rem .7rem; border-radius: 8px;
  font-size: .95rem; font-weight: 600; color: var(--brand-dark);
}
.nav__links a:hover { background: var(--cream-200); }
.nav__links a[aria-current="page"] { color: var(--brand); background: var(--cream-200); }
.nav__cta { margin-left: .4rem; }
.nav__toggle {
  display: none; background: none; border: 0; cursor: pointer; padding: .4rem;
  color: var(--brand-dark);
  /* 44x44 is the minimum comfortable touch target (WCAG 2.5.8 / iOS HIG). */
  min-width: 44px; min-height: 44px; align-items: center; justify-content: center;
}
.nav__toggle svg { width: 28px; height: 28px; }

@media (max-width: 920px) {
  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: fixed; inset: 62px 0 auto 0; flex-direction: column; align-items: stretch;
    gap: .1rem; background: var(--cream-100); border-bottom: 1px solid var(--line);
    padding: 1rem var(--gap) 1.5rem; box-shadow: var(--shadow-md);
    transform: translateY(-140%); transition: transform .28s ease; z-index: 50;
  }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: .8rem .6rem; font-size: 1.05rem; min-height: 44px; display: flex; align-items: center; }
  .nav__cta { margin: .5rem 0 0; }
  .nav__cta .btn { width: 100%; justify-content: center; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-900); color: #c4cdd6; padding-block: clamp(3rem, 6vw, 4.5rem) 2rem; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; } }
.site-footer h4 { color: var(--white); font-family: var(--font-body); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 1rem; }
.site-footer a { color: #c4cdd6; }
.site-footer a:hover { color: var(--gold-400); }
.footer-links { list-style: none; padding: 0; display: grid; gap: .55rem; }
.footer__brand p { color: #9aa6b2; max-width: 38ch; margin-top: .8rem; }
.footer__contact { display: grid; gap: .5rem; margin-top: .8rem; font-size: .95rem; }
.footer__contact a { display: inline-flex; align-items: center; gap: .5rem; }

/* Touch devices: give footer links a full-size tap target without changing
   the visual rhythm on desktop, where a mouse needs no such margin. */
@media (hover: none) and (pointer: coarse) {
  .footer__contact a,
  .footer-links a,
  .footer-bottom a { min-height: 44px; display: inline-flex; align-items: center; }
}
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.12);
  display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; justify-content: space-between;
  font-size: .85rem; color: #8b97a3;
}

/* ---------- Reveal on scroll (only hidden when JS is active) ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .btn:hover, .card--hover:hover { transform: none; }
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: 8px; top: -60px; background: var(--brand-dark); color: #fff;
  padding: .6rem 1rem; border-radius: 8px; z-index: 100; transition: top .2s;
}
.skip-link:focus { top: 8px; color: #fff; }

/* ---------- Rent payment buttons (sidebar: home + residents) ----------
   On-brand teal so they read as part of the system, but with a gold rim and a
   slow glow so they stand apart from the gold "Apply Today" above them. */
.nav__pay { display: grid; gap: .5rem; margin-top: .9rem; list-style: none; }
.nav__pay-label {
  font-size: .66rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); text-align: center;
}
.nav__links .btn-pay,
.btn-pay {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .7rem 1rem;
  border-radius: 999px;
  /* teal-600 -> darker teal keeps white text at >=5.8:1 (WCAG AA for
     normal-size bold text); teal-500 only reached 4.1:1. */
  background: linear-gradient(140deg, var(--teal-600), #225a56);
  color: #fff; font-weight: 700; font-size: .92rem; letter-spacing: .01em;
  border: 1px solid rgba(217, 164, 65, .55);
  box-shadow: 0 0 0 1px rgba(217,164,65,.12), 0 0 14px rgba(54,138,132,.45);
  transition: transform .18s ease, box-shadow .25s ease, background .25s ease;
  animation: payGlow 2.8s ease-in-out infinite;
}
.nav__links .btn-pay:hover,
.nav__links .btn-pay:focus-visible,
.btn-pay:hover,
.btn-pay:focus-visible {
  color: #fff;
  background: linear-gradient(140deg, var(--teal-600), var(--navy-800));
  border-color: var(--gold-400);
  box-shadow: 0 0 0 1px rgba(230,185,94,.5), 0 0 26px rgba(230,185,94,.55);
  transform: translateY(-2px);
  animation: none;
}
@keyframes payGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(217,164,65,.12), 0 0 12px rgba(54,138,132,.38); }
  50%      { box-shadow: 0 0 0 1px rgba(217,164,65,.30), 0 0 22px rgba(230,185,94,.42); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-pay { animation: none; transition: none; }
  .btn-pay:hover { transform: none; }
}
