/* ============================================
   RETIREMENT RED FLAGS — SHARED PAGE COMPONENTS
   Layout, type, buttons, cards and form fields
   built on /assets/css/tokens.css. Link this after
   tokens.css on every page.
   ============================================ */

/* --- Layout --- */
.rrf-container {
  max-width: var(--rrf-max-width);
  margin: 0 auto;
  padding: 0 var(--rrf-section-h);
}

.rrf-section {
  padding: var(--rrf-section-v) 0;
}

.rrf-section--mist {
  background: var(--rrf-mist);
}

.rrf-section--red {
  background: var(--rrf-red);
  color: var(--rrf-white);
}

.rrf-section--red a:not(.rrf-btn) {
  color: var(--rrf-white);
}

.rrf-section--red .rrf-h1,
.rrf-section--red .rrf-h2,
.rrf-section--red .rrf-h3,
.rrf-section--red .rrf-lede {
  color: var(--rrf-white);
}

.rrf-section--red .rrf-eyebrow {
  color: var(--rrf-white);
}

.rrf-center {
  text-align: center;
}

.rrf-center .rrf-lede,
.rrf-center .rrf-text {
  margin-left: auto;
  margin-right: auto;
}

/* --- Type --- */
.rrf-eyebrow {
  display: block;
  font-size: var(--rrf-eyebrow);
  font-weight: var(--rrf-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rrf-red);
  margin-bottom: var(--rrf-space-3);
}

.rrf-h1,
.rrf-h2,
.rrf-h3,
.rrf-h4 {
  font-weight: var(--rrf-bold);
  line-height: var(--rrf-line-tight);
  color: var(--rrf-ink);
}

.rrf-h1 { font-size: var(--rrf-h1); margin-bottom: var(--rrf-space-5); }
.rrf-h2 { font-size: var(--rrf-h2); margin-bottom: var(--rrf-space-4); }
.rrf-h3 { font-size: var(--rrf-h3); margin-bottom: var(--rrf-space-3); font-weight: var(--rrf-semibold); }
.rrf-h4 { font-size: var(--rrf-h4); margin-bottom: var(--rrf-space-3); font-weight: var(--rrf-semibold); }

.rrf-accent {
  color: var(--rrf-red);
}

.rrf-lede {
  font-size: var(--rrf-lede);
  line-height: 1.55;
  max-width: var(--rrf-text-width);
}

.rrf-text {
  max-width: var(--rrf-text-width);
}

.rrf-text p + p,
.rrf-text p + ul,
.rrf-text ul + p {
  margin-top: var(--rrf-space-4);
}

.rrf-text ul {
  padding-left: 1.25em;
}

.rrf-text-muted {
  color: var(--rrf-text-muted);
}

/* --- Buttons ---
   Min 48px tall for comfortable tapping. */
.rrf-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--rrf-space-4);
  margin-top: var(--rrf-space-6);
}

.rrf-center .rrf-btn-row {
  justify-content: center;
}

.rrf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 28px;
  font-family: var(--rrf-font);
  font-size: var(--rrf-body);
  font-weight: var(--rrf-semibold);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--rrf-radius);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.rrf-btn--primary {
  background: var(--rrf-red);
  border-color: var(--rrf-red);
  color: var(--rrf-white);
}

.rrf-btn--primary:hover,
.rrf-btn--primary:active {
  background: var(--rrf-red-hover);
  border-color: var(--rrf-red-hover);
  color: var(--rrf-white);
}

.rrf-btn--secondary {
  background: var(--rrf-white);
  border-color: var(--rrf-white);
  color: var(--rrf-red);
}

.rrf-btn--secondary:hover,
.rrf-btn--secondary:active {
  background: var(--rrf-mist);
  border-color: var(--rrf-mist);
  color: var(--rrf-red-hover);
}

.rrf-btn--outline {
  background: transparent;
  border-color: var(--rrf-red);
  color: var(--rrf-red);
}

.rrf-btn--outline:hover,
.rrf-btn--outline:active {
  background: var(--rrf-red);
  color: var(--rrf-white);
}

/* Primary on a red band flips to white so it stays visible */
.rrf-section--red .rrf-btn--primary {
  background: var(--rrf-white);
  border-color: var(--rrf-white);
  color: var(--rrf-red);
}

.rrf-section--red .rrf-btn--primary:hover {
  background: var(--rrf-mist);
  border-color: var(--rrf-mist);
  color: var(--rrf-red-hover);
}

.rrf-section--red .rrf-btn--outline {
  border-color: var(--rrf-white);
  color: var(--rrf-white);
}

.rrf-section--red .rrf-btn--outline:hover {
  background: var(--rrf-white);
  color: var(--rrf-red);
}

.rrf-btn--block {
  width: 100%;
}

/* --- Cards --- */
.rrf-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--rrf-space-6);
}

.rrf-card {
  display: flex;
  flex-direction: column;
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-top: 4px solid var(--rrf-red);
  border-radius: var(--rrf-radius-card);
  padding: var(--rrf-space-6);
  color: var(--rrf-ink);
}

.rrf-card__media {
  margin: calc(var(--rrf-space-6) * -1) calc(var(--rrf-space-6) * -1) var(--rrf-space-5);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.rrf-card__media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.rrf-card__title {
  font-size: var(--rrf-h4);
  font-weight: var(--rrf-semibold);
  line-height: 1.3;
  color: var(--rrf-ink);
  margin-bottom: var(--rrf-space-3);
}

.rrf-card__body {
  flex: 1;
}

.rrf-card .rrf-btn-row {
  margin-top: var(--rrf-space-5);
}

a.rrf-card {
  text-decoration: none;
  transition: box-shadow .15s ease, transform .15s ease;
}

a.rrf-card:hover {
  color: var(--rrf-ink);
  box-shadow: var(--rrf-shadow);
  transform: translateY(-2px);
}

/* --- Form fields ---
   Every input needs a visible <label>; placeholders are hints, not labels.
   The honeypot field (name="botcheck") uses .rrf-hp to hide it. */
.rrf-form {
  display: grid;
  gap: var(--rrf-space-5);
  max-width: 560px;
}

.rrf-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--rrf-space-4);
}

.rrf-field {
  display: flex;
  flex-direction: column;
  gap: var(--rrf-space-2);
}

.rrf-label {
  font-size: var(--rrf-small);
  font-weight: var(--rrf-semibold);
  color: var(--rrf-ink);
}

.rrf-input,
.rrf-select,
.rrf-textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font-family: var(--rrf-font);
  font-size: var(--rrf-body);
  color: var(--rrf-ink);
  background: var(--rrf-white);
  border: 2px solid #8A8A8A; /* 3.45:1 on white — meets 3:1 for UI components */
  border-radius: var(--rrf-radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.rrf-textarea {
  min-height: 140px;
  resize: vertical;
}

.rrf-input:focus,
.rrf-select:focus,
.rrf-textarea:focus {
  outline: none;
  border-color: var(--rrf-ink);
  box-shadow: 0 0 0 3px rgba(209, 25, 71, 0.25);
}

.rrf-input[aria-invalid="true"],
.rrf-select[aria-invalid="true"],
.rrf-textarea[aria-invalid="true"] {
  border-color: var(--rrf-red);
}

.rrf-field__hint {
  font-size: var(--rrf-small);
  color: var(--rrf-text-muted);
}

.rrf-field__error {
  font-size: var(--rrf-small);
  font-weight: var(--rrf-medium);
  color: var(--rrf-red);
}

.rrf-check {
  display: flex;
  align-items: flex-start;
  gap: var(--rrf-space-3);
  font-size: var(--rrf-small);
}

.rrf-check input {
  width: 22px;
  height: 22px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--rrf-red);
}

.rrf-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 600px) {
  .rrf-form__row {
    grid-template-columns: 1fr;
  }

  .rrf-btn-row .rrf-btn {
    width: 100%;
  }
}

/* ============================================
   PAGE PATTERNS (stage 2)
   Shared by the core pages. Red + white only.
   ============================================ */

/* --- Split layout: copy beside an image or form --- */
.rrf-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--rrf-space-7);
  align-items: center;
}

.rrf-split--top {
  align-items: start;
}

.rrf-split__media img {
  width: 100%;
  border-radius: var(--rrf-radius-card);
}

.rrf-split--media-first .rrf-split__media {
  order: -1;
}

@media (max-width: 900px) {
  .rrf-split {
    grid-template-columns: 1fr;
    gap: var(--rrf-space-6);
  }

  .rrf-split--media-first .rrf-split__media {
    order: 0;
  }
}

/* --- Hero --- */
.rrf-hero {
  padding: var(--rrf-space-8) 0;
  border-bottom: 4px solid var(--rrf-red);
}

.rrf-hero .rrf-split {
  grid-template-columns: 3fr 2fr;
}

@media (max-width: 900px) {
  .rrf-hero .rrf-split {
    grid-template-columns: 1fr;
  }
}

.rrf-hero__title {
  font-size: var(--rrf-h1);
  font-weight: var(--rrf-bold);
  line-height: var(--rrf-line-tight);
  color: var(--rrf-ink);
  margin-bottom: var(--rrf-space-5);
}

.rrf-hero__line {
  display: block;
}

.rrf-hero__flag {
  display: inline;
  padding: 0 12px;
  line-height: 1.45;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background: var(--rrf-red);
  color: var(--rrf-white);
  border-radius: var(--rrf-radius);
  letter-spacing: 0.02em;
}

.rrf-lede + p {
  margin-top: var(--rrf-space-3);
}

/* Simple page header for inner pages */
.rrf-page-header {
  padding: var(--rrf-space-8) 0 var(--rrf-space-7);
  background: var(--rrf-mist);
  border-bottom: 4px solid var(--rrf-red);
}

.rrf-page-header .rrf-h1 {
  margin-bottom: var(--rrf-space-4);
}

/* --- Section heading block --- */
.rrf-section-head {
  margin-bottom: var(--rrf-space-7);
}

.rrf-section-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--rrf-space-4);
  margin-bottom: var(--rrf-space-6);
}

.rrf-section-head--split .rrf-h2 {
  margin-bottom: 0;
}

.rrf-subhead {
  font-size: var(--rrf-lede);
  font-weight: var(--rrf-semibold);
  line-height: 1.4;
  margin-bottom: var(--rrf-space-4);
}

/* --- Check list (check-mark bullets) --- */
.rrf-checks {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--rrf-space-3);
  margin: var(--rrf-space-5) 0;
}

.rrf-checks li {
  position: relative;
  padding-left: 36px;
}

.rrf-checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rrf-red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.rrf-section--red .rrf-checks li::before {
  background-color: var(--rrf-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D11947' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
}

/* --- Red flag cards (homepage) --- */
.rrf-flag-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rrf-space-5);
}

.rrf-flag {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-left: 5px solid var(--rrf-red);
  border-radius: var(--rrf-radius-card);
  padding: var(--rrf-space-5);
}

.rrf-flag__num {
  display: block;
  font-size: var(--rrf-eyebrow);
  font-weight: var(--rrf-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rrf-red);
  margin-bottom: var(--rrf-space-2);
}

.rrf-flag__title {
  font-size: var(--rrf-h4);
  font-weight: var(--rrf-bold);
  line-height: 1.3;
  margin-bottom: var(--rrf-space-3);
}

.rrf-flag__body {
  flex: 1;
}

.rrf-flag__body p + p {
  margin-top: var(--rrf-space-3);
}

.rrf-flag__link,
.rrf-post__more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--rrf-space-4);
  font-weight: var(--rrf-semibold);
}

@media (max-width: 700px) {
  .rrf-flag-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Guide cards --- */
.rrf-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--rrf-space-6);
}

.rrf-guide-card {
  display: flex;
  flex-direction: column;
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-radius: var(--rrf-radius-card);
  overflow: hidden;
}

.rrf-guide-card__cover {
  display: block;
  background: var(--rrf-mist);
  padding: var(--rrf-space-5) var(--rrf-space-5) 0;
}

.rrf-guide-card__cover img {
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  aspect-ratio: 540 / 699;
  object-fit: cover;
  box-shadow: var(--rrf-shadow);
}

.rrf-guide-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--rrf-space-5);
}

.rrf-guide-card__body p {
  flex: 1;
}

.rrf-guide-card__title,
.rrf-post__title {
  font-size: 20px;
  font-weight: var(--rrf-semibold);
  line-height: 1.3;
  margin-bottom: var(--rrf-space-3);
}

.rrf-guide-card__title a,
.rrf-post__title a {
  color: var(--rrf-ink);
  text-decoration: none;
}

.rrf-guide-card__title a:hover,
.rrf-post__title a:hover {
  color: var(--rrf-red);
  text-decoration: underline;
}

.rrf-guide-card .rrf-btn {
  margin-top: var(--rrf-space-5);
  align-self: flex-start;
}

@media (max-width: 600px) {
  .rrf-guide-card {
    flex-direction: row;
  }

  .rrf-guide-card__cover {
    flex: 0 0 116px;
    padding: var(--rrf-space-4) 0 var(--rrf-space-4) var(--rrf-space-4);
    background: var(--rrf-white);
  }

  .rrf-guide-card__body {
    padding: var(--rrf-space-4);
  }

  .rrf-guide-card .rrf-btn {
    width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* --- Post cards (podcast, articles, news, press) --- */
.rrf-post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--rrf-space-6);
}

@media (max-width: 900px) {
  .rrf-post-grid {
    grid-template-columns: 1fr;
  }
}

.rrf-post {
  display: flex;
  flex-direction: column;
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-radius: var(--rrf-radius-card);
  overflow: hidden;
}

.rrf-post__media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.rrf-post__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--rrf-space-5);
}

.rrf-post__body > p {
  flex: 1;
}

.rrf-post__meta {
  font-size: var(--rrf-small);
  font-weight: var(--rrf-medium);
  color: var(--rrf-text-muted);
  margin-bottom: var(--rrf-space-3);
}

.rrf-post--wide {
  border-left: 5px solid var(--rrf-red);
}

.rrf-post--wide .rrf-post__body {
  padding: var(--rrf-space-6);
}

.rrf-post-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--rrf-space-6);
}

@media (max-width: 900px) {
  .rrf-post-pair {
    grid-template-columns: 1fr;
  }
}

/* --- Form panel --- */
.rrf-form-panel {
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-top: 5px solid var(--rrf-red);
  border-radius: var(--rrf-radius-card);
  padding: var(--rrf-space-6);
  box-shadow: var(--rrf-shadow);
  color: var(--rrf-ink);
}

.rrf-form-panel .rrf-form {
  max-width: none;
  margin-top: var(--rrf-space-5);
}

.rrf-form-panel .rrf-checks {
  margin: var(--rrf-space-4) 0;
}

.rrf-form__required {
  color: var(--rrf-red);
}

.rrf-form__note {
  font-size: var(--rrf-small);
  color: var(--rrf-text-muted);
}

.rrf-cover {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

@media (max-width: 600px) {
  .rrf-form-panel {
    padding: var(--rrf-space-5);
  }
}

/* --- Notice banner --- */
.rrf-banner {
  background: var(--rrf-red);
  color: var(--rrf-white);
  font-size: var(--rrf-lede);
  font-weight: var(--rrf-semibold);
  line-height: 1.45;
  text-align: center;
  padding: var(--rrf-space-5) var(--rrf-section-h);
}

.rrf-notice {
  background: var(--rrf-white);
  border: 2px solid var(--rrf-red);
  border-radius: var(--rrf-radius-card);
  padding: var(--rrf-space-6);
}

/* --- FAQ / accordions (details + summary) --- */
.rrf-faq {
  display: grid;
  gap: var(--rrf-space-3);
  max-width: 860px;
}

.rrf-faq details {
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-radius: var(--rrf-radius);
}

.rrf-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rrf-space-4);
  min-height: 56px;
  padding: var(--rrf-space-4) var(--rrf-space-5);
  font-size: 20px;
  font-weight: var(--rrf-semibold);
  line-height: 1.35;
  cursor: pointer;
  list-style: none;
}

.rrf-faq summary::-webkit-details-marker {
  display: none;
}

.rrf-faq summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 28px;
  font-weight: var(--rrf-medium);
  line-height: 1;
  color: var(--rrf-red);
}

.rrf-faq details[open] summary::after {
  content: "\2212";
}

.rrf-faq summary h3 {
  font-size: inherit;
  font-weight: inherit;
}

.rrf-faq__body {
  padding: 0 var(--rrf-space-5) var(--rrf-space-5);
}

.rrf-faq__body p + p,
.rrf-faq__body p + ul,
.rrf-faq__body ul + p {
  margin-top: var(--rrf-space-3);
}

.rrf-faq__body ul:not(.rrf-checks) {
  padding-left: 1.4em;
}

.rrf-faq__body .rrf-checks {
  margin: var(--rrf-space-3) 0;
}

/* --- Feature tiles --- */
.rrf-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--rrf-space-5);
}

.rrf-tile {
  background: var(--rrf-white);
  border: 1px solid var(--rrf-border);
  border-top: 4px solid var(--rrf-red);
  border-radius: var(--rrf-radius-card);
  padding: var(--rrf-space-5);
}

.rrf-tile .rrf-checks {
  margin-bottom: 0;
}

/* --- Testimonials --- */
.rrf-quotes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--rrf-space-5);
}

.rrf-quote {
  background: var(--rrf-white);
  border-left: 5px solid var(--rrf-red);
  border-radius: var(--rrf-radius);
  padding: var(--rrf-space-5);
}

.rrf-quote blockquote {
  font-size: 20px;
  font-weight: var(--rrf-medium);
  line-height: 1.5;
}

.rrf-quote figcaption {
  margin-top: var(--rrf-space-3);
  color: var(--rrf-text-muted);
  font-weight: var(--rrf-semibold);
}

/* --- Legal / long-form text --- */
.rrf-legal {
  max-width: 820px;
}

.rrf-legal h2 {
  font-size: var(--rrf-h3);
  font-weight: var(--rrf-bold);
  line-height: 1.3;
  margin: var(--rrf-space-7) 0 var(--rrf-space-3);
}

.rrf-legal h3 {
  font-size: 20px;
  font-weight: var(--rrf-semibold);
  margin: var(--rrf-space-5) 0 var(--rrf-space-2);
}

.rrf-legal p + p,
.rrf-legal p + ul,
.rrf-legal ul + p {
  margin-top: var(--rrf-space-3);
}

.rrf-legal ul {
  padding-left: 1.4em;
  margin-top: var(--rrf-space-2);
}

.rrf-legal li + li {
  margin-top: var(--rrf-space-1);
}

.rrf-legal a {
  overflow-wrap: anywhere;
}

/* --- Help strip ("Have a Question?") --- */
.rrf-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--rrf-space-5) var(--rrf-space-7);
  text-align: center;
}

.rrf-help img {
  width: 100%;
  max-width: 420px;
}

.rrf-help .rrf-h3 {
  margin-bottom: var(--rrf-space-2);
}

/* --- Spacing utilities --- */
.rrf-mt-4 { margin-top: var(--rrf-space-4); }
.rrf-mt-5 { margin-top: var(--rrf-space-5); }
.rrf-mt-6 { margin-top: var(--rrf-space-6); }
.rrf-mt-7 { margin-top: var(--rrf-space-7); }

.rrf-address {
  font-style: normal;
}

/* Visually hidden, still read by screen readers */
.rrf-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus ring stays visible (white) on red bands */
.rrf-section--red :focus-visible,
.rrf-banner :focus-visible {
  outline-color: var(--rrf-white);
}
