/* ===========================
   Base / Reset
   =========================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #111827;
  background-color: #f3f4f6;
}

body.pgg-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Remove default link underlines, reapply on hover where needed */
a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

/* Accessible hidden text */
.pgg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===========================
   Layout
   =========================== */

.pgg-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.pgg-section {
  background-color: #ffffff;
  border-radius: 0.5rem;
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
}

/* ===========================
   Header & Navigation
   =========================== */

.pgg-header {
  background-color: #111827;
  color: #f9fafb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.5);
}

.pgg-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.pgg-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.pgg-logo img {
  max-height: 32px;
  width: auto;
}

.pgg-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.pgg-nav a {
  color: #e5e7eb;
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
}

.pgg-nav a:hover,
.pgg-nav a:focus {
  background-color: rgba(249, 250, 251, 0.12);
  text-decoration: none;
}

/* Header search */
.pgg-search-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pgg-search-form input[type="search"] {
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #4b5563;
  background-color: #0f172a;
  color: #f9fafb;
  font-size: 0.9rem;
  min-width: 180px;
}

.pgg-search-form input[type="search"]::placeholder {
  color: #9ca3af;
}

.pgg-search-form button {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: none;
  background-color: #2563eb;
  color: #f9fafb;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.pgg-search-form button:hover {
  background-color: #1d4ed8;
}

/* ===========================
   Hero
   =========================== */

.pgg-hero {
  background: linear-gradient(135deg, #1d4ed8, #111827);
  color: #f9fafb;
  border-radius: 0.75rem;
  padding: 2rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.45);
}

.pgg-hero-inner {
  max-width: 900px;
  margin: 0 auto;
}

.pgg-hero h1 {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: 1.9rem;
}

.pgg-hero p {
  margin-top: 0;
  margin-bottom: 1rem;
  max-width: 640px;
}

.pgg-hero-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pgg-hero-search input[type="search"] {
  flex: 1 1 230px;
  padding: 0.6rem 0.75rem;
  border-radius: 999px;
  border: none;
  font-size: 0.95rem;
}

.pgg-hero-search button {
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: none;
  background-color: #fbbf24;
  color: #111827;
  font-weight: 600;
  cursor: pointer;
}

.pgg-hero-search button:hover {
  background-color: #f59e0b;
}

.pgg-hero-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.pgg-hero-quicklinks a {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.35);
  color: #e5e7eb;
  font-size: 0.9rem;
}

.pgg-hero-quicklinks a:hover {
  background-color: rgba(15, 23, 42, 0.5);
  text-decoration: none;
}

/* ===========================
   Home grid / columns
   =========================== */

.pgg-home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.pgg-home-column h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.pgg-state-list,
.pgg-category-list,
.pgg-grant-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pgg-state-list li,
.pgg-category-list li {
  margin-bottom: 0.4rem;
}

/* ===========================
   Categories index / cards
   =========================== */

.pgg-categories-index h1 {
  margin-top: 0;
}

.pgg-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.pgg-category-card {
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  padding: 1rem;
}

.pgg-category-card h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
}

.pgg-category-card p {
  margin: 0;
  font-size: 0.92rem;
  color: #4b5563;
}

/* Category detail */

.pgg-category-detail h1 {
  margin-top: 0;
}

.pgg-category-detail h2 {
  margin-top: 1.5rem;
}

/* ===========================
   Category snapshot
   =========================== */

.pgg-category-snapshot {
  margin: 1rem 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pgg-category-snapshot-item {
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  padding: 0.75rem 0.9rem;
}

.pgg-category-snapshot-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.pgg-category-snapshot-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #111827;
}

.pgg-category-count {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.4rem;
}

/* ===========================
   Grant list & grant detail
   =========================== */

.pgg-grant-list-page h1 {
  margin-top: 0;
}

.pgg-grants-search {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.pgg-grants-search input[type="search"] {
  background-color: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

.pgg-grants-search button {
  background-color: #111827;
}

.pgg-grants-search button:hover {
  background-color: #0f172a;
}

.pgg-grant-count {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: #4b5563;
}

.pgg-grant-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pgg-grant-list-item {
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  padding: 1rem;
  background-color: #ffffff;
  margin-bottom: 0.75rem;
}

.pgg-grant-list-item h2,
.pgg-grant-list-item h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.pgg-grant-list-item p {
  margin: 0.15rem 0;
}

.pgg-grant-deadline {
  font-size: 0.9rem;
  color: #374151;
}

/* Grant detail page */

.pgg-grant-detail h1 {
  margin-top: 0;
}

.pgg-grant-detail h2 {
  margin-top: 1.25rem;
}

/* ===========================
   States Index
   =========================== */

.pgg-states-index h1 {
  margin-top: 0;
}

.pgg-states-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.pgg-state-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.75rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  text-decoration: none;
  color: #111827;
  font-size: 0.95rem;
}

.pgg-state-card:hover {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  text-decoration: none;
}

.pgg-state-code {
  font-weight: 600;
  font-size: 0.9rem;
  color: #4b5563;
}

.pgg-state-name {
  font-size: 0.95rem;
}

/* ===========================
   Header Styling
   =========================== */

.pgg-state-detail h1 {
  margin-top: 0;
}

.pgg-state-detail h2 {
  margin-top: 1.5rem;
}

/* ===========================
   Search Page
   =========================== */

.pgg-search-page h1 {
  margin-top: 0;
}

.pgg-search-page-form {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.pgg-search-intro {
  font-size: 0.95rem;
  color: #4b5563;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.pgg-search-links {
  font-size: 0.95rem;
  color: #4b5563;
}

/* ===========================
   Category FAQ
   =========================== */

.pgg-faq-list {
  margin: 0.75rem 0 0;
  padding: 0;
}

.pgg-faq-item {
  margin-bottom: 0.75rem;
}

.pgg-faq-item dt {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.pgg-faq-item dd {
  margin: 0;
  font-size: 0.95rem;
  color: #4b5563;
}

/* ===========================
   Pagination
   =========================== */

.pgg-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.pgg-pagination a,
.pgg-pagination span {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background-color: #ffffff;
}

.pgg-pagination a {
  color: #1f2933;
}

.pgg-pagination a:hover {
  background-color: #e5e7eb;
  text-decoration: none;
}

.pgg-pagination .pgg-page-current {
  background-color: #111827;
  color: #f9fafb;
  border-color: #111827;
}

/* ===========================
   Footer
   =========================== */

.pgg-footer {
  background-color: #111827;
  color: #9ca3af;
  padding: 1rem 1rem 1.5rem;
  margin-top: auto;
}

.pgg-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.pgg-footer-links a {
  color: #e5e7eb;
  margin-right: 0.75rem;
  font-size: 0.9rem;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 900px) {
  .pgg-home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .pgg-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .pgg-nav {
    margin-left: 0;
  }

  .pgg-main {
    padding: 1.25rem 0.75rem 2.75rem;
  }

  .pgg-section {
    padding: 1.5rem 1.25rem;
  }

  .pgg-home-grid {
    grid-template-columns: 1fr;
  }
}

/* Grant detail layout tweaks */
/* Grant detail layout tweaks */
.pgg-grant-links {
  margin-top: 2rem;
}

.pgg-grant-categories ul,
.pgg-grant-states ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Categories can stay as a simple vertical list */
.pgg-grant-categories ul li + li {
    margin-top: 0.25rem;
}

/* States: responsive multi-column layout */
/* States: responsive multi-column layout */
/* States: responsive multi-column layout */
.pgg-grant-states ul {
  list-style: none;
  margin: 0;
  padding: 0;
  column-count: 3;
  column-gap: 1.5rem;
}

@media (max-width: 900px) {
  .pgg-grant-states ul {
    column-count: 2;
  }
}

@media (max-width: 640px) {
  .pgg-grant-states ul {
    column-count: 1;
  }
}


.pgg-grant-states li a {
    text-decoration: none;
}

.pgg-grant-states li a:hover,
.pgg-grant-states li a:focus {
    text-decoration: underline;
}

/* ===========================
   State snapshot
   =========================== */

.pgg-state-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.pgg-state-snapshot-item {
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  padding: 0.75rem 0.9rem;
}

.pgg-state-snapshot-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.pgg-state-snapshot-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #111827;
}

.pgg-state-snapshot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pgg-state-grant-count {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.15rem;
}


.pgg-state-snapshot-tags span {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  background-color: #e5e7eb;
  color: #111827;
}

/* Related grants list */
.pgg-related-grants {
    margin-top: 2rem;
}

.pgg-related-grants-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pgg-related-grants-list li + li {
    margin-top: 0.25rem;
}
