/* How it works — dedicated page (/how-it-works/)
   Cards are full-height link tiles. Keep text inside the card box. */

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

body {
  padding-top: 70px;
  overflow-x: hidden;
}

#main-content,
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem 2rem;
  width: 100%;
  min-width: 0;
}

/* portal.css sets section { padding: 4rem 0 } — reset for this page */
main > .role-section,
main section.role-section,
main section.hiw-cta {
  padding: 0;
  margin: 0 0 3rem;
}

.page-hero {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 0 0.5rem;
}

.page-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: #1e3a5f;
  margin: 0 0 0.75rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-hero p {
  font-size: 1.05rem;
  color: #64748b;
  max-width: 40rem;
  margin: 0 auto;
  line-height: 1.55;
}

.role-section {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.role-section:last-of-type {
  border-bottom: none;
}

.role-section h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  color: #1e3a5f;
  margin: 0 0 0.5rem;
  text-align: center;
}

.role-lead {
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
  margin: 0 auto 1.5rem;
  max-width: 34rem;
  line-height: 1.5;
}

/* min() prevents grid blow-out on narrow viewports (text/cards spilling) */
.how-it-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1.25rem;
  margin: 0 0 1.25rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.how-it-works-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.35rem 1.25rem 1.15rem;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  height: 100%;
  min-height: 0;
  min-width: 0;           /* allow flex/grid children to shrink */
  max-width: 100%;
  overflow: hidden;       /* keep text inside the rounded card */
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

a.how-it-works-card:hover,
a.how-it-works-card:focus-visible {
  border-color: #0891b2;
  box-shadow: 0 8px 24px rgba(8, 145, 178, 0.14);
  transform: translateY(-2px);
  outline: none;
}

a.how-it-works-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.35);
}

.how-it-works-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.1);
  font-size: 1rem;
  font-weight: 800;
  color: #0891b2;
  margin: 0 0 0.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.how-it-works-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.how-it-works-card p {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.55;
  margin: 0 0 1rem;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  min-width: 0;
}

.how-it-works-card .card-cta {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0891b2;
  margin-top: auto;
  padding-top: 0.25rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

a.how-it-works-card:hover .card-cta {
  color: #0e7490;
}

.role-extra {
  text-align: center;
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0;
  line-height: 1.6;
  padding: 0 0.25rem;
  overflow-wrap: anywhere;
}

.role-extra a {
  color: #0891b2;
  font-weight: 600;
  text-decoration: none;
}

.role-extra a:hover {
  text-decoration: underline;
}

.hiw-cta {
  text-align: center;
  padding: 1.5rem 0.5rem 3rem !important;
  margin-bottom: 0 !important;
}

.hiw-cta h2 {
  font-size: 1.5rem;
  color: #0f172a;
  margin: 0 0 0.5rem;
}

.hiw-cta p {
  color: #64748b;
  margin: 0 0 1.25rem;
}

.hiw-cta-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hiw-cta-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  line-height: 1.2;
}

.hiw-cta-actions .btn-primary {
  background: #0891b2;
  color: #fff;
  border: 1px solid #0891b2;
}

.hiw-cta-actions .btn-primary:hover {
  background: #0e7490;
  border-color: #0e7490;
}

.hiw-cta-actions .btn-secondary {
  background: #fff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.hiw-cta-actions .btn-secondary:hover {
  border-color: #0891b2;
  color: #0891b2;
}

@media (max-width: 640px) {
  #main-content,
  main {
    padding: 0 1rem 1.5rem;
    margin-top: 1.25rem;
  }

  .how-it-works-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .how-it-works-card {
    padding: 1.2rem 1.1rem 1.05rem;
  }
}
