/* Mobile refinement layer — focused on rhythm, navigation and scanability. */

@media (max-width: 62rem) {
  :root {
    --mobile-gutter: clamp(1rem, 4.5vw, 1.4rem);
    --mobile-section: clamp(3.1rem, 9vw, 4.35rem);
  }

  .nav-wrapper {
    box-shadow: 0 1px 0 rgba(155, 200, 226, 0.08);
  }

  .nav-glass {
    min-height: 64px;
  }

  .brand-mark {
    width: 2.1rem;
    height: 2.1rem;
    flex-basis: 2.1rem;
  }

  .brand-name {
    font-size: 0.94rem;
  }

  .menu-toggle {
    margin-left: auto;
    border-radius: 0.72rem;
  }

  .nav-links {
    top: 100%;
    left: calc(-1 * var(--mobile-gutter));
    right: calc(-1 * var(--mobile-gutter));
    max-height: calc(100dvh - 64px - env(safe-area-inset-top));
    overflow-y: auto;
    padding: 0.6rem var(--mobile-gutter) calc(0.9rem + env(safe-area-inset-bottom));
    border-bottom: 1px solid rgba(155, 200, 226, 0.16);
    background: color-mix(in srgb, var(--canvas) 99%, transparent);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.3);
  }

  .nav-links a {
    min-height: 50px;
    padding: 0 0.9rem;
    font-size: 0.8rem;
  }

  .nav-links a + a {
    border-top: 1px solid rgba(155, 200, 226, 0.07);
  }

  .nav-links a.active {
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .rb-hero,
  .page-hero,
  .hero-gradient,
  .case-hero {
    padding: clamp(2.45rem, 7vw, 3.35rem) 0 clamp(2.8rem, 8vw, 3.8rem);
  }

  .rb-hero-grid,
  .page-hero__grid,
  .case-hero__grid {
    gap: 1.65rem;
  }

  .rb-hero h1,
  .page-hero__copy h1,
  .hero-content h1,
  .case-hero__copy h1 {
    max-width: 14ch;
    margin: 0.55rem 0 0.9rem;
    font-size: clamp(2.25rem, 9.6vw, 3.25rem);
    line-height: 1.01;
    letter-spacing: -0.04em;
  }

  .rb-hero-copy > p:not(.rb-kicker),
  .page-hero__copy > p:not(.eyebrow),
  .hero-content > p:not(.eyebrow),
  .case-hero__copy > p:not(.eyebrow) {
    font-size: 0.96rem;
    line-height: 1.58;
  }

  .rb-actions,
  .home-hero__actions {
    margin-top: 1.25rem;
  }

  .btn,
  .btn.primary,
  .btn.secondary {
    min-height: 46px;
    padding: 0.68rem 0.9rem;
  }

  .hero-proofline {
    margin-top: 1.15rem !important;
    gap: 0.4rem !important;
  }

  .hero-proofline li {
    padding: 0.38rem 0.55rem;
    font-size: 0.68rem;
  }

  .portfolio-console {
    margin-top: 0 !important;
    border-radius: 1rem;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
  }

  .portfolio-console__bar {
    padding: 0.68rem 0.85rem;
  }

  .portfolio-console__body {
    padding: 0.25rem 0.85rem;
  }

  .portfolio-console__row {
    grid-template-columns: minmax(5.7rem, 0.34fr) minmax(0, 0.66fr);
    gap: 0.7rem;
    padding: 0.72rem 0;
  }

  .portfolio-console__key {
    font-size: 0.64rem;
  }

  .portfolio-console__value {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .portfolio-console__footer {
    padding: 0.72rem 0.85rem 0.8rem;
    font-size: 0.68rem;
  }

  .rb-section,
  .section {
    padding-bottom: var(--mobile-section);
  }

  .rb-section-head,
  .section-heading {
    gap: 0.5rem;
    margin-bottom: 1.35rem;
  }

  .rb-section-head h2,
  .section-heading h2,
  .rb-close h2,
  .closing-panel h2 {
    max-width: 20ch;
    font-size: clamp(1.72rem, 7vw, 2.35rem);
    line-height: 1.08;
  }

  .rb-section-head p:not(.rb-kicker),
  .section-heading p:not(.eyebrow) {
    margin-top: 0.4rem;
    font-size: 0.94rem;
    line-height: 1.55;
  }

  .recruiter-brief {
    gap: 0.8rem;
    padding: 1rem 0;
  }

  .recruiter-brief__grid {
    border-radius: 0.9rem;
  }

  .recruiter-brief__item {
    padding: 1rem;
  }

  .recruiter-brief__item strong {
    font-size: 0.96rem;
  }

  .recruiter-brief__item p {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .rb-work-grid {
    border-radius: 0.95rem;
  }

  .rb-work-primary,
  .rb-work-secondary {
    padding: 1.1rem;
    gap: 1.05rem;
  }

  .rb-work-title,
  .rb-work-secondary .rb-work-title {
    max-width: 20ch;
    margin: 0.45rem 0 0.45rem;
    font-size: clamp(1.45rem, 6.8vw, 2rem);
    line-height: 1.06;
  }

  .rb-work-copy {
    font-size: 0.88rem;
    line-height: 1.52;
  }

  .rb-work-signal {
    margin-top: 0.9rem;
  }

  .rb-work-foot {
    margin-top: 0.55rem;
  }

  .rb-capability,
  .skill-entry,
  .experience-entry,
  .case-study-row {
    gap: 0.42rem;
    padding: 1.05rem 0;
  }

  .rb-capability h3,
  .skill-entry h3,
  .experience-entry h3,
  .case-study-row h2,
  .case-study-row h3 {
    font-size: 1.06rem;
    line-height: 1.22;
  }

  .rb-capability p,
  .skill-entry p,
  .experience-entry p,
  .experience-entry li,
  .case-study-row p {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .aside-panel,
  .credential-panel,
  .form-panel,
  .card,
  .profile-embed {
    padding: 1rem;
    border-radius: 0.9rem;
  }

  .case-section {
    padding: 1.45rem 0 1.7rem;
  }

  .case-section h2 {
    font-size: clamp(1.55rem, 6.8vw, 2.05rem);
    line-height: 1.08;
  }

  .case-section > p,
  .finding p,
  .outcome-item span,
  .case-aside__panel p,
  .case-aside__panel li {
    font-size: 0.9rem;
    line-height: 1.55;
  }

  .finding {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.9rem 0;
  }

  .outcome-item {
    padding: 0.85rem 0;
  }

  .case-study-row__proof {
    margin-top: 0.7rem;
    padding-top: 0.65rem;
  }

  .contact-shell {
    gap: 1.8rem;
  }

  .contact-intro h2,
  .form-panel h2 {
    font-size: clamp(1.55rem, 7vw, 2.1rem);
  }

  .form-panel {
    padding: 1rem;
  }

  .form-panel input,
  .form-panel textarea {
    min-height: 46px;
  }

  .rb-proof {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
  }

  .rb-proof-item,
  .rb-proof-item:nth-child(2),
  .rb-proof-item:nth-child(3),
  .rb-proof-item:nth-child(4) {
    display: block;
    padding: 1rem 0.8rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line) !important;
  }

  .rb-proof-item:nth-child(2n) {
    border-right: 0;
  }

  .rb-proof-item:nth-child(n + 3) {
    border-bottom: 0 !important;
  }

  .rb-proof-item strong {
    font-size: clamp(1.45rem, 6vw, 1.9rem);
  }

  .rb-proof-item span {
    margin-top: 0.35rem;
    font-size: 0.69rem;
    line-height: 1.35;
  }

  .rb-close,
  .closing-panel {
    gap: 1rem;
    padding-top: 1.25rem;
  }

  .rb-close p,
  .closing-panel p {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .footer-inner {
    min-height: 0;
    gap: 0.7rem;
    padding: 1.2rem 0 calc(1.2rem + env(safe-area-inset-bottom));
  }

  .footer-inner p,
  .footer-links a {
    font-size: 0.71rem;
  }
}

@media (max-width: 35rem) {
  .rb-actions,
  .home-hero__actions {
    gap: 0.5rem;
  }

  .portfolio-console__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 0.68rem 0;
  }

  .portfolio-console__footer {
    display: grid;
    gap: 0.35rem;
  }

  .hero-proofline {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  .hero-proofline li {
    width: fit-content;
    max-width: 100%;
  }

  .rb-work-signal,
  .case-study-row__proof {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .rb-proof {
    grid-template-columns: 1fr;
    border-bottom: 0;
  }

  .rb-proof-item,
  .rb-proof-item:nth-child(2),
  .rb-proof-item:nth-child(3),
  .rb-proof-item:nth-child(4) {
    display: grid;
    grid-template-columns: minmax(5.4rem, 0.36fr) minmax(0, 0.64fr);
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.82rem 0;
    border-right: 0;
    border-bottom: 1px solid var(--line) !important;
  }

  .rb-proof-item:last-child {
    border-bottom: 0 !important;
  }

  .rb-proof-item span {
    margin-top: 0;
  }

  .footer-links {
    gap: 0.35rem 0.8rem;
  }
}

@media (max-width: 23rem) {
  .rb-hero h1,
  .page-hero__copy h1,
  .hero-content h1,
  .case-hero__copy h1 {
    font-size: 2.05rem;
  }

  .nav-links a {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-links {
    scroll-behavior: auto;
  }
}

/* Keep core copy legible and reduce long heading stacks on small screens. */
@media (max-width: 62rem) {
  .rb-hero h1 { max-width: 16ch; line-height: 1.08; }
  .page-hero__copy h1, .hero-content h1, .case-hero__copy h1 { max-width: 20ch; line-height: 1.1; }
  .rb-work-copy, .rb-capability p, .skill-entry p, .experience-entry p,
  .experience-entry li, .case-study-row p, .case-section > p, .finding p,
  .outcome-item span, .case-aside__panel p, .case-aside__panel li { font-size: 1rem; line-height: 1.65; }
  .recruiter-brief__item p { font-size: 0.94rem; }
  .menu-toggle { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .footer-inner { padding-right: 3.5rem; }
  .footer-links a { display: inline-flex; min-height: 44px; align-items: center; font-size: 0.8rem; }
}
@media (max-width: 62rem) {
  .nav-links { width: auto; border-radius: 0; }
  .rb-close { padding: 1.25rem; }
}
