/* Shared small-screen rules. Content owns its space; the artwork stays behind it. */
.mobile-menu { display: none; }
.exploration-copy {
  position: absolute; top: 52%; left: 50%; transform: translate(-50%, -50%);
  display: grid; width: calc(100% - 48px); max-width: 1100px; min-width: 0; z-index: 1;
}
.exploration-copy > :is(.exploration-heading, .exploration-outro) {
  position: relative; inset: auto; grid-area: 1 / 1; align-self: center;
  width: auto; padding: 0; margin: 0; text-align: center;
}
.floating-disciplines { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.floating-disciplines .floating-tag { pointer-events: auto; }
.floating-disciplines .tag-uiux { top: 22%; left: 8%; }
.floating-disciplines .tag-dev { top: 27%; right: 8%; }
.floating-disciplines .tag-brand { bottom: 24%; left: 7%; }
.floating-disciplines .tag-graphics { bottom: 18%; right: 7%; }
.project-meta > span, .contact-bottom > *, .site-footer > * { min-width: 0; }
.project-title, .dialog-content, .contact-form-status { overflow-wrap: anywhere; }
.direct-contact > a { display: inline-block; max-width: 100%; overflow-wrap: anywhere; line-height: 1.7; }
.contact-menu nav { max-width: calc(100vw - 40px); }
.dialog-close { min-height: 44px; flex-shrink: 0; }
.dialog-visual .project-image { container-type: inline-size; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.text-link, .back-top { min-height: 44px; align-items: center; }

@media (max-width: 900px) {
  :root { --gutter: clamp(16px, 4.5vw, 24px); }
  html { scroll-padding-top: 88px; }
  .site-header {
    height: 76px;
    padding: 12px var(--gutter);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
  }
  .site-header > nav, .site-header .identity-name { display: none; }
  .header-identity { gap: 8px; min-width: 0; }
  .site-header .wordmark { min-height: 44px; display: flex; align-items: center; }
  .site-header .rm-logo { width: 58px; height: 38px; }
  .site-header .motion-toggle { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .site-header .header-contact { min-height: 44px; margin: 0; font-size: 11px; gap: 8px; white-space: nowrap; }
  .site-header .header-contact::before { display: none; }
  .site-header .header-contact > .accent-mark { font-size: 20px; }
  .mobile-menu { display: block; position: relative; }
  .mobile-menu summary {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    width: 44px; height: 44px; gap: 7px; list-style: none; cursor: pointer;
    border: 1px solid #10182028; border-radius: 50%;
  }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu summary span { width: 19px; height: 1px; background: currentColor; transition: transform .2s; }
  .mobile-menu[open] summary span:first-child { transform: translateY(4px) rotate(45deg); }
  .mobile-menu[open] summary span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .site-header .mobile-menu nav {
    position: absolute; inset: 54px 0 auto auto; transform: none; margin: 0;
    display: grid; gap: 2px; width: min(260px, calc(100vw - 32px)); padding: 10px;
    border: 1px solid #d3d7d9; border-radius: 16px; background: #f7f8f8;
    color: #101820; box-shadow: 0 16px 40px #10182018;
  }
  .site-header .mobile-menu nav a { display: flex; align-items: center; min-height: 48px; padding: 10px 14px; border-radius: 8px; font-size: 16px; }
  .mobile-menu nav a:hover, .mobile-menu nav a[aria-current] { background: #dc143c0d; color: var(--accent); }
  .site-header.is-dark .mobile-menu summary { border-color: #ffffff50; }
  .site-header summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
  .progress-rail { display: none; }
  .journey-intro { position: relative; display: block; padding: 0; }
  .hero-primary { position: absolute; bottom: 80px; left: var(--gutter); right: var(--gutter); width: auto; max-width: 660px; }
  .hero-primary h1 { font-size: clamp(32px, 7.3vw, 56px); line-height: 1.06; }
  .hero-primary h1 > span { font-size: .83em; }
  .hero-primary > .eyebrow { font-size: 9px; letter-spacing: .07em; line-height: 1.7; }
  .hero-secondary { display: none; }
  .intro-description { font-size: 16px; line-height: 1.5; }
  .journey-destination { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 8px; padding: 110px var(--gutter) 164px; }
  .journey-destination h2 { font-size: clamp(30px, 7.1vw, 58px); max-width: 100%; text-align: left; line-height: 1.1; }
  .journey-destination h2 br { display: none; }
  .journey-label { position: static; font-size: 10px; margin-bottom: 16px; }
  .destination-cta { left: var(--gutter); bottom: 78px; transform: none; }
  .destination-cta:hover { transform: translateY(-2px); }
  .journey-count { display: none; }
  .scroll-cue { left: var(--gutter); bottom: max(24px, env(safe-area-inset-bottom)); }
  .ideas-section .line-mask { overflow: visible; }
  .contact-title-link h2 { font-size: clamp(64px, 16vw, 110px); }
  .contact-title-link { gap: 12px; }
  .contact-star { flex-shrink: 0; }
  .email-row { max-width: 100%; gap: 8px; }
  .email-row > a { min-width: 0; overflow-wrap: anywhere; }
  .copy-email { flex-shrink: 0; }
  .site-footer { flex-wrap: wrap; gap: 12px 24px; padding-block: 24px; }
}

@media (max-width: 900px), (max-height: 560px) {
  .exploration-stage {
    display: block;
    padding: 0;
    --orbit-gutter: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
  }
  .exploration-frame { clip-path: inset(var(--frame-inset, 3%) round var(--frame-radius, 24px)); }
  .exploration-copy {
    position: absolute;
    top: 52%; left: 50%; transform: translate(-50%, -50%);
    display: grid; width: calc(100% - 32px); max-width: 580px; min-width: 0;
    z-index: 1;
  }
  .exploration-copy > :is(.exploration-heading, .exploration-outro) {
    position: relative; inset: auto; grid-area: 1 / 1; align-self: center; width: auto;
    padding: 0; margin: 0; text-align: center;
  }
  .exploration-heading > .eyebrow { display: none; }
  .exploration-copy h2, .exploration-copy h3 { font-size: clamp(28px, 8.8vw, 48px); line-height: 1.08; letter-spacing: -.055em; }
  .exploration-outro p { font-size: clamp(12px, 3.3vw, 14px); line-height: 1.4; margin-top: 16px; }
  .floating-disciplines {
    position: absolute; inset: 0; display: block; width: 100%; max-width: none;
    z-index: 2; pointer-events: none;
  }
  .floating-disciplines .floating-tag {
    position: absolute; inset: auto; width: max-content; max-width: calc(50% - 24px);
    min-width: 0; min-height: 44px; padding: 0 15px; justify-content: center; gap: 6px;
    font-size: clamp(10px, 2.9vw, 12px); line-height: 1.35; color: #3e4850;
    white-space: nowrap; text-align: center; border: 0; background: transparent;
    box-shadow: none; backdrop-filter: none; isolation: isolate; pointer-events: auto;
  }
  /* The visual pill is 32px tall; the link retains a full 44px touch area. */
  .floating-disciplines .floating-tag::before {
    content: ""; position: absolute; inset: 6px 0; z-index: -1;
    border: 1px solid #dc143c4d; border-radius: 999px; background: #f5f6f74d;
    transition: background .25s, border-color .25s;
  }
  .floating-disciplines .floating-tag:hover::before,
  .floating-disciplines .floating-tag:focus-visible::before { background: #fff9; border-color: var(--accent); }
  .floating-disciplines .tag-uiux { top: 22%; left: max(9%, var(--orbit-gutter)); }
  .floating-disciplines .tag-dev { top: 27%; right: max(5%, var(--orbit-gutter)); }
  .floating-disciplines .tag-brand { bottom: 24%; left: var(--orbit-gutter); }
  .floating-disciplines .tag-graphics { bottom: 18%; right: var(--orbit-gutter); }
  .floating-tag > span { flex-shrink: 0; font-size: 14px; }
  .exploration-caption { display: none; }
  .breathing-fallback { top: 54%; width: min(88vw, 620px); }
}

@media (max-width: 540px) {
  .contact-header { height: 76px; padding-inline: 16px; gap: 12px; }
  .contact-navigation { gap: 16px; }
  .contact-main-page { padding-inline: 12px; }
  .contact-panel { padding: 36px 20px; }
  .contact-panel h1, .contact-panel .contact-display { font-size: clamp(34px, 8.8vw, 46px); }
  .contact-interests legend { line-height: 1.5; }
  .interest-options { gap: 8px; }
  .interest-options label { max-width: 100%; }
  .interest-options span { font-size: 14px; padding-inline: 14px; white-space: normal; }
  .direct-contact > a { font-size: 16px; }
  .contact-page-footer { padding-inline: 20px; }
  .work-section { padding-inline: var(--gutter); }
  .work-section .project-title { gap: 12px; font-size: clamp(23px, 6vw, 28px); }
  .work-section .project-summary { line-height: 1.55; }
  .work-section .project-tags { flex-wrap: wrap; }
  .project-dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 18px; }
  .dialog-bar { padding: 12px 18px; gap: 12px; }
  .dialog-bar .eyebrow { font-size: 9px; }
  .dialog-content { padding: 24px 20px; }
  .dialog-content h2 { font-size: clamp(32px, 9vw, 46px); }
  .dialog-story { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .dialog-contact { white-space: normal; text-align: center; }
}

/* Landscape phones and short windows use natural scrolling, never clipped scenes. */
@media (max-height: 560px) {
  .journey { height: auto !important; }
  .journey-stage { position: relative !important; height: auto !important; min-height: 1240px !important; overflow: hidden; }
  .journey-intro, .journey-destination { height: 620px; min-height: 620px; opacity: 1 !important; transform: none !important; }
  .journey-intro { position: relative; display: block; padding: 0; }
  .hero-primary { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 64px; width: auto; max-width: 700px; }
  .hero-primary h1 { font-size: clamp(32px, 5.5vw, 54px); }
  .hero-secondary { display: none; }
  .journey-stage > #journey-canvas, .journey .hero-wash { height: 620px; }
  .hero-fallback { bottom: 50% !important; }
  .journey .journey-video-layer, .motion-enabled:not(.reduced-motion) .journey .journey-video-layer { inset: 50% 0 0; opacity: 1; clip-path: none; transform: none; }
  .journey-destination {
    position: relative !important; inset: auto !important; visibility: visible !important; pointer-events: auto !important;
    flex-direction: column; align-items: flex-start; justify-content: center; gap: 12px; padding: 100px var(--gutter);
  }
  .journey-destination h2 { font-size: clamp(32px, 5.5vw, 54px); max-width: 100%; text-align: left; }
  .journey-destination h2 br { display: none; }
  .journey-label { position: static; margin-bottom: 20px; }
  .destination-cta { position: static; transform: none; margin-top: 20px; }
  .journey .scroll-cue, .journey-count { display: none; }
  .exploration { height: auto !important; }
  .exploration-stage { position: relative !important; height: auto !important; min-height: 620px; }
  .exploration-heading { opacity: 1 !important; transform: none !important; }
  .exploration-outro { display: none; }
  .exploration-frame { clip-path: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .exploration { height: auto !important; }
  .exploration-stage { height: auto !important; min-height: max(620px, 100svh); }
  .exploration-copy .exploration-heading { opacity: 1 !important; transform: none !important; }
  .mobile-menu summary span { transition: none; }
}
