/* ============================================================================
   NorthGrid — css/resources.css
   AUDIT 2026-10-28 BW: New file. Styles for the Resources library
   (resources/index.php, resources/doc.php, resources/download.php error pages)
   and Find a NorthGrid Contractor (find-a-contractor/index.php). Loaded after
   css/ng-brand.css and uses its tokens. Every rule is scoped to an .ngr- class,
   so nothing here changes a shared rule on any other page.

   The lead forms here use .ngr-form, NOT .contact-form: js/main.js binds the
   first .contact-form on a page, rewrites its button to "Send Message" and posts
   a fixed homepage field list. These forms are posted by js/ng-lead-forms.js.
   .ngr-form copies the .contact-form card look from ng-brand.css.

   Contrast (pairs documented in ng-brand.css): Onyx on white 16.3, ink-2 on
   white 6.9, Chalk on Pine 9.8, Copper on white 5.9. Amber is only a fill or
   border here, never text on a light surface.
   ========================================================================== */

/* ── Hero (uses the shared .plans-hero frame, one column) ──────────────── */
.ngr-hero .plans-hero-inner { grid-template-columns: minmax(0, 1fr); }
.ngr-hero h1 { max-width: 20ch; }
.ngr-hero .lead { max-width: 62ch; }
.ngr-hero { padding-bottom: 56px; }
/* Keep page content above the hero's decorative ::before tile (ng-brand.css .plans-hero). */
.ngr-hero > .section-inner { position: relative; z-index: 1; }

.ngr-section { padding-top: clamp(48px, 3rem + 2vw, 88px); padding-bottom: clamp(48px, 3rem + 2vw, 88px); }
.ngr-section.ngr-alt { background: var(--ng-chalk-50); }
.ngr-section-head { margin-bottom: 32px; }
.ngr-section-head .section-h2 { margin-bottom: 10px; }
.ngr-section-head p { color: var(--ng-ink-2); max-width: 62ch; }

/* ── Field Guide feature (hub) ─────────────────────────────────────────── */
.ngr-feature {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px);
  align-items: center; background: var(--ng-white); border: 1px solid var(--ng-line);
  border-radius: var(--ng-radius); padding: clamp(22px, 3vw, 40px); box-shadow: var(--ng-shadow);
  border-top: 4px solid var(--ng-amber);
}
.ngr-feature h3 { font-family: var(--ng-font-display); font-weight: 400; font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem); line-height: 1.1; margin-bottom: 10px; }
.ngr-feature p { color: var(--ng-ink-2); margin-bottom: 18px; }
.ngr-feature .section-h2 { margin: 8px 0 10px; }

/* ── Cover images ──────────────────────────────────────────────────────── */
.ngr-cover {
  width: 100%; height: auto; display: block; border-radius: 4px; background: var(--ng-white);
  box-shadow: 0 1px 0 #d4cfc3, 0 14px 30px -14px rgba(39, 59, 26, 0.45);
}
.ngr-cover.ngr-tilt { transform: rotate(-2deg); }
@media (prefers-reduced-motion: reduce) { .ngr-cover.ngr-tilt { transform: none; } }

/* ── Card grid (hub, "more resources") ─────────────────────────────────── */
.ngr-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2vw, 28px); }
.ngr-card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  background: var(--ng-white); border: 1px solid var(--ng-line); border-radius: var(--ng-radius);
  overflow: hidden; transition: box-shadow var(--ng-ease), transform var(--ng-ease);
}
.ngr-card:hover, .ngr-card:focus-within { box-shadow: var(--ng-shadow); transform: translateY(-2px); }
.ngr-card-img { aspect-ratio: 4 / 3; overflow: hidden; background: var(--ng-chalk-50); border-bottom: 1px solid var(--ng-line); }
.ngr-card-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.ngr-card-body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 22px; flex: 1; }
.ngr-kicker { font-size: 0.8125rem; letter-spacing: var(--ng-track-caps); text-transform: uppercase; color: var(--ng-copper); font-weight: 600; }
.ngr-card h3 { font-size: 1.1875rem; line-height: 1.3; }
.ngr-card h3 a { text-decoration: none; color: var(--ng-ink); }
.ngr-card h3 a::after { content: ''; position: absolute; inset: 0; } /* whole card is the link */
.ngr-card h3 a:focus-visible { outline: none; }
.ngr-card:focus-within { outline: 3px solid var(--ng-pine); outline-offset: 3px; }
.ngr-card p { color: var(--ng-ink-2); font-size: 0.96875rem; line-height: 1.55; }
.ngr-card-cta { margin-top: auto; padding-top: 8px; font-size: 0.9375rem; font-weight: 600; color: var(--ng-pine); display: inline-flex; align-items: center; gap: 8px; }
.ngr-empty { color: var(--ng-ink-2); font-style: italic; }
.ngr-more-link { margin-top: 24px; }

/* ── Document landing page ─────────────────────────────────────────────── */
.ngr-crumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.875rem; color: var(--ng-ink-2); margin-bottom: 22px; }
.ngr-crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--ng-line-ui); }
.ngr-crumbs a { color: var(--ng-ink-2); }
.ngr-doc {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.5rem clamp(28px, 4vw, 56px);
  grid-template-areas: "intro form" "points form"; grid-template-rows: auto 1fr; align-items: start;
}
.ngr-doc-intro { grid-area: intro; }
.ngr-doc-form { grid-area: form; }
.ngr-doc-points { grid-area: points; }
.ngr-doc-head { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.ngr-h1 { font-size: clamp(1.875rem, 1.3rem + 1.6vw, 2.75rem); line-height: 1.08; margin: 6px 0 12px; }
.ngr-sub { font-size: 1.125rem; color: var(--ng-ink); line-height: 1.5; margin-bottom: 14px; }
.ngr-lede { color: var(--ng-ink-2); line-height: 1.65; }
.ngr-meta { font-size: 0.875rem; color: var(--ng-ink-2); margin-top: 12px; }
.ngr-doc-points h2 { font-family: var(--ng-font-body); font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em; margin-bottom: 8px; }
.ngr-points { list-style: none; max-width: 36rem; }
.ngr-points li { position: relative; padding: 0.4rem 0 0.4rem 1.5rem; line-height: 1.5; }
.ngr-points li::before { content: ''; position: absolute; left: 0; top: 0.95rem; width: 0.6rem; height: 0.6rem; background: var(--ng-amber); transform: rotate(45deg); }
.ngr-legal { margin-top: 1.5rem; font-size: 0.85rem; line-height: 1.55; color: var(--ng-ink-2); max-width: 46rem; }

/* ── Form card ─────────────────────────────────────────────────────────── */
.ngr-formcard {
  background: var(--ng-white); border: 1px solid var(--ng-line); border-top: 4px solid var(--ng-amber);
  border-radius: var(--ng-radius); padding: clamp(22px, 3vw, 36px); box-shadow: var(--ng-shadow);
  scroll-margin-top: calc(var(--ng-nav-h) + 16px);
}
.ngr-formcard > h2 { font-family: var(--ng-font-body); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 6px; }
.ngr-formlede { color: var(--ng-ink-2); margin-bottom: 18px; }
.ngr-form { display: flex; flex-direction: column; gap: 18px; }
.ngr-form button[type="submit"] { align-self: stretch; }
.ngr-form fieldset { border: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ngr-form fieldset + fieldset { border-top: 1px solid var(--ng-line); padding-top: 22px; }
.ngr-form legend {
  font-family: var(--ng-font-body); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em;
  color: var(--ng-ink); padding: 0; margin-bottom: 4px; float: left; width: 100%;
}
.ngr-form legend + * { clear: both; }
.ngr-q { font-size: 0.9375rem; font-weight: 600; color: var(--ng-ink); }
.ngr-hint { font-size: 0.875rem; color: var(--ng-ink-2); font-weight: 400; }
.ngr-choices { display: grid; gap: 8px; }
.ngr-choices.ngr-two { grid-template-columns: 1fr 1fr; }
.ngr-choice {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.45; font-size: 0.96875rem;
  padding: 10px 12px; border: 1.5px solid var(--ng-line); border-radius: 8px; background: var(--ng-white);
  transition: border-color var(--ng-ease), background-color var(--ng-ease);
}
.ngr-choice:hover { border-color: var(--ng-line-ui); }
.ngr-choice input { flex: none; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--ng-pine); }
.ngr-choice:has(input:checked) { border-color: var(--ng-pine); background: rgba(39, 59, 26, 0.05); }
.ngr-choice:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(39, 59, 26, 0.25); }
.ngr-group { display: flex; flex-direction: column; gap: 8px; }
.ngr-group.has-error .ngr-choice { border-color: var(--ng-danger); }
.ngr-row3 { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; gap: 18px; }
.ngr-permission .ngr-choice { font-size: 0.9375rem; }
.ngr-reveal[hidden] { display: none; }

.ngr-status {
  margin: 0 0 4px; padding: 12px 16px; border-left: 4px solid var(--ng-danger); background: rgba(218, 44, 56, 0.07);
  border-radius: 0 8px 8px 0; color: var(--ng-onyx); font-size: 0.96rem; line-height: 1.55;
}
.ngr-status:empty { display: none; }
.ngr-status a { color: inherit; font-weight: 600; }

.ngr-done { outline: none; }
.ngr-done h2 { font-family: var(--ng-font-body); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 10px; }
.ngr-done p { margin-bottom: 14px; line-height: 1.6; }
.ngr-done .ngr-next { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--ng-line); }
.ngr-done .btn-primary, .ngr-done .btn-secondary { margin-top: 4px; }

/* ── Find a Contractor ─────────────────────────────────────────────────── */
.ngr-steps { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2vw, 28px); counter-reset: ngr-step; }
.ngr-steps li {
  position: relative; background: var(--ng-white); border: 1px solid var(--ng-line); border-radius: var(--ng-radius);
  padding: 24px 22px 22px 22px; counter-increment: ngr-step;
}
.ngr-steps li::before {
  content: counter(ngr-step, decimal-leading-zero); display: block; font-family: var(--ng-font-display);
  font-size: 2rem; line-height: 1; color: var(--ng-copper); margin-bottom: 12px;
}
.ngr-steps h3 { font-size: 1.125rem; margin-bottom: 6px; }
.ngr-steps p { color: var(--ng-ink-2); font-size: 0.96875rem; line-height: 1.6; }
.ngr-contractor { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.ngr-aside h2 { margin-bottom: 14px; }
.ngr-aside p { color: var(--ng-ink-2); margin-bottom: 14px; }
.ngr-note {
  margin-top: 20px; padding: 14px 18px; background: var(--ng-white); border-left: 4px solid var(--ng-sage);
  border-radius: 0 8px 8px 0; font-size: 0.9rem; line-height: 1.6; color: var(--ng-ink-2);
}
.ngr-aside .ngr-points { margin-bottom: 8px; }

/* ── Simple message page (download errors) ─────────────────────────────── */
.ngr-simple { padding: calc(var(--ng-nav-h) + 64px) var(--ng-gutter) 96px; }
.ngr-simple-inner { max-width: 720px; }
.ngr-simple .ngr-lede { margin-bottom: 24px; font-size: 1.0625rem; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ngr-grid, .ngr-steps { grid-template-columns: 1fr 1fr; }
  .ngr-contractor { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  /* Phone order: intro, form, points, so the form is reached without scrolling past the bullets. */
  .ngr-doc { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "form" "points"; grid-template-rows: auto; }
  .ngr-doc-head { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.1rem; }
}
@media (max-width: 640px) {
  .ngr-grid, .ngr-steps, .ngr-choices.ngr-two, .ngr-row3 { grid-template-columns: 1fr; }
  .ngr-feature { grid-template-columns: minmax(0, 1fr); }
  .ngr-feature .ngr-cover { max-width: 160px; }
}
