/* Shared PL/EN homepage sections. Load after the base and shared home styles. */
.home-feature-grid,
.home-course-strip,
.home-research-panel,
.home-topic-grid,
.home-risk-card {
  --home-ink: #10283f;
  --home-muted: #465a67;
  --home-green: #00785a;
  --home-line: #d6e3dc;
  color: var(--home-ink);
  min-width: 0;
  font-size: 1rem;
  line-height: 1.65;
}

/* Illustrated articles remain readable and clickable as complete cards. */
.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.home-feature-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--home-line);
  border-radius: 12px;
  box-shadow: 0 3px 14px rgb(16 40 63 / 4%);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.home-feature-image {
  flex: none;
  overflow: hidden;
  border-radius: 11px 11px 0 0;
  background: #f1f6f3;
}
.home-feature-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}
.home-feature-copy {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 24px;
}
.home-feature-copy .eyebrow,
.home-research-copy .eyebrow {
  margin: 0 0 12px;
  color: var(--home-green);
  font-size: .875rem;
  line-height: 1.5;
  letter-spacing: .05em;
}
.home-feature-copy h3 {
  margin: 0;
  color: var(--home-ink);
  font-size: 1.25rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.home-feature-copy > p:not(.eyebrow) {
  margin: 12px 0 22px;
  color: var(--home-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.home-feature-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #e5ede8;
  color: var(--home-green);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.6;
}

/* A small continuation link replaces the repeated four-lesson block. */
.home-course-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin-top: 28px;
  padding: 22px 24px;
  border: 1px solid var(--home-line);
  border-radius: 10px;
  background: #f4f8f5;
}
.home-course-strip p {
  flex: 1 1 28rem;
  margin: 0;
  color: var(--home-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.home-course-strip strong { color: var(--home-ink); }
.home-course-strip .link-more {
  flex-shrink: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 0;
  white-space: normal;
  font-size: .875rem;
  line-height: 1.6;
}

/* Research uses the actual chart, with room for its caption and method. */
.home-research-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  align-items: center;
  gap: 40px;
  padding: 36px;
  border: 1px solid var(--home-line);
  border-radius: 14px;
  background: #eef5f1;
}
.home-research-copy,
.home-research-figure { min-width: 0; }
.home-research-copy h2 {
  margin: 0 0 18px;
  color: var(--home-ink);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.home-research-copy > p:not(.eyebrow) {
  margin: 0 0 20px;
  color: var(--home-muted);
  font-size: 1rem;
  line-height: 1.7;
}
.home-research-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0;
  padding: 20px 0;
  border-top: 1px solid #cadcd2;
  border-bottom: 1px solid #cadcd2;
}
.home-research-fact { min-width: 0; }
.home-research-fact strong {
  display: block;
  color: var(--home-green);
  font-family: var(--font-display, inherit);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.home-research-fact span {
  display: block;
  margin-top: 7px;
  color: var(--home-muted);
  font-size: .875rem;
  line-height: 1.6;
}
.home-research-copy > p.home-research-note {
  font-size: .875rem;
  line-height: 1.65;
}
.home-research-copy .btn {
  min-height: 48px;
  white-space: normal;
  text-align: center;
  line-height: 1.5;
}
.home-research-copy .home-research-all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 8px 0 8px 18px;
  padding: 8px 0;
  color: var(--home-green);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: normal;
  vertical-align: middle;
}
.home-research-figure {
  margin: 0;
  padding: 18px;
  border: 1px solid #dce7df;
  border-radius: 10px;
  background: #fff;
}
.home-research-figure > a {
  display: block;
  border-radius: 4px;
}
.home-research-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.home-research-figure figcaption {
  margin: 14px 0 0;
  color: var(--home-muted);
  font-size: .875rem;
  line-height: 1.65;
}

/* Topic diagrams share one calm surface; mobile cards use a short row. */
.home-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.home-topic-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--home-line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.home-topic-card > img {
  display: block;
  width: 100%;
  height: 128px;
  margin-bottom: 18px;
  object-fit: contain;
  border-radius: 6px;
  background: #f3f7f4;
}
.home-topic-card > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.home-topic-card h3 {
  margin: 0 0 10px;
  color: var(--home-ink);
  font-size: 1.125rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.home-topic-card p {
  margin: 0 0 16px;
  color: var(--home-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.home-topic-count {
  display: block;
  margin-top: auto;
  color: var(--home-green);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.6;
}

/* Only the homepage tools panel is affected. Explicit class is preferred. */
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  align-items: center;
  gap: 40px;
  padding: 36px;
  background: #10283f;
  border-radius: 14px;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div {
  min-width: 0;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div > p:not(.eyebrow) {
  color: #d2e1df;
  font-size: 1rem;
  line-height: 1.7;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div > .eyebrow {
  color: #a9dfc8;
  font-size: .875rem;
  line-height: 1.6;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div > .link-more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 16px;
  white-space: normal;
  line-height: 1.6;
}
.home-risk-card {
  width: 100%;
  padding: 28px;
  border: 1px solid #d5e2dc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgb(0 0 0 / 10%);
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) .home-risk-card p {
  margin: 0;
  color: var(--home-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.home-risk-card h3,
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) .home-risk-card h2 {
  margin: 0 0 16px;
  color: var(--home-ink);
  font-size: 1.25rem;
  line-height: 1.35;
}
.home-risk-form { margin: 0; }
.home-risk-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.home-risk-form label {
  display: block;
  min-width: 0;
  color: var(--home-ink);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.6;
}
.home-risk-form input,
.home-risk-form select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #8aa298;
  border-radius: 6px;
  background: #fff;
  color: var(--home-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}
.home-risk-form input { font-variant-numeric: tabular-nums; }
.home-risk-form select { cursor: pointer; }
.home-risk-unit { margin-top: 16px; }
.home-risk-output {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #c8dfd2;
  border-radius: 8px;
  background: #edf6f0;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) .home-risk-output .home-risk-label {
  color: var(--home-ink);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.6;
}
.home-risk-output output {
  display: block;
  margin: 8px 0 10px;
  color: var(--home-green);
  font-family: var(--font-display, inherit);
  font-size: clamp(1.875rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) .home-risk-card [data-risk-formula] {
  font-size: .875rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.home-risk-form [aria-invalid="true"] {
  border-color: #a63d32;
  box-shadow: inset 0 0 0 1px #a63d32;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) .home-risk-card .home-risk-error {
  margin-top: 14px;
  color: #9b3328;
  font-size: 1rem;
  line-height: 1.6;
}
.home-risk-error[hidden] { display: none; }
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) .home-risk-card .home-risk-caption {
  margin-top: 18px;
  font-size: 1rem;
  line-height: 1.65;
}
.home-risk-card #home-risk-help { margin-bottom: 18px; }
.home-risk-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 12px;
}
.home-risk-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  color: var(--home-green);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.6;
  text-decoration: underline;
  text-underline-offset: 4px;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div:first-child .home-risk-links a {
  color: #b4e9d4;
}

/* Keyboard and touch states are visible without relying on movement. */
.home-feature-card:focus-visible,
.home-topic-card:focus-visible,
.home-course-strip a:focus-visible,
.home-research-panel a:focus-visible,
.home-risk-form :is(input, select, button):focus-visible,
.home-risk-links a:focus-visible {
  outline: 3px solid #00785a;
  outline-offset: 4px;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div > a:focus-visible {
  outline: 3px solid #a9dfc8;
  outline-offset: 4px;
}
:is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div:first-child .home-risk-links a:focus-visible {
  outline: 3px solid #b4e9d4;
  outline-offset: 4px;
}
@media (hover: hover) and (pointer: fine) {
  .home-feature-card:hover {
    border-color: #92b8a7;
    box-shadow: 0 9px 24px rgb(16 40 63 / 8%);
    transform: translateY(-2px);
  }
  .home-feature-card:hover h3,
  .home-topic-card:hover h3 { color: var(--home-green); }
  .home-topic-card:hover {
    border-color: #92b8a7;
    background: #fbfdfb;
  }
  .home-risk-links a:hover { color: #005b44; }
  :is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) > div:first-child .home-risk-links a:hover {
    color: #fff;
  }
}

@media (max-width: 960px) {
  .home-feature-grid { gap: 18px; }
  .home-feature-copy { padding: 20px; }
  .home-research-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 28px;
  }
  .home-research-copy { max-width: 68ch; }
  .home-research-figure { width: 100%; }
  .home-topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 28px;
  }
}
@media (max-width: 760px) {
  .home-feature-grid { grid-template-columns: minmax(0, 1fr); }
  .home-feature-card { flex-direction: row; }
  .home-feature-image {
    width: 35%;
    border-radius: 11px 0 0 11px;
  }
  .home-feature-image img { height: 100%; object-fit: contain; }
}
@media (max-width: 680px) {
  .home-course-strip { margin-top: 22px; padding: 18px 20px; gap: 10px; }
  .home-course-strip p { flex-basis: 100%; }
  .home-research-panel { padding: 22px; gap: 24px; }
  .home-research-copy .home-research-all { display: flex; width: fit-content; margin: 14px 0 0; }
  .home-research-facts { gap: 16px; margin: 22px 0; padding: 18px 0; }
  .home-research-figure { padding: 12px; }
  .home-topic-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .home-topic-card { flex-direction: row; align-items: flex-start; padding: 18px; gap: 16px; }
  .home-topic-card > img { width: 72px; height: 72px; flex: none; margin: 0; }
  .home-topic-card h3 { margin-bottom: 7px; }
  .home-topic-card p { margin-bottom: 10px; }
  :is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) { padding: 22px; gap: 24px; }
  .home-risk-card { padding: 22px; }
  .home-risk-output { padding: 18px; }
}
@media (max-width: 520px) {
  .home-feature-card { flex-direction: column; }
  .home-feature-image { width: 100%; border-radius: 11px 11px 0 0; }
  .home-feature-image img { height: auto; object-fit: cover; }
  .home-feature-copy { padding: 22px; }
  .home-research-panel { padding: 20px; }
  .home-research-facts { gap: 12px; }
  .home-research-figure > a {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .home-research-figure img { min-width: 375px; }
  .home-topic-card { padding: 16px; gap: 14px; }
  .home-topic-card > img { width: 60px; height: 60px; }
  :is(.tools-panel.home-tools-panel, .tools-panel:has(.home-risk-card)) { padding: 20px; }
  .home-risk-card { padding: 20px; }
  .home-risk-fields { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .home-risk-output { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-feature-card,
  .home-topic-card { transition: none; }
  .home-feature-card:hover { transform: none; }
}
@media (forced-colors: active) {
  .home-feature-card,
  .home-topic-card,
  .home-risk-card,
  .home-risk-output,
  .home-research-panel,
  .home-course-strip { border-color: CanvasText; }
  .home-risk-form [aria-invalid="true"] { outline: 2px solid CanvasText; }
}

.home-chart-hint { display: none; }
@media (max-width: 520px) { .home-chart-hint { display: block; margin-top: 8px; } }
