/* Rank Forge Marketing — sitewide mobile formatting and spacing */

@media (max-width: 760px) {
  :root {
    --rf-mobile-gutter: 20px;
    --rf-mobile-section: 52px;
    --rf-mobile-card-pad: 22px;
  }

  html {
    overflow-x: clip;
    scroll-padding-top: 84px;
  }

  body {
    min-width: 0;
    overflow-x: clip;
  }

  main,
  main > section,
  main > section > div,
  main article,
  main aside,
  main form,
  main fieldset,
  main [style*="display:grid"],
  main [style*="display:flex"] {
    min-width: 0;
  }

  main img,
  main video,
  main iframe,
  main canvas,
  main svg {
    max-width: 100%;
  }

  main h1,
  main h2,
  main h3,
  main h4,
  main p,
  main li,
  main dd,
  main a,
  main span,
  footer a,
  footer p {
    overflow-wrap: anywhere;
  }

  main h1,
  main h1[style],
  .rf3-hero h1,
  .rf3-audit-page-hero h1,
  .rf3-case-hero h1,
  .rf3-work-index-hero h1,
  .rf-case-index-hero h1,
  .rf-case-detail-hero h1 {
    font-size: clamp(38px, 10.8vw, 46px) !important;
    line-height: 1.02 !important;
    letter-spacing: -.036em !important;
    text-wrap: balance;
  }

  main h2,
  main h2[style],
  .rf3-title,
  .rf3-audit-copy h2,
  .rf3-case-outcome h2,
  .rf3-final h2 {
    font-size: clamp(30px, 8.6vw, 38px) !important;
    line-height: 1.08 !important;
    letter-spacing: -.028em !important;
  }

  main h3,
  main h3[style] {
    line-height: 1.18 !important;
  }

  main p,
  main li,
  main dd {
    line-height: 1.62;
  }

  .rf-shell,
  .rf3-shell {
    width: calc(100% - (var(--rf-mobile-gutter) * 2)) !important;
    max-width: none !important;
    margin-inline: auto !important;
  }

  .rfnav-main,
  .rfn-main {
    width: 100% !important;
    height: 72px !important;
    min-height: 72px !important;
    padding-inline: var(--rf-mobile-gutter) !important;
  }

  .rfnav-logo,
  .rfn-logo {
    min-width: 0;
  }

  .rfnav-logo img,
  .rfn-logo img {
    flex: 0 0 auto;
    height: 34px !important;
  }

  .rfnav-logo b,
  .rfn-logo b {
    min-width: 0;
    font-size: 19px !important;
  }

  .rfnav-burger,
  .rfn-burger {
    flex: 0 0 44px;
  }

  .rfnav-menu,
  .rfn-menu {
    max-height: calc(100dvh - 72px - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .rfnav-bottombar,
  .rfn-mobbar {
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }

  /* Normalize legacy inline page containers to the same readable gutter. */
  main > section > div[style*="margin:0 auto"][style*="padding:"],
  main > section > div[style*="margin: 0 auto"][style*="padding:"] {
    padding-left: var(--rf-mobile-gutter) !important;
    padding-right: var(--rf-mobile-gutter) !important;
  }

  main > section:not(:first-of-type) > div[style*="margin:0 auto"][style*="padding:clamp"],
  main > section:not(:first-of-type) > div[style*="margin: 0 auto"][style*="padding:clamp"] {
    padding-top: var(--rf-mobile-section) !important;
    padding-bottom: var(--rf-mobile-section) !important;
  }

  main > section:first-of-type > div[style*="margin:0 auto"][style*="padding:clamp"],
  main > section:first-of-type > div[style*="margin: 0 auto"][style*="padding:clamp"] {
    padding-top: 34px !important;
    padding-bottom: 50px !important;
  }

  /* Inline grids account for most legacy templates. A single column avoids
     narrow cards and minmax overflow on compact phones. */
  main [style*="display:grid"][style*="grid-template-columns"],
  main [style*="display: grid"][style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px !important;
  }

  main [style*="display:flex"][style*="justify-content:space-between"],
  main [style*="display: flex"][style*="justify-content: space-between"] {
    flex-wrap: wrap !important;
    gap: 16px !important;
  }

  main [style*="display:flex"][style*="gap:44px"],
  main [style*="display:flex"][style*="gap: 44px"],
  main [style*="display:grid"][style*="gap:44px"],
  main [style*="display:grid"][style*="gap: 44px"] {
    gap: 28px !important;
  }

  main [style*="padding:32px"],
  main [style*="padding: 32px"],
  main [style*="padding:30px"],
  main [style*="padding: 30px"],
  main [style*="padding:28px"],
  main [style*="padding: 28px"] {
    padding: var(--rf-mobile-card-pad) !important;
  }

  main details > summary[style*="padding:22px"],
  main details > summary[style*="padding: 22px"] {
    padding: 18px var(--rf-mobile-card-pad) !important;
  }

  main details > div[style*="padding:0 24px 24px"],
  main details > div[style*="padding: 0 24px 24px"] {
    padding: 0 var(--rf-mobile-card-pad) var(--rf-mobile-card-pad) !important;
  }

  .rf-leadbox,
  .rf3-audit-form,
  .rf3-report,
  .rf3-quote,
  .rf-next-steps {
    padding: var(--rf-mobile-card-pad) !important;
  }

  .rf-leadbox {
    margin-top: 4px;
  }

  main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  main select,
  main textarea,
  main button[type="submit"] {
    width: 100% !important;
    max-width: 100%;
  }

  main input,
  main select,
  main textarea {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  main textarea {
    min-height: 132px;
  }

  main .rfh0,
  main .rf3-button,
  main a[style*="background:#F26522"],
  main a[style*="background: #F26522"] {
    max-width: 100%;
    min-height: 48px;
    justify-content: center;
    text-align: center;
  }

  main table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .rf-evidence-section,
  .rf-home-services,
  .rf-service-directory,
  .rf-founder-note-section,
  .rf-home-founder,
  .rf-case-featured,
  .rf-case-more,
  .rf-case-cta,
  .rf-case-detail-body,
  .rf3-work,
  .rf3-services,
  .rf3-audit-preview,
  .rf3-process,
  .rf3-founder,
  .rf3-testimonials,
  .rf3-faq,
  .rf3-case-brief,
  .rf3-case-media,
  .rf3-case-decisions,
  .rf3-case-outcome,
  .rf3-work-index {
    padding-top: var(--rf-mobile-section) !important;
    padding-bottom: var(--rf-mobile-section) !important;
  }

  .rf3-section-head,
  .rf3-founder-grid,
  .rf3-faq-grid,
  .rf3-process-grid,
  .rf3-audit-grid,
  .rf3-audit-page-grid,
  .rf3-case-two,
  .rf3-case-media-grid,
  .rf3-case-outcome-grid,
  .rf3-work-index-card,
  .rf3-work-index-card:nth-child(even) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .rf3-section-head,
  .rf3-founder-grid,
  .rf3-faq-grid,
  .rf3-process-grid,
  .rf3-audit-grid,
  .rf3-audit-page-grid,
  .rf3-case-outcome-grid {
    gap: 32px !important;
  }

  .rf3-section-head,
  .rf-section-intro {
    margin-bottom: 32px !important;
  }

  .rf3-proofbar-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .rf3-proofbar-grid > div,
  .rf3-proofbar-grid > div:first-child,
  .rf3-proofbar-grid > div:last-child {
    padding: 20px 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
  }

  .rf3-proofbar-grid > div:last-child {
    border-bottom: 0;
  }

  .rf3-projects,
  .rf3-quotes,
  .rf3-principles {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .rf3-project,
  .rf3-project:first-child {
    min-height: 340px !important;
  }

  .rf3-service-row {
    grid-template-columns: 34px minmax(0, 1fr) auto !important;
    gap: 10px 12px !important;
    padding: 20px 0 !important;
  }

  .rf3-service-row p {
    grid-column: 2 / 4;
  }

  .rf3-case-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .rf3-case-meta div {
    padding: 15px 12px 15px 0 !important;
  }

  .rf3-case-meta div:nth-child(even) {
    padding-left: 12px !important;
    border-right: 0;
  }

  .rf3-case-meta div:nth-child(n + 3) {
    border-top: 1px solid var(--rf3-line);
  }

  .rf3-decision-list {
    margin-top: 30px;
  }

  .rf3-decision-list div {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px 12px !important;
  }

  .rf3-decision-list p {
    grid-column: 2;
  }

  .rf3-work-index-list {
    gap: 52px;
  }

  .rf3-work-index-card:nth-child(even) .rf3-work-index-media {
    order: 0;
  }

  .rf3-final {
    padding: var(--rf-mobile-section) 0 !important;
  }

  .rf3-final .rf3-button,
  .rf3-hero-actions .rf3-button,
  .rf-page-contact button[type="submit"] {
    width: 100% !important;
  }

  .rf3-next-project {
    align-items: flex-start;
    padding: 38px 0 !important;
  }

  footer > div[style*="max-width"][style*="margin:0 auto"],
  footer > div[style*="max-width"][style*="margin: 0 auto"] {
    padding-left: var(--rf-mobile-gutter) !important;
    padding-right: var(--rf-mobile-gutter) !important;
  }

  footer [style*="display:grid"][style*="grid-template-columns"],
  footer [style*="display: grid"][style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
  }

  footer [style*="grid-column:1 / -1"] {
    max-width: none !important;
    padding-bottom: 26px;
  }

  footer a[href^="mailto:"] {
    width: 100%;
  }

  footer [style*="margin-top:52px"],
  footer [style*="margin-top: 52px"] {
    margin-top: 28px !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
  }
}

@media (max-width: 390px) {
  :root {
    --rf-mobile-gutter: 18px;
    --rf-mobile-section: 48px;
    --rf-mobile-card-pad: 20px;
  }

  main h1,
  main h1[style],
  .rf3-hero h1,
  .rf3-audit-page-hero h1,
  .rf3-case-hero h1,
  .rf3-work-index-hero h1 {
    font-size: clamp(35px, 10.7vw, 41px) !important;
  }

  .rfnav-logo b,
  .rfn-logo b {
    font-size: 18px !important;
  }

  .rfnav-logo b small,
  .rfn-logo b small {
    letter-spacing: 2px;
  }

  .rf3-focus-choices,
  .rf3-case-meta {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .rf3-case-meta div,
  .rf3-case-meta div:nth-child(even) {
    padding: 14px 0 !important;
    border-right: 0;
    border-top: 1px solid var(--rf3-line);
  }

  .rf3-case-meta div:first-child {
    border-top: 0;
  }

  .rf3-outcome-list div,
  .rf-case-outcome dl > div {
    display: grid;
    gap: 6px;
  }

  .rf3-outcome-list dd,
  .rf-case-outcome dd {
    text-align: left;
  }
}

/* Screenshot QA corrections — dark footer contrast */
footer[style*="background:#101113"] {
  background: #101113 !important;
  color: #f7f8fa !important;
}

footer[style*="background:#101113"] p,
footer[style*="background:#101113"] a,
footer[style*="background:#101113"] [style*="color:#93959A"],
footer[style*="background:#101113"] [style*="color: #93959A"],
footer[style*="background:#101113"] [style*="color:#A9ABAD"],
footer[style*="background:#101113"] [style*="color: #A9ABAD"],
footer[style*="background:#101113"] [style*="color:#6E6A5F"],
footer[style*="background:#101113"] [style*="color: #6E6A5F"],
footer[style*="background:#101113"] [style*="color:#75777C"],
footer[style*="background:#101113"] [style*="color: #75777C"] {
  color: #cbd2d9 !important;
}

footer[style*="background:#101113"] .rf-footer-brand b,
footer[style*="background:#101113"] .rf-footer-brand b span,
footer[style*="background:#101113"] strong,
footer[style*="background:#101113"] b,
footer[style*="background:#101113"] [style*="color:#F3F2EE"],
footer[style*="background:#101113"] [style*="color: #F3F2EE"] {
  color: #f7f8fa !important;
}

footer[style*="background:#101113"] .rf-footer-brand small,
footer[style*="background:#101113"] a[href="/free-seo-audit"] {
  color: #f47a46 !important;
}

footer[style*="background:#101113"] a[href^="mailto:"],
footer[style*="background:#101113"] a[href^="tel:"] {
  color: #f2f5f7 !important;
}

footer[style*="background:#101113"] a[aria-label] {
  color: #e4e9ee !important;
}

@media (max-width: 760px) {
  /* Keep the selected-work proof readable instead of layering metrics over
     the browser and phone mockups. */
  .rf3-workboard {
    min-height: 0 !important;
    margin-top: 26px !important;
    padding: 46px var(--rf-mobile-card-pad) var(--rf-mobile-card-pad) !important;
  }

  .rf3-workboard::before {
    top: 16px;
    left: var(--rf-mobile-card-pad);
  }

  .rf3-workboard .rf3-browser {
    margin: 0;
  }

  .rf3-workboard .rf3-phone {
    display: none;
  }

  .rf3-workboard .rf3-ledger {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 5px !important;
    margin-top: 20px;
  }

  .rf3-workboard .rf3-ledger strong {
    font-size: 32px !important;
    line-height: 1;
  }

  .rf3-workboard .rf3-ledger span {
    font-size: 15px !important;
    line-height: 1.45 !important;
  }

  .rf3-workboard .rf3-ledger small {
    grid-column: auto;
    margin-top: 10px;
    padding-top: 14px;
    font-size: 13px !important;
    line-height: 1.55 !important;
  }

  /* Project cards use a separate text panel so headings never compete with
     screenshots or photography. */
  .rf3-project,
  .rf3-project:first-child {
    display: grid;
    grid-template-rows: auto auto;
    min-height: 0 !important;
    background: var(--rf3-navy) !important;
  }

  .rf3-project-media {
    position: relative !important;
    inset: auto !important;
    aspect-ratio: 16 / 10;
  }

  .rf3-project-media::after {
    display: none;
  }

  .rf3-project-copy,
  .rf3-project:not(:first-child) .rf3-project-copy {
    position: relative !important;
    inset: auto !important;
    padding: 20px var(--rf-mobile-card-pad) 22px !important;
    background: var(--rf3-navy) !important;
    color: #fff !important;
  }

  .rf3-project-copy h3 {
    margin-top: 8px;
    font-size: clamp(24px, 7.2vw, 30px) !important;
    line-height: 1.1 !important;
  }

  .rf3-project-copy p {
    margin-top: 10px;
    color: #d3dae2 !important;
    font-size: 15px !important;
    line-height: 1.55 !important;
  }

  .rf3-project-index {
    top: 14px;
    left: 14px;
  }

  .rf3-projects {
    gap: 24px !important;
  }

  .rf3-work .rf3-section-head {
    gap: 20px !important;
  }

  /* Give the audit explainer a natural reading width and stack the choices. */
  .rf3-audit-grid {
    gap: 30px !important;
  }

  .rf3-audit-copy h2 {
    max-width: none !important;
    margin-top: 12px !important;
  }

  .rf3-audit-copy p {
    margin-top: 18px !important;
  }

  .rf3-choice-list,
  .rf3-focus-choices {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    margin: 22px 0 0 !important;
  }

  .rf3-choice-list span,
  .rf3-focus-choices label {
    min-height: 48px !important;
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    text-align: left !important;
  }

  .rf3-audit-copy .rf3-button {
    width: 100% !important;
    margin-top: 12px;
  }

  .rf3-report {
    margin-top: 0;
  }

  .rf3-report h3 {
    font-size: clamp(28px, 8vw, 34px) !important;
  }

  /* The dark homepage footer needs extra separation from the fixed action bar. */
  footer[style*="background:#101113"] > div[style*="max-width"] {
    padding-top: 48px !important;
  }

  footer[style*="background:#101113"] a[href^="mailto:"],
  footer[style*="background:#101113"] a[href^="tel:"] {
    min-height: 48px;
    line-height: 1.4;
  }

  footer[style*="background:#101113"] .rf-footer-group {
    border-color: #3a3f45 !important;
  }

  footer[style*="background:#101113"] .rf-footer-heading {
    color: #f7f8fa !important;
  }
}
